unexpected "dependent match elimination failed"
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Prerequisites
Please put an X between the brackets as you perform the following steps:
- Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - Test your test case against the latest nightly release, for example on
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
The equation compiler gives error "dependent match elimination failed" when I expect the match to succeed
Context
inductive MyOrder : Nat × Nat × Nat → Nat × Nat × Nat → Prop
| twice {x y n u v m : Nat} : m + 2 ≤ n → MyOrder (x, y, n) (u, v, m)
| within {x y u v m : Nat} : x ≤ u → y ≤ v → MyOrder (x, y, m) (u, v, m)
| next_min {x y u v m : Nat} : min x y + 1 ≤ min u v → MyOrder (x, y, m + 1) (u, v, m)
theorem antisymmetric : ∀ {x y : Nat × Nat × Nat}, MyOrder x y → MyOrder y x → x = y
| _, _, .twice _, .twice _ => _
| _, _, .twice _, .within _ _ => _
| _, _, .twice _, .next_min _ => _
| _, _, .within _ _, .twice _ => _
| _, _, .within _ _, .within _ _ => _
| _, _, .next_min _, .twice _ => _
Steps to Reproduce
- Code as above
Expected behavior: Code gives errors on the six right-hand-sides to fill in the six proofs.
Actual behavior: The line | _, _, .twice _, .within _ _ => _ gives confusing error
dependent match elimination failed, inaccessible pattern found
.(n✝)
constructor expected
Versions
Lean 4.15.0-rc1
Target: x86_64-unknown-linux-gnu
Using live.lean-lang.org on Lean nightly.
Additional Information
Discussion here: https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/dependent.20match.20elimination.20failed
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the minimal MyOrder and antisymmetric reproducer against the latest Lean nightly, focusing on the equation compiler's dependent match elimination. Read the linked Zulip discussion for context; done means the reported pattern no longer produces the confusing inaccessible-pattern error and behaves as expected for the six proof holes.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100