failed to generate equality theorem for `match` expression with array patterns
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
A sub-issue of https://github.com/leanprover/lean4/issues/9713 is that match statements with array patterns fail to produce equations:
def testMatch : Array α → Unit
| #[a] => ()
| _ => ()
/--
error: Failed to realize constant testMatch.match_1.eq_1:
failed to generate equality theorems for `match` expression `testMatch.match_1`
case isTrue
α✝ : Type u_1
motive✝ : Array α✝ → Sort u_2
x✝¹ : Array α✝
h_1✝ : (a : α✝) → motive✝ #[a]
h_2✝ : (x : Array α✝) → motive✝ x
x✝ : ∀ (a : α✝), x✝¹ = #[a] → False
h✝ : x✝¹.size = 1
⊢ (⋯ ▸ fun h => ⋯ ▸ h_1✝ (x✝¹.getLit 0 ⋯ ⋯)) ⋯ = h_2✝ x✝¹
---
error: Unknown constant `testMatch.match_1.eq_1`
-/
#guard_msgs in
#print testMatch.match_1.eq_1
Version
Lean 4.23.0-nightly-2025-08-11
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 reproducing the testMatch definition and its #guard_msgs/#print testMatch.match_1.eq_1 checks from the issue. Investigate the compiler path that generates equality theorems for match expressions with array patterns. Done means the equality theorem is generated and the guarded output no longer reports the failed realization or unknown constant.
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
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100