Application type mismatch in omega
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 following input causes a failure in 4.21.0-rc3. It used to work in previous versions.
import Aesop
add_aesop_rules safe (by omega)
inductive Formula (α: Type): Type where
| Not: Formula α → Formula α
| Atom: α → Formula α
structure Struct (α: Type) where
var_to_formula: Array (Formula α)
formula_to_var: List (Formula α)
theorem test (c: Struct α) (f: Formula α)
(i₃: ∀ i, i ≥ 1 → (h: i < c.var_to_formula.size) → c.var_to_formula[i] ∈ c.formula_to_var):
(∀ i, i ≥ 1 → (h: i < c.var_to_formula.size + 1) →
f = (c.var_to_formula.push f)[i]'(by simp [h]) ∨
(c.var_to_formula.push f)[i]'(by simp [h]) ∈ c.formula_to_var) := by
aesop (add norm Array.getElem_push)
Here are the error messages
error: Bugs/Panic2.lean:3:25: (kernel) application type mismatch
@getElem (Array (Formula α)) Nat (Formula α) (fun xs i => i < xs.size) Array.instGetElemNatLtSize
(Struct.var_to_formula α c) i a✝
argument has type
¬((∀ (h : i < Array.size (Struct.var_to_formula α c)),
f =
@getElem (Array (Formula α)) Nat (Formula α) (fun xs i => i < xs.size) Array.instGetElemNatLtSize
(Struct.var_to_formula α c) i h) ∨
f ∈ Struct.formula_to_var α c)
but function has type
(fun xs i => i < xs.size) (Struct.var_to_formula α c) i → Formula α
error: Bugs/Panic2.lean:15:8: (kernel) unknown constant 'push_cases._proof_1_1'
Versions
Lean 4.21.0-rc3
Lean 4.21.0
Lean 4.22.0
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 reproducer in Bugs/Panic2.lean against the listed Lean versions. Investigate the interaction between omega, Aesop, Array.getElem_push, and kernel elaboration that produces the application type mismatch and unknown push_cases constant. Done means the reproducer no longer emits either error, with a regression test covering the failure.
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
- Mostly clear
- Newbie friendliness
- 35/100