fix: type mismatches in cbv proof terms about ite/dite/Decide#12811
Closed
wkrozowski wants to merge 3 commits intoleanprover:masterfrom
Closed
fix: type mismatches in cbv proof terms about ite/dite/Decide#12811wkrozowski wants to merge 3 commits intoleanprover:masterfrom
cbv proof terms about ite/dite/Decide#12811wkrozowski wants to merge 3 commits intoleanprover:masterfrom
Conversation
This PR fixes `cbv`'s handling of `ite`/`dite`/`decide` when the condition is simplified via congruence. Previously, in the congruence case (where condition `c` simplifies to `c'`), the tactic would try to simplify the original decidable instance and fall back to a generic congruence result if it couldn't match `isTrue`/`isFalse`. Now it constructs a decidable instance for the simplified condition `c'` via `decidable_of_decidable_of_eq` and tries to match that, allowing full reduction. New `*_congr` lemmas in `Init.Sym.Lemmas` produce the correct proof terms for this case. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
!bench |
|
Benchmark results for fb24c80 against fe1ad52 are in! @wkrozowski
Large changes (1🟥)
Small changes (1✅, 2🟥)
|
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
…dite`/`decide`
When `simpAndMatch{Ite,DIte}Decidable` simplified the decidable instance,
the simplified instance was passed to `match{Ite,DIte}Decidable` which used
it in the proof term. This produced a proof about `@decide p simplified_inst`
instead of `@decide p original_inst`, causing a kernel type mismatch.
Now `match{Ite,DIte}Decidable` and `matchDecideInst` take an optional
`inst'` parameter for pattern matching while using the original `inst`
in proof construction.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cbv decidable instance resolution in congruence casecbv handling of decide,ite and dite
Contributor
Author
|
!bench |
|
Benchmark results for fb24c80 against fe1ad52 are in! @wkrozowski
Large changes (2🟥)
Small changes (1✅, 2🟥)
|
cbv handling of decide,ite and ditecbv proof terms
cbv proof termscbv proof terms about ite/dite/Decide
Contributor
Author
|
Continuing work in #12816 |
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.
This PR fixes two issues in
cbv's proof term construction forite/dite/decide.First, when the condition/proposition is unchanged but the
Decidableinstance is simplified (e.g. via@[cbv_eval]rules), the proof terms were built using the simplified instance rather than the original, causing kernel type mismatches. NowmatchIteDecidable,matchDIteDecidable, andmatchDecideInstpattern-match on the simplified instance to determineisTrue/isFalsebut use the original instance in the proof term.Second, when the condition
csimplifies to a newc', the tactic previously could not reduce the resultingDecidableinstance. Now it derives aDecidable c'instance viadecidable_of_decidable_of_eq, simplifies it, and uses new*_congrlemmas (ite_true_congr,dite_true_congr,decide_isTrue_congr, etc.) to produce the correct proof terms.