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. Mechanizes the remaining grammar claims from
grammar-proofs.md in priority order, with Lean↔Coq parity on the structural
results. New, CI-gated (lean-proofs.yml / coq-proofs.yml), sorry/admit-free.
docs/proofs/verification/WokeGrammarStructure.lean (Lean 4.30.0):
- T2.1 no left recursion, WHOLE grammar: the begins-with-first-nonterminal graph
as data + a strictly-decreasing rank ⇒ no nonterminal reaches itself.
no_left_recursion depends on NO axioms.
- Discrepancy found and machine-checked: the grammar as literally written DOES
have one left-recursive production — the guard pattern
`pattern = … | pattern "when" expression` — which the parser does not implement
(the grammar's own NOTE). The prose §2.1 blanket "no left recursion" is
corrected in-place.
- T4.1 maximal munch + T4.2 keyword priority: a word scanner with general
longest-match and keyword-on-exact-match lemmas + kernel-decided concretes
(remember↦keyword, remembering↦one identifier, remember(↦keyword then stop).
- T1.2 LL(1)=NO / T2.3 LL(2)=YES: the x vs x(…) FIRST/FIRST conflict and its
two-token resolution (mirrors the parser's peek=='(' branch).
docs/proofs/verification/WokeGrammarStructure.v (Coq 8.18.0):
- Coq mirror of no-left-recursion (+ guard discrepancy) and the LL classification.
Print Assumptions: axiom-free ("Closed under the global context").
Docs: GRAMMAR-PROOF-INVENTORY.md records P2/P3/P4 + the Coq mirror, and honestly
FLAGS the §7 formal-language-theory claims (T7.1 not-regular, §7.3 CFL closure)
as general REG/CFL facts needing an automata library (Mathlib) unavailable in the
offline single-file setup — recorded rather than stubbed. grammar-proofs.md gets
the in-place §2.1 correction and a §7 mechanization-status note.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015oyMquf4daB6hMhmqB1wAL
| 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