Repository navigation
Conversation
PR of the program-logic reorganization stack (see src/phl/REFACTORING.md). It migrates the bridge tactics relating judgements: `bypr`, `pr_bounded`, `hoare`, `phoare split` and `hoare split`: - rules/hoare/ecHoareOfBdHoare.ml: `hoare [c : P ==> Q]` from `phoare [c : P ==> !Q] = 0%r` (no exceptional postcondition); rules/bdhoare/ecBdHoareOfHoare.ml: the converse. The `hoare` tactic on a phoare goal is derived: the bound-changing consequence to `= 0%r`, then the rule. - rules/bdhoare/ecBdHoarePr.ml: `phoare [f : P ==> Q] ~ d` from `forall &m, 0%r <= d /\ (P => Pr[f(args) @ &m : Q] ~ d)`; rules/hoare/ecHoarePr.ml derives the hoare form from it and the view above. rules/equiv/ecEquivPr.ml: `equiv [f1 ~ f2 : P ==> Q]` from the equality of the distributions of two observed expressions; the node records their common type, re-checked by the builder. - rules/bdhoare/ecBdHoarePrBounded.ml: a probability is in [0, 1] and that of `false` is 0, plus the premise forms `P => 1%r <= d` / `P => d <= 0%r` (the bound-changing consequence would add a `0%r <= d` conjunct, so they are kept as rules). - rules/bdhoare/ecBdHoareSplit.ml: inclusion-exclusion on a conjunction or a disjunction, and the complement rule; the bound change and the `phoare split b1 b2 : R` case analysis are derived. - rules/hoare/ecHoareSplit.ml: `hoare split`, derived from the consequence rules (no rule of its own). - Each rule (statement and/or procedure form) is documented as an inference rule in its .mli and emits a node with a registered checker; side conditions (bound `= 0%r`, shape of the postcondition, bound combining the premises' bounds, ...) are part of the subgoal builders, so the checkers re-validate them. - EcPhlPr, EcPhlCoreView, EcPhlBdHoare, EcPhlHiBdHoare and EcPhlHoare are reduced to dispatchers and adapters; their interfaces are unchanged. EcPhlPr.t_prfalse, which has no caller, is not migrated and is flagged as unsound in a comment. Behaviour is preserved: on the new test, goals after every bridge tactic and the error messages of every failing invocation are identical to those of the unmodified build. A new test, tests/pr-bridges.ec, exercises every rule reachable from the surface syntax and the error paths (the procedure forms of the split rules are not reachable: `phoare split` cannot type its bounds on a procedure goal). The stdlib, the unit tests and the examples pass under EC_RECHECK=1 with no RecheckFailure. Each of the 14 checkers, when deliberately broken, is caught only under EC_RECHECK (on the new test, except the unreachable ones; on the stdlib where the rule is used there: hoareF-of-bdhoare 2 files, bdhoareS-of-hoare 9, bdhoareF-of-hoare 4, bdhoareF-pr 9, equivF-pr 8, bdhoareS-prbounded 6, bdhoareF-prbounded 4, bdhoareS-split-or 1).
strub
added this pull request to stack #1156
October 6, 2026 22:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR of the program-logic reorganization stack (see
src/phl/REFACTORING.md). It migrates the bridge tactics relating
judgements:
bypr,pr_bounded,hoare,phoare splitandhoare split:hoare [c : P ==> Q]fromphoare [c : P ==> !Q] = 0%r(no exceptional postcondition);rules/bdhoare/ecBdHoareOfHoare.ml: the converse. The
hoaretacticon a phoare goal is derived: the bound-changing consequence to
= 0%r, then the rule.phoare [f : P ==> Q] ~ dfromforall &m, 0%r <= d /\ (P => Pr[f(args) @ &m : Q] ~ d);rules/hoare/ecHoarePr.ml derives the hoare form from it and the view
above. rules/equiv/ecEquivPr.ml:
equiv [f1 ~ f2 : P ==> Q]fromthe equality of the distributions of two observed expressions; the
node records their common type, re-checked by the builder.
that of
falseis 0, plus the premise formsP => 1%r <= d/P => d <= 0%r(the bound-changing consequence would add a0%r <= dconjunct, so they are kept as rules).or a disjunction, and the complement rule; the bound change and the
phoare split b1 b2 : Rcase analysis are derived.hoare split, derived from theconsequence rules (no rule of its own).
inference rule in its .mli and emits a node with a registered
checker; side conditions (bound
= 0%r, shape of the postcondition,bound combining the premises' bounds, ...) are part of the subgoal
builders, so the checkers re-validate them.
are reduced to dispatchers and adapters; their interfaces are
unchanged. EcPhlPr.t_prfalse, which has no caller, is not migrated
and is flagged as unsound in a comment.
Behaviour is preserved: on the new test, goals after every bridge
tactic and the error messages of every failing invocation are identical
to those of the unmodified build.
A new test, tests/pr-bridges.ec, exercises every rule reachable from the
surface syntax and the error paths (the procedure forms of the split
rules are not reachable:
phoare splitcannot type its bounds on aprocedure goal). The stdlib, the unit tests and the examples pass under
EC_RECHECK=1 with no RecheckFailure. Each of the 14 checkers, when
deliberately broken, is caught only under EC_RECHECK (on the new test,
except the unreachable ones; on the stdlib where the rule is used
there: hoareF-of-bdhoare 2 files, bdhoareS-of-hoare 9,
bdhoareF-of-hoare 4, bdhoareF-pr 9, equivF-pr 8, bdhoareS-prbounded 6,
bdhoareF-prbounded 4, bdhoareS-split-or 1).