or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
provisional cache
When caching in the trait solver, we have to make sure that we consider everything that may impact the result. In the global cache this includes the remaining allowed depth and in case we cache the root of a cycle, other cycle participants.
The provisional cache is necessary as we can otherwise get hangs, e.g. when compiling syn. We have to make sure that the existence of the provisional cache does not impact behavior in undesirable ways.
how to think about cycles
Conceptionally, a solver cycle is simply an infinitely deep proof tree. A cycle
A -> B -> A
should therefore be equivalent to the cycleA -> B -> A -> B -> A
. This is not quite the case due to incompleteness- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →This is achieved via a fixpoint algorithm for goals on the stack. However, we have to be careful when caching any goals which depend on the provisional result of goals still on the stack.
When caching these goals we have to make sure the cache does not impact behavior. Let's look at the following dependency tree:
We want to reuse the cache entry for
D
in theD'
path. For this to be correct everything we possible relied upon when computingD
must be handled:D
,B
andA
B -> C -> D
is coinductive butB -> C -> F -> D'
is not, then the result ofD'
may differ fromD
.cycle examples
Using
any
of all paths to decide whether a cycle is inductive or coinductive.impl II
We only track the highest cycle head
h
for a provisional entry for the goalg
. After popping the highest head from the stack, we remove the provisional entry. Recomputingg
will depend onh
. This can use the provisional entry forh
without needing a fixpoint computation. While this can observably result in a different result forg
due to incompleteness, this is not unsound asg
is not a cycle root, so its result does not get moved to the global cache.