Repository navigation
Conversation
strub
added this pull request to stack #1156
October 6, 2026 21:39
PR of the program-logic reorganization stack (see src/phl/REFACTORING.md). It migrates the `transitivity` / `replace` tactic class: - rules/equiv/ecEquivTrans.ml: the two trusted transitivity rules, for statements (t_equivS_trans) and procedures (t_equivF_trans), documented as inference rules in the .mli: from c1 ~ c2 : P1 ==> Q1, c2 ~ c3 : P2 ==> Q2 and the two composition side conditions (P => exists intermediate values, P1 /\ P2; Q1 => Q2 => Q), conclude c1 ~ c3 : P ==> Q. Each emits a node recording the typed intermediate program (memory type and statement, or procedure) and the four relations, with a registered checker; the builder takes the goal's hyps (it recomputes the variables of the intermediate memory and the procedures' memories) and re-checks that the relations are stated over the goal's memories. - `transitivity*` / `replace*` (t_equivS_trans_eq, also used by `outline` and `rewrite equiv`) is a derived form: the rule with equality relations, its two side conditions closed on the spot. - `replace` involves no position: the pattern only names parts of the current program for reuse in the new one, which replaces the whole side, so there is no implicit seq-ing or framing to remove. - EcPhlTrans is reduced to the dispatcher (matching on the goal kind) and positional adapters (interface unchanged); the no-op FApi.t_low3 wrappers are dropped. Behaviour is preserved, error messages and their order included. A new test, tests/transitivity.ec, exercises the statement (both sides) and procedure forms, `transitivity*`, `replace` / `replace*` and the error paths; it passes with and without this change. The stdlib and the unit tests pass under EC_RECHECK=1 with no RecheckFailure; each checker, when deliberately broken, is caught only under EC_RECHECK (stdlib: equivS-trans 13 files, equivF-trans 9).
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
transitivity/replacetactic class:
for statements (t_equivS_trans) and procedures (t_equivF_trans),
documented as inference rules in the .mli: from c1 ~ c2 : P1 ==> Q1,
c2 ~ c3 : P2 ==> Q2 and the two composition side conditions
(P => exists intermediate values, P1 /\ P2; Q1 => Q2 => Q), conclude
c1 ~ c3 : P ==> Q. Each emits a node recording the typed
intermediate program (memory type and statement, or procedure) and
the four relations, with a registered checker; the builder takes
the goal's hyps (it recomputes the variables of the intermediate
memory and the procedures' memories) and re-checks that the
relations are stated over the goal's memories.
transitivity*/replace*(t_equivS_trans_eq, also used byoutlineandrewrite equiv) is a derived form: the rule withequality relations, its two side conditions closed on the spot.
replaceinvolves no position: the pattern only names parts of thecurrent program for reuse in the new one, which replaces the whole
side, so there is no implicit seq-ing or framing to remove.
and positional adapters (interface unchanged); the no-op
FApi.t_low3 wrappers are dropped.
Behaviour is preserved, error messages and their order included.
A new test, tests/transitivity.ec, exercises the statement (both
sides) and procedure forms,
transitivity*,replace/replace*and the error paths; it passes with and without this change. The
stdlib and the unit tests pass under EC_RECHECK=1 with no
RecheckFailure; each checker, when deliberately broken, is caught only
under EC_RECHECK (stdlib: equivS-trans 13 files, equivF-trans 9).