From 61b3dde868fc6755c0e80315baaca348a62f2c29 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Sat, 7 Nov 2026 20:09:23 +0000 Subject: [PATCH 1/7] Adopt canonical gate repairs and declare the actual Atoma audit scope Resolve the observed allowlist, canon identity, over-broad Zig FFI scan and template map-control failures. The FFI fix is merged upstream and its pins remain ancestors of main. Record the stronger native RSR applicability findings without claiming qualification. Preserve all required soundness and security checks. Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> --- .github/workflows/actions.lock | 39 +++++++++++++++++---- .github/workflows/governance.yml | 2 +- .github/workflows/main-estate-audit.yml | 5 ++- atoma_chora.deed | 22 ++++-------- docs/audit/2026-11-07-soundness-sprint.adoc | 30 ++++++++++++++++ tests/e2e/use_template_mint_test.sh | 13 +++++-- 6 files changed, 85 insertions(+), 26 deletions(-) diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index 2aff101a..32ff7dec 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -31,7 +31,7 @@ workflows: '.github/workflows/estate-rules.yml': - 'actions/checkout@v7.0.1' '.github/workflows/governance.yml': - - 'metadatastician/standards@b3ce78e1a8cb24b33fde5c9da6a7c09486efda78' + - 'metadatastician/standards@fe57d352f0b1a50e5cb07b4aac2581caf355388e' '.github/workflows/groove-check.yml': - 'actions/checkout@v7.0.1' '.github/workflows/guix-policy.yml': @@ -43,7 +43,7 @@ workflows: '.github/workflows/labels.yml': [] '.github/workflows/lock-sync-gate.yml': [] '.github/workflows/main-estate-audit.yml': - - 'hyperpolymath/cicd-suite@55556cf5ba71ba744695861503c13148d3915a5d' + - 'hyperpolymath/cicd-suite@2dbe6e9c2da71fbce336079f8e016c2de0b90111' '.github/workflows/mirror.yml': - 'metadatastician/standards@b3ce78e1a8cb24b33fde5c9da6a7c09486efda78' '.github/workflows/ossf-best-practices.yml': @@ -210,19 +210,25 @@ dependencies: commit: 'sha1-0f8e8c99d88aeb3fbfd523f1ef2c6f762d10d64d' owner_id: 75048950 repo_id: 623796603 - 'hyperpolymath/cicd-suite@0da816c05ae7486671d863e07935f93981c0c2d5': + 'hyperpolymath/cicd-suite@c519c4520afbfe48f16aceb0706d7cfb1d649994': ref: 'main' - commit: 'sha1-0da816c05ae7486671d863e07935f93981c0c2d5' + commit: 'sha1-c519c4520afbfe48f16aceb0706d7cfb1d649994' owner_id: 6759885 repo_id: 1326697643 - 'hyperpolymath/cicd-suite@55556cf5ba71ba744695861503c13148d3915a5d': + 'hyperpolymath/cicd-suite@2dbe6e9c2da71fbce336079f8e016c2de0b90111': ref: 'main' - commit: 'sha1-55556cf5ba71ba744695861503c13148d3915a5d' + commit: 'sha1-2dbe6e9c2da71fbce336079f8e016c2de0b90111' owner_id: 6759885 repo_id: 1326697643 uses: + - 'hyperpolymath/cicd-suite@3c2d4028d7203097f3c54106556e20947f9e04ef' - 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1' - - 'hyperpolymath/cicd-suite@0da816c05ae7486671d863e07935f93981c0c2d5' + - 'hyperpolymath/cicd-suite@c519c4520afbfe48f16aceb0706d7cfb1d649994' + 'hyperpolymath/cicd-suite@3c2d4028d7203097f3c54106556e20947f9e04ef': + ref: 'main' + commit: 'sha1-3c2d4028d7203097f3c54106556e20947f9e04ef' + owner_id: 6759885 + repo_id: 1326697643 'hyperpolymath/smtp-notify-action@v0.5.0': ref: 'v0.5.0' commit: 'sha1-c1c9fa07992a02c1fd3d67a0dc1b08cccb852aef' @@ -247,6 +253,25 @@ dependencies: - 'oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6' - 'swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6' - 'webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555' + 'metadatastician/standards@fe57d352f0b1a50e5cb07b4aac2581caf355388e': + ref: 'main' + commit: 'sha1-fe57d352f0b1a50e5cb07b4aac2581caf355388e' + owner_id: 297579217 + repo_id: 1116521501 + uses: + - 'actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9' + - 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1' + - 'actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9' + - 'denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed' + - 'dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8' + - 'editorconfig-checker/action-editorconfig-checker@51f63319f592f97930c73d9c46184d20bd206393' + - 'erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124' + - 'github/codeql-action@b96794f015dfd88f77b49b1c93e0fa7110f94c63' + - 'goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406' + - 'ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e' + - 'oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6' + - 'swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6' + - 'webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555' 'ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e': ref: 'v2.5.0' commit: 'sha1-fa7117db83c52d787ae5a89f350999701505d78e' diff --git a/.github/workflows/governance.yml b/.github/workflows/governance.yml index 67f4c4bd..7b07b680 100644 --- a/.github/workflows/governance.yml +++ b/.github/workflows/governance.yml @@ -17,4 +17,4 @@ permissions: jobs: governance: - uses: metadatastician/standards/.github/workflows/governance-reusable.yml@b3ce78e1a8cb24b33fde5c9da6a7c09486efda78 + uses: metadatastician/standards/.github/workflows/governance-reusable.yml@fe57d352f0b1a50e5cb07b4aac2581caf355388e diff --git a/.github/workflows/main-estate-audit.yml b/.github/workflows/main-estate-audit.yml index c856ee3f..f5b59207 100644 --- a/.github/workflows/main-estate-audit.yml +++ b/.github/workflows/main-estate-audit.yml @@ -17,4 +17,7 @@ on: jobs: call-estate-audit: - uses: hyperpolymath/cicd-suite/.github/workflows/main-estate-audit.yml@55556cf5ba71ba744695861503c13148d3915a5d # cicd-suite MAIN (branch-reachable): remote-form callee — 27 full-SHA refs, de-onboarded; witnessed cross-repo in rsr runs 35282081912 + 35283168495 (jobs spawn; gates audit THIS repo). Prior f9e173a pin (via #137) = deleted PR head: pull-ref-only reachability -> 0-job creation rejection; its onboarded @main/tag form was separately proven startup_failure cross-repo (35280642055). Repin on callee updates; never to PR-head commits. + uses: hyperpolymath/cicd-suite/.github/workflows/main-estate-audit.yml@2dbe6e9c2da71fbce336079f8e016c2de0b90111 + with: + # Includes the frame FFI implementation and all its local Zig imports. + zig-ffi-paths: examples/atoma/frame-v1/src diff --git a/atoma_chora.deed b/atoma_chora.deed index 4935fb52..fdb09d83 100644 --- a/atoma_chora.deed +++ b/atoma_chora.deed @@ -30,9 +30,9 @@ ; equal canon.lock [canon.artifacts]; canon.lock [canon.lockstep].order is ; spine-adopts-then-canon-releases, so this clause moves FIRST. (canon - :version "2.1.2" + :version "2.1.4" :criteria-sha256 "6a5aa8857bd0d0d58ef48827938ca17c251b6b854dacf59d306388d61694d82a" - :gates-sha256 "e70efd2f53c9445e30da4baf770366f04a4a84ffd844a01426e587e565b53e6a" + :gates-sha256 "2f31f46d4753432e0aa8c9c28f339e18e062c98dc6e6ef4ecbb76993cf37638b" :lockstep-since "2026-09-17" ; A canon change this repo cannot satisfy is a change made in the WRONG ; ORDER, not a rejected change: land the spine's adoption first, then the @@ -199,8 +199,8 @@ (manifest :version "0.1.0" :last-updated "2026-11-07" - :project "Atoma" - :purpose "Canonical RSR (Rhodium Standard Repository) template — governance, CI/CD, machine-readable metadata, ABI/FFI seam and formal-verification scaffolding that hyperpolymath projects are instantiated from." + :project "atoma" + :purpose "Experimental verification of a closed Zig subset, with source-bound obligations, model proofs and explicit replay/refinement limits." (agent :name CLAUDE :role "proofs, compilers, repo-local implementation, CI/CD, formal verification, Rust/Idris2/Zig") (agent :name CHATGPT :role "prose, papers, publication review, standards docs, outreach drafts, letters") (agent :name GEMINI :role "estate audits, cross-repo sweeps, long-context triage, pattern detection") @@ -1044,16 +1044,8 @@ "Axis 1 priority governs resource allocation" "Axis 2 type governs commit categorisation" "Axis 3 focus governs audit depth"))) - ; rsr-profile — this repo's declared RSR v2.0 capabilities. - ; Written by just repo-init on 2026-11-07. The template's maximal - ; profile was replaced at mint: declare only what this tree carries. - (rsr-profile - :version "1.0.0" - :spec "rsr-criteria-v2" - :declares-against "2.1.1-draft" - ; UNASSIGNED: declare capabilities (or a preset) — see standards - ; .machine_readable/template-capability-gates.toml - :capabilities ()) + (rsr-profile :version "1.0.0" :spec "rsr-criteria-v2" :declares-against "2.1.4-draft" + :capabilities ("bash" "zig" "cli" "library" "formal-proofs")) ; variant — provenance contract (ADR-0002 shape; ADR-0003 use). ; Records what this repo was minted from, for re-templating tooling and ; the drift gate (scripts/check-variant-drift.sh). The mint renders @@ -1096,7 +1088,7 @@ :extra-branches () :canon-version "2.1.2" :criteria-sha256 "6a5aa8857bd0d0d58ef48827938ca17c251b6b854dacf59d306388d61694d82a" - :gates-sha256 "e70efd2f53c9445e30da4baf770366f04a4a84ffd844a01426e587e565b53e6a" + :gates-sha256 "2f31f46d4753432e0aa8c9c28f339e18e062c98dc6e6ef4ecbb76993cf37638b" :archetype "" ; Which minting path actually ran (#201/#203 needed this signal). :minted-by "repo-init" diff --git a/docs/audit/2026-11-07-soundness-sprint.adoc b/docs/audit/2026-11-07-soundness-sprint.adoc index 719acacc..6f6a362f 100644 --- a/docs/audit/2026-11-07-soundness-sprint.adoc +++ b/docs/audit/2026-11-07-soundness-sprint.adoc @@ -149,3 +149,33 @@ job-aware closure check are recorded distinctly; a global pass is not claimed. The existing SonarCloud project is `hyperpolymath_zigprove` (Atoma's previous name); the local scanner configuration now targets that project rather than the template's project. + +== Remaining inherited gate repairs after PR 3 + +PR 3 was merged on 2026-11-07 while its inherited gate repairs were still +being evaluated. The following follow-up uses the actual failure evidence: + +* Governance's old allowlist snapshot did not recognise the standards + repository transfer. Pin its reusable to reviewed main commit `fe57d352`. +* Adopt the canon's 2.1.4 identity and gate-table hash; the criteria hash is + unchanged. This is a declared audit target, not a conformance certificate. +* Pin the merged canonical FFI-scope repair from cicd-suite PR 93 at + `2dbe6e9c`. Declare the frame implementation and its local import closure + as the FFI scope. The CLI remains outside that lexical FFI rule. +* Repair the map staleness control in the canonical template (PR 294), with + the same change here. It now creates its own tracked/deleted fixture and + checks both index and worktree behavior instead of depending on archetypes/. +* Correct the folded manifest's repository identity and purpose, and declare + the demonstrated core capabilities instead of leaving the profile unassigned. + +The native RSR applicability reader was also run, using its validated DEED +AST. It found retained template packaging/interface/release scaffolding that +does not match the declared core capabilities. That is recorded maintenance +debt, not hidden by declaring every possible capability. Broad RSR qualification +remains unearned; structural `just validate-rsr` is a different, weaker check. +Packaging/profile reconciliation is a follow-up before an experimental release. + +Local lock closure and placeholder validation pass. The full local mint test +could not start without uuidgen: apt-listbugs refused the available Debian +uuid-runtime package (bug 1126894), and the refusal was not overridden. +Hosted Ubuntu CI supplies that tool and must establish the complete mint result. diff --git a/tests/e2e/use_template_mint_test.sh b/tests/e2e/use_template_mint_test.sh index 4aa76461..445746a9 100755 --- a/tests/e2e/use_template_mint_test.sh +++ b/tests/e2e/use_template_mint_test.sh @@ -201,9 +201,18 @@ g -C "$C" diff --quiet -- docs/architecture/REPOSITORY-MAP.adoc \ # commit, after a removal), reproduces the stale map lintel shipped. SM="$work/stale-map" use_template "$SM" -(cd "$SM" && rm -rf archetypes && bash scripts/gen-repo-map.sh . >/dev/null) -grep -q '^| `archetypes' "$SM/docs/architecture/REPOSITORY-MAP.adoc" \ +# Create the control explicitly: minted descendants no longer carry archetypes/. +# The assertion must test index staleness, not assume a template-only directory. +printf 'map staleness control\n' > "$SM/map-staleness-control.txt" +g -C "$SM" add map-staleness-control.txt +rm "$SM/map-staleness-control.txt" +(cd "$SM" && bash scripts/gen-repo-map.sh . >/dev/null) +grep -qF 'map-staleness-control.txt' "$SM/docs/architecture/REPOSITORY-MAP.adoc" \ || fail 'control: index mode no longer shows the pre-commit staleness; this check is vacuous' +(cd "$SM" && bash scripts/gen-repo-map.sh --worktree . >/dev/null) +if grep -qF 'map-staleness-control.txt' "$SM/docs/architecture/REPOSITORY-MAP.adoc"; then + fail 'control: worktree mode retained a deleted source' +fi pass "the committed map is fresh (the index-mode control reproduces lintel's stale map)" (cd "$C" && env -u GITHUB_REPOSITORY bash scripts/check-no-placeholders.sh .) > "$work/ph.log" 2>&1 \ From cf9c4ae79d3ccaf2f9bbbbb9db9c8ebeb7914784 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Sat, 7 Nov 2026 20:14:30 +0000 Subject: [PATCH 2/7] Recognize the canonical standards owner in the inherited governance assertion Backport repository-transfer compatibility to the older reusable-workflow test. Continue requiring a full SHA and an exact matching lock dependency; unrelated owners remain rejected. The current template already recognizes both canonical owner spellings in its newer checkout-based policy test. Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> --- tests/workflows/governance_policy_test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/workflows/governance_policy_test.sh b/tests/workflows/governance_policy_test.sh index 9b00e1d7..b9e40f25 100644 --- a/tests/workflows/governance_policy_test.sh +++ b/tests/workflows/governance_policy_test.sh @@ -46,12 +46,12 @@ console.log("PASS: unrestricted pull requests coexist with filtered pushes and m // The replacement must still invoke the shared policy, at a locked revision. // Derive that revision from the call so legitimate pin updates need no edit. const use = governance.jobs.governance.uses; -const match = /^hyperpolymath\/standards\/\.github\/workflows\/governance-reusable\.yml@([a-f0-9]{40})$/.exec(use); +const match = /^(metadatastician|hyperpolymath)\/standards\/\.github\/workflows\/governance-reusable\.yml@([a-f0-9]{40})$/.exec(use); assert.ok(match, "governance must invoke the standards reusable workflow at a full SHA"); -const dependency = `hyperpolymath/standards@${match[1]}`; +const dependency = `${match[1]}/standards@${match[2]}`; assert.deepEqual(lock.workflows[".github/workflows/governance.yml"], [dependency], "governance's lock record must match its reusable workflow call"); -assert.equal(lock.dependencies[dependency]?.commit, `sha1-${match[1]}`, +assert.equal(lock.dependencies[dependency]?.commit, `sha1-${match[2]}`, "the governance pin must have a corresponding locked dependency commit"); console.log("PASS: governance delegates to the locked standards policy"); JS From 1ba1a4591430c8397618bc02438fc7bc64ae078c Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Sat, 7 Nov 2026 20:20:16 +0000 Subject: [PATCH 3/7] Restore canonical KYAML after container identity rendering Use the checksum-verified formatter and yq versions pinned by Estate Rules. The formatter confirms parsed data is unchanged. All three retained config format checks and the KYAML ratchet controls pass; template-only value assertions remain correctly inapplicable after minting. Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> --- build/container/compose.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/container/compose.yaml b/build/container/compose.yaml index 4cc16734..f8a7b910 100644 --- a/build/container/compose.yaml +++ b/build/container/compose.yaml @@ -21,7 +21,7 @@ # ────────────────────────────────────────────────────────────────────── # Primary application service # ────────────────────────────────────────────────────────────────────── - "atoma": { + atoma: { build: { context: "..", dockerfile: "build/container/Containerfile", @@ -74,7 +74,7 @@ "rokur-audit:/var/log/rokur", ], depends_on: { - "atoma": { + atoma: { condition: "service_healthy", }, }, @@ -128,7 +128,7 @@ }, }, volumes: { - "atoma-data": null, + atoma-data: null, rokur-audit: null, }, } From bc9914115798fefe51c4a8c49d31edc663404ff4 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Sat, 7 Nov 2026 20:23:26 +0000 Subject: [PATCH 4/7] Replay source-derived u8 model proofs through ECHIDNA and coqchk Generate a closed finite-domain Coq theorem from the actual admitted Zig body and contract. Require exact source/proof regeneration, real ECHIDNA JSON verification, a fresh compiled proof, independent coqchk and a closed-assumptions audit. Wire all replay tools and rejection controls into the existing required soundness gate. Local complete gate passes: two model proofs, ten rejection controls, a direct axiom control, and the prior frame/Idris/Agda/SMT/compiled Zig checks. Record separate local/hosted tool profiles and update R1/v1 claims. No Zig/compiler refinement or full cross-kernel claim is made; status remains INCOMPLETE. Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> --- .github/workflows/atoma.yml | 2 + README.adoc | 14 ++-- docs/audit/2026-11-07-source-replay.adoc | 74 ++++++++++++++++++ .../2026-11-07-source-replay/README.adoc | 15 ++++ .../identity-assumptions.txt | 3 + .../increment-assumptions.txt | 3 + .../2026-11-07-source-replay/local-gate.txt | 59 ++++++++++++++ .../local-inputs.sha256 | 35 +++++++++ docs/decisions/ATOMA-SOURCE-TO-PROOF.adoc | 7 ++ docs/decisions/ATOMA-TOOLCHAIN.adoc | 2 + docs/plan/ULTRAPLAN.adoc | 9 +++ docs/status/PROOF-STATUS.adoc | 6 +- docs/status/ROADMAP.adoc | 6 +- scripts/atoma-ci-replay-toolchain.sh | 24 ++++++ scripts/atoma-gate-falsifiers.sh | 4 +- scripts/atoma-gate.sh | 3 +- scripts/atoma-replay-gate.sh | 76 +++++++++++++++++++ scripts/atoma-replay.sh | 74 ++++++++++++++++++ tools/atoma/src/main.zig | 9 ++- tools/atoma/src/source.zig | 36 +++++++++ 20 files changed, 444 insertions(+), 17 deletions(-) create mode 100644 docs/audit/2026-11-07-source-replay.adoc create mode 100644 docs/audit/2026-11-07-source-replay/README.adoc create mode 100644 docs/audit/2026-11-07-source-replay/identity-assumptions.txt create mode 100644 docs/audit/2026-11-07-source-replay/increment-assumptions.txt create mode 100644 docs/audit/2026-11-07-source-replay/local-gate.txt create mode 100644 docs/audit/2026-11-07-source-replay/local-inputs.sha256 create mode 100644 scripts/atoma-ci-replay-toolchain.sh create mode 100644 scripts/atoma-replay-gate.sh create mode 100644 scripts/atoma-replay.sh diff --git a/.github/workflows/atoma.yml b/.github/workflows/atoma.yml index 65452cf8..6bd714c0 100644 --- a/.github/workflows/atoma.yml +++ b/.github/workflows/atoma.yml @@ -26,6 +26,8 @@ jobs: persist-credentials: false - name: Provision pinned proof tools run: bash scripts/atoma-ci-toolchain.sh + - name: Provision source-model replay tools + run: bash scripts/atoma-ci-replay-toolchain.sh - name: Run required source, contract and proof checks run: bash scripts/atoma-gate.sh - name: Preserve evidence even on failure diff --git a/README.adoc b/README.adoc index 77a4fdd3..48b68e6b 100644 --- a/README.adoc +++ b/README.adoc @@ -8,12 +8,13 @@ Atoma develops source-bound verification for an explicitly closed Zig subset. It currently provides canonical contracts, a syntax screen, typechecked Idris2 specifications, Agda proofs of a store-free model and a finite u8 source pilot. It is not yet a general sound verifier for Zig. Evidence remains -*INCOMPLETE (Warrant)*: compiler/refinement arguments and independent replay -are unfinished. +*INCOMPLETE (Warrant)*: finite-model replay now runs through ECHIDNA and +coqchk, while compiler/refinement arguments and the full kernel chain remain +unfinished. == Build and check -Use Zig 0.15.2, Z3 4.13.3 and the Agda/Idris2 profiles in +Use Zig 0.15.2, Z3 4.13.3 and the Agda/Idris2/ECHIDNA/Coq profiles in link:docs/decisions/ATOMA-TOOLCHAIN.adoc[the toolchain decision]. From the repository root: @@ -25,6 +26,8 @@ bash scripts/atoma-gate.sh The gate rebuilds the current source, runs contract extraction and registered proof checks, checks the good and wrong-body fixtures against every u8 input, and exercises failures for missing tools, stale executables and I/O errors. +It also regenerates source-bound Coq model proofs, runs actual ECHIDNA, +checks the compiled libraries with coqchk and audits theorem assumptions. Evidence is written to `build/atoma-evidence/`. The hosted workflow publishes the same evidence and is required on `main`. @@ -44,8 +47,9 @@ translation, provenance and kernel-replay evidence. == Plan and collaboration The link:docs/plan/ULTRAPLAN.adoc[v1 plan] defines conjunctive release gates, -estimates and stop points. The next stage is a source/proof/replay vertical -slice and explicit alias/memory boundary work. +estimates and stop points. The first finite-model replay slice is described +in link:docs/audit/2026-11-07-source-replay.adoc[the replay report]. Next are +the typed semantic boundary, an alias counterexample and checked refinement. The link:docs/decisions/ATOMA-SIBLING-TRANSFER.adoc[sibling assessment] explains potential reuse with Quintessence, Apodeixis.jl and Bactrian. diff --git a/docs/audit/2026-11-07-source-replay.adoc b/docs/audit/2026-11-07-source-replay.adoc new file mode 100644 index 00000000..36ff31aa --- /dev/null +++ b/docs/audit/2026-11-07-source-replay.adoc @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: CC-BY-SA-4.0 +// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell += Atoma R1 finite-model replay slice +:revdate: 2026-11-07 + +== Scope and result + +`source-coq` lowers the same closed Zig u8 fragment as `source-vc` and emits a +Coq theorem about all 256 inputs. The body and postcondition are emitted +separately. A false obligation is still emitted: the finite evaluator does not +choose a successful proof. Coq checks finite reflection and the theorem that +the domain check entails the postcondition for every input below 256. + +The local positive run used Zig 0.15.2, ECHIDNA 2.3.0 built with Cargo.lock at +`2ab7574ae1e574b0e881422fde6252bf79dea178`, and Rocq/coqchk 9.2. ECHIDNA was +built with Rust 1.99.1 locally. The separate hosted bootstrap profile uses +Rust 1.99.0 and Ubuntu Noble Coq 8.18.0+dfsg-1build2. These are different +profiles; their environment evidence must not be described as identical. + +The real ECHIDNA `prove --output json` command compiles the exact generated +file. A separate `coqchk` process checks its compiled library recursively. +An importing audit checks the theorem's type and requires `Print Assumptions` +to report a closed context. The Coq backend invokes `coqc` by name; the adapter +checks that this is the same compiler it records in the tool manifest. + +Local replay controls passed for wrapping increment and identity. Rejections +cover a wrong body, a constant body, stale source, an admitted replacement, +a missing checker, an existing evidence directory, malformed JSON, unknown, +a fake verified result without a compiled proof, and a corrupted compiled +proof. A separate admitted-theorem control compiles and passes `coqchk` but +reports an axiom, demonstrating why the closure check is necessary. + +Hosted results must be read from the exact PR head; local evidence alone is +not a hosted pass. The existing required `Atoma soundness gate` now provisions +the replay tools and runs these checks without a missing-tool skip. + +== Evidence and trust boundary + +Run `bash scripts/atoma-gate.sh` for the complete gate, or build the CLI and +run `bash scripts/atoma-replay-gate.sh` with the pinned tools on PATH. +The latter writes fresh evidence directories below `build/atoma-evidence/`. +For an individual proof use: + +---- +tools/atoma/zig-out/bin/atoma source-coq examples/atoma/source-u8/increment.zig > /tmp/AtomaProof.v +bash scripts/atoma-replay.sh examples/atoma/source-u8/increment.zig /tmp/AtomaProof.v /tmp/new-atoma-replay +---- + +The adapter regenerates the proof from a source snapshot and requires exact +byte equality. A pre-existing directory is refused. The original source, +proof and regenerated proof are compared again after subprocesses finish. +The result includes the ECHIDNA JSON, compiled library, assumption audit, +tool versions, executable hashes and input hashes. A receipt is written only +after every stage succeeds. Its status is always `INCOMPLETE`. + +This is source-derived finite-model proof replay. It is *not* replay of a Z3 +proof certificate, a Zig/compiler refinement proof, an ECHIDNA translation +proof, or the full Dedukti/Coq/Lean4 chain. Coq compilation and coqchk are +separate checks within one prover family. The parser, lowering/emitter, +adapter, toolchain and execution environment remain trusted. Exact hash and +byte binding detects mismatched evidence; it does not prove the emitter's +semantic correctness. The compiled Zig exhaustive witness remains separate. + +== Next acceptance + +R1 is partial. The next work is an explicit typed boundary with source +locations, one aliasing counterexample, and a checked argument connecting +admitted Zig to the model. Before broadening the language, test invalidation +across compiler/target/mode and imported-source changes. Cross-kernel replay +and authenticated COMPLETE receipts remain later conjunctive v1 gates. + +Transfer to Quintessence, Apodeixis.jl and Bactrian should reuse the evidence +protocol, failure cases and trust ledger first. This result does not establish +shared actor, dynamic-dispatch, memory or effect semantics for those languages. diff --git a/docs/audit/2026-11-07-source-replay/README.adoc b/docs/audit/2026-11-07-source-replay/README.adoc new file mode 100644 index 00000000..fbe32e87 --- /dev/null +++ b/docs/audit/2026-11-07-source-replay/README.adoc @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: CC-BY-SA-4.0 +// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell += Local replay evidence + +These are results of the complete local gate, using the separately documented +local tool profile. The source manifest records the bytes executed in that +run; it is not a claim that a later documentation/CI repair commit was tested. +The generated proofs, compiled libraries, ECHIDNA result, coqchk logs, receipt +and tool hashes are generated afresh under build/atoma-evidence/replay.*/ and +uploaded by the required hosted Atoma soundness workflow. The committed text +is a review aid; fresh exact-head hosted evidence is the merge gate. + +The frame receipt remains a different model and still lacks its full kernel +chain. The new finite-u8 replay result remains INCOMPLETE: source/compiler +refinement, memory/aliasing and cross-kernel translation are unproved. diff --git a/docs/audit/2026-11-07-source-replay/identity-assumptions.txt b/docs/audit/2026-11-07-source-replay/identity-assumptions.txt new file mode 100644 index 00000000..2abd4eff --- /dev/null +++ b/docs/audit/2026-11-07-source-replay/identity-assumptions.txt @@ -0,0 +1,3 @@ +atoma_u8 : forall x : nat, x < 256 -> body x = specification x + : forall x : nat, x < 256 -> body x = specification x +Closed under the global context diff --git a/docs/audit/2026-11-07-source-replay/increment-assumptions.txt b/docs/audit/2026-11-07-source-replay/increment-assumptions.txt new file mode 100644 index 00000000..2abd4eff --- /dev/null +++ b/docs/audit/2026-11-07-source-replay/increment-assumptions.txt @@ -0,0 +1,3 @@ +atoma_u8 : forall x : nat, x < 256 -> body x = specification x + : forall x : nat, x < 256 -> body x = specification x +Closed under the global context diff --git a/docs/audit/2026-11-07-source-replay/local-gate.txt b/docs/audit/2026-11-07-source-replay/local-gate.txt new file mode 100644 index 00000000..db9904df --- /dev/null +++ b/docs/audit/2026-11-07-source-replay/local-gate.txt @@ -0,0 +1,59 @@ +1/3: Building FrameAbi (FrameAbi.idr) +2/3: Building Extract (Extract.idr) +3/3: Building Linearity (Linearity.idr) +EQUIVALENT blake3:ee4d77f0932619c5c1933d342f645a4eff85d9fead9fb0c1d9c8a0890feb2358 +F0.1 ok: Idris2 contract, QTT negatives and executable Face A extraction +atoma 24 tests (canon + frontend + vc + source) +G1 ok unit tests (frame_parse) +G2 ok cross-compiles: x86_64 aarch64 riscv64 wasm32 +G3 ok layout witness: 60 rows over 4 targets +G4 ok usize-across-FFI rejected on wasm32 (F0.3) +G5 ok seam equivalence blake3:f5f97a7bee44d4596590ecb7745c70565ebdf4fb5daa8a48d9a365a85f265756 +G5 ok divergence probe blake3:d49201f2c05100701a8ed42138066e50ee488b050b6d8ad49957c6226affca70 +G6 ok mutation sweep: 11 applied, 11 distinct artifacts +G7 ok 14 VCs discharged by z3: 8 unsat, 6 sat (blake3:dec3d83389ef29f4ec5d49805ba527f92fef6224b0613a98393ed7f1c69ce35d) +G8 ok Face B extracted from source blake3:ee4d77f0932619c5c1933d342f645a4eff85d9fead9fb0c1d9c8a0890feb2358 +G9 ok syntax screen: 6 exports, 6 contracts, 0 diagnostics +G10 ok negative corpus rejected: 20 diagnostics, 17 distinct codes +G11 ok metatheory typechecks: 4 modules, 0 postulates (blake3:e2b2f961812d4ed1165f3d306d267dd95af7d0f13f7ce146fde9355d7a647249) + +receipt: witness/phase0.receipt.json +{"artifacts":{"face-a":"blake3:f5f97a7bee44d4596590ecb7745c70565ebdf4fb5daa8a48d9a365a85f265756","face-b":"blake3:f5f97a7bee44d4596590ecb7745c70565ebdf4fb5daa8a48d9a365a85f265756","layout":"blake3:c75f72ce33010b457c8dc7f8c8514720904ddaeca9de0ce412cc7d61cf8accd1"},"contract":"atoma.frame.parse","equivalence":"EQUIVALENT","gate":"phase0","mutants":{"applied":11,"distinct":11},"proof":{"modules":4,"srcset":"blake3:e2b2f961812d4ed1165f3d306d267dd95af7d0f13f7ce146fde9355d7a647249","status":"checked"},"schema":"atoma.receipt.v1","smt":{"status":"discharged","vcs":14,"vcset":"blake3:dec3d83389ef29f4ec5d49805ba527f92fef6224b0613a98393ed7f1c69ce35d"},"status":"INCOMPLETE","status_class":"Warrant","subset":{"codes_negative_corpus":17,"contracts":6,"diagnostics_negative_corpus":20},"targets":["aarch64","riscv64","wasm32","x86_64"],"tests":{"atoma":24,"frame_parse":13}} +STATUS: INCOMPLETE (Warrant) - Dedukti/coqchk/lean4checker checks did not run. +SOURCE-PILOT-CHECKED inputs=256 source-blake3:bd2dd1c4c6b45f4ba3f58ece20f737ea9121bde5061f64b593b2e039d5e4d041 +STATUS: INCOMPLETE (Warrant); frontend/compiler refinement unproved +1/1 compiled-witness.test.compiled pilot matches the contract for every u8 input...OK +All 1 tests passed. +falsifier PASS missing ZIG rejected +falsifier PASS missing Z3 rejected +falsifier PASS missing AGDA rejected +falsifier PASS missing IDRIS2 rejected +falsifier PASS stale executable cannot bypass current-source build +falsifier PASS solver stdout cannot hide a failed process +falsifier PASS source command input/output errors are distinct from verification failures +falsifier PASS empty Agda registry rejected +REPLAY-MODEL-CHECKED: ECHIDNA + coqchk; INCOMPLETE, Zig refinement unproved +source.zig: OK +AtomaProof.v: OK +AtomaProof.vo: OK +Audit.v: OK +Audit.vo: OK +echidna.json: OK +coqchk.txt: OK +assumptions.txt: OK +coqc-version.txt: OK +coqchk-version.txt: OK +echidna-version.txt: OK +REPLAY-MODEL-CHECKED: ECHIDNA + coqchk; INCOMPLETE, Zig refinement unproved +REPLAY-FALSIFIER-KILLED wrong-body +REPLAY-FALSIFIER-KILLED literal +REPLAY-FALSIFIER-KILLED stale-source +REPLAY-FALSIFIER-KILLED admitted +REPLAY-FALSIFIER-KILLED missing-kernel +REPLAY-FALSIFIER-KILLED reused-directory +REPLAY-FALSIFIER-KILLED malformed +REPLAY-FALSIFIER-KILLED unknown +REPLAY-FALSIFIER-KILLED no-proof +REPLAY-FALSIFIER-KILLED corrupt +REPLAY GATE PASS: two source-derived models checked, 10 rejection controls, axiom control; INCOMPLETE +ATOMA GATE PASS — INCOMPLETE (Warrant); finite-model replay checked, program refinement unproved diff --git a/docs/audit/2026-11-07-source-replay/local-inputs.sha256 b/docs/audit/2026-11-07-source-replay/local-inputs.sha256 new file mode 100644 index 00000000..770ecafc --- /dev/null +++ b/docs/audit/2026-11-07-source-replay/local-inputs.sha256 @@ -0,0 +1,35 @@ +eb84b84cc007189377d2a3e64fdb0b86fa505b0d2dba7a0ac138284eca4c6afb examples/atoma/frame-v1/abi/Extract.idr +e8bf96eb9e3ba594744548741a9ee28561a4174f40202d9d7055650930b36c4f examples/atoma/frame-v1/abi/FrameAbi.idr +b722461649bcded19c78a14dd4b6ef76d1f90e69c15d3b5d4e338606505242f8 examples/atoma/frame-v1/abi/FrameAbi.ipkg +31d3619fe4020fdfab117c504249f0c491eb0fd8605e35986d3638e4d77d7c42 examples/atoma/frame-v1/abi/Linearity.idr +f18d016580750126fb2e38ba9a02291a86574d7a316d0d18acbe5064e71661fa examples/atoma/frame-v1/spec/face-a.cspec +8ddc7ad8611fdbd323789fcc5ace9509433e95d84f1be79cf9034b3af454046a examples/atoma/frame-v1/spec/face-b.cspec +3d20b211285a7514cc2c5b3b6cf40d6a1b3a405116514569c5b87d9a940f6666 examples/atoma/frame-v1/spec/layout.cspec +d96d491575b4aa98344b2c408742b4192a3614b597b8d7d1f46ffac3685c1d24 examples/atoma/frame-v1/src/atoma.zig +2690434265c3ca2c6a4b8750ea81a496d4f52dbb25926c89645ff8040a28204f examples/atoma/frame-v1/src/frame_parse.zig +133752532ce17073b76626a6feeb3a9c3ec510fb836d5173c41d0644e9389238 examples/atoma/source-u8/compiled-witness.zig +0dfd0dc5af9adb93726d10dca8531f5140d1f1cf5117a4c68d948ac42c591a45 examples/atoma/source-u8/increment.zig +4296b25b6083732d72127cc021da50a7c4a4ac7ae7fb67274fafd9f261b95857 examples/atoma/source-u8/recursive.zig +605f194214cabbf703961c21b0ddb9e30465b895a9a4dc78351e08cfdce8276d examples/atoma/source-u8/wrong-body.zig +9a8b2000096ec3214899d822e11a4ad060b30515bb11865c70478f1057bb0fdf tools/atoma/src/canon.zig +1ae7f5e849324945e126c928111c78a42de3f6e14c3b24ab0de035752b4916a8 tools/atoma/src/frontend.zig +2b6a9cb91dbb9c0efc1ec558bf37177bfaf83cb0fd3806a69857b3105b799983 tools/atoma/src/main.zig +9f1d89990d310f6d49eb87f841358b3e3bc4385d2e24013c261ef1d87061f29b tools/atoma/src/source.zig +7bcb0cb5fe70f391e5b3a0c55fc5fd3325657943148090fd3cf7dbeb5b8240c9 tools/atoma/src/vc.zig +a060c98d92d78795186ad5b22e50a664efdc7e0fd618cedc09f889e14d8ff5cd verification/atoma/agda/Bv.agda +97c4e2e52364c0f1d8fef12a33e091ceb4f4cea9ae030d231651127d2390d3e5 verification/atoma/agda/Core.agda +f1e2447cf61217b3b6007dc56f0fcde88caa8f804c75c7e2aff7a4993cc9b643 verification/atoma/agda/Lin.agda +8526085a08c2f8d3c1093fb5137ba3d4fd60f230bf6cb8e623ba5818b73a41a4 verification/atoma/agda/Soundness.agda +d777465faa96e3a894bae826a60f7980fd50fb68cabfc97d9293990cc34c57f6 verification/atoma/check-agda.sh +b0eac35d5b00bef70a4927ccb68111dcc684f5df17ffad6b613ab977fe0f57d8 tools/atoma/build.zig +9259c3bf44be3182cd9f3d2206c72f215b2f41b33feddbbeb602b1efddee4c9f scripts/atoma-check-idris.sh +1798c74bba5da08d830f5ade38fd79881e4dc27f23b5b53e08205cc4cf1bf882 scripts/atoma-ci-replay-toolchain.sh +f17d862442291100bbfef0073925143a21a52aa1bc84fa8072a56584754b1df1 scripts/atoma-ci-toolchain.sh +1b0d43c3f2024971447c5f7d789be0f1ee0ad887f7ab31c54eef26078bebe306 scripts/atoma-gate-falsifiers.sh +c9d07e6aa84ab94ac4afe765821b1d73f8fa4071afea6110415f4147b6e862a5 scripts/atoma-gate.sh +92fb4bc49d81a354a208ee6c6c7cd73c712666a928d62bfed5862764421a410f scripts/atoma-replay-gate.sh +7f0acfb1b53b11f8f72de7f9ae671a3f7d84d696139219c2ac79ffdc70072ebd scripts/atoma-replay.sh +eedd113fdef194f42ee2ae9187f2d5b03476b91072fa5b8957511a8da4b5d0d4 examples/atoma/frame-v1/verify.sh +358cd904557a41b5c30cdfe9dcd67451ccac31c7cd09b5b2bd6c339023fded46 verification/proofs/agda/MANIFEST +f4d5954e01a91cc3f7911cd36a5eb699c5b3f62a4c457613e2147899a601a33d verification/proofs/idris2/MANIFEST +762fdabfc6752e57a41ab731b7e0c862502a2136f2b2b5f229f520ff08df0bd4 .github/workflows/atoma.yml diff --git a/docs/decisions/ATOMA-SOURCE-TO-PROOF.adoc b/docs/decisions/ATOMA-SOURCE-TO-PROOF.adoc index 8c91cac8..6e291769 100644 --- a/docs/decisions/ATOMA-SOURCE-TO-PROOF.adoc +++ b/docs/decisions/ATOMA-SOURCE-TO-PROOF.adoc @@ -67,6 +67,13 @@ cycles; imports, aliases and higher-order calls are not generally resolved. == Next semantic work +The R1 finite-model replay slice adds `source-coq` and +`scripts/atoma-replay.sh`: actual ECHIDNA compilation, independent `coqchk`, +and a closed-assumptions audit, with exact regenerated-proof/source binding. +See `docs/audit/2026-11-07-source-replay.adoc` for evidence and trust limits. +This checks a generated Coq model theorem, not a Z3 certificate translation +or Zig refinement. R1 and the full required replay chain remain partial. + . Define a closed typed scalar/struct/slice subset and an assumption manifest; pin the compiler adapter and targets. Add source locations to every IR node. . Model finite machine arithmetic separately from mathematical integers. Check diff --git a/docs/decisions/ATOMA-TOOLCHAIN.adoc b/docs/decisions/ATOMA-TOOLCHAIN.adoc index d25e9f44..08da0c72 100644 --- a/docs/decisions/ATOMA-TOOLCHAIN.adoc +++ b/docs/decisions/ATOMA-TOOLCHAIN.adoc @@ -16,6 +16,8 @@ the entire transitive system environment. | Z3 | 4.13.3 official x86_64 glibc 2.35 archive | SHA-256 pinned in installer; local Debian 4.13.3-1 also exercised | Idris2 | v0.8.0 commit `15a3e4e70843f7a34100f6470c04b791330788df`, Chez bootstrap | Exact fetched commit checked; local 0.8.0-b6cbc25d5 is a separate recorded profile | Agda | Ubuntu package `agda-bin=2.6.3-1build1` | apt authentication and exact package version; local Debian 2.6.4.3-1+b2 is a separate recorded profile +| Coq replay | Ubuntu Noble `coq=8.18.0+dfsg-1build2` | coqc and coqchk from the authenticated package; local Rocq 9.2 is a separate recorded profile +| ECHIDNA | `2ab7574ae1e574b0e881422fde6252bf79dea178`, locked release build, Rust 1.99.0 | No default optional prover features; local build uses Rust 1.99.1. This consumes the existing Rust verifier; it adds no Rust implementation proof claim | Actions | checkout v7.0.1, upload-artifact v7.0.2 | Immutable commits recorded by `gh actions-lock` in `actions.lock`; no credential persistence; read-only repository token |=== diff --git a/docs/plan/ULTRAPLAN.adoc b/docs/plan/ULTRAPLAN.adoc index 56158200..f895e4bd 100644 --- a/docs/plan/ULTRAPLAN.adoc +++ b/docs/plan/ULTRAPLAN.adoc @@ -35,6 +35,8 @@ The following gaps remain central: semantic subset checker. * No real ECHIDNA-to-Dedukti/Coq/Lean4 replay chain is demonstrated. Exported declarations and admitted skeletons are not checked proof translations. + The R1 slice now exercises real ECHIDNA-to-Coq finite-model compilation, + independent coqchk and a no-axioms audit; the full chain remains open. * Store, loops, aliasing, capabilities, modular calls and source refinement remain unproved. There is no sound general Zig verifier yet. * The deed/arrival pack now identify experimental Atoma. Estate compliance @@ -91,6 +93,13 @@ Re-estimate after R1, with compiler/formal-methods expertise available. | R5 | Three pilots, mutation/aspect campaigns, installation/release audit | 5–8 | Published release evidence; all v1 gates satisfied |=== +R1 progress: the source-bound u8 function now has a generated Coq model +theorem and a real ECHIDNA/coqchk path with adversarial replay controls. +This closes a narrow replay experiment, not R1: the alias counterexample, +typed-subset expansion and source-to-model refinement argument remain open. +Do those before expanding features or shortening the v1 estimate. See +`docs/audit/2026-11-07-source-replay.adoc`. + An initial envelope is about 30–60 focused person-weeks plus contingency, with some overlap. Two experienced contributors might deliver the restricted v1 in 6–12 months; part-time work scales accordingly. Broad Verus-like coverage is diff --git a/docs/status/PROOF-STATUS.adoc b/docs/status/PROOF-STATUS.adoc index 61a0bd0f..0708ea79 100644 --- a/docs/status/PROOF-STATUS.adoc +++ b/docs/status/PROOF-STATUS.adoc @@ -18,8 +18,10 @@ execution over 256 inputs; wrong body rejected | Parser/lowering/compiler remain trusted; general calls, imports, memory and loops are refused | Legacy frame SMT | Eight unsat and six sat model obligations | Not derived from the frame implementation body -| Independent replay | Pending next milestone | No complete -ECHIDNA/Dedukti/Coq/Lean4 chain has been demonstrated +| Finite-model replay | Source-derived Coq theorem, actual ECHIDNA compilation, +independent coqchk and closed-assumptions audit; adversarial controls | +Trusted frontend/emitter; no Zig refinement or complete +ECHIDNA/Dedukti/Coq/Lean4 chain |=== The inherited general ABI scaffold has four Idris quarantines. Its Types model diff --git a/docs/status/ROADMAP.adoc b/docs/status/ROADMAP.adoc index 8998a40c..f605209d 100644 --- a/docs/status/ROADMAP.adoc +++ b/docs/status/ROADMAP.adoc @@ -21,9 +21,9 @@ head must independently pass hosted checks before merge. == Next acceptance -* Source/proof/replay vertical slice: a source-derived obligation accepted by - an independent checker, with exact source/tool identity and stale evidence - rejection. No unproved declaration or admitted theorem may count as replay. +* Extend the locally passing finite-model replay slice to a checked + source-to-model argument. Its ECHIDNA/coqchk path requires fresh source/proof + identity and closed assumptions; it does not establish Zig refinement. * Typed semantic boundary and explicit memory/alias counterexample. * Second-language transfer spike before choosing the full sibling sequence. diff --git a/scripts/atoma-ci-replay-toolchain.sh b/scripts/atoma-ci-replay-toolchain.sh new file mode 100644 index 00000000..eb003cbb --- /dev/null +++ b/scripts/atoma-ci-replay-toolchain.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell +# Bounded CI bootstrap profile, alongside ATOMA-TOOLCHAIN.adoc. +set -euo pipefail +: "${RUNNER_TEMP:?runner scratch directory required}" +: "${GITHUB_PATH:?GitHub PATH file required}" +task="$RUNNER_TEMP/atoma-replay-toolchain" +mkdir -p "$task" +sudo apt-get update +sudo apt-get install -y --no-install-recommends coq=8.18.0+dfsg-1build2 jq libssl-dev pkg-config +rustup toolchain install 1.99.0 --profile minimal +git init "$task/echidna" +git -C "$task/echidna" remote add origin https://github.com/hyperpolymath/echidna.git +git -C "$task/echidna" fetch --depth 1 origin 2ab7574ae1e574b0e881422fde6252bf79dea178 +git -C "$task/echidna" checkout --detach FETCH_HEAD +[[ $(git -C "$task/echidna" rev-parse HEAD) == 2ab7574ae1e574b0e881422fde6252bf79dea178 ]] +( + cd "$task/echidna" + cargo +1.99.0 build --locked --release --bin echidna -j 2 +) +echo "$task/echidna/target/release" >> "$GITHUB_PATH" +dpkg-query -W coq +"$task/echidna/target/release/echidna" --version diff --git a/scripts/atoma-gate-falsifiers.sh b/scripts/atoma-gate-falsifiers.sh index baf0230b..34f1e68f 100644 --- a/scripts/atoma-gate-falsifiers.sh +++ b/scripts/atoma-gate-falsifiers.sh @@ -47,14 +47,14 @@ echo 'falsifier PASS solver stdout cannot hide a failed process' atoma="$root/tools/atoma/zig-out/bin/atoma" printf 'export fn broken(' > "$tmp/syntax.zig" truncate -s 16777217 "$tmp/too-large.zig" -for command in source-check source-vc; do +for command in source-check source-vc source-coq; do for input in absent.zig syntax.zig too-large.zig; do rc=0 "$atoma" "$command" "$tmp/$input" > "$tmp/out" 2>&1 || rc=$? [[ "$rc" == 3 ]] || { echo "FAIL $command $input exit=$rc, expected I/O/parse exit 3" >&2; exit 1; } done done -for command in source-check source-vc; do +for command in source-check source-vc source-coq; do rc=0 "$atoma" "$command" "$root/examples/atoma/source-u8/increment.zig" > /dev/full 2> "$tmp/out" || rc=$? [[ "$rc" == 3 ]] || { echo "FAIL $command output write error exit=$rc, expected 3" >&2; exit 1; } diff --git a/scripts/atoma-gate.sh b/scripts/atoma-gate.sh index 7f95b0de..8a1a2650 100644 --- a/scripts/atoma-gate.sh +++ b/scripts/atoma-gate.sh @@ -73,6 +73,7 @@ fi grep -q 'TestExpectedEqual' "$evidence/compiled-bad.txt" bash scripts/atoma-gate-falsifiers.sh | tee "$evidence/falsifiers.txt" +bash scripts/atoma-replay-gate.sh | tee "$evidence/replay.txt" # Bind the source, contracts, proof sources and gate definitions to this run. # Exclude generated caches/witnesses to avoid self-referential digests. find tools/atoma/src examples/atoma/frame-v1/src examples/atoma/frame-v1/abi \ @@ -82,4 +83,4 @@ find tools/atoma/src examples/atoma/frame-v1/src examples/atoma/frame-v1/abi \ sha256sum tools/atoma/build.zig scripts/atoma-*.sh examples/atoma/frame-v1/verify.sh \ verification/proofs/{agda,idris2}/MANIFEST .github/workflows/atoma.yml >> "$evidence/inputs.sha256" cp examples/atoma/frame-v1/witness/phase0.receipt.json "$evidence/" -echo 'ATOMA GATE PASS — INCOMPLETE (Warrant); no program-refinement or kernel-replay claim' +echo 'ATOMA GATE PASS — INCOMPLETE (Warrant); finite-model replay checked, program refinement unproved' diff --git a/scripts/atoma-replay-gate.sh b/scripts/atoma-replay-gate.sh new file mode 100644 index 00000000..17f13612 --- /dev/null +++ b/scripts/atoma-replay-gate.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell +set -euo pipefail +root=$(cd "$(dirname "$0")/.." && pwd) +cd "$root" +export ATOMA=${ATOMA:-$root/tools/atoma/zig-out/bin/atoma} +export ECHIDNA=${ECHIDNA:-echidna} COQC=${COQC:-coqc} COQCHK=${COQCHK:-coqchk} +work=$(mktemp -d "$root/build/atoma-evidence/replay.XXXXXX") +pilot="$root/examples/atoma/source-u8" +replay="$root/scripts/atoma-replay.sh" +"$ATOMA" source-coq "$pilot/increment.zig" > "$work/good.v" +bash "$replay" "$pilot/increment.zig" "$work/good.v" "$work/good" +(cd "$work/good" && sha256sum -c inputs.sha256) +printf '/// @ensures result == x +%% 0\nexport fn identity(x: u8) callconv(.c) u8 { return x; }\n' > "$work/identity.zig" +"$ATOMA" source-coq "$work/identity.zig" > "$work/identity.v" +bash "$replay" "$work/identity.zig" "$work/identity.v" "$work/identity" +reject() { + local name=$1 expected=$2; shift 2 + if "$@" > "$work/$name.log" 2>&1; then + echo "FAIL replay accepted $name" >&2; exit 1 + fi + grep -qF "$expected" "$work/$name.log" || { cat "$work/$name.log" >&2; exit 1; } + [[ ! -e "$work/$name/receipt.json" ]] || { echo 'FAIL failure published a receipt' >&2; exit 1; } + echo "REPLAY-FALSIFIER-KILLED $name" +} +"$ATOMA" source-coq "$pilot/wrong-body.zig" > "$work/wrong.v" +reject wrong-body 'ECHIDNA did not verify' bash "$replay" "$pilot/wrong-body.zig" "$work/wrong.v" "$work/wrong-body" +printf '/// @ensures result == x +%% 0\nexport fn constant(x: u8) callconv(.c) u8 { return 0; }\n' > "$work/literal.zig" +"$ATOMA" source-coq "$work/literal.zig" > "$work/literal.v" +reject literal 'ECHIDNA did not verify' bash "$replay" "$work/literal.zig" "$work/literal.v" "$work/literal" +cp "$pilot/increment.zig" "$work/changed.zig" +printf '\n// a source identity change\n' >> "$work/changed.zig" +reject stale-source 'proof does not match current source' bash "$replay" "$work/changed.zig" "$work/good.v" "$work/stale-source" +sed 's/Proof\. vm_compute\. reflexivity\. Qed\./Admitted./' "$work/good.v" > "$work/admitted.v" +reject admitted 'proof does not match current source' bash "$replay" "$pilot/increment.zig" "$work/admitted.v" "$work/admitted" +reject missing-kernel 'missing tool:' env COQCHK="$work/no-such-checker" bash "$replay" "$pilot/increment.zig" "$work/good.v" "$work/missing-kernel" +reject reused-directory 'evidence directory must be new' bash "$replay" "$pilot/increment.zig" "$work/good.v" "$work/good" +cat > "$work/fake-echidna" <<'SH' +#!/usr/bin/env bash +set -euo pipefail +if [[ $1 == --version ]]; then echo 'echidna fake-negative-control'; exit 0; fi +case ${FAKE_MODE:?} in + malformed) echo '{' ;; + unknown) jq -cn --arg goal "$2" '{schema:"echidna.prove.result/1",status:"unknown",prover:"Coq",goal:$goal,trust:{axioms:[],confidence:null}}' ;; + no-proof) jq -cn --arg goal "$2" '{schema:"echidna.prove.result/1",status:"verified",prover:"Coq",goal:$goal,trust:{axioms:[],confidence:null}}' ;; + corrupt) + "$REAL_ECHIDNA" "$@" + printf 'corrupted compiled proof\n' > "${2%.v}.vo" + ;; + *) exit 2 ;; +esac +SH +chmod +x "$work/fake-echidna" +for mode in malformed unknown no-proof corrupt; do + case $mode in + malformed|unknown) reason='malformed, non-verified or assumption-bearing' ;; + no-proof) reason='produced no compiled proof' ;; + corrupt) reason='independent compiled-proof check failed' ;; + *) exit 2 ;; + esac + reject "$mode" "$reason" env REAL_ECHIDNA="$ECHIDNA" ECHIDNA="$work/fake-echidna" FAKE_MODE="$mode" \ + bash "$replay" "$pilot/increment.zig" "$work/good.v" "$work/$mode" +done +# This control demonstrates why coqchk alone cannot discharge the no-axioms +# obligation: an admitted theorem compiles and checks, but is not closed. +mkdir "$work/axiom-control" +printf 'Theorem admitted_control : False. Admitted.\nPrint Assumptions admitted_control.\n' > "$work/axiom-control/Control.v" +( + cd "$work/axiom-control" + timeout -k 5 120 "$COQC" -q Control.v > assumptions.txt 2> assumptions.stderr + timeout -k 5 120 "$COQCHK" -silent -Q . '' Control > coqchk.txt 2>&1 + grep -q '^Axioms:' assumptions.txt + ! grep -q '^Closed under the global context$' assumptions.txt +) +echo 'REPLAY GATE PASS: two source-derived models checked, 10 rejection controls, axiom control; INCOMPLETE' diff --git a/scripts/atoma-replay.sh b/scripts/atoma-replay.sh new file mode 100644 index 00000000..6801fdd0 --- /dev/null +++ b/scripts/atoma-replay.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell +# Replay the closed u8 model. Never issues a COMPLETE receipt. +set -euo pipefail +[[ $# == 3 ]] || { echo 'usage: atoma-replay.sh SOURCE PROOF NEW_EVIDENCE_DIRECTORY' >&2; exit 2; } +root=$(cd "$(dirname "$0")/.." && pwd) +export ATOMA=${ATOMA:-$root/tools/atoma/zig-out/bin/atoma} +export ECHIDNA=${ECHIDNA:-echidna} COQC=${COQC:-coqc} COQCHK=${COQCHK:-coqchk} +fail() { echo "REPLAY-REFUSED: $*" >&2; exit 1; } +for tool in "$ATOMA" "$ECHIDNA" "$COQC" "$COQCHK" jq timeout sha256sum; do + command -v "$tool" >/dev/null || fail "missing tool: $tool" +done +# The pinned ECHIDNA Coq backend invokes coqc by name. Audit that exact +# compiler, even when a caller supplies COQC as an absolute path. +[[ $(realpath "$(command -v coqc)") == $(realpath "$(command -v "$COQC")") ]] \ + || fail 'COQC differs from the compiler ECHIDNA will invoke' +source_path=$(realpath "$1") +proof_path=$(realpath "$2") +out=$(realpath -m "$3") +# No pre-existing .vo, receipt, or cached result may contribute to this run. +mkdir "$out" || fail 'evidence directory must be new' +cp "$source_path" "$out/source.zig" +cp "$proof_path" "$out/AtomaProof.v" +"$ATOMA" source-coq "$out/source.zig" > "$out/regenerated.v" +cmp -s "$out/AtomaProof.v" "$out/regenerated.v" || fail 'proof does not match current source and emitter' +cd "$out" +"$COQC" --version > coqc-version.txt +"$COQCHK" --version > coqchk-version.txt +"$ECHIDNA" --version > echidna-version.txt +case $(head -n 1 coqc-version.txt) in + 'The Coq Proof Assistant, version 8.18.0'|'The Rocq Prover, version 9.2') ;; + *) fail 'unsupported Coq/Rocq profile' ;; +esac +# ECHIDNA's backend compiles this exact source file. Its JSON verdict alone +# does not certify a proof or the absence of assumptions. +timeout -k 5 120 "$ECHIDNA" prove "$out/AtomaProof.v" --prover coq --timeout 90 --output json \ + > echidna.json 2> echidna.stderr || fail 'ECHIDNA did not verify the obligation' +jq -e -s --arg goal "$out/AtomaProof.v" ' + length == 1 and (.[0] | .schema == "echidna.prove.result/1" and + .status == "verified" and .prover == "Coq" and .goal == $goal and + .trust.axioms == [] and .trust.confidence == null)' echidna.json >/dev/null \ + || fail 'malformed, non-verified or assumption-bearing ECHIDNA result' +[[ -s AtomaProof.vo ]] || fail 'ECHIDNA produced no compiled proof' +# Check the actual compiled library, recursively, with no -admit/-norec. +timeout -k 5 120 "$COQCHK" -silent -Q . '' AtomaProof > coqchk.txt 2>&1 \ + || fail 'independent compiled-proof check failed' +# coqchk permits axioms. Require this particular theorem to have none. +cat > Audit.v <<'COQ' +Require Import AtomaProof. +Check (atoma_u8 : forall x : nat, x < 256 -> body x = specification x). +Print Assumptions atoma_u8. +COQ +timeout -k 5 120 "$COQC" -q -Q . '' Audit.v > assumptions.txt 2> assumptions.stderr \ + || fail 'theorem type or assumption audit failed' +[[ $(grep -c '^Closed under the global context$' assumptions.txt) == 1 ]] \ + || fail 'the theorem is not closed under the global context' +! grep -q '^Axioms:' assumptions.txt || fail 'axioms in theorem closure' +cmp -s "$source_path" source.zig || fail 'source changed during replay' +cmp -s "$proof_path" AtomaProof.v || fail 'proof changed during replay' +cmp -s AtomaProof.v regenerated.v || fail 'proof was changed by a subprocess' +sha256sum source.zig AtomaProof.v AtomaProof.vo Audit.v Audit.vo echidna.json \ + coqchk.txt assumptions.txt coqc-version.txt coqchk-version.txt echidna-version.txt > inputs.sha256 +for tool in "$ATOMA" "$ECHIDNA" "$COQC" "$COQCHK"; do + sha256sum "$(command -v "$tool")" +done > tools.sha256 +source_digest=$(sha256sum source.zig | cut -d ' ' -f 1) +proof_digest=$(sha256sum AtomaProof.v | cut -d ' ' -f 1) +jq -cnS --arg source "$source_digest" --arg proof "$proof_digest" \ + '{schema:"atoma.replay.u8/1",status:"INCOMPLETE",scope:"source-derived finite u8 model", + source_sha256:$source,proof_sha256:$proof,echidna:"verified",coqchk:"checked", + assumptions:[],refinement:"unproved"}' > receipt.json.tmp +mv receipt.json.tmp receipt.json +echo 'REPLAY-MODEL-CHECKED: ECHIDNA + coqchk; INCOMPLETE, Zig refinement unproved' diff --git a/tools/atoma/src/main.zig b/tools/atoma/src/main.zig index bfc2be89..9f0ff114 100644 --- a/tools/atoma/src/main.zig +++ b/tools/atoma/src/main.zig @@ -71,7 +71,7 @@ fn sourceReport(comptime fmt: []const u8, args: anytype) void { } fn usage() noreturn { - sayLine("usage: atoma [args]"); + sayLine("usage: atoma [args]"); std.process.exit(2); } @@ -85,7 +85,7 @@ pub fn main() !void { if (args.len < 2) usage(); const cmd = args[1]; - if (std.mem.eql(u8, cmd, "source-vc") or std.mem.eql(u8, cmd, "source-check")) { + if (std.mem.eql(u8, cmd, "source-vc") or std.mem.eql(u8, cmd, "source-coq") or std.mem.eql(u8, cmd, "source-check")) { if (args.len != 3) usage(); const src = readFile(args[2]) catch |e| { print("SOURCE-IO-ERROR {s}: {s}\n", .{ args[2], @errorName(e) }); @@ -98,10 +98,11 @@ pub fn main() !void { else => @as(u8, 1), }); }; - if (std.mem.eql(u8, cmd, "source-vc")) { + if (!std.mem.eql(u8, cmd, "source-check")) { var out = std.Io.Writer.Allocating.init(gpa); defer out.deinit(); - p.emit(&out.writer) catch |e| { + const emitted = if (std.mem.eql(u8, cmd, "source-coq")) p.emitCoq(&out.writer) else p.emit(&out.writer); + emitted catch |e| { std.debug.print("SOURCE-IO-ERROR: {s}\n", .{@errorName(e)}); std.process.exit(3); }; diff --git a/tools/atoma/src/source.zig b/tools/atoma/src/source.zig index fd36c357..2026e164 100644 --- a/tools/atoma/src/source.zig +++ b/tools/atoma/src/source.zig @@ -28,6 +28,14 @@ pub const Expr = union(enum) { .add_wrap => |n| try w.print("(bvadd x (_ bv{d} 8))", .{n}), } } + + fn coq(self: Expr, w: *std.Io.Writer) !void { + switch (self) { + .input => try w.writeAll("x"), + .literal => |n| try w.print("{d}", .{n}), + .add_wrap => |n| try w.print("(x + {d}) mod 256", .{n}), + } + } }; pub const Program = struct { @@ -50,6 +58,34 @@ pub const Program = struct { try self.body.smt(w); try w.print(" (bvadd x (_ bv{d} 8)))))\n(check-sat)\n", .{self.ensures_add}); } + + /// A closed finite-model theorem, not a Zig/compiler refinement proof or + /// a translation of a solver certificate. A wrong body emits a false + /// obligation that Coq must reject; no evaluator verdict selects the proof. + pub fn emitCoq(self: Program, w: *std.Io.Writer) !void { + const hash = std.fmt.bytesToHex(self.source_hash, .lower); + try w.print("(* atoma.source.u8.coq.v1 source-blake3:{s} *)\n", .{hash}); + try w.writeAll("From Coq Require Import Arith List Bool.\nDefinition body (x : nat) : nat := "); + try self.body.coq(w); + try w.print(".\nDefinition specification (x : nat) : nat := (x + {d}) mod 256.\n", .{self.ensures_add}); + try w.writeAll( + \\Definition domain_check : bool := + \\ forallb (fun x => Nat.eqb (body x) (specification x)) (seq 0 256). + \\Lemma domain_checked : domain_check = true. + \\Proof. vm_compute. reflexivity. Qed. + \\Theorem atoma_u8 : forall x : nat, x < 256 -> body x = specification x. + \\Proof. + \\ intros x Hx. apply Nat.eqb_eq. + \\ assert (Hin : In x (seq 0 256)). + \\ { apply in_seq. split; [apply Nat.le_0_l | exact Hx]. } + \\ pose proof domain_checked as H. + \\ unfold domain_check in H. rewrite forallb_forall in H. + \\ exact (H x Hin). + \\Qed. + \\Print Assumptions atoma_u8. + \\ + ); + } }; const Cursor = struct { From a31b724d0fa928b12de1ced6d34c19b0fe49cc9f Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Sat, 7 Nov 2026 20:26:38 +0000 Subject: [PATCH 5/7] Create the evidence parent for standalone replay gate runs Make the documented standalone replay command work in a fresh checkout after building the CLI. A failed directory creation still exits nonzero; each individual evidence directory must still be new. Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> --- scripts/atoma-replay-gate.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/atoma-replay-gate.sh b/scripts/atoma-replay-gate.sh index 17f13612..b29ea393 100644 --- a/scripts/atoma-replay-gate.sh +++ b/scripts/atoma-replay-gate.sh @@ -6,6 +6,7 @@ root=$(cd "$(dirname "$0")/.." && pwd) cd "$root" export ATOMA=${ATOMA:-$root/tools/atoma/zig-out/bin/atoma} export ECHIDNA=${ECHIDNA:-echidna} COQC=${COQC:-coqc} COQCHK=${COQCHK:-coqchk} +mkdir -p "$root/build/atoma-evidence" work=$(mktemp -d "$root/build/atoma-evidence/replay.XXXXXX") pilot="$root/examples/atoma/source-u8" replay="$root/scripts/atoma-replay.sh" From 18f0e42ff87227cb166e190e30adb276b9e2aca5 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Sat, 7 Nov 2026 20:47:24 +0000 Subject: [PATCH 6/7] Bind the returned compiled theorem to the source-derived statement Restate the expected theorem directly from the Zig source and reject a valid compiled theorem for the wrong model. The complete local gate passes two positive models, eleven replay rejection controls and the independent axiom control. Update proof evidence and generated identity to preserve the explicit unproved refinement boundary. Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> --- CLAUDE.md | 8 ++++---- atoma_chora.deed | 6 +++--- docs/audit/2026-11-07-source-replay.adoc | 8 ++++++-- .../identity-assumptions.txt | 4 ++-- .../increment-assumptions.txt | 4 ++-- .../audit/2026-11-07-source-replay/local-gate.txt | 3 ++- .../2026-11-07-source-replay/local-inputs.sha256 | 10 +++++----- .../wrong-library-rejected.txt | 11 +++++++++++ scripts/atoma-gate-falsifiers.sh | 4 ++-- scripts/atoma-replay-gate.sh | 13 +++++++++++-- scripts/atoma-replay.sh | 15 +++++++++------ tools/atoma/src/main.zig | 6 +++--- tools/atoma/src/source.zig | 10 ++++++++++ 13 files changed, 70 insertions(+), 32 deletions(-) create mode 100644 docs/audit/2026-11-07-source-replay/wrong-library-rejected.txt diff --git a/CLAUDE.md b/CLAUDE.md index badf3dad..6070b03d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell - + # You are in the hyperpolymath estate — orient before acting @@ -63,14 +63,14 @@ Put every question that needs the owner's decision through the selector (the Ask # This repo: `atoma` · clade `fv-atoma` - **Identity** — uuid `#u5"github.com/hyperpolymath/atoma"`; clade `fv` (secondary ``); born 2026-10-22; forge `hyperpolymath/atoma`. -- **IS** — Experimental source-bound verification for an explicitly closed Zig subset. Solver, model and compiled-test evidence remain distinct from independent proof replay. +- **IS** — Experimental source-bound obligations and finite-model proof replay for an explicitly closed Zig subset. Source/compiler refinement remains unproved. - **IS-NOT** — a general Zig soundness certificate · a production verifier · a repository template · an ECHIDNA replacement -- **Where it sits** — pipeline position **language-verification**; chain `Zig source and contracts -> Atoma obligations -> ECHIDNA proof exchange and independent replay (planned)`; coordination = `echidna`. +- **Where it sits** — pipeline position **language-verification**; chain `Zig source and contracts -> Atoma finite-model proof -> ECHIDNA/Coq replay (experimental); full kernel chain planned`; coordination = `echidna`. - **Constraints here** (AGENTIC) — fail-closed; evidence-per-step; no-silent-skip; rerun-after-fix; release-claim-requires-hard-pass. Never: banned langs (above), secrets, state files in repo root, AGPL. Details: the deed's `(bot-directives (methodology) (coverage) (debt))` clauses. - **Golden path** (ANCHOR) — `just test && just quality` → Core tests pass; Quality gates pass; No unresolved critical security findings. - **State** — phase active; maturity experimental. Milestones and next actions: `docs/status/ROADMAP.adoc`. - + ## Estate-Wide Format Migration Directives diff --git a/atoma_chora.deed b/atoma_chora.deed index fdb09d83..33589ff6 100644 --- a/atoma_chora.deed +++ b/atoma_chora.deed @@ -124,12 +124,12 @@ :project "atoma" :ecosystem "hyperpolymath" :position-type "verification-tool" - :purpose "Experimental source-bound verification for an explicitly closed Zig subset. Solver, model and compiled-test evidence remain distinct from independent proof replay." + :purpose "Experimental source-bound obligations and finite-model proof replay for an explicitly closed Zig subset. Source/compiler refinement remains unproved." :not ("a general Zig soundness certificate" "a production verifier" "a repository template" "an ECHIDNA replacement") :pipeline-position "language-verification" - :chain "Zig source and contracts -> Atoma obligations -> ECHIDNA proof exchange and independent replay (planned)" + :chain "Zig source and contracts -> Atoma finite-model proof -> ECHIDNA/Coq replay (experimental); full kernel chain planned" :coordination echidna - (related :name "echidna" :relationship proof-exchange :notes "Planned obligation dispatch and replay; integration is not yet demonstrated.") + (related :name "echidna" :relationship proof-exchange :notes "Real Coq backend exercised by the finite-u8 replay gate; general exchange and cross-kernel translation remain planned.") (related :name "standards" :relationship standard-source :notes "Estate policy and required verification boundaries; canonical repository metadatastician/standards.") (related :name "quintessence" :relationship sibling-verifier :notes "Elixir verification; possible shared Zig native-boundary evidence.") (related :name "Apodeixis.jl" :relationship sibling-verifier :notes "Julia verification; possible shared proof evidence interfaces.") diff --git a/docs/audit/2026-11-07-source-replay.adoc b/docs/audit/2026-11-07-source-replay.adoc index 36ff31aa..ea9b833a 100644 --- a/docs/audit/2026-11-07-source-replay.adoc +++ b/docs/audit/2026-11-07-source-replay.adoc @@ -19,7 +19,9 @@ profiles; their environment evidence must not be described as identical. The real ECHIDNA `prove --output json` command compiles the exact generated file. A separate `coqchk` process checks its compiled library recursively. -An importing audit checks the theorem's type and requires `Print Assumptions` +An importing audit restates the expected theorem directly from the source +with `source-coq-audit`, rather than trusting definitions inside the returned +library. It requires `Print Assumptions` to report a closed context. The Coq backend invokes `coqc` by name; the adapter checks that this is the same compiler it records in the tool manifest. @@ -27,7 +29,9 @@ Local replay controls passed for wrapping increment and identity. Rejections cover a wrong body, a constant body, stale source, an admitted replacement, a missing checker, an existing evidence directory, malformed JSON, unknown, a fake verified result without a compiled proof, and a corrupted compiled -proof. A separate admitted-theorem control compiles and passes `coqchk` but +proof, and a valid compiled proof of the wrong model while the expected proof +source is left intact. The last control catches self-referential audits that +only check a returned library against its own definitions. A separate admitted-theorem control compiles and passes `coqchk` but reports an axiom, demonstrating why the closure check is necessary. Hosted results must be read from the exact PR head; local evidence alone is diff --git a/docs/audit/2026-11-07-source-replay/identity-assumptions.txt b/docs/audit/2026-11-07-source-replay/identity-assumptions.txt index 2abd4eff..b7c851e5 100644 --- a/docs/audit/2026-11-07-source-replay/identity-assumptions.txt +++ b/docs/audit/2026-11-07-source-replay/identity-assumptions.txt @@ -1,3 +1,3 @@ -atoma_u8 : forall x : nat, x < 256 -> body x = specification x - : forall x : nat, x < 256 -> body x = specification x +atoma_u8 : forall x : nat, x < 256 -> x = (x + 0) mod 256 + : forall x : nat, x < 256 -> x = (x + 0) mod 256 Closed under the global context diff --git a/docs/audit/2026-11-07-source-replay/increment-assumptions.txt b/docs/audit/2026-11-07-source-replay/increment-assumptions.txt index 2abd4eff..117abd62 100644 --- a/docs/audit/2026-11-07-source-replay/increment-assumptions.txt +++ b/docs/audit/2026-11-07-source-replay/increment-assumptions.txt @@ -1,3 +1,3 @@ -atoma_u8 : forall x : nat, x < 256 -> body x = specification x - : forall x : nat, x < 256 -> body x = specification x +atoma_u8 : forall x : nat, x < 256 -> (x + 1) mod 256 = (x + 1) mod 256 + : forall x : nat, x < 256 -> (x + 1) mod 256 = (x + 1) mod 256 Closed under the global context diff --git a/docs/audit/2026-11-07-source-replay/local-gate.txt b/docs/audit/2026-11-07-source-replay/local-gate.txt index db9904df..e5c91b9f 100644 --- a/docs/audit/2026-11-07-source-replay/local-gate.txt +++ b/docs/audit/2026-11-07-source-replay/local-gate.txt @@ -55,5 +55,6 @@ REPLAY-FALSIFIER-KILLED malformed REPLAY-FALSIFIER-KILLED unknown REPLAY-FALSIFIER-KILLED no-proof REPLAY-FALSIFIER-KILLED corrupt -REPLAY GATE PASS: two source-derived models checked, 10 rejection controls, axiom control; INCOMPLETE +REPLAY-FALSIFIER-KILLED wrong-library +REPLAY GATE PASS: two source-derived models checked, 11 rejection controls, axiom control; INCOMPLETE ATOMA GATE PASS — INCOMPLETE (Warrant); finite-model replay checked, program refinement unproved diff --git a/docs/audit/2026-11-07-source-replay/local-inputs.sha256 b/docs/audit/2026-11-07-source-replay/local-inputs.sha256 index 770ecafc..e9a0d0a1 100644 --- a/docs/audit/2026-11-07-source-replay/local-inputs.sha256 +++ b/docs/audit/2026-11-07-source-replay/local-inputs.sha256 @@ -13,8 +13,8 @@ d96d491575b4aa98344b2c408742b4192a3614b597b8d7d1f46ffac3685c1d24 examples/atoma 605f194214cabbf703961c21b0ddb9e30465b895a9a4dc78351e08cfdce8276d examples/atoma/source-u8/wrong-body.zig 9a8b2000096ec3214899d822e11a4ad060b30515bb11865c70478f1057bb0fdf tools/atoma/src/canon.zig 1ae7f5e849324945e126c928111c78a42de3f6e14c3b24ab0de035752b4916a8 tools/atoma/src/frontend.zig -2b6a9cb91dbb9c0efc1ec558bf37177bfaf83cb0fd3806a69857b3105b799983 tools/atoma/src/main.zig -9f1d89990d310f6d49eb87f841358b3e3bc4385d2e24013c261ef1d87061f29b tools/atoma/src/source.zig +c9ad5d9f3e47b4127b922641c05ce7da7c7d84b9225d65f721066e98606e4457 tools/atoma/src/main.zig +679278f11b162256d3f3b9d8873c9738f6aa510d2cd894f6ed4a91f4287aede1 tools/atoma/src/source.zig 7bcb0cb5fe70f391e5b3a0c55fc5fd3325657943148090fd3cf7dbeb5b8240c9 tools/atoma/src/vc.zig a060c98d92d78795186ad5b22e50a664efdc7e0fd618cedc09f889e14d8ff5cd verification/atoma/agda/Bv.agda 97c4e2e52364c0f1d8fef12a33e091ceb4f4cea9ae030d231651127d2390d3e5 verification/atoma/agda/Core.agda @@ -25,10 +25,10 @@ b0eac35d5b00bef70a4927ccb68111dcc684f5df17ffad6b613ab977fe0f57d8 tools/atoma/bu 9259c3bf44be3182cd9f3d2206c72f215b2f41b33feddbbeb602b1efddee4c9f scripts/atoma-check-idris.sh 1798c74bba5da08d830f5ade38fd79881e4dc27f23b5b53e08205cc4cf1bf882 scripts/atoma-ci-replay-toolchain.sh f17d862442291100bbfef0073925143a21a52aa1bc84fa8072a56584754b1df1 scripts/atoma-ci-toolchain.sh -1b0d43c3f2024971447c5f7d789be0f1ee0ad887f7ab31c54eef26078bebe306 scripts/atoma-gate-falsifiers.sh +f7bcacdf76a3e5230d532180902e3098e598dd6882d889f8f6b631efc6f01f06 scripts/atoma-gate-falsifiers.sh c9d07e6aa84ab94ac4afe765821b1d73f8fa4071afea6110415f4147b6e862a5 scripts/atoma-gate.sh -92fb4bc49d81a354a208ee6c6c7cd73c712666a928d62bfed5862764421a410f scripts/atoma-replay-gate.sh -7f0acfb1b53b11f8f72de7f9ae671a3f7d84d696139219c2ac79ffdc70072ebd scripts/atoma-replay.sh +1e4e7492b6994654bc5c0a396a3ff49c55d8b3b6d7abbb159b44f79f9bb73088 scripts/atoma-replay-gate.sh +6d6e11c3e5761c94209046969e6d9348eb455cc91dcaf06fe3f3af5c49898cd9 scripts/atoma-replay.sh eedd113fdef194f42ee2ae9187f2d5b03476b91072fa5b8957511a8da4b5d0d4 examples/atoma/frame-v1/verify.sh 358cd904557a41b5c30cdfe9dcd67451ccac31c7cd09b5b2bd6c339023fded46 verification/proofs/agda/MANIFEST f4d5954e01a91cc3f7911cd36a5eb699c5b3f62a4c457613e2147899a601a33d verification/proofs/idris2/MANIFEST diff --git a/docs/audit/2026-11-07-source-replay/wrong-library-rejected.txt b/docs/audit/2026-11-07-source-replay/wrong-library-rejected.txt new file mode 100644 index 00000000..d32dc8a4 --- /dev/null +++ b/docs/audit/2026-11-07-source-replay/wrong-library-rejected.txt @@ -0,0 +1,11 @@ +File "./Audit.v", line 2, characters 5-8: +Warning: "From Coq" has been replaced by "From Stdlib". +[deprecated-from-Coq,deprecated-since-9.0,deprecated,default] +File "./Audit.v", line 4, characters 7-26: +Error: +The term "atoma_u8" has type + "forall x : nat, x < 256 -> body x = specification x" +while it is expected to have type + "forall x : nat, x < 256 -> (x + 1) mod 256 = (x + 1) mod 256" +(cannot unify "body x = specification x" and +"(x + 1) mod 256 = (x + 1) mod 256"). diff --git a/scripts/atoma-gate-falsifiers.sh b/scripts/atoma-gate-falsifiers.sh index 34f1e68f..af2dfa88 100644 --- a/scripts/atoma-gate-falsifiers.sh +++ b/scripts/atoma-gate-falsifiers.sh @@ -47,14 +47,14 @@ echo 'falsifier PASS solver stdout cannot hide a failed process' atoma="$root/tools/atoma/zig-out/bin/atoma" printf 'export fn broken(' > "$tmp/syntax.zig" truncate -s 16777217 "$tmp/too-large.zig" -for command in source-check source-vc source-coq; do +for command in source-check source-vc source-coq source-coq-audit; do for input in absent.zig syntax.zig too-large.zig; do rc=0 "$atoma" "$command" "$tmp/$input" > "$tmp/out" 2>&1 || rc=$? [[ "$rc" == 3 ]] || { echo "FAIL $command $input exit=$rc, expected I/O/parse exit 3" >&2; exit 1; } done done -for command in source-check source-vc source-coq; do +for command in source-check source-vc source-coq source-coq-audit; do rc=0 "$atoma" "$command" "$root/examples/atoma/source-u8/increment.zig" > /dev/full 2> "$tmp/out" || rc=$? [[ "$rc" == 3 ]] || { echo "FAIL $command output write error exit=$rc, expected 3" >&2; exit 1; } diff --git a/scripts/atoma-replay-gate.sh b/scripts/atoma-replay-gate.sh index b29ea393..d4761b95 100644 --- a/scripts/atoma-replay-gate.sh +++ b/scripts/atoma-replay-gate.sh @@ -49,15 +49,24 @@ case ${FAKE_MODE:?} in "$REAL_ECHIDNA" "$@" printf 'corrupted compiled proof\n' > "${2%.v}.vo" ;; + wrong-library) + cp "$2" "$2.original" + # Both sides change, so this is a valid closed theorem, but for the + # wrong source model. Restore the expected .v after compiling it. + sed 's/(x + 1) mod 256/(x + 2) mod 256/g' "$2.original" > "$2" + "$REAL_ECHIDNA" "$@" + mv "$2.original" "$2" + ;; *) exit 2 ;; esac SH chmod +x "$work/fake-echidna" -for mode in malformed unknown no-proof corrupt; do +for mode in malformed unknown no-proof corrupt wrong-library; do case $mode in malformed|unknown) reason='malformed, non-verified or assumption-bearing' ;; no-proof) reason='produced no compiled proof' ;; corrupt) reason='independent compiled-proof check failed' ;; + wrong-library) reason='theorem type or assumption audit failed' ;; *) exit 2 ;; esac reject "$mode" "$reason" env REAL_ECHIDNA="$ECHIDNA" ECHIDNA="$work/fake-echidna" FAKE_MODE="$mode" \ @@ -74,4 +83,4 @@ printf 'Theorem admitted_control : False. Admitted.\nPrint Assumptions admitted_ grep -q '^Axioms:' assumptions.txt ! grep -q '^Closed under the global context$' assumptions.txt ) -echo 'REPLAY GATE PASS: two source-derived models checked, 10 rejection controls, axiom control; INCOMPLETE' +echo 'REPLAY GATE PASS: two source-derived models checked, 11 rejection controls, axiom control; INCOMPLETE' diff --git a/scripts/atoma-replay.sh b/scripts/atoma-replay.sh index 6801fdd0..a0027a6c 100644 --- a/scripts/atoma-replay.sh +++ b/scripts/atoma-replay.sh @@ -11,6 +11,10 @@ fail() { echo "REPLAY-REFUSED: $*" >&2; exit 1; } for tool in "$ATOMA" "$ECHIDNA" "$COQC" "$COQCHK" jq timeout sha256sum; do command -v "$tool" >/dev/null || fail "missing tool: $tool" done +ATOMA=$(realpath "$(command -v "$ATOMA")") +ECHIDNA=$(realpath "$(command -v "$ECHIDNA")") +COQC=$(realpath "$(command -v "$COQC")") +COQCHK=$(realpath "$(command -v "$COQCHK")") # The pinned ECHIDNA Coq backend invokes coqc by name. Audit that exact # compiler, even when a caller supplies COQC as an absolute path. [[ $(realpath "$(command -v coqc)") == $(realpath "$(command -v "$COQC")") ]] \ @@ -45,12 +49,11 @@ jq -e -s --arg goal "$out/AtomaProof.v" ' # Check the actual compiled library, recursively, with no -admit/-norec. timeout -k 5 120 "$COQCHK" -silent -Q . '' AtomaProof > coqchk.txt 2>&1 \ || fail 'independent compiled-proof check failed' -# coqchk permits axioms. Require this particular theorem to have none. -cat > Audit.v <<'COQ' -Require Import AtomaProof. -Check (atoma_u8 : forall x : nat, x < 256 -> body x = specification x). -Print Assumptions atoma_u8. -COQ +# Restate the expected theorem from the source snapshot, never by trusting +# body/specification definitions in the returned .vo. A valid proof of a +# different model must fail even if the backend leaves the expected .v intact. +# coqchk also permits axioms, so audit this theorem's full assumption closure. +"$ATOMA" source-coq-audit source.zig > Audit.v timeout -k 5 120 "$COQC" -q -Q . '' Audit.v > assumptions.txt 2> assumptions.stderr \ || fail 'theorem type or assumption audit failed' [[ $(grep -c '^Closed under the global context$' assumptions.txt) == 1 ]] \ diff --git a/tools/atoma/src/main.zig b/tools/atoma/src/main.zig index 9f0ff114..5226f814 100644 --- a/tools/atoma/src/main.zig +++ b/tools/atoma/src/main.zig @@ -71,7 +71,7 @@ fn sourceReport(comptime fmt: []const u8, args: anytype) void { } fn usage() noreturn { - sayLine("usage: atoma [args]"); + sayLine("usage: atoma [args]"); std.process.exit(2); } @@ -85,7 +85,7 @@ pub fn main() !void { if (args.len < 2) usage(); const cmd = args[1]; - if (std.mem.eql(u8, cmd, "source-vc") or std.mem.eql(u8, cmd, "source-coq") or std.mem.eql(u8, cmd, "source-check")) { + if (std.mem.eql(u8, cmd, "source-vc") or std.mem.eql(u8, cmd, "source-coq") or std.mem.eql(u8, cmd, "source-coq-audit") or std.mem.eql(u8, cmd, "source-check")) { if (args.len != 3) usage(); const src = readFile(args[2]) catch |e| { print("SOURCE-IO-ERROR {s}: {s}\n", .{ args[2], @errorName(e) }); @@ -101,7 +101,7 @@ pub fn main() !void { if (!std.mem.eql(u8, cmd, "source-check")) { var out = std.Io.Writer.Allocating.init(gpa); defer out.deinit(); - const emitted = if (std.mem.eql(u8, cmd, "source-coq")) p.emitCoq(&out.writer) else p.emit(&out.writer); + const emitted = if (std.mem.eql(u8, cmd, "source-coq")) p.emitCoq(&out.writer) else if (std.mem.eql(u8, cmd, "source-coq-audit")) p.emitCoqAudit(&out.writer) else p.emit(&out.writer); emitted catch |e| { std.debug.print("SOURCE-IO-ERROR: {s}\n", .{@errorName(e)}); std.process.exit(3); diff --git a/tools/atoma/src/source.zig b/tools/atoma/src/source.zig index 2026e164..cb722961 100644 --- a/tools/atoma/src/source.zig +++ b/tools/atoma/src/source.zig @@ -86,6 +86,16 @@ pub const Program = struct { \\ ); } + + /// Restate the expected theorem from source. Referring to body/specification + /// inside the returned library would only check that library against itself. + pub fn emitCoqAudit(self: Program, w: *std.Io.Writer) !void { + const hash = std.fmt.bytesToHex(self.source_hash, .lower); + try w.print("(* atoma.source.u8.audit.v1 source-blake3:{s} *)\n", .{hash}); + try w.writeAll("From Coq Require Import Arith.\nRequire Import AtomaProof.\nCheck (AtomaProof.atoma_u8 : forall x : nat, x < 256 -> "); + try self.body.coq(w); + try w.print(" = (x + {d}) mod 256).\nPrint Assumptions AtomaProof.atoma_u8.\n", .{self.ensures_add}); + } }; const Cursor = struct { From d94a1e062832626dbaa9d1cb3560d6250d4fb3e5 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Sat, 7 Nov 2026 20:54:03 +0000 Subject: [PATCH 7/7] Preserve the historical template mint provenance Restore the original canon 2.1.2 gates digest in the historical provenance clause while retaining canon 2.1.4 for the live audit. The complete provenance clause matches the original minted record byte for byte; generated arrival content remains unchanged. Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> --- atoma_chora.deed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atoma_chora.deed b/atoma_chora.deed index 33589ff6..9367d836 100644 --- a/atoma_chora.deed +++ b/atoma_chora.deed @@ -1088,7 +1088,7 @@ :extra-branches () :canon-version "2.1.2" :criteria-sha256 "6a5aa8857bd0d0d58ef48827938ca17c251b6b854dacf59d306388d61694d82a" - :gates-sha256 "2f31f46d4753432e0aa8c9c28f339e18e062c98dc6e6ef4ecbb76993cf37638b" + :gates-sha256 "e70efd2f53c9445e30da4baf770366f04a4a84ffd844a01426e587e565b53e6a" :archetype "" ; Which minting path actually ran (#201/#203 needed this signal). :minted-by "repo-init"