ASCII forall and exists fail to parse with binder predicates
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 66/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- compilers
Direzione di ricerca
Start with the bounded-binder syntax declarations in src/Init/BinderPredicates.lean and the ASCII quantifier spelling in src/Lean/Parser/Term.lean. Run the bounded_binders.lean reproductions from the issue and compare their parse behavior with the Unicode forms. Done when ASCII bounded binders parse equivalently and regression coverage checks the cases listed in the issue, including the exists tactic and pretty-printing.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Prerequisites
- 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”) - When reporting a perceived soundness bug: Does it affect
lake check --paranoid?
If in doubt, please reach out on [email protected] for responsible disclosure.
Description
ASCII forall and exists fail to parse with binder predicates, although the equivalent Unicode ∀ and ∃ forms work. Plain binders accept both spellings; adding ∈ s or < n unexpectedly requires switching the quantifier to Unicode.
Context
This affects projects using ASCII quantifier keywords. The motivating example is microsoft/CCF, whose downstream compatibility module adds ASCII bounded-binder syntax rewriting to the Unicode forms; this workaround was reported to compile on Lean 4.35.0 without breaking the exists tactic.
Searches of Lean issues, PRs, and the public Zulip archive did not find a duplicate or prior discussion specifically about these ASCII spellings.
Steps to Reproduce
- Save this self-contained file as
bounded_binders.lean(no additional imports):
example : forall n ∈ [1, 2], n > 0 := by decide
example : exists n ∈ [1, 2], n > 1 := by decide
example : forall n < 3, n < 5 := by omega
- Run
lean bounded_binders.lean. - Compare with the following successful Unicode equivalents and plain ASCII binders:
example : ∀ n ∈ [1, 2], n > 0 := by decide
example : ∃ n ∈ [1, 2], n > 1 := by decide
example : ∀ n < 3, n < 5 := by omega
example : forall n : Nat, n = n := by intro n; rfl
example : exists n : Nat, n = 1 := by exists 1
example : ∃ n, n = 1 := by exists 1
Expected behavior: All three ASCII bounded-binder examples should elaborate with the same meaning as their Unicode equivalents.
Actual behavior: The first two examples report unexpected token '∈'; expected ','. The third reports unexpected token '<'; expected ','.
Versions
#eval Lean.versionString outputs "4.35.0"; lean --version reports Lean (version 4.35.0, Release).
Also reproduced all three errors on the latest published nightly as of 2026-11-06: nightly-2026-11-06.
Lean (version 4.37.0-nightly-2026-11-06, x86_64-unknown-linux-gnu, commit d4cada4c0c02734da4a3a00dac27faa8ca2b912b, Release)
The Unicode equivalents and plain ASCII binders elaborate successfully on both versions.
OS: Azure Linux 4.0 (Container Image Beta), x86_64; Linux kernel 6.8.0-1064-azure.
Additional Information
The plain universal binder uses unicodeSymbol "∀" "forall" in src/Lean/Parser/Term.lean, but the separate bounded-binder rules in src/Init/BinderPredicates.lean register only Unicode tokens:
syntax "∃ " binderIdent binderPred ", " term : term
syntax "∀ " binderIdent binderPred ", " term : term
A possible fix is to use the existing syntax DSL mechanism for alternate spellings:
syntax unicode("∃ ", "exists ") binderIdent binderPred ", " term : term
syntax unicode("∀ ", "forall ") binderIdent binderPred ", " term : term
The suggested fix has not yet been implemented or verified. Regression tests should check equivalent macro expansion (including anonymous binders), continued parsing of the exists tactic, and pretty-printing with Unicode enabled and disabled.
Soundness prerequisite: N/A; this is a parser inconsistency, not a perceived soundness bug.
Investigation and issue drafting assisted by GitHub Copilot.
- 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 ·