[Merged by Bors] - fix: make sure tactics in DefEqTransformations do not reorder hypotheses#12077
[Merged by Bors] - fix: make sure tactics in DefEqTransformations do not reorder hypotheses#12077
Conversation
There was a problem hiding this comment.
Thank you very much Kyle, this looks great!
I do not understand the tiny details of the changes, but it all looks very good! I checked that the new unfold_let is idempotent in all the test files and a few other random locations and it seems to be!
| let lctx := (← mvarId.getDecl).lctx | ||
| let some decl := lctx.find? fvarId | throwTacticEx `changeLocalDecl mvarId m!"\ | ||
| local variable {Expr.fvar fvarId} is not present in local context{mvarId}" | ||
| let toRevert := lctx.foldl (init := #[]) fun arr decl' => | ||
| if decl.index ≤ decl'.index then arr.push decl'.fvarId else arr |
There was a problem hiding this comment.
@adomani If you want to be more comfortable reviewing, here's what to look for: the last five lines are new, creating this toRevert array.
The change to runDefEqTactic seems straightforward.
There was a problem hiding this comment.
Ok, I had indeed "micro-diffed" your PR, but thanks for the encouragement!
I'll be more assertive:
maintainer merge
|
🚀 Pull request has been placed on the maintainer queue by adomani. |
…ses (#12077) Reported by Damiano Testa [on Zulip](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/.60unfold_let.60.20weirdness/near/432757494). The upstream function `Lean.MVarId.changeLocalDecl` should probably be changed to preserve hypothesis order, but for now we add the `Lean.MVarId.changeLocalDecl'` variant.
|
Pull request successfully merged into master. Build succeeded: |
…ses (#12077) Reported by Damiano Testa [on Zulip](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/.60unfold_let.60.20weirdness/near/432757494). The upstream function `Lean.MVarId.changeLocalDecl` should probably be changed to preserve hypothesis order, but for now we add the `Lean.MVarId.changeLocalDecl'` variant.
…ses (#12077) Reported by Damiano Testa [on Zulip](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/.60unfold_let.60.20weirdness/near/432757494). The upstream function `Lean.MVarId.changeLocalDecl` should probably be changed to preserve hypothesis order, but for now we add the `Lean.MVarId.changeLocalDecl'` variant.
…ses (#12077) Reported by Damiano Testa [on Zulip](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/.60unfold_let.60.20weirdness/near/432757494). The upstream function `Lean.MVarId.changeLocalDecl` should probably be changed to preserve hypothesis order, but for now we add the `Lean.MVarId.changeLocalDecl'` variant.
…ses (#12077) Reported by Damiano Testa [on Zulip](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/.60unfold_let.60.20weirdness/near/432757494). The upstream function `Lean.MVarId.changeLocalDecl` should probably be changed to preserve hypothesis order, but for now we add the `Lean.MVarId.changeLocalDecl'` variant.
…ses (#12077) Reported by Damiano Testa [on Zulip](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/.60unfold_let.60.20weirdness/near/432757494). The upstream function `Lean.MVarId.changeLocalDecl` should probably be changed to preserve hypothesis order, but for now we add the `Lean.MVarId.changeLocalDecl'` variant.
Reported by Damiano Testa on Zulip.
The upstream function
Lean.MVarId.changeLocalDeclshould probably be changed to preserve hypothesis order, but for now we add theLean.MVarId.changeLocalDecl'variant.