Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get_elem_tactic_trivial to not loop in the presence of mvars #5119

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

nomeata
Copy link
Collaborator

@nomeata nomeata commented Aug 21, 2024

The goal at the crucial step is

a : Array Nat
i : Fin ?m.27
⊢ ↑i < a.size

and after the apply Fin.val_lt_of_le; we have

a : Array Nat
i : Fin ?m.27
⊢ ?m.27 ≤ a.size

and now apply Fin.val_lt_of_le applies again, due to accidential defeq. Adding with_reducible helps here.

fixes #5061

The goal at the crucial step is
```
a : Array Nat
i : Fin ?m.27
⊢ ↑i < a.size
```
and after the `apply Fin.val_lt_of_le;` we have
```
a : Array Nat
i : Fin ?m.27
⊢ ?m.27 ≤ a.size
```
and now `apply Fin.val_lt_of_le` applies again, due to accidential defeq. Adding `with_reducible` helps here.

fixes #5061
@nomeata nomeata added the will-merge-soon …unless someone speaks up label Aug 21, 2024
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc August 21, 2024 18:18 Inactive
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Aug 21, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Aug 21, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Aug 21, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Aug 21, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

Mathlib CI status (docs):

@nomeata nomeata added this pull request to the merge queue Aug 21, 2024
Merged via the queue into master with commit c78bb62 Aug 21, 2024
19 checks passed
@@ -184,7 +184,7 @@ instance [GetElem? cont Nat elem dom] [h : LawfulGetElem cont Nat elem dom] :
@[simp] theorem getElem!_fin [GetElem? Cont Nat Elem Dom] (a : Cont) (i : Fin n) [Inhabited Elem] : a[i]! = a[i.1]! := rfl

macro_rules
| `(tactic| get_elem_tactic_trivial) => `(tactic| apply Fin.val_lt_of_le; get_elem_tactic_trivial; done)
| `(tactic| get_elem_tactic_trivial) => `(tactic| (with_reducible apply Fin.val_lt_of_le); get_elem_tactic_trivial; done)
Copy link
Member

Choose a reason for hiding this comment

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

An explanatory comment seems to be missing here :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, maybe. Although with_reducible itself already shuts loudly “don't apply this lemma unless the goals looks like it”, and brings this in line with similar tactic invocations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN will-merge-soon …unless someone speaks up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exponential behavior in compilation
3 participants