ASCII forall and exists fail to parse with binder predicates
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 66/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- compilers
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Lean
- Stars
- 10.3k
- Forks
- 1.1k
- Avg merge
- 19h 8m
- Merged PRs (30d)
- 421
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from leanprover/lean4
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16681 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
leanprover/lean4#16305 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
leanprover/lean4#16299 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16257 ·
Maintainers usually reply within 1 day
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
leanprover/lean4#15683 ·
Maintainers usually reply within 1 day
All issues in leanprover/lean4
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 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 refusedPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
sagemathinc/sagebrush#1683 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
microts: a model local that every branch assigns raises unused_assignments in the generated RustOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
pocket-stack/pocketjs#756 ·
-
bot-triaged module: aotinductor module: compile-time module: inductor module: performance module: rocm oncall: export oncall: pt2 triaged
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day