|
2 | 2 | SPDX-License-Identifier: MPL-2.0 |
3 | 3 | SPDX-FileCopyrightText: 2026 Hyperpolymath |
4 | 4 | --> |
5 | | -# WokeLang Lean4 Proof Audit |
| 5 | +# WokeLang Proof Audit (Lean 4 + Coq) |
6 | 6 |
|
7 | | -This document records a completeness/correspondence audit of |
8 | | -`WokeLang.lean`, answering the two questions raised in |
9 | | -[`PROOF-NEEDS.md`](../../../PROOF-NEEDS.md): *is the sorry-free claim still |
10 | | -true?* and *do the proofs cover the full type system or only a subset?* |
| 7 | +This document records a completeness/correspondence audit of the two formal |
| 8 | +developments — `WokeLang.lean` (Lean 4) and `WokeLang.v` (Coq) — answering the |
| 9 | +questions raised in [`PROOF-NEEDS.md`](../../../PROOF-NEEDS.md): *is the |
| 10 | +verified/sorry-free claim still true?* and *do the proofs cover the full type |
| 11 | +system or only a subset?* (The Lean sections come first; the Coq audit is its |
| 12 | +own section below.) |
11 | 13 |
|
12 | 14 | ## Toolchain |
13 | 15 |
|
@@ -151,6 +153,54 @@ theorems (`weaken_collapses_distinction`, `affine_canonical`, |
151 | 153 | - Still open in Tier 1: **float** arithmetic variants (`sub`/`mul`/`div` on |
152 | 154 | `float`, mirroring `add` on float) and **`array`** typing/evaluation. |
153 | 155 |
|
| 156 | +## Coq proofs (`WokeLang.v`) — audited 2026-06-14 |
| 157 | + |
| 158 | +A parallel Coq formalization exists. It was given the same meticulous |
| 159 | +treatment as the Lean file. |
| 160 | + |
| 161 | +- **Toolchain:** Coq **8.18.0** (ubuntu-24.04 apt). Build / verify (the oracle): |
| 162 | + `cd docs/proofs/verification && coqc WokeLang.v` (exit 0 ⇒ verified). CI gate: |
| 163 | + `.github/workflows/coq-proofs.yml` (pinned to ubuntu-24.04 — the file is |
| 164 | + version-sensitive). |
| 165 | + |
| 166 | +- **Rot found and fixed.** Like the Lean file, `WokeLang.v` did **not compile** |
| 167 | + (no CI ever ran the prover). The *only* breakage: `value_eq_dec` used `decide |
| 168 | + equality; … apply list_eq_dec; assumption`, but the recursive IH for the |
| 169 | + nested `list value` is no longer in scope under 8.18 → "No such assumption". |
| 170 | + Fixed with an explicit fixpoint (`fix IH 1; …; apply list_eq_dec; exact IH`). |
| 171 | + Everything else — including the large `preservation` proof — then compiled. |
| 172 | + |
| 173 | +- **Soundness (meticulous check).** No `Admitted`/`admit`/`Axiom`/`Conjecture`. |
| 174 | + `Print Assumptions` on `progress`/`preservation`/`type_safety` shows they |
| 175 | + depend **only** on `ClassicalDedekindReals.sig_forall_dec` + |
| 176 | + `functional_extensionality` — both pulled in *unavoidably* by modelling |
| 177 | + floats as real numbers (`R`), exactly as the file header claims ("no new |
| 178 | + axioms beyond those implicit in `Coq.Reals`"). Consistent, standard, honest. |
| 179 | + |
| 180 | +- **Coverage vs. the Lean file.** Complementary, not identical: |
| 181 | + - Coq is **ahead on arrays** — full `T_Array`/`T_Lit_Array`, array stepping |
| 182 | + (`S_Array_step`/`S_Array_val`), and a `progress` that uses **well-founded |
| 183 | + induction on `expr_size`** to get an IH for array elements. (This is exactly |
| 184 | + the Tier-1 item still open on the Lean side.) |
| 185 | + - Coq models floats as `ℝ` ⇒ `value_eq_dec` is fully decidable (`Req_EM_T`), |
| 186 | + at the cost of the classical-reals axioms above. (Lean models `Float` as |
| 187 | + opaque IEEE and decides equality classically via `by_cases`.) |
| 188 | + - Coq is **behind on binops**: only `add`/`eq`/`and` have rules — none of |
| 189 | + `sub/mul/div/mod` or the comparisons/`or` the Lean file now has. |
| 190 | + |
| 191 | +- **`cap_subsumes` bug fixed.** Its catch-all was `TODO: false`, so the relation |
| 192 | + was **not even reflexive** (`cap_subsumes CapProcess CapProcess = false`). |
| 193 | + Fixed to fall back to decidable equality (`capability_eq_dec`), and |
| 194 | + `cap_subsumes_refl` is now proven (axiom-free). `cap_subsumes_trans` is a |
| 195 | + documented follow-up (the relation is transitive; a robust Coq proof needs |
| 196 | + explicit per-kind case analysis, not the brittle 6×6×6 automation). |
| 197 | + |
| 198 | +- **Quality follow-up (flagged, not blocking).** The `preservation` proof is a |
| 199 | + large brute-force `try solve [...]` pile ending in a literal *"Nuclear |
| 200 | + option"* — it compiles and is axiom-honest, but is fragile and unreviewable. |
| 201 | + A clean per-case rewrite (in the style of the Lean `preservation`) is worth |
| 202 | + doing. Also: bring the Coq binops up to parity with the extended Lean set. |
| 203 | + |
154 | 204 | ## Status |
155 | 205 |
|
156 | 206 | - Repair to `sorry`-free under Lean 4.30.0: see CI / `lean` check. |
|
0 commit comments