Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/atoma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
<!-- The region between the ARRIVAL-PACK markers is generated from this
repo's deed by `just claude-md` — do not hand-edit it. -->

<!-- ARRIVAL-PACK:BEGIN — estate-common @Manifesto:DRAFT-unratified · repo @deed:DEED@43fff49e4ef3 ANCHOR@c1206073e239 — generated by `just claude-md`, do not hand-edit -->
<!-- ARRIVAL-PACK:BEGIN — estate-common @Manifesto:DRAFT-unratified · repo @deed:DEED@533f61c6ea74 ANCHOR@c1206073e239 — generated by `just claude-md`, do not hand-edit -->

# You are in the hyperpolymath estate — orient before acting

Expand Down Expand Up @@ -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`.

<!-- ARRIVAL-PACK:END · provenance: DEED@43fff49e4ef3 ANCHOR@c1206073e239 · Manifesto@DRAFT-unratified · regenerate: `just claude-md` (k9 drift-detects; do not hand-edit above) -->
<!-- ARRIVAL-PACK:END · provenance: DEED@533f61c6ea74 ANCHOR@c1206073e239 · Manifesto@DRAFT-unratified · regenerate: `just claude-md` (k9 drift-detects; do not hand-edit above) -->

<!-- Hand-authored (owner, 2026-10-05): kept below the generated region so `just claude-md` does not overwrite it. -->
## Estate-Wide Format Migration Directives
Expand Down
14 changes: 9 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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`.

Expand All @@ -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.

Expand Down
6 changes: 3 additions & 3 deletions atoma_chora.deed
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
78 changes: 78 additions & 0 deletions docs/audit/2026-11-07-source-replay.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
= 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 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.

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, 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
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.
15 changes: 15 additions & 0 deletions docs/audit/2026-11-07-source-replay/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
= 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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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
60 changes: 60 additions & 0 deletions docs/audit/2026-11-07-source-replay/local-gate.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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-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
35 changes: 35 additions & 0 deletions docs/audit/2026-11-07-source-replay/local-inputs.sha256
Original file line number Diff line number Diff line change
@@ -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
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
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
f7bcacdf76a3e5230d532180902e3098e598dd6882d889f8f6b631efc6f01f06 scripts/atoma-gate-falsifiers.sh
c9d07e6aa84ab94ac4afe765821b1d73f8fa4071afea6110415f4147b6e862a5 scripts/atoma-gate.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
762fdabfc6752e57a41ab731b7e0c862502a2136f2b2b5f229f520ff08df0bd4 .github/workflows/atoma.yml
Loading
Loading