Commit 343867d
fix(proofs): repair WokeLang.lean to verify under Lean 4.30.0 + add CI gate (#79)
## Summary
The Lean 4 formal-verification file
`docs/proofs/verification/WokeLang.lean` claimed *"all 12 `sorry`
eliminated / verified"* — but it had **silently bit-rotted** and did
**not compile** under a current Lean toolchain (~100 errors). Root
cause: **no CI ever ran the prover** (workflows only covered the OCaml
core + e2e), so the headline correctness claim was never
machine-enforced.
This PR restores **sorry-free compilation under Lean 4.30.0**, adds the
missing **CI gate**, and documents a coverage/correspondence audit.
## What changed
**Only proof bodies + 2 `deriving` clauses + 1 `abbrev`** — every
theorem signature and every inductive is **byte-identical** (verified by
diff). No statement was weakened; no `sorry`/`admit`/`axiom` introduced.
Root causes fixed:
- **`DecidableEq` no longer derives** for `Value`/`WokeType` (`Float`
has none — NaN; and nested `List Self` blocks the deriving handler) →
reduced to `deriving Repr`; equality decisions use Lean's classical
`by_cases` (no instance needed).
- **`induction`/`cases` on concrete indices** (`emptyTypeEnv`,
`emptyEnv`) + binder-arity drift across Lean versions. `preservation`
made **type-polymorphic** via `induction hs generalizing t` (its
congruence cases need the IH at the operand type, not the result type).
`cases … with | inr ⟨..⟩` anonymous-constructor patterns → `obtain` (no
longer supported in `cases`). Type-mismatched reduction siblings
discharged with `nomatch`.
- **`BEq Permission`**: made `Permission` a reducible `abbrev` so the
`String` instance transfers.
## Verification
```
$ lean docs/proofs/verification/WokeLang.lean # exit 0, no output
```
Machine-checked: `progress`, `preservation`, `type_safety` (multi-step),
`consent_monotonicity`, `consent_preservation` — for the expression core
(incl. the Result/`unwrap`/`error` panic-propagation fragment).
## Added
- **`docs/proofs/verification/lean-toolchain`** — pins Lean v4.30.0.
- **`docs/proofs/verification/AUDIT.md`** — answers PROOF-NEEDS.md #1 &
#2: the proofs cover a **clean expression core** (a strict,
honestly-scoped subset), the Lean type system corresponds to the
**Rust** typechecker (not the OCaml `core/eval.ml`, which models a
different language), and the consent theorems correspond to the spec's
Hoare logic.
- **`.github/workflows/lean-proofs.yml`** — installs the pinned
toolchain and runs the check on every push to the proof dir, so this
can't bit-rot again. SHA-pinned action, pure-bash install (matches
estate governance).
## Note on scope
This repairs and re-verifies the **existing** proofs and makes them
durable. It does **not** yet extend coverage (more binops/comparisons,
statements, arrays, compiler/VM correctness) — those remain per
PROOF-NEEDS.md and are tabulated in AUDIT.md.
https://claude.ai/code/session_013wg3Mtq2QFhYi4XVw1Z6z7
---
_Generated by [Claude
Code](https://claude.ai/code/session_013wg3Mtq2QFhYi4XVw1Z6z7)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent f51b27e commit 343867d
4 files changed
Lines changed: 288 additions & 89 deletions
File tree
- .github/workflows
- docs/proofs/verification
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
0 commit comments