"failed to generate equational theorem" when a `match` discriminant such as `1 - a` becomes a closed term after unfolding
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- compilers
Direzione di ricerca
Start with the minimal reproducer in the issue and inspect src/Lean/Elab/PreDefinition/Eqns.lean, which the report identifies as the equation theorem generation code. Compare the generated proof for a closed arithmetic match discriminant with the working id 3 case, then check whether the stated hypothesis is used. Done when the equation theorem is generated and simp [f] proves f 0 = 0.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Prerequisites
- Check that your issue is not already filed: searched for
failed to generate equational theorem,equational theorem match discriminantandclosed discriminant. Related: #16259 (same kind ofmatch, but there the hypothesis is dropped from the statement), #7841, #15735, #10431. - 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.
Description
Lean accepts this definition and states a true equation lemma for it, but cannot prove that lemma:
def f (a : Nat) : Nat :=
match 1 - a, a with
| n+1, 0 => n
| _, _ => 0
#check @f.eq_1
example : f 0 = 0 := by simp [f]
Eqn.lean:6:8: error: Failed to realize constant f.eq_1:
failed to generate equational theorem for `f`
n : Nat
h : 1 - 0 = n.succ
⊢ 0 = n
Eqn.lean:6:8: error(lean.unknownIdentifier): Unknown identifier `f.eq_1`
Eqn.lean:7:30: error: failed to generate equational theorem for `f`
...
Eqn.lean:7:24: error: `simp` made no progress
The hypothesis h : 1 - 0 = n.succ is in the goal and gives n = 0, but the proof doesn't use it. example : f 0 = 0 := rfl and by unfold f; rfl are both accepted. Unlike #16259, the generated statement here is correct; only its proof fails. 5 - a fails the same way, while match id 3, a with ... works (h.eq_1 : ∀ n, id 3 = n.succ → h 0 = n).
Expected behavior: f.eq_1 : ∀ (n : Nat), 1 - 0 = n.succ → f 0 = n is generated and simp [f] proves f 0 = 0.
Actual behavior: the errors above.
Versions
4.37.0-nightly-2026-11-05 failed to generate equational theorem
4.35.0 failed to generate equational theorem (hypothesis named heq)
4.22.0 (deterministic) timeout at `whnf`
These are on macOS arm64 (official toolchains via elan), and Linux x86_64 gives the same results. Since the nightly, the only change on master to src/Lean/Elab/PreDefinition/Eqns.lean is #16275, which is about over-applied matchers.
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask
them to add 👍 to it.
Found by an automated differential tester (ephyra); this report was drafted with AI assistance.
- Lingua principale
- Lean
- Stelle
- 10.3k
- Fork
- 1.1k
- Merge medio
- 19h 8m
- PR unite (30g)
- 421
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di leanprover/lean4
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
leanprover/lean4#16681 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
leanprover/lean4#16305 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
leanprover/lean4#16299 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
leanprover/lean4#16257 ·
I maintainer di solito rispondono entro 1 giorno
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
leanprover/lean4#15683 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di leanprover/lean4
Issue simili
-
bug fixed form parser medium priority tokenizer
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
swc-project/swc-next-issues#817 ·
-
Magma mode: div:=, mod:= and the other keyword assignments (join:=, meet:=, diff:=, sdiff:=, and:=, or:=, xor:=) are refusedForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
sagemathinc/sagebrush#1683 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
microts: a model local that every branch assigns raises unused_assignments in the generated RustApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
pocket-stack/pocketjs#756 ·