Document work's algorithm - #17
pgiarrusso-sl wants to merge 5 commits into
Conversation
CI summary (Details)Active Repos
|
| Repo | Job Branch | Job Commit |
|---|---|---|
| ./ | main | b9f28b5 |
| fmdeps/BRiCk/ | main | d94485e |
| fmdeps/auto/ | main | 63d5e05 |
| bluerock/NOVA/ | skylabs-proof | 6cbef03 |
| bluerock/bhv/ | skylabs-main | 448828c |
| fmdeps/brick-libcpp/ | main | 2014908 |
| fmdeps/ci/ | main | 680889d |
| vendored/elpi/ | skylabs-master | aa4475f |
| vendored/flocq/ | skylabs-master | cf9cc84 |
| fmdeps/fm-tools/ | main | fb160a9 |
| psi/protos/ | main | 8fe3e7c |
| psi/backend/ | main | 0b5fea6 |
| psi/ide/ | main | 6b596cf |
| psi/data/ | main | 76acc2f |
| vendored/rocq/ | skylabs-master | 2ede3c9 |
| fmdeps/rocq-agent-toolkit/ | main | ac7e4ec |
| vendored/rocq-elpi/ | skylabs-master | 103a742 |
| vendored/rocq-equations/ | skylabs-main | a8c4832 |
| vendored/rocq-ext-lib/ | skylabs-master | 94a6630 |
| vendored/rocq-iris/ | skylabs-master | 3ad4ddd |
| vendored/rocq-lsp/ | skylabs-main | a8b7272 |
| vendored/rocq-stdlib/ | skylabs-master | bc07423 |
| vendored/rocq-stdpp/ | skylabs-master | e01d802 |
| fmdeps/skylabs-fm/ | main | e8b88a7 |
| vendored/vsrocq/ | skylabs-main | 5b4527e |
Performance
| Relative | Master | MR | Change | Filename |
|---|---|---|---|---|
| +0.00% | 125439.4 | 125439.5 | +0.0 | total |
| +0.00% | 22788.6 | 22788.6 | +0.0 | ├ translation units |
| +0.00% | 102650.9 | 102650.9 | +0.0 | └ proofs and tests |
Full Results
| Relative | Master | MR | Change | Filename |
|---|---|---|---|---|
| +0.00% | 125439.4 | 125439.5 | +0.0 | total |
| +0.00% | 22788.6 | 22788.6 | +0.0 | ├ translation units |
| +0.00% | 102650.9 | 102650.9 | +0.0 | └ proofs and tests |
|
|
||
| ## Iris goals | ||
|
|
||
| `sep` works on Iris goals `Γ ; Γp ; Γs ⊢ Q`, where `Γ` is the Rocq context, |
There was a problem hiding this comment.
- Needed: show how
Γ ; Γp ; Γs ⊢ Qactually looks in Rocq. - Possible: use actual goals instead of this notation. (But they seem unwieldy).
| 2. then apply forward and backward hints to simplify assumptions and | ||
| conclusions, as far as possible | ||
| 3. then apply learning hints to instantiate any existentials as far as possible | ||
| 4. if enabled, instantiate any remaining existential quantifiers with evars |
There was a problem hiding this comment.
This needs to be at the very end; ework will only do that if there is nothing else it can do.
| 4. if enabled, instantiate any remaining existential quantifiers with evars | ||
| 5. apply introduction rules for joint conjunctions | ||
| <!-- when? this seems the most reasonable point --> | ||
| 6. then apply framing/identity cancellation, and cancellation hints as far as possible |
There was a problem hiding this comment.
Identity cancellation is at a fixed cost (hopefully higher than most hints users write). Is this list the wrong place to announce that priorities/costs matter?
|
|
||
| ## Iris goals | ||
|
|
||
| `sep` works on Iris goals `Γ ; Γp ; Γs ⊢ Q`, where `Γ` is the Rocq context, |
There was a problem hiding this comment.
sep technically also works on plain bi entailments; not sure if this is relevant here (and you do not claim that it doesn't)
| Iris assumptions can be named or anonymous; by default `sep` will preserve named | ||
| assumptions unchanged, but `$usenamed=true` will override this behavior. | ||
|
|
||
| `sep` will eliminate separating conjunctions in assumptions. |
There was a problem hiding this comment.
Also existentials. And conjunctions in the intuitionistic context. And separation conjunctions in the intuitionistic context if the bi is positive.
There was a problem hiding this comment.
Another thing to mention somewhere around here: sep bubbles up existentials to the top of the conclusion (but will not treat this as progress, i.e. the bubbling up is not committed unless actual progress is made in another fashion)
| `sep` simplifies or solves separation logic entailments `P ⊢ Q` via builtin | ||
| proof rules and user-defined Rocq hints. | ||
|
|
||
| 1. apply introduction rules for universals and wands |
There was a problem hiding this comment.
| 1. apply introduction rules for universals and wands | |
| The core algorithm repeats these steps: | |
| 1. apply introduction rules for universals and wands |
| conclusions, as far as possible | ||
| 3. then apply learning hints to instantiate any existentials as far as possible | ||
| 4. if enabled, instantiate any remaining existential quantifiers with evars | ||
| 5. apply introduction rules for joint conjunctions |
There was a problem hiding this comment.
Gregory asked what this means, I answered iSplit — maybe
| 5. apply introduction rules for joint conjunctions | |
| 5. apply introduction rules for joint conjunctions (like `iSplit`) |
|
|
||
| 1. apply introduction rules for universals and wands | ||
| 2. then apply forward and backward hints to simplify assumptions and | ||
| conclusions, as far as possible |
There was a problem hiding this comment.
| conclusions, as far as possible | |
| conclusions, as far as possible; hints are applied in order |
| `sep` works on Iris goals `Γ ; Γp ; Γs ⊢ Q`, where `Γ` is the Rocq context, | ||
| `Γp` is the intuitionistic context, `Γs` is the spatial context, and `Q` is the | ||
| conclusion. | ||
| In an Iris goal, assumptions in `Γp` can be duplicated or discarded |
There was a problem hiding this comment.
Pull this section out into a separate section on "Iris goals" .
Also explain difference between pure and Iris assertions. (Is that a separate section).
There was a problem hiding this comment.
also point out the existence of evars. (But users know them, and maybe the user of evars is an extension since we avoid ego).
| ## Iris goals | ||
|
|
||
| `sep` works on Iris goals `Γ ; Γp ; Γs ⊢ Q`, where `Γ` is the Rocq context, | ||
| `Γp` is the intuitionistic context, `Γs` is the spatial context, and `Q` is the | ||
| conclusion. | ||
| In an Iris goal, assumptions in `Γp` can be duplicated or discarded | ||
| freely, unlike assumptions in `Γs`. |
There was a problem hiding this comment.
I would propose moving this out to a separate page.
| freely, unlike assumptions in `Γs`. | ||
|
|
||
| Iris assumptions can be named or anonymous; by default `sep` will preserve named | ||
| assumptions unchanged, but `$usenamed=true` will override this behavior. |
There was a problem hiding this comment.
"Idiomatic IPM proofs name hypotheses, but idiomatic work proofs do not, and we prefer avoiding splitting the context".
See also next section, but we don't just avoid iSplitL.
- we prefer to never split the goal eagerly (usually, work in a single goal) — avoid splitting context with
iSplitL— avoid splitting context withiApplywith multiple premises. "We avoid doing frame inference"... - idiomatically we avoid name management for assumptions
- avoid introducing existentials
| `sep` simplifies or solves separation logic entailments `P ⊢ Q` via builtin | ||
| proof rules and user-defined Rocq hints. | ||
|
|
||
| 1. apply introduction rules for universals and wands |
There was a problem hiding this comment.
(Need to add mentions of naming policies).
| Instead, we can cancel spatial assumptions against conclusion conjuncts using | ||
| the following cancellation rule: | ||
| ``` | ||
| P1 ⊢~ P2 Γ ; Γp ; Γs ⊢ Q | ||
| -------------------------------------- CANCEL | ||
| Γ ; Γp ; P1, Γs ⊢ P2 ∗ Q | ||
| ``` |
There was a problem hiding this comment.
| Instead, we can cancel spatial assumptions against conclusion conjuncts using | |
| the following cancellation rule: | |
| ``` | |
| P1 ⊢~ P2 Γ ; Γp ; Γs ⊢ Q | |
| -------------------------------------- CANCEL | |
| Γ ; Γp ; P1, Γs ⊢ P2 ∗ Q | |
| ``` | |
| The core automation applies "rules" eagerly based on priorities. | |
| Instead, we can cancel spatial assumptions against conclusion conjuncts using | |
| the following cancellation rule: |
P1 ⊢~ P2 Γ ; Γp ; Γs ⊢ Q
-------------------------------------- CANCEL
Γ ; Γp ; P1, Γs ⊢ P2 ∗ Q
bwd.md
Applying a BWD rules replace a (separation) conjunction in the goal with another:
Definition my_hint :=
\bwd
\proving A
\through B
\end.
Next Obligation. .. Qed.When applying this rule on a goal of the form
...
---------------*
exists a b c, A ** X ** ...will result in a goal of the form
...
--------------*
exists a b c, B ** X ** ...There was a problem hiding this comment.
add this to the bwd.md from auto-docs.
| proof rules and user-defined Rocq hints. | ||
|
|
||
| 1. apply introduction rules for universals and wands | ||
| 2. then apply forward and backward hints to simplify assumptions and |
There was a problem hiding this comment.
Are the priorities for \bwd and \fwd different?
We're confused about an hint like this, but I plan to not explain it — but figure it out so the explanation isn't false.
#[program]
Definition type_ptrR_to_type_ptr_FB p ty :=
\fwd
\proving p |-> type_ptrR ty (* spatial conclusion to match *)
\through type_ptr ty p (* replacement spatial conclusion *)
\end.
| Instead, we can cancel spatial assumptions against conclusion conjuncts using | ||
| the following cancellation rule: | ||
| ``` | ||
| P1 ⊢~ P2 Γ ; Γp ; Γs ⊢ Q |
There was a problem hiding this comment.
Probably go back to identity cancellation here.
Gregory suggests leaving the "other steps" (the hints) to other documents (about bwd/fwd etc), so we don't need to talk much about the generalization here.
| 5. apply introduction rules for joint conjunctions | ||
| <!-- when? this seems the most reasonable point --> | ||
| 6. then apply framing/identity cancellation, and cancellation hints as far as possible | ||
| 7. restart from 1 |
There was a problem hiding this comment.
Maybe talk about priorities rather than bwd/fwd as a separate step?
The actual implementation has separate phases — but this should not matter because hints should be "confluent" — concretely,
idiomatic cancelx hints will introduce terms in "bwd/fwd normal form"not possible, because normal forms are not preserved by instantiating hint metavariables- idiomatic cancelx hints should only be triggered on conjuncts in normal forms — which is easier, so if you introduce a non-normal form (and phase ordering questions apply) no cancelx hints will apply on it, so that'll be processed by the next bwd phase. This way, phases aren't exposed to the user.
- also, bwd/fwd hints shouldn't be "orphans" morally
CI summary (Details)Active Repos
|
| Repo | Job Branch | Job Commit |
|---|---|---|
| ./ | main | 7d2ee30 |
| fmdeps/BRiCk/ | main | f029bba |
| fmdeps/auto/ | main | 020df41 |
| bluerock/NOVA/ | skylabs-proof | dc3d314 |
| bluerock/bhv/ | skylabs-main | c46f5e3 |
| fmdeps/brick-libcpp/ | main | 2014908 |
| fmdeps/ci/ | main | 9e6e574 |
| vendored/elpi/ | skylabs-master | aa4475f |
| vendored/flocq/ | skylabs-master | cf9cc84 |
| fmdeps/fm-tools/ | main | e5188db |
| psi/protos/ | main | 8fe3e7c |
| psi/backend/ | main | 0b5fea6 |
| psi/ide/ | main | 6b596cf |
| psi/data/ | main | 82cb305 |
| vendored/rocq/ | skylabs-master | 2ede3c9 |
| fmdeps/rocq-agent-toolkit/ | main | ac7e4ec |
| vendored/rocq-elpi/ | skylabs-master | 103a742 |
| vendored/rocq-equations/ | skylabs-main | a8c4832 |
| vendored/rocq-ext-lib/ | skylabs-master | 94a6630 |
| vendored/rocq-iris/ | skylabs-master | 3ad4ddd |
| vendored/rocq-lsp/ | skylabs-main | a8b7272 |
| vendored/rocq-stdlib/ | skylabs-master | bc07423 |
| vendored/rocq-stdpp/ | skylabs-master | e01d802 |
| fmdeps/skylabs-fm/ | main | e8b88a7 |
| vendored/vsrocq/ | skylabs-main | 5b4527e |
Performance
| Relative | Master | MR | Change | Filename |
|---|---|---|---|---|
| +0.00% | 126419.2 | 126419.2 | +0.0 | total |
| +0.00% | 22690.6 | 22690.6 | +0.0 | ├ translation units |
| +0.00% | 103728.6 | 103728.6 | +0.0 | └ proofs and tests |
Full Results
| Relative | Master | MR | Change | Filename |
|---|---|---|---|---|
| +0.00% | 126419.2 | 126419.2 | +0.0 | total |
| +0.00% | 22690.6 | 22690.6 | +0.0 | ├ translation units |
| +0.00% | 103728.6 | 103728.6 | +0.0 | └ proofs and tests |
Begin writing our internal manual.
Over #16.
Fix https://github.com/SkyLabsAI/agent-foundation/issues/35.