Skip to content

Commit 877ede2

Browse files
hyperpolymathclaudecoderabbitai[bot]
authored
proofs: honest prover gate — absent prover = fail, z3 expect-checked, Print Assumptions gated, Agda 4/4 --safe (4b–4d) (#172)
## Why Phase 4b–4d of the residual-evidence-types ultraplan (absolute-zero is upstream of echo-types, hence of residual). Four defects let the prover gate say green without checking: | defect | before | after | |---|---|---| | absent Isabelle / Mizar | `echo "… (skipped)"`, then `ALL-PROVERS-GREEN` on 4 of 6 provers | `fail=1`; a listed Agda module missing on disk also fails | | z3 | `z3 cno_properties.smt2` (file does not exist) under `\|\| true`; the live check was z3's exit code, 0 for sat **and** unsat | generic expect-checker: every `(check-sat)` must carry `; expect sat\|unsat` and the verdicts must match in order; fails on `unknown`, `(error`, missing annotation, no files, rc≠0 | | assumptions | no `Print Assumptions` ran anywhere; "closed under the global context" was prose | `proofs/coq/check-assumptions.sh` over the 17 theorems PROOF-STATUS names, in the Coq CI job, with a `--control` that must reject `landauer_limit_positive` (rests on `kB_positive`) | | Agda | CI checked 2 of 4 modules; `EchoBridgeCNO.agda` had no `--safe` pragma | pragma added; CI, Justfile and the gate check all four | Also: `Justfile` `verify-z3` no longer skips-as-passes; `verify-coq` runs the gate; `verify-all` runs the self-test. PROOF-STATUS: the Agda section now matches CI, the assumptions claim is the measured fact (17/17 closed, gated), the census pointer is #171. ## Evidence (measured locally 2026-09-23, before push — the owner may merge before CI reports) **Gate self-test** `proofs/tests/gate-selftest.sh` — 16/16, each negative asserting its reason string (stub PATH, `HOME` overridden because the gate prepends `~/.elan/bin`): ``` PASS: A all provers present -> ALL-PROVERS-GREEN PASS: B isabelle absent -> fail PASS: C mizar verifier absent -> fail PASS: D MIZFILES unset -> fail PASS: E z3 verdict mismatch -> fail PASS: F z3 (error line -> fail PASS: G z3 unknown verdict -> fail PASS: H idris2 exit 3 -> fail PASS: I positive control repeats green PASS: J real z3, committed OND_checks.smt2 -> OK PASS: K real z3, expect-flipped mutant -> fail PASS: L real z3, (check-sat) without expect -> fail PASS: M no .smt2 files -> fail PASS: N real z3, contradictory assertions vs expect sat -> fail GATE-SELFTEST OK: 16/16 cases ``` **Meta-mutants (does the suite itself bite?)** — reverting the Isabelle line to `(skipped)` flunks exactly case B; replacing the checker's comparison with `got="$expected"` flunks exactly E, G, K, N. Both restored, suite green again. **Assumptions gate** — `ASSUMPTIONS-CHECK OK: 17/17 theorems closed under the global context`; `--control`: `landauer_limit_positive rejected, naming kB_positive`; an empty audit file fails as vacuous; a renamed theorem fails on coqc exit 1. Full census for #171: 182 top-level theorems, 109 closed, 73 axiom-dependent. **Agda** — `agda 2.6.4.3 --safe --without-K` passes `CNO`, `OND`, `EchoBridgeScaffold`, `EchoBridgeCNO`. ⚠ CI runs Agda **2.6.3 / stdlib v1.7.3**; the two newly-checked modules have not been run at that version locally (`Axiom.Extensionality.Propositional` exists in v1.7.3). A red there is a **finding** (issue with acceptance criteria), not a revert of the gate. **Workflow** — `Bun.YAML.parse` ok (4 jobs); `actionlint` clean; `gh actions-lock --verify-local`: all 16 workflows have complete lockfile coverage (no `uses:` line changed). `just verify-z3`, `verify-coq`, `verify-gate-selftest`, `build-agda` all rc=0. ## Deliberately left out of this PR - The per-prover convenience targets `build-coq` / `build-mizar` still print "skipping" when the tool is absent; the canonical `just verify`, `verify-z3` and `verify-coq` do not. (Same defect class; separate small change if wanted.) - The gate's "listed Agda module missing on disk → fail" branch is not covered by the self-test (it would need a mutated source tree). - The plan's "fix the README.adoc filename (`EchoCNOBridge` does not exist)" item was **wrong**: `proofs/agda/README.adoc:39` cites echo-types' `proofs/agda/EchoCNOBridge.agda`, which exists on echo-types main. Not changed. - The axiom tag grammar (four forms across 38 declarations) and the full-tree census gate → #171. ## Merge policy Auto-merge (squash) goes on only when **every** check is green (owner ruling 2026-09-22). Any pre-existing red gets a triage issue, not a merge-over. Refs #171; #170 (Scorecard highs) is unrelated but its `code_scanning` rule may now evaluate on this PR for the first time — if it blocks, that belongs on #170. **Second commit (`b0a08cc`)** — CodeRabbit's Major on the first commit was right: the canonical gate `proofs/verify-all-provers.sh` built Coq but never ran `check-assumptions.sh`, so `just verify` could print ALL-PROVERS-GREEN on an axiom-bearing theorem (the same defect class this PR cures elsewhere). The gate now runs the audit and its `--control` after a successful build, each with its own reason line; the self-test's `coqc` stub answers `Print Assumptions` faithfully (Closed for the 17 audited theorems, `Axioms: kB_positive` for the control's target) and cases O/P prove the gate turns red for each audit mutant. Self-test 16/16; against the previous gate exactly O and P fail. Real prover locally (Coq 8.20.1): ASSUMPTIONS-CHECK OK 17/17, ASSUMPTIONS-CONTROL OK. The two docstring commits between are CodeRabbit's. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QYY8Gp4v4x2J7iSNn1vZ57 https://claude.ai/code/session_01QYY8Gp4v4x2J7iSNn1vZ57 --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent dd87b48 commit 877ede2

9 files changed

Lines changed: 348 additions & 67 deletions

File tree

‎.github/workflows/proofs.yml‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ jobs:
5656
coq_makefile -f _CoqProject -o Makefile.all
5757
make -f Makefile.all -j"$(nproc)"
5858
echo "✓ Coq: 14/14 theories compiled (CNO + OND)"
59+
- name: Print Assumptions gate (17 named theorems closed) + control
60+
working-directory: proofs/coq
61+
run: |
62+
bash check-assumptions.sh
63+
bash check-assumptions.sh --control
5964
6065
agda:
6166
name: Agda — CNO + OND
@@ -79,13 +84,15 @@ jobs:
7984
mkdir -p "$HOME/.agda"
8085
echo "$HOME/agda-stdlib/standard-library.agda-lib" > "$HOME/.agda/libraries"
8186
echo "standard-library" > "$HOME/.agda/defaults"
82-
- name: Type-check CNO + OND (--safe --without-K)
87+
- name: Type-check CNO + OND + EchoBridge (4 modules, --safe --without-K)
8388
working-directory: proofs/agda
8489
run: |
8590
agda --version
8691
agda --safe --without-K CNO.agda
8792
agda --safe --without-K OND.agda
88-
echo "✓ Agda: CNO + OND type-check"
93+
agda --safe --without-K EchoBridgeScaffold.agda
94+
agda --safe --without-K EchoBridgeCNO.agda
95+
echo "✓ Agda: CNO + OND + EchoBridgeScaffold + EchoBridgeCNO type-check"
8996
9097
z3:
9198
name: Z3 — CNO + OND bounded checks
@@ -97,9 +104,10 @@ jobs:
97104
- name: Run Z3 checks
98105
run: |
99106
z3 --version
100-
sh proofs/z3/verify.sh || true
101-
z3 proofs/z3/ond/OND_checks.smt2
102-
echo "✓ Z3: OND bounded instances checked"
107+
bash proofs/z3/verify.sh
108+
echo "✓ Z3: every (check-sat) verdict matched its ; expect annotation"
109+
- name: Gate self-test (stub provers + z3 mutants must turn the gate red)
110+
run: bash proofs/tests/gate-selftest.sh
103111

104112
lean:
105113
name: Lean — core CNO (6 modules + axiom audit)

‎Justfile‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ build-lean:
3939
@echo "Building Lean 4 proofs..."
4040
cd proofs/lean4 && lake build
4141

42-
# Build Agda proofs (CNO + OND, --safe --without-K)
42+
# Build Agda proofs (CNO + OND + EchoBridge, 4 modules, --safe --without-K)
4343
build-agda:
4444
@echo "Building Agda proofs..."
45-
cd proofs/agda && agda --safe --without-K CNO.agda && agda --safe --without-K OND.agda
45+
cd proofs/agda && agda --safe --without-K CNO.agda && agda --safe --without-K OND.agda && agda --safe --without-K EchoBridgeScaffold.agda && agda --safe --without-K EchoBridgeCNO.agda
4646

4747
# Build Isabelle/HOL proofs (CNO + OND session)
4848
build-isabelle:
@@ -78,21 +78,21 @@ verify:
7878
@proofs/verify-all-provers.sh
7979

8080
# Verify all proofs (per-prover targets; `just verify` is the canonical one-shot)
81-
verify-all: verify-coq verify-z3 verify-lean verify-agda verify-isabelle verify-mizar verify-idris
81+
verify-all: verify-coq verify-z3 verify-lean verify-agda verify-isabelle verify-mizar verify-idris verify-gate-selftest
8282
@echo "✓ All verifications complete"
8383

84-
# Verify Coq proofs
84+
# Verify Coq proofs: build, then the Print Assumptions gate and its control
8585
verify-coq: build-coq
86-
@echo "✓ Coq proofs verified"
86+
bash proofs/coq/check-assumptions.sh
87+
bash proofs/coq/check-assumptions.sh --control
88+
@echo "✓ Coq proofs verified (17 named theorems closed under the global context)"
8789

88-
# Verify Z3 SMT properties (CNO checks + OND bounded instances)
90+
# Verify Z3 SMT properties: every (check-sat) verdict must match its `; expect` annotation (no skip-as-pass)
8991
verify-z3:
9092
@echo "Verifying Z3 SMT properties..."
91-
@if command -v z3 >/dev/null 2>&1; then \
92-
sh proofs/z3/verify.sh && z3 proofs/z3/ond/OND_checks.smt2 && echo "✓ Z3 verification complete"; \
93-
else \
94-
echo "⚠ z3 not found, skipping Z3 verification"; \
95-
fi
93+
@command -v z3 >/dev/null 2>&1 || { echo "✗ z3 not found (required, not skipped)"; exit 1; }
94+
bash proofs/z3/verify.sh
95+
@echo "✓ Z3 verification complete"
9696

9797
# Verify Lean 4 proofs
9898
verify-lean:
@@ -116,6 +116,10 @@ verify-isabelle: build-isabelle
116116
verify-mizar: build-mizar
117117
@echo "✓ Mizar proofs verified"
118118

119+
# Self-test the prover gate: stubbed toolchains + z3 mutants must turn it red
120+
verify-gate-selftest:
121+
bash proofs/tests/gate-selftest.sh
122+
119123
# Verify the Idris 2 ABI package
120124
verify-idris: build-idris
121125
@echo "✓ Idris ABI verified"

‎PROOF-STATUS.adoc‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ All six provers are installed and were *reproduced in this environment*. A singl
1717
gate, `proofs/verify-all-provers.sh`, builds every prover and prints
1818
`ALL-PROVERS-GREEN`: *Coq, Agda, Lean 4 (+Mathlib), Z3, Isabelle/HOL, Mizar*,
1919
plus the *Idris 2* ABI. Both the CNO and OND pillars are covered.
20+
An absent prover is a *failure*, never a skip (since 2026-09-23 — before that Isabelle
21+
and Mizar printed "skipped" and the gate could say GREEN on four of six), and Z3
22+
verdicts are compared with the `; expect sat|unsat` annotation on every `(check-sat)`
23+
(`proofs/z3/verify.sh`). Since 2026-09-23 the gate also runs the Coq `Print Assumptions` audit and
24+
its `--control` after the build, so a theorem resting on an axiom, or an audit that can no
25+
longer say no, turns it red. `proofs/tests/gate-selftest.sh` proves both gates turn red for
26+
each absent or failing prover, for each verdict mutant and for both audit mutants (16 cases, run in CI).
2027
====
2128

2229
== Coq — VERIFIED (this environment)
@@ -82,9 +89,15 @@ of these, each documented in-file with its blocker:
8289
`nat -> C` single-qubit model; faithful discharge is a separate formalisation.
8390

8491
These are the analogue of the OND-6 research fork: openly labelled, not silently
85-
assumed. `Print Assumptions` on every headline theorem shows only Coq stdlib axioms
86-
(`ClassicalDedekindReals.*`, `functional_extensionality*`) plus, where relevant, the
87-
explicitly-tagged postulate above — never a hidden project axiom.
92+
assumed. `Print Assumptions` on each of the 17 theorems this document names in backticks
93+
prints `Closed under the global context` — no stdlib axiom and no project axiom (measured
94+
2026-09-23, Coq 8.18). That is CI-gated: `proofs/coq/audit/Assumptions.v` lists the 17 and
95+
`proofs/coq/check-assumptions.sh` (Coq job of `proofs.yml`, and the canonical
96+
`proofs/verify-all-provers.sh` gate since 2026-09-23) fails on any `Axioms:` block or a
97+
missing line; its `--control` mode proves the gate bites by requiring that
98+
`landauer_limit_positive`, which rests on `kB_positive`, is rejected. The wider tree is not
99+
closed — 109 of 182 top-level theorems are; the other 73 rest on stdlib classical axioms
100+
and/or the tagged parameters — see #171 for the census and the tag-grammar work.
88101

89102
=== Reversibility <-> CNO bridge (2026-07-16, the theorem MAA cites)
90103

@@ -151,8 +164,11 @@ capstone) remains open by design — see `docs/OND-ROADMAP.adoc`.
151164

152165
== Agda — VERIFIED (this environment)
153166

154-
* `agda` 2.6.3, `--safe --without-K`: `CNO.agda`, `OND.agda`, `EchoBridgeCNO.agda`
155-
type-check. The EchoBridge modules take **funext as an explicit hypothesis**
167+
* `agda` 2.6.3 (CI) / 2.6.4.3 (local), `--safe --without-K`: `CNO.agda`, `OND.agda`,
168+
`EchoBridgeScaffold.agda`, `EchoBridgeCNO.agda` type-check; every file carries the
169+
`{-# OPTIONS --safe --without-K #-}` pragma and CI (`proofs.yml`) checks all four. Until
170+
2026-09-23 CI checked only the first two and `EchoBridgeCNO.agda` had no pragma of its
171+
own. The EchoBridge modules take **funext as an explicit hypothesis**
156172
(not a global `postulate`); `OND.agda` uses zero postulates.
157173

158174
== Lean 4 — VERIFIED (this environment)
@@ -225,3 +241,7 @@ capstone) remains open by design — see `docs/OND-ROADMAP.adoc`.
225241
* Remaining axioms are exactly: (a) tagged physical postulates (the honest metal
226242
boundary), and (b) the class-A items listed above (true, provable in principle,
227243
openly labelled). No headline theorem depends on a hidden project axiom.
244+
* Measured 2026-09-23: the 17 named theorems are closed under the global context
245+
(CI-gated); of all 182 top-level theorems, 109 are closed and 73 rest on stdlib
246+
classical axioms and/or the tagged parameters. The "exactly" in the bullet above is
247+
not yet machine-checked — the tag grammar is unified under #171.

‎proofs/agda/EchoBridgeCNO.agda‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{-# OPTIONS --safe --without-K #-}
2+
13
-- Concrete Echo/CNO instantiation against CNO.Program and CNO.eval.
24
--
35
-- Primary bridge: use CNO.state-eq directly as the relation in EchoRel.

‎proofs/coq/audit/Assumptions.v‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
(* SPDX-License-Identifier: MPL-2.0 *)
2+
(* Print Assumptions audit over the theorems PROOF-STATUS.adoc names.
3+
4+
NOT listed in _CoqProject: proofs/coq/check-assumptions.sh compiles this file
5+
after the theories are built and FAILS unless every line below prints
6+
"Closed under the global context" (no stdlib axiom, no project axiom).
7+
Add a line here whenever PROOF-STATUS starts naming a theorem; the checker
8+
counts the "Print Assumptions" lines, so a theorem cannot be dropped silently.
9+
Measured 2026-09-23: 17/17 closed (Coq 8.18). *)
10+
Require CNO.CNO.
11+
Require CNO.FilesystemCNO.
12+
Require CNO.LambdaCNO.
13+
Require CNO.OND.
14+
Print Assumptions CNO.CNO.cno_equiv_seq_empty_of_reverses.
15+
Print Assumptions CNO.FilesystemCNO.create_unlink_inverse.
16+
Print Assumptions CNO.LambdaCNO.eta_equivalence.
17+
Print Assumptions CNO.CNO.eval_app.
18+
Print Assumptions CNO.CNO.eval_deterministic.
19+
Print Assumptions CNO.FilesystemCNO.mkdir_idempotent.
20+
Print Assumptions CNO.FilesystemCNO.mkdir_not_identity.
21+
Print Assumptions CNO.FilesystemCNO.mkdir_rmdir_inverse.
22+
Print Assumptions CNO.FilesystemCNO.rename_inverse.
23+
Print Assumptions CNO.CNO.reverses_seq_computes_identity.
24+
Print Assumptions CNO.CNO.reversible_bridge_backward_upto.
25+
Print Assumptions CNO.CNO.reversible_bridge_forward.
26+
Print Assumptions CNO.CNO.reversible_iff_exists_reverses.
27+
Print Assumptions CNO.OND.skip_program_is_core_CNO.
28+
Print Assumptions CNO.FilesystemCNO.snapshot_restore_identity.
29+
Print Assumptions CNO.FilesystemCNO.transaction_cno.
30+
Print Assumptions CNO.OND.writer_program_not_core_CNO.

‎proofs/coq/check-assumptions.sh‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: MPL-2.0
3+
# Absolute Zero — Print Assumptions gate for the Coq pillar.
4+
#
5+
# Compiles audit/Assumptions.v (or the file given as $1) against the built
6+
# theories, using the -R roots from _CoqProject, and FAILS unless every
7+
# `Print Assumptions` line answers "Closed under the global context":
8+
# - any "Axioms:" block -> FAIL (the block is printed);
9+
# - closed-count != line-count -> FAIL (a theorem silently missing);
10+
# - coqc exit != 0 -> FAIL (a renamed/removed theorem);
11+
# - a file with no Print Assumptions lines -> FAIL (vacuous gate).
12+
# `--control` proves the gate bites: it audits CNO.StatMech.landauer_limit_positive,
13+
# which rests on the tagged axiom PhysicsConstants.kB_positive, and requires
14+
# the gate to REJECT it naming that axiom.
15+
# Run after `coq_makefile -f _CoqProject -o Makefile.all && make -f Makefile.all`.
16+
set -uo pipefail
17+
HERE="$(cd "$(dirname "$0")" && pwd)"
18+
19+
command -v coqc >/dev/null || { echo "ASSUMPTIONS-CHECK FAILED: coqc not on PATH"; exit 1; }
20+
RFLAGS=()
21+
while read -r flag dir ns; do
22+
[ "$flag" = "-R" ] && RFLAGS+=("-R" "$HERE/$dir" "$ns")
23+
done < "$HERE/_CoqProject"
24+
[ "${#RFLAGS[@]}" -gt 0 ] || { echo "ASSUMPTIONS-CHECK FAILED: no -R roots in _CoqProject"; exit 1; }
25+
26+
# check_file <file.v>: compile an audit with at least one Print Assumptions command.
27+
# Print the Coq output and remove generated artefacts beside the audit file.
28+
# Succeed only if compilation succeeds, no axiom blocks appear, and the number
29+
# of closed results matches the number of Print Assumptions commands.
30+
check_file() {
31+
local file=$1 base dir out rc expected closed axioms
32+
base="$(basename "${file%.v}")"; dir="$(dirname "$file")"
33+
expected=$(grep -c '^Print Assumptions' "$file")
34+
if [ "$expected" -eq 0 ]; then
35+
echo "ASSUMPTIONS-CHECK FAILED: $file has no 'Print Assumptions' lines (vacuous)"; return 1
36+
fi
37+
out="$(coqc "${RFLAGS[@]}" "$file" 2>&1)"; rc=$?
38+
rm -f "$dir/$base.vo" "$dir/$base.vos" "$dir/$base.vok" "$dir/$base.glob" "$dir/.$base.aux"
39+
printf '%s\n' "$out"
40+
if [ "$rc" -ne 0 ]; then echo "ASSUMPTIONS-CHECK FAILED: coqc exit $rc on $file"; return 1; fi
41+
closed=$(printf '%s\n' "$out" | grep -c '^Closed under the global context')
42+
axioms=$(printf '%s\n' "$out" | grep -c '^Axioms:')
43+
if [ "$axioms" -ne 0 ] || [ "$closed" -ne "$expected" ]; then
44+
echo "ASSUMPTIONS-CHECK FAILED: $file — expected $expected closed, got closed=$closed axiom-blocks=$axioms"
45+
return 1
46+
fi
47+
echo "ASSUMPTIONS-CHECK OK: $expected/$expected theorems closed under the global context ($file)"
48+
}
49+
50+
if [ "${1:-}" = "--control" ]; then
51+
tmp="$(mktemp -d "${TMPDIR:-/tmp}/az-assumptions-control.XXXXXX")"
52+
trap 'rm -rf "$tmp"' EXIT
53+
printf 'Require CNO.StatMech.\nPrint Assumptions CNO.StatMech.landauer_limit_positive.\n' > "$tmp/Control.v"
54+
if check_file "$tmp/Control.v" > "$tmp/control.log" 2>&1; then
55+
echo "ASSUMPTIONS-CONTROL FAILED: landauer_limit_positive (rests on kB_positive) PASSED the gate"
56+
cat "$tmp/control.log"; exit 1
57+
fi
58+
if ! grep -q 'kB_positive' "$tmp/control.log"; then
59+
echo "ASSUMPTIONS-CONTROL FAILED: the rejection did not name PhysicsConstants.kB_positive"
60+
cat "$tmp/control.log"; exit 1
61+
fi
62+
echo "ASSUMPTIONS-CONTROL OK: landauer_limit_positive rejected, naming kB_positive (the gate bites)"
63+
exit 0
64+
fi
65+
66+
check_file "${1:-$HERE/audit/Assumptions.v}"

0 commit comments

Comments
 (0)