Skip to content

Commit 6f93e98

Browse files
hyperpolymathclaude
andcommitted
proof(coq): discharge eval_deterministic from step_deterministic_strong (#133)
CNO.v previously declared `eval_deterministic` as an Axiom with an in-file note that it "could be proven by induction on the evaluation relation". This commit does that proof — the determinism is genuine, not assumed. Adds: - Lemma `step_deterministic_strong : forall s i s1 s2, step s i s1 -> step s i s2 -> s1 = s2` (syntactic equality, not =st= — the `step` constructors produce `mkState …` whose components are functions of the start state and instruction; the auxiliary witnesses in `step_load`/`step_store`/ `step_add` are pinned by their hypotheses, e.g. `state_memory s addr = val`, so two derivations yield the same `val`.) - Theorem `eval_deterministic` (replacing the prior Axiom) — induction on the eval derivation, with step_deterministic_strong forcing the intermediate state to coincide so the IH closes the tail. Verification: - `coqc -R common CNO common/CNO.v` → exit 0 (Coq 8.18.0). - `Print Assumptions eval_deterministic.` → "Closed under the global context" (no axioms, no admits). - `Print Assumptions cno_equiv_refl.` → likewise closed (the sole in-tree caller of `eval_deterministic`, unchanged in name and type). - All 11 Coq proof files under proofs/coq/{common,quantum,lambda, physics,malbolge,category,filesystem} recompile clean. - Full `lake build` over proofs/lean4 → 1631/1632 targets green (Lean side untouched by this change; build re-verified for absence of regression). This addresses the residual `eval_deterministic` arm under hyperpolymath/standards#133 (the rescue branch's `PROOF-STATUS-2026-05-18.md` named it explicitly as a "post-T0 axiom audit" target). The ~120 other Coq `Axiom`/`Parameter` declarations remain — they are separate audit work (legitimate model assumption vs. avoidable proof shortcut). Refs hyperpolymath/standards#124 Refs hyperpolymath/standards#133 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 95e0b7a commit 6f93e98

1 file changed

Lines changed: 51 additions & 9 deletions

File tree

proofs/coq/common/CNO.v

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -444,15 +444,57 @@ Qed.
444444

445445
(** ** CNO Equivalence *)
446446

447-
(** Evaluation is deterministic *)
448-
Axiom eval_deterministic :
449-
forall p s s1 s2,
450-
eval p s s1 -> eval p s s2 -> s1 =st= s2.
451-
452-
(** Note: This could be proven by induction on the evaluation relation,
453-
but would require showing that the step relation is deterministic.
454-
For now, we axiomatize it as a reasonable assumption for our
455-
simple instruction set. *)
447+
(** Single-step evaluation is fully deterministic: same start state and
448+
instruction force a syntactically identical result state. The result
449+
of `step` is always `mkState …` whose components are functions of the
450+
instruction and the start state (`state_memory`, `get_reg`,
451+
`set_reg`, `mem_update`); the auxiliary witnesses in [step_load] /
452+
[step_store] / [step_add] are pinned by their hypotheses. *)
453+
Lemma step_deterministic_strong : forall s i s1 s2,
454+
step s i s1 -> step s i s2 -> s1 = s2.
455+
Proof.
456+
intros s i s1 s2 H1 H2.
457+
destruct i; inversion H1; subst; inversion H2; subst; try reflexivity.
458+
- (* Store: two get_reg results agree by functional dependence. *)
459+
match goal with
460+
| [ Ha : get_reg _ _ = Some ?v1,
461+
Hb : get_reg _ _ = Some ?v2 |- _ ] =>
462+
rewrite Ha in Hb; injection Hb as ->
463+
end.
464+
reflexivity.
465+
- (* Add: two pairs of get_reg results. *)
466+
repeat match goal with
467+
| [ Ha : get_reg ?regs ?r = Some ?v1,
468+
Hb : get_reg ?regs ?r = Some ?v2 |- _ ] =>
469+
rewrite Ha in Hb; injection Hb as ->; clear Ha
470+
end.
471+
reflexivity.
472+
Qed.
473+
474+
(** Evaluation is deterministic. Discharged 2026-05-20 from
475+
[step_deterministic_strong] by induction on the eval derivation —
476+
[Print Assumptions] reports "Closed under the global context".
477+
Was previously an [Axiom] (see PROOF-STATUS-2026-05-18.md
478+
"post-T0 axiom audit"). *)
479+
Theorem eval_deterministic : forall p s s1 s2,
480+
eval p s s1 -> eval p s s2 -> s1 =st= s2.
481+
Proof.
482+
intros p s s1 s2 H1.
483+
generalize dependent s2.
484+
induction H1 as [ s0 | i is sA sB sC Hstep Hev IH ]; intros s2 H2.
485+
- (* eval_empty: inversion forces s2 = s0. *)
486+
inversion H2; subst. apply state_eq_refl.
487+
- (* eval_step: inversion gives step sA i sB' and eval is sB' s2.
488+
step_deterministic_strong then forces sB = sB' (syntactic), so the
489+
induction hypothesis closes the tail. *)
490+
inversion H2; subst.
491+
match goal with
492+
| [ Hs : step sA i ?sBp, He : eval is ?sBp s2 |- _ ] =>
493+
pose proof (step_deterministic_strong _ _ _ _ Hstep Hs) as Heq;
494+
subst sBp;
495+
apply IH; exact He
496+
end.
497+
Qed.
456498

457499
(** Two programs are CNO-equivalent if they produce the same state transformations *)
458500
Definition cno_equiv (p1 p2 : Program) : Prop :=

0 commit comments

Comments
 (0)