You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #102 (merged). Continues mechanizing the grammar claims
from
`grammar-proofs.md` in priority order, with **Lean↔Coq parity** on the
structural
results. All new files are CI-gated and `sorry`/`admit`-free; the
headline
theorems are **axiom-free**.
## What's proved
**`WokeGrammarStructure.lean`** (Lean 4.30.0):
| Claim | Result |
|---|---|
| **T2.1 no left recursion** (whole grammar) |
begins-with-first-nonterminal graph as data + strictly-decreasing rank ⇒
`no_left_recursion : ∀ a, ¬ Reach a a` — **depends on no axioms** |
| **Discrepancy found** | the grammar *as written* HAS a left-recursive
production: the guard pattern `pattern = … \| pattern "when" expression`
(`guard_pattern_is_left_recursive`). The prose §2.1 blanket "no left
recursion" is **false as written** — corrected in place. The parser
doesn't implement the guard alt (the grammar's own NOTE), so
`no_left_recursion` holds for the implemented grammar. |
| **T4.1 maximal munch / T4.2 keyword priority** | general
`munch_maximal` (longest-match) + `kw_priority`, plus kernel-`decide`d
concretes (`remember`↦keyword, `remembering`↦*one* identifier,
`remember(`↦keyword then stop) |
| **T1.2 LL(1)=✗ / T2.3 LL(2)=✓** | `not_LL1` (the `x` vs `x(…)`
FIRST/FIRST conflict) + `LL2_separates` (two tokens decide — mirrors the
parser's `peek=='('` branch) |
**`WokeGrammarStructure.v`** (Coq 8.18.0): Coq mirror of
no-left-recursion (+ the
guard discrepancy) and the LL classification. `Print Assumptions` →
**axiom-free**
("Closed under the global context").
## Honestly flagged (not faked) — §7 formal-language-theory
`T7.1` not-regular (pumping) and §7.3 CFL closure/non-closure are
general facts
about the *classes* REG/CFL, not this grammar, and need an automata
library
(Mathlib `Computability.*`) that the repo's deliberately Mathlib-free,
offline,
single-file prover setup doesn't provide. Recorded in
`GRAMMAR-PROOF-INVENTORY.md` rather than stubbed; the combinatorial
kernel
(unbounded balanced nesting) is exercised concretely in
`WokeGrammar.lean`.
## CI
`lean-proofs.yml` and `coq-proofs.yml` gain steps for the new files (the
existing
Lean/Coq proofs continue to be gated). Local: both compile exit-0;
`#print
axioms`/`Print Assumptions` confirm the axiom footprints above.
Draft for review.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_015oyMquf4daB6hMhmqB1wAL
---
_Generated by [Claude
Code](https://claude.ai/code/session_015oyMquf4daB6hMhmqB1wAL)_
Co-authored-by: Claude <noreply@anthropic.com>
| T2.1 | §2.1 No left recursion | ✅ yes (whole grammar) |**P2**| Grammar as data; `¬ LeftRecursive G` by decision/structural proof over **all** productions | MACHINE-CHECKED |
60
+
| T2.1 | §2.1 No left recursion | ✅ yes (whole grammar) |**P2**| Grammar as data; rank-decreasing `Reach` ⇒ `¬ Reach a a` over **all** productions | MACHINE-CHECKED (**+ found a real discrepancy:** the guard pattern IS left-recursive — see below)|
61
61
| T2.2 | §2.2 Unambiguity | ✅ for the core (undecidable in general) |**P1**| Determinism of the verified parser ⇒ unique parse: `Derives ts e₁ → Derives ts e₂ → e₁=e₂` for the expression core | MACHINE-CHECKED (core) |
62
62
| T2.3 | §2.3 LL(2) | ◑ partial |**P4**| The one 2-token decision (`ident` vs `ident(`) witnessed; determinism of the core parser. Full LL(2) table for all 94 productions is not built | MACHINE-CHECKED (witness) |
63
63
| T3.1 | §3.1 Parser soundness | ✅ for the core |**P1**|`parse ts = some (e, rest) → Derives (consumed) e`| MACHINE-CHECKED (core) |
@@ -69,7 +69,7 @@ reach here, with reason).
69
69
| T6.3 | §6.3 Left-associativity | ✅ |**P1**|`a-b-c ↦ (a-b)-c` from the strict-`<` model + general statement | MACHINE-CHECKED |
70
70
| T1.1 | §1.1 CFG membership | ✅ |**P4**| By construction (the grammar relation is a CFG) | MACHINE-CHECKED |
71
71
| T1.2 | §1.1 LL(1) = ✗ | ✅ |**P4**| Exhibit the FIRST/FIRST conflict (`primary → identifier` vs `identifier "(" …`) — a 1-lookahead non-determinism witness | MACHINE-CHECKED |
0 commit comments