Skip to content

[Merged by Bors] - fix: make sure tactics in DefEqTransformations do not reorder hypotheses#12077

Closed
kmill wants to merge 1 commit intomasterfrom
kmill_fix_reordering_defeqtransformations
Closed

[Merged by Bors] - fix: make sure tactics in DefEqTransformations do not reorder hypotheses#12077
kmill wants to merge 1 commit intomasterfrom
kmill_fix_reordering_defeqtransformations

Conversation

@kmill
Copy link
Copy Markdown
Contributor

@kmill kmill commented Apr 12, 2024

Reported by Damiano Testa on Zulip.

The upstream function Lean.MVarId.changeLocalDecl should probably be changed to preserve hypothesis order, but for now we add the Lean.MVarId.changeLocalDecl' variant.


Open in Gitpod

@kmill kmill added awaiting-review t-meta Tactics, attributes or user commands labels Apr 12, 2024
Copy link
Copy Markdown
Contributor

@adomani adomani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

adomani added a commit that referenced this pull request Apr 12, 2024
Comment on lines +26 to +30
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
Copy link
Copy Markdown
Contributor Author

@kmill kmill Apr 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I had indeed "micro-diffed" your PR, but thanks for the encouragement!

I'll be more assertive:

maintainer merge

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

bors merge

@github-actions
Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by adomani.

@github-actions github-actions bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Apr 12, 2024
@adomani adomani mentioned this pull request Apr 12, 2024
mathlib-bors bot pushed a commit that referenced this pull request Apr 12, 2024
…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.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Apr 12, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title fix: make sure tactics in DefEqTransformations do not reorder hypotheses [Merged by Bors] - fix: make sure tactics in DefEqTransformations do not reorder hypotheses Apr 12, 2024
@mathlib-bors mathlib-bors bot closed this Apr 12, 2024
@mathlib-bors mathlib-bors bot deleted the kmill_fix_reordering_defeqtransformations branch April 12, 2024 14:33
xgenereux pushed a commit that referenced this pull request Apr 15, 2024
…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.
atarnoam pushed a commit that referenced this pull request Apr 16, 2024
…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.
uniwuni pushed a commit that referenced this pull request Apr 19, 2024
…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.
callesonne pushed a commit that referenced this pull request Apr 22, 2024
…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.
Jun2M pushed a commit that referenced this pull request Apr 24, 2024
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants