fix(phl): proc rewrite /= honors the proof-local simplify context - #1146
Merged
Merged
Conversation
`process_rewrite_simpl` reduced with a bare `EcReduction.nodelta`, whose `user_local` is `SimplifyContext.empty`. The lemmas and databases added by `hint ...` or by `with hint ... (...)` were therefore invisible to it, unlike every other reduction tactic (`t_cbv`, `t_cbn`, `simplify`, `cbv`), which all thread `FApi.tc1_simplify_context`. The same `ri` is reused by the `t_change` that discharges the side goal, so the discharge stays consistent with the rewriting performed. The tests keep the rule in a named database and drop the hint before the closing `apply`, so that only a rewriting of the program itself can close the goal; each of them fails without the fix.
strub
approved these changes
Sep 22, 2026
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.
Fixes #1145.
process_rewrite_simplreduced with a bareEcReduction.nodelta, whoseuser_localisSimplifyContext.empty. Databases activated withhint +dband lemmas added withhint {l}— whether by the standalonecommand or by the scoped
with hint ... (...)form — were thereforeinvisible to
proc rewrite /=, unlike every other reduction tactic(
t_cbv,t_cbn,simplify,cbv), which all threadFApi.tc1_simplify_context.The same
riis reused by thet_changedischarging the side goal, so thedischarge stays consistent with the rewriting performed.
Tests
tests/procrewrite-simpl.ecgains five lemmas coveringhint +db,hint {l}, and both scoped forms. They keep the rule in a named databaseso kernel conversion cannot fire it on its own, and drop the hint before
the closing
apply— otherwise it is theapply's own conversion, whichdoes see the local context, that closes the goal, and the test passes even
with the bug present.
Checked in both directions by rebuilding: the four positive lemmas each
fail on unpatched
mainand pass with the patch. No regression onprocrewrite,procchange,match_codepos,local_hint_simplify,hint_simplify_db,simplify_head_filter,simplify-delta-ops.theories/crypto/assumptions/DHIES.ecuses theproc rewrite <pterm>branch, which this patch does not touch.
Not included
The two related points listed at the end of the issue (
ptenv_of_penvwithout
~simpl:, and the absence of a use-sitehintclause onproc rewrite /=) are left out to keep this PR to the single fix.