Skip to content

Commit fd66256

Browse files
hyperpolymathclaude
andcommitted
proofs: repair Coq keystone CNO.v, add self-contained Complex, status ledger
The "100% complete / 0 Admitted" claim was inaccurate: proofs/coq/common/ CNO.v did not compile at all. This repairs the Tier-0 keystone. CNO.v (now compiles clean under Coq 8.20): - eval_app (both dirs): brittle inversion-autoname -> shape/derivation - state_eq_refl: removed dead `unfold mem_eq` ("No such goal") - cno_composition/empty_is_cno/nop_is_cno: robust nested split, fresh names - SOUNDNESS FIX: state_eq drops the program-counter conjunct (every instruction advances PC, so the old def made every non-empty CNO false; nop_is_cno was unprovable). state_eq = memory + registers + I/O. - cno_equiv_sym: inline component flip (no Symmetric instance) - cno_eval_on_equal_states: real logic bug (wrong existential witness) - state_eq/_trans/_sym: 4 -> 3 conjunct refactor Complex.v (new): self-contained complex numbers (C = R*R). Replaces the non-existent Coq.Complex.Complex; Coquelicot rejected (mathcomp2 + HB + coq-elpi weight for shallow usage). Quantum files rewired to CNO.Complex; build convention standardized to CNO.CNO / CNO.Complex. PROOF-STATUS-2026-05-18.md: honest per-file proof-debt ledger correcting the prior inaccurate completion docs. Verified: Agda proofs/agda/CNO.agda clean; common/CNO.v and common/Complex.v compile clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 35933a6 commit fd66256

5 files changed

Lines changed: 274 additions & 81 deletions

File tree

PROOF-STATUS-2026-05-18.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Proof Status — 2026-05-18 (Review & Repair)
2+
3+
**Author of this analysis:** Claude (review session, 2026-05-18)
4+
**Scope:** Independent verification + repair of the absolute-zero proof corpus.
5+
6+
> ⚠️ **Correction of prior documentation.** `PROOF-COMPLETION-2026-02-06.md`
7+
> claims *"100% COMPLETE (0 Admitted)"*. That is **inaccurate**. The keystone
8+
> Coq file `proofs/coq/common/CNO.v` **did not compile at all** (multiple
9+
> broken proofs, a soundness defect, and a real logic bug); "0 Admitted" was
10+
> achieved partly by **axiomatization** and the remaining proofs were
11+
> bit-rotted/false. This document records the *true* state.
12+
13+
## Toolchain (reproducible)
14+
15+
- Coq **8.20.1** via `nix … github:NixOS/nixpkgs/nixos-24.11#coq`
16+
- Agda **2.7.0.1** + `standard-library` **2.1.1** via the same nixpkgs pin
17+
(also builds clean under Agda 2.6.3 / 2.8.0 — interfaces in `_build/`)
18+
- Lean toolchain `leanprover/lean4:v4.16.0` + mathlib (via `elan`/`lake`)
19+
20+
## ✅ Verified (machine-checked)
21+
22+
| Artifact | Status |
23+
|---|---|
24+
| `proofs/agda/CNO.agda` | **type-checks clean** — 0 postulates, 0 holes, 0 unsolved metas. This is the file `echo-types` depends on (`depend: absolute-zero`). |
25+
| `proofs/coq/common/CNO.v` | **compiles clean** (one cosmetic `non-recursive fixpoint` warning on `verification_complexity` base case). |
26+
27+
## Soundness fix (semantic change — deliberate)
28+
29+
`state_eq` previously required `state_pc s1 = state_pc s2`. But `step`
30+
advances the program counter for **every** instruction (`step_nop`
31+
`S (state_pc s)`). Therefore *no non-empty program could ever satisfy
32+
`is_CNO`* and `nop_is_cno` was **false as stated** — its old "proof" never
33+
discharged `s.pc = S s.pc`, which is the real reason `CNO.v` never compiled.
34+
35+
**Decision (2026-05-18):** `state_eq` now compares **memory + registers +
36+
I/O only**; the program counter is control-flow bookkeeping, not an
37+
observable side effect. This makes the non-trivial CNO claims *genuinely
38+
provable*. All dependents must be re-verified under the new `state_eq`.
39+
40+
## Bugs fixed in `CNO.v`
41+
42+
1. `eval_app` (→): relied on inversion-autogenerated name `H3` (Coq-version
43+
dependent) → rewritten to grab the recursive premise by shape.
44+
2. `eval_app` (←): same class → re-proved by induction on the derivation.
45+
3. `state_eq_refl`: dead `unfold mem_eq. reflexivity.` → "No such goal" →
46+
version-safe finisher.
47+
4. `cno_composition`: fragile `repeat split` over the 4-way conjunction +
48+
name reuse → explicit nested `split`, fresh names.
49+
5. `empty_is_cno`: same idiom → robust; reuses `state_eq_refl`.
50+
6. `nop_is_cno`: **false** under old `state_eq`; now genuinely provable
51+
after the PC-exclusion fix; re-proved robustly.
52+
7. `cno_equiv_sym`: `symmetry` needs a `Symmetric` instance (none) and
53+
`state_eq_sym` is defined later → inline component-wise flip.
54+
8. `cno_eval_on_equal_states`: **real logic bug** — both branches
55+
`exists`-ed the wrong witness (`s'`/`s` instead of the end-state `sx`).
56+
9. `state_eq` / `state_eq_trans` / `state_eq_sym`: refactored 4→3 conjuncts.
57+
58+
## Proof-debt ledger (honest)
59+
60+
| File | State | Blocker |
61+
|---|---|---|
62+
| `proofs/agda/CNO.agda` | ✅ verified ||
63+
| `proofs/coq/common/CNO.v` | ✅ compiles | — (cosmetic warning) |
64+
| `proofs/coq/common/Complex.v` | ✅ compiles | **NEW** self-contained complex numbers (`CNO.Complex`). Decision: Coquelicot rejected — drags mathcomp2 + Hierarchy-Builder + coq-elpi for shallow `C=R*R` usage. |
65+
| `proofs/coq/quantum/QuantumMechanicsExact.v` | ⚠️ dep resolved | now uses `CNO.Complex`; local `Cconj` redef removed; remaining = internal bit-rot (e.g. `QME.v:58`). |
66+
| `proofs/coq/quantum/QuantumCNO.v` | ⚠️ dep resolved | now uses `CNO.Complex`; remaining = internal bit-rot (e.g. `:45` `dim:nat` vs `R`). |
67+
68+
**Build convention (standardized 2026-05-18):** common dir compiled with
69+
`-R <common> CNO`; every dependent uses `Require Import CNO.CNO.` and (for
70+
quantum) `Require Import CNO.Complex.` — fixes the inconsistent
71+
`CNO` vs `CNO.CNO` Require mismatch across files.
72+
| `proofs/coq/lambda/LambdaCNO.v` || missing `Require Import Lia` + bit-rot |
73+
| `proofs/coq/physics/StatMech.v` || `Require`/`-R` convention (`CNO` vs `CNO.CNO`) + likely CNO.v-class bit-rot |
74+
| `proofs/coq/physics/LandauerDerivation.v` || same |
75+
| `proofs/coq/malbolge/MalbolgeCore.v` || same |
76+
| `proofs/coq/category/CNOCategory.v` || same |
77+
| `proofs/coq/filesystem/FilesystemCNO.v` || same |
78+
| `proofs/lean4/CNO.lean` || genuine incomplete proof — `cons` case of the memory-preservation lemma |
79+
| `proofs/lean4/{FilesystemCNO,LambdaCNO,QuantumCNO}.lean` | ✅ build ||
80+
| ~121 Coq `Axiom`/`Parameter` | ⚠️ assumptions | **NOT holes.** Separate post-T0 audit (e.g. `eval_deterministic`, `cno_decidable`, `eval_respects_state_eq_left/right`). |
81+
82+
## Tier-0 status
83+
84+
- **Keystone complete:** `CNO.v` (Coq) + `CNO.agda` (Agda) verified.
85+
- **T0 remaining:** the 7 dependent Coq files + the Lean `CNO.lean` lemma.
86+
- **Post-T0:** the ~121-axiom audit (classify *legitimate model assumption*
87+
vs *hard proof papered over*).
88+
89+
## Position vs. before the review
90+
91+
Before: believed "100% complete" while the keystone **did not compile**
92+
(false confidence). After: keystone genuinely verified + Agda verified +
93+
an accurate ledger. **Better in reality and epistemically**; not the
94+
illusory "100%". The underlying thesis is plausibly intact; the
95+
*formalization* required real repair — keystone delivered, remainder
96+
scoped above.

proofs/coq/common/CNO.v

Lines changed: 86 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,14 @@ Record ProgramState : Type := mkState {
6161

6262
(** State equality *)
6363
Definition state_eq (s1 s2 : ProgramState) : Prop :=
64+
(* NOTE (2026-05-18): state_pc is deliberately EXCLUDED. The program
65+
counter is control-flow bookkeeping, not an observable side effect;
66+
`step` advances it for every instruction, so requiring PC-equality
67+
made `nop_is_cno` (and every non-empty CNO claim) FALSE. Observable
68+
state = memory + registers + I/O. *)
6469
s1.(state_memory) =mem= s2.(state_memory) /\
6570
s1.(state_registers) = s2.(state_registers) /\
66-
s1.(state_io) = s2.(state_io) /\
67-
s1.(state_pc) = s2.(state_pc).
71+
s1.(state_io) = s2.(state_io).
6872

6973
Notation "s1 '=st=' s2" := (state_eq s1 s2) (at level 70).
7074

@@ -268,27 +272,28 @@ Proof.
268272
+ (* p1 = i :: p1' *)
269273
simpl in H.
270274
inversion H; subst.
271-
apply IH in H3.
272-
destruct H3 as [sm [H3a H3b]].
275+
(* Grab the recursive `eval (p1' ++ p2)` premise by shape, not by the
276+
inversion-autogenerated name (which is Coq-version dependent — the
277+
old `H3` broke under Coq 8.20). *)
278+
match goal with
279+
| [ Hrec : eval (p1' ++ p2) _ _ |- _ ] =>
280+
apply IH in Hrec; destruct Hrec as [sm [H3a H3b]]
281+
end.
273282
exists sm.
274283
split; try assumption.
275284
eapply eval_step; eassumption.
276-
- (* <- direction *)
285+
- (* <- direction: induct on the derivation `eval p1 s sm` (robust; no
286+
reliance on inversion-autogenerated hypothesis names, which broke
287+
under Coq 8.20). *)
277288
intros [sm [H1 H2]].
278-
generalize dependent s'.
279-
generalize dependent sm.
280-
generalize dependent s.
281-
induction p1 as [| i p1' IH]; intros s sm s' H1 H2.
282-
+ (* p1 = [] *)
283-
simpl.
284-
inversion H1; subst.
285-
assumption.
286-
+ (* p1 = i :: p1' *)
287-
simpl.
288-
inversion H1; subst.
289-
eapply eval_step.
290-
* eassumption.
291-
* apply IH; eassumption.
289+
revert s' H2.
290+
induction H1 as [ s0 | i is s1 s2 s3 Hstep Hev IH ]; intros s' H2.
291+
+ (* eval_empty: p1 = [], s0 = sm *)
292+
simpl. exact H2.
293+
+ (* eval_step: eval (i :: is) s1 s3 *)
294+
simpl. eapply eval_step.
295+
* exact Hstep.
296+
* apply IH. exact H2.
292297
Qed.
293298

294299
(** State equality is reflexive *)
@@ -297,16 +302,19 @@ Proof.
297302
intros s.
298303
unfold state_eq.
299304
repeat split; try reflexivity.
300-
unfold mem_eq. reflexivity.
305+
(* Coq 8.20: `reflexivity` already discharges the mem_eq goal (function
306+
equality), so the old explicit `unfold mem_eq. reflexivity.` now raises
307+
"No such goal". Make the finisher no-op-safe across Coq versions. *)
308+
all: try (unfold mem_eq; reflexivity).
301309
Qed.
302310

303311
(** State equality is transitive *)
304312
Lemma state_eq_trans :
305313
forall s1 s2 s3, s1 =st= s2 -> s2 =st= s3 -> s1 =st= s3.
306314
Proof.
307-
intros s1 s2 s3 [Hm1 [Hr1 [Hi1 Hp1]]] [Hm2 [Hr2 [Hi2 Hp2]]].
308-
unfold state_eq.
309-
repeat split.
315+
intros s1 s2 s3 [Hm1 [Hr1 Hi1]] [Hm2 [Hr2 Hi2]].
316+
unfold state_eq in *.
317+
split; [ | split ].
310318
- (* Memory *)
311319
unfold mem_eq in *.
312320
intros addr.
@@ -315,8 +323,6 @@ Proof.
315323
transitivity (s2.(state_registers)); auto.
316324
- (* I/O *)
317325
transitivity (s2.(state_io)); auto.
318-
- (* PC *)
319-
transitivity (s2.(state_pc)); auto.
320326
Qed.
321327

322328
(** Purity is transitive *)
@@ -342,30 +348,29 @@ Proof.
342348
unfold is_CNO in *.
343349
destruct H1 as [T1 [I1 [P1 R1]]].
344350
destruct H2 as [T2 [I2 [P2 R2]]].
345-
repeat split.
351+
(* Robust: explicit nested split (not `repeat split`, which mis-structured
352+
the 4-way is_CNO conjunction under Coq 8.20), seq_comp unfolded up front,
353+
and fresh intro names (`s0`) that cannot clash with earlier hypotheses. *)
354+
unfold seq_comp in *.
355+
split; [ | split; [ | split ] ].
346356
- (* Termination *)
347-
intros s.
357+
intros s0.
348358
unfold terminates in *.
349-
destruct (T1 s) as [s1 E1].
359+
destruct (T1 s0) as [s1 E1].
350360
destruct (T2 s1) as [s2 E2].
351361
exists s2.
352-
unfold seq_comp.
353362
apply eval_app.
354363
exists s1.
355364
split; assumption.
356365
- (* Identity *)
357-
intros s s' Heval.
358-
unfold seq_comp in Heval.
366+
intros s0 s' Heval.
359367
apply eval_app in Heval.
360368
destruct Heval as [sm [E1 E2]].
361-
(* p1 maps s to itself, so sm = s *)
362-
(* p2 maps sm to itself, so s' = sm = s *)
363369
apply I1 in E1.
364370
apply I2 in E2.
365371
eapply state_eq_trans; eassumption.
366372
- (* Purity *)
367-
intros s s' Heval.
368-
unfold seq_comp in Heval.
373+
intros s0 s' Heval.
369374
apply eval_app in Heval.
370375
destruct Heval as [sm [E1 E2]].
371376
apply P1 in E1.
@@ -383,23 +388,18 @@ Qed.
383388
Theorem empty_is_cno : is_CNO [].
384389
Proof.
385390
unfold is_CNO.
386-
repeat split.
391+
split; [ | split; [ | split ] ].
387392
- (* Termination *)
388-
intros s.
389-
exists s.
390-
constructor.
391-
- (* Identity *)
392-
intros s s' Heval.
393+
intros s0. exists s0. constructor.
394+
- (* Identity: eval [] s0 s' forces s' = s0, so reuse state_eq_refl *)
395+
intros s0 s' Heval.
393396
inversion Heval; subst.
394-
unfold state_eq.
395-
repeat split; try reflexivity.
396-
unfold mem_eq. reflexivity.
397+
apply state_eq_refl.
397398
- (* Purity *)
398-
intros s s' Heval.
399+
intros s0 s' Heval.
399400
inversion Heval; subst.
400-
unfold pure, no_io, no_memory_alloc.
401-
split; try reflexivity.
402-
unfold mem_eq. reflexivity.
401+
unfold pure, no_io, no_memory_alloc, mem_eq.
402+
split; [ reflexivity | intros addr; reflexivity ].
403403
- (* Thermodynamic reversibility *)
404404
unfold thermodynamically_reversible.
405405
intros s1 s2 Heval.
@@ -412,27 +412,30 @@ Qed.
412412
Theorem nop_is_cno : is_CNO [Nop].
413413
Proof.
414414
unfold is_CNO.
415-
repeat split.
415+
(* Robust: explicit nested split, fresh names, and inversion hypotheses
416+
grabbed by shape (match goal) so Coq-version autonaming can't break it.
417+
With PC excluded from state_eq, [Nop] is genuinely a CNO. *)
418+
split; [ | split; [ | split ] ].
416419
- (* Termination *)
417-
intros s.
418-
exists (mkState s.(state_memory) s.(state_registers) s.(state_io) (S s.(state_pc))).
419-
apply eval_step with (s2 := mkState s.(state_memory) s.(state_registers) s.(state_io) (S s.(state_pc))).
420-
+ constructor.
421-
+ constructor.
422-
- (* Identity - modulo PC increment *)
423-
intros s s' Heval.
420+
intros s0.
421+
eexists.
422+
eapply eval_step.
423+
+ apply step_nop.
424+
+ apply eval_empty.
425+
- (* Identity *)
426+
intros s0 s' Heval.
424427
inversion Heval; subst.
425-
inversion H; subst.
426-
inversion H0; subst.
427-
unfold state_eq.
428-
repeat split; try reflexivity.
429-
unfold mem_eq. reflexivity.
428+
match goal with H : step _ Nop _ |- _ => inversion H; subst end.
429+
match goal with H : eval [] _ _ |- _ => inversion H; subst end.
430+
unfold state_eq, mem_eq.
431+
split; [ intros addr; reflexivity | split; reflexivity ].
430432
- (* Purity *)
431-
intros s s' Heval.
433+
intros s0 s' Heval.
432434
inversion Heval; subst.
433-
inversion H; subst.
434-
unfold pure, no_io, no_memory_alloc.
435-
split; reflexivity.
435+
match goal with H : step _ Nop _ |- _ => inversion H; subst end.
436+
match goal with H : eval [] _ _ |- _ => inversion H; subst end.
437+
unfold pure, no_io, no_memory_alloc, mem_eq.
438+
split; [ reflexivity | intros addr; reflexivity ].
436439
- (* Thermodynamic reversibility *)
437440
unfold thermodynamically_reversible.
438441
intros s1 s2 Heval.
@@ -469,17 +472,26 @@ Theorem cno_equiv_sym : forall p1 p2, cno_equiv p1 p2 -> cno_equiv p2 p1.
469472
Proof.
470473
unfold cno_equiv.
471474
intros p1 p2 H s s1 s2 H1 H2.
472-
symmetry.
473-
apply H; assumption.
475+
(* `symmetry` needs a registered Symmetric instance for =st= (none), and
476+
state_eq_sym is defined later in this file. Derive s2 =st= s1 from H
477+
and flip each observable component by hand. *)
478+
destruct (H s s2 s1 H2 H1) as [Hm [Hr Hi]].
479+
unfold state_eq, mem_eq in *.
480+
split; [ | split ].
481+
- intros addr; symmetry; apply Hm.
482+
- symmetry; exact Hr.
483+
- symmetry; exact Hi.
474484
Qed.
475485

476486
(** State equality is symmetric *)
477487
Lemma state_eq_sym : forall s1 s2, s1 =st= s2 -> s2 =st= s1.
478488
Proof.
479-
intros s1 s2 [Hm [Hr [Hi Hp]]].
489+
intros s1 s2 [Hm [Hr Hi]].
480490
unfold state_eq, mem_eq in *.
481-
repeat split; auto.
482-
intros addr. symmetry. apply Hm.
491+
split; [ | split ].
492+
- intros addr. symmetry. apply Hm.
493+
- symmetry. exact Hr.
494+
- symmetry. exact Hi.
483495
Qed.
484496

485497
Theorem cno_equiv_trans :
@@ -613,13 +625,13 @@ Lemma cno_eval_on_equal_states :
613625
Proof.
614626
intros p s s' H_cno H_eq.
615627
split; intros [sx H_eval].
616-
- (* Forward direction *)
617-
exists s'.
628+
- (* Forward: eval p s sx and s =st= s' ==> eval p s' sx *)
629+
exists sx.
618630
eapply eval_respects_state_eq_left.
619631
+ eassumption.
620632
+ assumption.
621-
- (* Backward direction *)
622-
exists s.
633+
- (* Backward: eval p s' sx and s =st= s' ==> eval p s sx *)
634+
exists sx.
623635
eapply eval_respects_state_eq_left.
624636
+ eassumption.
625637
+ apply state_eq_sym. assumption.

0 commit comments

Comments
 (0)