Commit c77b102
CFL pumping lemma — machine-checked from scratch in Lean (cfl_pumping) (#106)
## Summary
Machine-checks the **pumping lemma for context-free languages** — a
result even Mathlib lacks — built from scratch in core Lean
(Mathlib-free, single-file, `lean
docs/proofs/verification/WokeGrammarPumping.lean`).
`cfl_pumping`: for an ε-free binary-normal-form grammar with `card`
nonterminals, any word `z ∈ L(S)` of length `≥ 2^(card+1)` decomposes as
`z = u v w x y` with
- `1 ≤ |v x|` (the pumped part is non-empty — uses ε-freeness),
- `|v w x| ≤ 2^(card+1)` (the window is bounded),
- `u vⁱ w xⁱ y ∈ L(S)` for every `i`.
## What's in the file (`WokeGrammarPumping.lean`)
Foundation (landed first):
- parse trees `PT` over a binary-normal-form grammar; `yield_bound`
(`|w| < 2^height`);
- one-hole contexts `Ctx` + `fill`; `pumpIter` (the pumping operation);
- `spine`/`spine_length`; a Mathlib-free finite `pigeon`hole.
Assembly (this completes it):
- `Ctx.comp` — context composition;
- `descend` — tallest-spine descent (recursion on **depth** so it
reduces definitionally);
- `ht_descend` — descended-subtree height is `ht t − d`;
- `nodeNT_add` — depth-composition law that locates the repeated
nonterminal;
- `yield_nonempty` / `descend_sibling_nonempty` — ε-free ⇒ `|v x| ≥ 1`;
- `cfl_pumping` — pigeonhole over the bottom `card+1` spine nodes ⇒
outer·pump·base ⇒ pump via `pumpIter`.
## Trust base
The three standard classical kernel constants (`propext`,
`Classical.choice`, `Quot.sound`) — the same foundations Mathlib relies
on (`Classical.choice` enters via the `pigeon` case split). No holes and
no project-specific assumptions; every step is checked by Lean's kernel.
## Verification
`lean docs/proofs/verification/WokeGrammarPumping.lean` exits 0 with no
errors (wired into `.github/workflows/lean-proofs.yml`).
Docs updated: `grammar-proofs.md` §7.3 and `GRAMMAR-PROOF-INVENTORY.md`
record the pumping lemma as machine-checked. The §7.3 ∩/¬ non-closure
corollary (finite `IsCFL` + `aⁿbⁿcⁿ ∉ CFL` + De Morgan) is the remaining
increment, now unblocked.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_015oyMquf4daB6hMhmqB1wAL
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent dfcec84 commit c77b102
4 files changed
Lines changed: 420 additions & 7 deletions
File tree
- .github/workflows
- docs/proofs
- formal-semantics
- verification
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
332 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
333 | 337 | | |
334 | 338 | | |
335 | 339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
165 | | - | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| |||
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
177 | | - | |
178 | | - | |
179 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
180 | 194 | | |
181 | 195 | | |
182 | 196 | | |
| |||
0 commit comments