-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: have
Lean.Meta.isConstructorApp'?
be aware of n + k
Nat offs…
…ets (#6270) This PR fixes a bug that could cause the `injectivity` tactic to fail in reducible mode, which could cause unfolding lemma generation to fail (used by tactics such as `unfold`). In particular, `Lean.Meta.isConstructorApp'?` was not aware that `n + 1` is equivalent to `Nat.succ n`. Closes #5064
- Loading branch information
Showing
2 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/-! | ||
# Make sure `injection` tactic can handle `0 = n + 1` | ||
https://github.com/leanprover/lean4/issues/5064 | ||
-/ | ||
|
||
/-! | ||
Motivating example from #5064. | ||
This failed when generating the splitter theorem for `thingy`. | ||
-/ | ||
|
||
def thingy : List (Nat ⊕ Nat) → List Bool | ||
| Sum.inr (_n + 2) :: l => thingy l | ||
| _ => [] | ||
termination_by l => l.length | ||
|
||
/-- info: ⊢ [] = [] -/ | ||
#guard_msgs in | ||
theorem thingy_empty : thingy [] = [] := by | ||
unfold thingy | ||
trace_state | ||
rfl | ||
|
||
/-! | ||
Test using `injection` directly. | ||
-/ | ||
example (n : Nat) (h : 0 = n + 1) : False := by | ||
with_reducible injection h |