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
31 changes: 31 additions & 0 deletions .github/workflows/atoma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,39 @@ concurrency:
cancel-in-progress: true

jobs:
scalar:
name: Scalar source proof gate
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- name: Provision scalar proof profile
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends agda-bin=2.6.3-1build1 coq=8.18.0+dfsg-1build2 zstd
bash scripts/atoma-download-zig.sh "$RUNNER_TEMP/scalar-zig"
cd "$RUNNER_TEMP"
curl --proto '=https' --proto-redir '=https' --connect-timeout 20 --max-time 240 -fL --retry 1 https://github.com/leanprover/lean4/releases/download/v4.15.0/lean-4.15.0-linux.tar.zst -o scalar-lean.tar.zst
echo 'af71a2569a9f68337de2434829b3008cd8e32c436e9cb6bd8c84a2c2ba3585c9 scalar-lean.tar.zst' | sha256sum -c -
tar --zstd -xf scalar-lean.tar.zst
echo "$RUNNER_TEMP/lean-4.15.0-linux/bin" >> "$GITHUB_PATH"
mkdir -p "$GITHUB_WORKSPACE/build/scalar-proof-evidence"
sha256sum scalar-lean.tar.zst > "$GITHUB_WORKSPACE/build/scalar-proof-evidence/lean-archive.sha256"
- name: Agda then Lean and Coq, Cubical, source falsifiers
run: bash scripts/atoma-scalar-proof-gate.sh
- uses: actions/upload-artifact@v7.0.2
if: always()
with:
name: scalar-proof-evidence-${{ github.sha }}
path: build/scalar-proof-evidence/
if-no-files-found: error

soundness:
name: Atoma soundness gate
needs: [scalar]
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
Expand Down
31 changes: 29 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@

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.
specifications, Agda proofs of a store-free model, a finite u8 source pilot,
and a closed scalar source checker for real Proven and UAA helpers.
It is not yet a general sound verifier for Zig. Evidence remains
*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/ECHIDNA/Coq profiles in
Use Zig 0.15.2, Z3 4.13.3, Lean 4.15.0 and the Agda/Idris2/ECHIDNA/Coq profiles in
link:docs/decisions/ATOMA-TOOLCHAIN.adoc[the toolchain decision].
From the repository root:

[source,bash]
----
bash scripts/atoma-scalar-proof-gate.sh
bash scripts/atoma-gate.sh
----

Expand All @@ -31,6 +33,31 @@ 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`.

== Experimental scalar MVP

The hosted workflow requires the scalar proof gate before the soundness gate.
It checks strict compatible Agda, Lean/Coq finite reflection, full Cubical and
source falsifiers, then consumes the exact revisions in
`tests/consumer-scalar/consumers.tsv`. Proven's byte-word encoder and UAA's tag
classifier remain pure Zig; their authoritative contracts/oracles are Idris2.
Each helper is compared with a freshly compiled Idris table for all 256 inputs
in all four Zig optimization modes. Coq independently interprets the original
source bytes, followed by ECHIDNA compilation, coqchk and assumption audits.

For one admitted helper and a table containing exactly 256 `index value` rows:

[source,bash]
----
bash scripts/atoma-scalar-replay.sh helper.zig contract.tsv /tmp/new-scalar-evidence
----

The evidence directory must be new. `atoma scalar-coq` only exports a proof
capsule; successful export is not verification. A supplied table has no Idris
authority by itself: the consumer gate binds its fresh producer and inputs.
Whole-boundary receipts remain INCOMPLETE. This experimental scalar path does
not cover pointer leases, stateful wrappers or compiler refinement. See the
link:docs/decisions/ATOMA-SCALAR-SOURCE.adoc[admitted grammar and MVP acceptance].

== Current verification boundary

`tools/atoma` owns the command-line tooling and closed source pilot.
Expand Down
92 changes: 92 additions & 0 deletions docs/decisions/ATOMA-SCALAR-SOURCE.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
= Closed scalar source checking for the first experimental MVP
:revdate: 2026-11-24

Status: implementation under remote validation. Passing evidence must name
the exact commit and hosted run. This decision does not change COMPLETE,
the v1 gates, or the estate architecture: Idris2 defines ABI contracts;
foreign-facing FFI and API implementations are pure Zig.

== Why this slice

The earlier u8 replay checks a theorem about a model emitted by the Zig
frontend. A faulty frontend could emit a correct model for an incorrect body.
The new path sends original source bytes to a separate Coq parser and
interpreter. The Zig command only serializes bytes and a complete contract
table; it cannot supply the parser's answer or the interpreted expression.

The first actual sources are Proven's RefC byte-to-word marshaling helper and
UAA's protocol classifier. They are factored from the production Zig wrappers,
not rewritten application algorithms. Proven retains its SDK/target guard and
calls Idris for header semantics. UAA retains its registration table and
callback behavior. The helpers introduce no C FFI or C API implementation.
Idris's private RefC backend and a foreign C test caller remain separate.

== Admitted grammar and meaning

Each source contains exactly one public, non-exported pure function, one u8
parameter and one return expression. ASCII whitespace and line comments are
allowed. The alternatives are:

* A u64 shift/OR: `return (@as(u64, x) << S) | T;`, with decimal S at most 56
and T at most 255.
* A Boolean interval: `return x >= LO and x <= HI;`, with both bounds at most
255; Boolean results are represented as 0 or 1 in the contract table.

No imports, calls, pointers, state, additional declarations, generics, loops,
overflowing arithmetic or arbitrary comptime evaluation are admitted.
The Coq source interpreter defines the meaning used in this claim. Its proof
establishes every input below 256 agrees with the supplied table and every
result fits u64. It does not prove equivalence to the full Zig language or
compiler. Native compilation is an additional required consumer gate, so a
string accepted by the closed parser but rejected by Zig cannot pass that gate.

== Authority, replay and falsifiers

The consumer runner fetches exact commits from `tests/consumer-scalar/consumers.tsv`
and compiles an Idris oracle in a new directory with totality, warnings-as-errors
and a no-holes check. Proven's word-profile contract and UAA's existing finite
decoder supply all 256 rows. The compiler, primitive Bits8 conversion and RefC
execution remain trusted; an oracle run is not a theorem about Idris compilation.

An independent `od`/awk serializer compares source bytes and table literals
against the generated Coq capsule. ECHIDNA compiles the theorem; `coqchk`
rechecks it; a separately generated audit checks its type against fresh input
literals and prints its assumptions. The source-checker object is compiled
before dispatch and must remain unchanged afterward. Evidence binds sources,
contract, checker source/object, theorem, tools and replay results.

The actual helper is also compiled with Zig 0.15.2 in Debug, ReleaseSafe,
ReleaseFast and ReleaseSmall on the hosted native target. Every input must
match the fresh Idris oracle. Wrong shifts, tags, ranges, contracts, trailing
imports and stale capsules are refusal controls. Consumer mutations must
compile successfully and then fail both native comparison and proof replay.

Finite-reflection mathematics is developed in strict compatible Agda, re-proved
in Lean without Mathlib and instantiated in the Coq source checker. Full Cubical
checks a path-equality leg. These are related hand-written proofs, with statement
correspondence pending; Lean and Agda do not independently certify the Coq parser.
Cubical is not another independent kernel. No external verified-checker or
Mathesis admission claim is made. Generic finite reflection is established
mathematics, not a claim of a new result.

== Experimental MVP acceptance and remaining work

The scalar MVP requires a green exact-head remote gate, both pinned real
consumer helpers, fresh Idris tables, all-input native comparisons, kernel
replay, independent serialization and assumption audits, and intended negative
controls. It produces explicitly scoped evidence, with the whole-boundary
receipt still INCOMPLETE. Prototype implementation alone is not acceptance.

The next semantic milestone must cover a genuinely different boundary:
Proven's decode/call relation with pointer carriers and leases, and UAA's
registration/callback state and refusal behavior. Prove framing, ownership,
failure paths and source correspondence before admitting those constructs.
The scalar work does not discharge that milestone or reduce v1 to two helpers.
Compiler refinement, general import/call closure, runtime state, the complete
required checker chain and reproducible tool provisioning remain open.

Use extra reasoning effort for these semantic and trust-boundary decisions;
routine CI plumbing and documentation need less. All heavy validation is
hosted while the local resource hold remains in force.
9 changes: 9 additions & 0 deletions docs/decisions/ATOMA-TOOLCHAIN.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ the entire transitive system environment.
| 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
|===

The Zig downloader also permits HTTPS mirrors while retaining the exact same
archive SHA-256. Each transfer has a bounded timeout; an integrity mismatch is
fatal. Availability fallback does not admit a different compiler. Scalar proof
CI additionally pins Lean 4.15.0's release archive SHA-256 to
`af71a2569a9f68337de2434829b3008cd8e32c436e9cb6bd8c84a2c2ba3585c9`.
This is the official release URL's archive observed in hosted run
`45472034875`, not an independently published upstream signature. The whole
system/package closure remains outside the reproducibility claim.

Agda runs `--safe --without-K` and fresh interface checks in both profiles.
These flags do not prove that a Dedukti/CIC export exists. CI must demonstrate
the pinned release profile; a local pass on newer Idris/Agda is not substituted
Expand Down
17 changes: 16 additions & 1 deletion docs/plan/ULTRAPLAN.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
= Atoma — soundness-first plan to v1
:revdate: 2026-11-07
:revdate: 2026-11-24
:toc:

Atoma is experimental. The release objective is a useful verifier for an
Expand Down Expand Up @@ -45,6 +45,21 @@ The following gaps remain central:

== Definition of v1

The first experimental MVP is the closed scalar consumer path described in
link:../decisions/ATOMA-SCALAR-SOURCE.adoc[the scalar source decision]. Its first
complete hosted evidence is
https://github.com/hyperpolymath/atoma/actions/runs/45491963944[run 45491963944]
at `3ea192650d752da1e4dbb504c7fa2a6568778aed`: fresh Idris contracts, actual
Proven/UAA Zig helpers, all-input native comparisons, independent source
interpretation, kernel replay and negative controls. Later manifest-hardening
changes must also pass the required exact-head gate before merge.
Whole-boundary receipts remain INCOMPLETE.
This milestone precedes v1; it does not discharge memory, state, compiler
refinement or the full checker chain. #28 merged on 2026-11-24 after its required
soundness and CI checks passed; consumer source checking and its evidence are
in #30. Next, prove the full-word decoder relation and the registry state/effect
contract before extending source interpretation to calls, memory or ownership.

All applicable rows must pass on the release commit. They are conjunctive
gates, not a readiness percentage.

Expand Down
39 changes: 30 additions & 9 deletions docs/status/ROADMAP.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
= Atoma roadmap
:revdate: 2026-11-07
:revdate: 2026-11-24

The active link:../plan/ULTRAPLAN.adoc[v1 plan] owns milestone acceptance and
estimates. Atoma is experimental. There is no overall readiness percentage.
Expand All @@ -19,20 +19,41 @@ Identity/ownership repair instantiates the original RSR template provenance,
removes its production claims, and names `atoma_chora.deed`. The PR's current
head must independently pass hosted checks before merge.

== Next acceptance

* 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.
== Experimental scalar MVP and next acceptance

The immediate experimental MVP is scoped by
link:../decisions/ATOMA-SCALAR-SOURCE.adoc[the closed scalar source decision].
Complete hosted evidence was obtained at
`3ea192650d752da1e4dbb504c7fa2a6568778aed` in
https://github.com/hyperpolymath/atoma/actions/runs/45491963944[run 45491963944]:
both real consumers, every byte input in four Zig build modes, source replay,
closed assumptions and all five scalar replay attacks. Subsequent gate
hardening requires both consumers exactly once, validates complete manifest
records and requires completed evidence from each. Every PR head must pass
the required checks before merge. The implemented path connects
the actual Proven word encoder and UAA protocol classifier to fresh Idris2
contracts and independently interprets their source bytes in Coq. It leaves
pointer/ownership and stateful foreign-boundary obligations explicit.

* Proven: prove decoder acceptance iff the entire 64-bit word is a canonical
byte encoding, then bind the actual raw-word decoder source and its encoder
dependency. Immediate tagged words are not allocated objects; pointer-carrier
correspondence and later buffer leases remain separate obligations.
* UAA: prove state-preserving refusals, selected callback/context identity,
busy-state framing and restoration after a normally returning callback.
State the serialized access and borrowed-lifetime preconditions explicitly.
* Extend checked source interpretation to these operations, with an explicit
memory/alias counterexample before admitting pointer-bearing effects. The
ECHIDNA/coqchk path does not establish general Zig/compiler refinement.
* Second-language transfer spike before choosing the full sibling sequence.

Store, loops, permissions, compiler refinement and the complete required
kernel chain remain open. A passing scoped gate is not production readiness.

== Dogfooding status

The frame and u8 examples exercise the local verifier/tooling path. No external
consumer evidence window or broad CRG qualification has been established.
The frame and u8 examples exercise the local verifier/tooling path. Proven and
UAA now supply real scalar helpers and fresh Idris2 oracle evidence in hosted
CI. No production deployment window or broad CRG qualification is established.
The four inherited Idris ABI quarantines remain documented and excluded from
claims about checked implementations. See link:PROOF-STATUS.adoc[proof status].
4 changes: 2 additions & 2 deletions examples/atoma/frame-v1/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ bash "$root/scripts/atoma-check-idris.sh" || die "F0.1 Idris2 contract/extractio
atoma_tests=0
test_log=$(mktemp)
trap 'rm -f "$test_log"' EXIT
for m in canon frontend vc source; do
for m in canon frontend vc source scalar; do
"$ZIG" test "$root/tools/atoma/src/$m.zig" > "$test_log" 2>&1 || {
cat "$test_log" >&2; die "unit tests in $m.zig"
}
n=$(sed -n 's/^All \([0-9][0-9]*\) tests passed\.$/\1/p' "$test_log")
[ -n "$n" ] || die "cannot count the tests in $m.zig"
atoma_tests=$((atoma_tests + n))
done
printf 'atoma %s tests (canon + frontend + vc + source)\n' "$atoma_tests"
printf 'atoma %s tests (canon + frontend + vc + source + scalar)\n' "$atoma_tests"

cd "$here"

Expand Down
6 changes: 2 additions & 4 deletions scripts/atoma-ci-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ set -euo pipefail
: "${RUNNER_TEMP:?GitHub runner scratch directory required}"
: "${GITHUB_PATH:?GitHub PATH file required}"
task="$RUNNER_TEMP/atoma-toolchain"
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
mkdir -p "$task"
cd "$task"
sudo apt-get update
sudo apt-get install -y --no-install-recommends agda-bin=2.6.3-1build1 chezscheme build-essential libgmp-dev curl ca-certificates unzip xz-utils
curl --proto '=https' --proto-redir '=https' -fL --retry 3 https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz -o zig.tar.xz
echo '02aa270f183da276e5b5920b1dac44a63f1a49e55050ebde3aecc9eb82f93239 zig.tar.xz' | sha256sum -c -
tar -xf zig.tar.xz
echo "$task/zig-x86_64-linux-0.15.2" >> "$GITHUB_PATH"
bash "$root/scripts/atoma-download-zig.sh" "$task"
curl --proto '=https' --proto-redir '=https' -fL --retry 3 https://github.com/Z3Prover/z3/releases/download/z3-4.13.3/z3-4.13.3-x64-glibc-2.35.zip -o z3.zip
echo '32c7377026733c9d7b33c21cd77a68f50ba682367207b031a6bfd80140a8722f z3.zip' | sha256sum -c -
unzip -q z3.zip
Expand Down
19 changes: 19 additions & 0 deletions scripts/atoma-consumer-manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0
# Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
# Both real consumers are mandatory, exactly once, before any expensive work.
set -euo pipefail
[[ $# == 1 ]] || exit 2
declare -A seen=()
while read -r repo revision helper oracle extra || [[ -n ${repo:-} ]]; do
[[ $repo == \#* || -z $repo ]] && continue
case "$repo" in proven|unified-api-adapter) ;; *) echo 'Invalid consumer manifest: unknown repository' >&2; exit 1 ;; esac
[[ -z ${seen[$repo]:-} ]] || { echo 'Invalid consumer manifest: duplicate repository' >&2; exit 1; }
[[ -z ${extra:-} && $revision =~ ^[0-9a-f]{40}$ && -n $helper && -n $oracle ]] || {
echo 'Invalid consumer manifest: malformed row' >&2; exit 1;
}
seen[$repo]=1
done < "$1"
[[ ${seen[proven]:-} == 1 && ${seen[unified-api-adapter]:-} == 1 && ${#seen[@]} == 2 ]] || {
echo 'Invalid consumer manifest: both Proven and UAA are required' >&2; exit 1;
}
Loading
Loading