Repository navigation
fix: kill must respect the exceptional postconditions - #1176
Merged
Merged
Conversation
On a hoare goal, `EcLowPhlGoal.t_code_transform` handed the code
transformations the main postcondition only. `kill` uses it to check
that the killed code writes no variable read by the postcondition, so a
variable read only by an exceptional postcondition could be killed,
which proves false judgements, e.g.
hoare [N.f : N.x = 0 ==> true | oops _ => N.x = 0]
for `N.f = { N.x <- 1; raise (oops 0); }`, by `kill 1`. As for #1129
(`swap`), no derivation of `false` is known: no rule relates exceptional
postconditions to `phoare` / `Pr`.
The transformations now get the conjunction of the main and exceptional
postconditions (they only use it for the variables it reads; `kill` is
the only one that does). The issue dates from the introduction of
exceptions (bba1f1b, first released in r2026.03).
tests/kill-exn.ec checks that `kill` is rejected in that case and still
applies when the exceptional postconditions do not read the killed
variables. The stdlib, the unit tests and the examples pass.
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.
On a hoare goal,
EcLowPhlGoal.t_code_transformhanded the codetransformations the main postcondition only.
killuses it to checkthat the killed code writes no variable read by the postcondition, so a
variable read only by an exceptional postcondition could be killed,
which proves false judgements, e.g.
hoare [N.f : N.x = 0 ==> true | oops _ => N.x = 0]
for
N.f = { N.x <- 1; raise (oops 0); }, bykill 1. As for #1129(
swap), no derivation offalseis known: no rule relates exceptionalpostconditions to
phoare/Pr.The transformations now get the conjunction of the main and exceptional
postconditions (they only use it for the variables it reads;
killisthe only one that does). The issue dates from the introduction of
exceptions (bba1f1b, first released in r2026.03).
tests/kill-exn.ec checks that
killis rejected in that case and stillapplies when the exceptional postconditions do not read the killed
variables. The stdlib, the unit tests and the examples pass.