Repository navigation
Conversation
strub
added this pull request to stack #1156
October 8, 2026 05:52
PR of the program-logic reorganization stack (see
src/phl/REFACTORING.md). It migrates the `codetx` tactic class (kill,
alias, set, set-match, cfold, `case <-` and `simplify if`) onto the
transformation rule of each logic:
- rules/transforms/ecTr{Kill,Alias,Set,SetMatch,CFold,AsgnCase,
SimplifyIf}.ml: seven catalogue entries, with resolved parameters
(normalized, possibly nested, code positions; typed expressions; the
matched subterm and its occurrences for set-match). Each entry
re-checks its side conditions (kill: the killed code writes nothing
read by the code that may run after it, loops included, as computed by
`EcPV.zpr_pv`, or by the postcondition; set-match: the
selected occurrences are alpha-equivalent to the named subterm; the
tuple split: the assigned variables are not read by the expression;
...) with today's messages, so the checker re-validates them.
- rules/ecPlTransform.ml: a new obligation kind, `OLossless ks` (the
statement `ks` is lossless), stated by each of the four transformation
rules as `phoare [ks : true ==> true] = 1` in the memory of the
transformed program: the premise `kill` has always stated.
- kill reads the postcondition through the context of the rule, which
for hoare includes the exceptional postconditions (as on main since
the corresponding fix).
- EcMatching.Zipper.zipper_of_nm_cpos: the zipper at a normalized code
position, without environment.
- EcPhlCodeTx is reduced to derived tactics and a logic-agnostic
dispatcher onto the transformation rule of the goal's logic; its
interface is unchanged, the no-op FApi.t_low* wrappers are dropped,
and it no longer uses EcLowPhlGoal.t_code_transform (still used by
EcPhlLoopTx). weakmem changes the memory type of the goal: it is not
a program transformation and is left unchanged.
Behaviour is otherwise preserved: on the new test, the goals after
every step and the error messages of every failing invocation are
identical to those of the unmodified build. Anomalies (assertion
failures) raised by `case <-` on ill-formed input are kept, their
reported source location aside.
A new test, tests/codetx.ec, exercises every entry in every logic
(hoare, ehoare, phoare, both equiv sides), at top-level and nested
positions, the error paths, and the kill of a variable read by an
exceptional postcondition (rejected); tests/kill-exn.ec and
tests/kill-loop.ec pass unchanged. The stdlib, the unit tests and the examples pass
under EC_RECHECK=1 with no RecheckFailure. The transformation checkers,
when deliberately broken on the entries of this class, are caught only
under EC_RECHECK: on the new test, on the stdlib (bdhoare-transform 1,
equiv-transform 2), the other unit tests (hoare-transform 2) and the
examples (hoare-transform 1, bdhoare-transform 1); ehoare-transform only
by the new test.
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
codetxtactic class (kill,alias, set, set-match, cfold,
case <-andsimplify if) onto thetransformation rule of each logic:
SimplifyIf}.ml: seven catalogue entries, with resolved parameters
(normalized, possibly nested, code positions; typed expressions; the
matched subterm and its occurrences for set-match). Each entry
re-checks its side conditions (kill: the killed code writes nothing
read by the code that may run after it, loops included, as computed by
EcPV.zpr_pv, or by the postcondition; set-match: theselected occurrences are alpha-equivalent to the named subterm; the
tuple split: the assigned variables are not read by the expression;
...) with today's messages, so the checker re-validates them.
OLossless ks(thestatement
ksis lossless), stated by each of the four transformationrules as
phoare [ks : true ==> true] = 1in the memory of thetransformed program: the premise
killhas always stated.for hoare includes the exceptional postconditions (as on main since
the corresponding fix).
position, without environment.
dispatcher onto the transformation rule of the goal's logic; its
interface is unchanged, the no-op FApi.t_low* wrappers are dropped,
and it no longer uses EcLowPhlGoal.t_code_transform (still used by
EcPhlLoopTx). weakmem changes the memory type of the goal: it is not
a program transformation and is left unchanged.
Behaviour is otherwise preserved: on the new test, the goals after
every step and the error messages of every failing invocation are
identical to those of the unmodified build. Anomalies (assertion
failures) raised by
case <-on ill-formed input are kept, theirreported source location aside.
A new test, tests/codetx.ec, exercises every entry in every logic
(hoare, ehoare, phoare, both equiv sides), at top-level and nested
positions, the error paths, and the kill of a variable read by an
exceptional postcondition (rejected); tests/kill-exn.ec and
tests/kill-loop.ec pass unchanged. The stdlib, the unit tests and the examples pass
under EC_RECHECK=1 with no RecheckFailure. The transformation checkers,
when deliberately broken on the entries of this class, are caught only
under EC_RECHECK: on the new test, on the stdlib (bdhoare-transform 1,
equiv-transform 2), the other unit tests (hoare-transform 2) and the
examples (hoare-transform 1, bdhoare-transform 1); ehoare-transform only
by the new test.