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
30 changes: 29 additions & 1 deletion .github/workflows/atoma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@ concurrency:
cancel-in-progress: true

jobs:
word_source:
name: Universal source interpretation
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- name: Provision independent Coq checker
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends coq=8.18.0+dfsg-1build2
- name: Guarded decoder and imported encoder source
run: bash scripts/atoma-word-source-proof-gate.sh
- name: Actual registry state-kernel source
if: success() || failure()
run: bash scripts/atoma-registry-source-proof-gate.sh
- uses: actions/upload-artifact@v7.0.2
if: always()
with:
name: word-source-proof-evidence-${{ github.sha }}
path: |
build/scalar-proof-evidence/word-source/
build/scalar-proof-evidence/registry-source/
if-no-files-found: error

scalar:
name: Scalar source proof gate
runs-on: ubuntu-24.04
Expand All @@ -41,6 +67,8 @@ jobs:
run: bash scripts/atoma-scalar-proof-gate.sh
- name: Universal decoder theory (Agda, Lean, Coq and Cubical)
run: bash scripts/atoma-word-proof-gate.sh
- name: Generic registry theory (compatible Agda, Lean and full Cubical)
run: bash scripts/atoma-registry-proof-gate.sh
- name: Preserve canonical repository map for review
run: |
bash scripts/gen-repo-map.sh .
Expand All @@ -54,7 +82,7 @@ jobs:

soundness:
name: Atoma soundness gate
needs: [scalar]
needs: [scalar, word_source]
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
Expand Down
84 changes: 84 additions & 0 deletions docs/decisions/ATOMA-BOUNDARY-SOURCE.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
= Decoder and registry source-binding milestone
:revdate: 2026-11-25

This milestone is experimental. A source interpretation theorem is not a theorem
about all Zig programs, the compiler, the whole FFI wrapper or foreign memory.
The boundary architecture remains Idris2 ABI contracts and pure Zig FFIs/APIs.

== Two distinct source profiles

The decoder profile consumes the complete original Proven decoder module and
its complete imported encoder. The lexer preserves the exact quoted import
literal; the parser checks names, types, statement order and end of file.
It interprets unsigned division, the range refusal, checked narrowing, actual
encoder evaluation and full-word equality. The theorem quantifies over all
natural words, including every u64 input. Outer evaluation failure/trap and
normal InvalidRefcResult are distinct; successful admission excludes traps.
No finite native corpus is presented as the universal proof.

The registry profile consumes UAA's actual generic pure state kernel.
The parser checks record declarations, all function signatures and bodies,
and absence of imports or trailing code. Field selectors, field updates,
status codes and restoration flags become operands in its interpretation.
It proves equivalence with an independently written contract denotation for
arbitrary opaque endpoint values. Endpoint identity includes the callback/context
pair as a value, not ownership or validity of the pointed-to objects.

The actual UAA FFI calls this state kernel. The source theorem does not yet
interpret allocation, dereference, defer, callback execution or destruction.
The theorem about finish does not prove that every machine path invokes finish.
Native wrapper tests supply additional execution evidence under the ownership
premises below. An implementation digest binds identity; it does not close
these semantic gaps.

== Contract and checker authority

The pinned consumer commits live in tests/consumer-word/. Both must be present.
Atoma rebuilds total, warning-free, no-holes Idris2 oracles in fresh directories.
Proven provides 1026 decoder witnesses, including canonical values, tag/low-bit
corruption, high payloads, zero and the maximum word.
UAA supplies 900 two-operation traces over two distinct endpoint identities,
both slots, all initial occupancy/busy states, and 17 signed-status witnesses.
The actual Zig kernels must agree in Debug, ReleaseSafe, ReleaseFast and
ReleaseSmall. Compilable wrong implementations must disagree.

Atoma independently compiles its Coq source checker, serializes original source
bytes, dispatches the capsule through ECHIDNA, requires a structured verified
result, runs coqchk and independently regenerates and compiles the audit capsule.
Checker objects and input sources must remain unchanged across dispatch.
Whole-boundary receipts remain INCOMPLETE.

Agda develops the generic frame, endpoint-identity, reentrancy and restoration
witnesses with --safe --without-K --cubical-compatible --double-check.
Lean re-proves those statements without Mathlib; the gate requires six exact,
unique no-axioms reports. Coq instantiates the operational source interpretation.
Full Cubical checks path versions of the compatible Agda witnesses.
These are re-proved legs, not transported proof objects. Statement
correspondence is BRIDGE-PENDING; no PWG upgrade, external verified-checker
qualification or Mathesis admission follows automatically.

== Ownership and execution premises still owed

* A live registry has one serialized owner; concurrent operations are outside scope.
* Registered callback code and context, and a call's input slice, remain live.
* Foreign callbacks cannot write the registry through raw aliases.
* Callback return is normal; panic, longjmp, cancellation and nontermination
do not inherit a normal-return restoration theorem.
* RefC target/layout checks are required; pointer/integer-carrier and compiler
correspondence remain unproved.

== Acceptance and next work

Acceptance requires green exact-head remote checks in Atoma and both consumers,
native mutations killed for the intended reason, fresh receipts and a review of
the admitted source grammar. Draft code and passing model proofs alone do not
complete this milestone. Heavy local validation remains on hold.

Next, interpret the wrappers' dereferences, begin/defer/finish sequencing and
callback effect contract; show an alias counterexample before claiming an
exclusive-ownership lift. Bind caller capabilities and lifetime transitions to
Idris2 contracts. Then reconcile the Agda/Lean/Coq statements and integrate the
estate's independent verified checkers. These are v1 prerequisites, not implied
by source-profile admission.

27 changes: 27 additions & 0 deletions docs/decisions/ATOMA-SIBLING-TRANSFER.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,30 @@ Run small experiments, not four simultaneous universal-verifier builds.
each verifier owns its language boundary, Atoma owns the admitted Zig seam.

No sibling files or schedules are changed by this Atoma sprint.

== Lessons from the decoder and registry source profiles (2026-11-25)

The first reusable result is a trust-boundary pattern: send original source
bytes to a separate closed parser/interpreter, bind every admitted import,
and audit the checked theorem independently of the emitter. Proven's guarded
decoder needed full import binding, distinction between refusal and trap, and
a universal arithmetic argument. UAA needed parameterized endpoint identity,
state frames, reentrancy and explicit normal-return premises. These are
different semantic obligations even though both use the same replay machinery.

Fresh Idris2 oracles and four-mode native runs found the practical contract
surface without claiming compiler correctness. Wrong implementations must
compile and then fail execution; parser refusals and compilation failures
are useful controls but are not counted as native mutation kills.

The portability boundary is also clearer: a generic state record can preserve
callback/context values without proving ownership of their pointees. A busy
flag is not a linear capability. Each sibling must state and discharge its
own alias, lifetime, runtime and exceptional-control-flow obligations.

Reusable now: source envelopes, import-closure checks, fresh oracle construction,
capsule regeneration, unchanged-checker checks, exact assumption audits and
mutation accounting. Not established: automatic Agda-to-Lean/Coq transport,
equivalence of language semantics, compiler refinement or a measured speedup
for any sibling. Carry the BRIDGE-PENDING state into any second-language spike.

20 changes: 20 additions & 0 deletions docs/plan/ULTRAPLAN.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,23 @@ before each step and does the mechanical edits. The advisor reviews the close
of each stage and each change to a status word. The person-week ranges in the
sequence table above stay the planning basis; the sizes here only order the
agent work.

== Decoder and registry source binding (2026-11-25)

R1/R2 now have an implementation under remote validation for two further source
profiles: Proven's guarded decoder plus imported encoder, and UAA's generic
registry state kernel. Both are called by the actual pure Zig FFI wrappers;
Idris2 owns their ABI contracts. See
link:../decisions/ATOMA-BOUNDARY-SOURCE.adoc[scope, acceptance and open obligations].

The new gates combine original-byte Coq interpretation, fresh native Idris/Zig
comparisons and ECHIDNA/coqchk replay. The registry theory adds compatible Agda,
axiom-free Lean witnesses and full Cubical paths. They do not establish whole
wrapper effects, compiler correctness, pointer leases or cross-kernel transport.
Their acceptance remains pending until exact-head consumer and Atoma runs pass.

The next R1 exit item remains a concrete alias counterexample and a checked
ownership premise for callback/defer/finish. T1–T4 and S1–S6 stay open. The v1
scope and person-week envelope above are unchanged; these deliberately narrow
source profiles are evidence for the experimental MVP, not a shortcut to v1.

17 changes: 16 additions & 1 deletion docs/status/PROOF-STATUS.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 proof status
:revdate: 2026-11-07
:revdate: 2026-11-25

Evidence remains *INCOMPLETE / Warrant*. Counts below describe scoped checks;
they are not a fraction of Zig soundness or a release-readiness percentage.
Expand Down Expand Up @@ -83,3 +83,18 @@ The manifests in `verification/proofs/` declare exact checked/quarantined scope.

See link:../plan/ULTRAPLAN.adoc[the stable task register] and
link:../audit/2026-11-07-soundness-sprint.adoc[the repair evidence].

== Source-binding milestone (under qualification)

The decoder/import and registry-kernel source capsules passed their independent
Coq interpretation, assumption audits, coqchk and rejecting source mutations in
https://github.com/hyperpolymath/atoma/actions/runs/45527831101[run 45527831101]
at head 1cc383c1ff2e747cb96d13a49638326ee75823f7. Registry compatible Agda,
Lean and full Cubical witnesses passed in the same run. Combined consumer and
ECHIDNA qualification was still pending when this entry was prepared.

The existing proof-policy claims table and grades above are not promoted by
these observations. Cross-kernel statement correspondence is BRIDGE-PENDING.
See link:../decisions/ATOMA-BOUNDARY-SOURCE.adoc[the source-profile decision]
for the exact interpretation, compiler, wrapper and ownership boundaries.

42 changes: 42 additions & 0 deletions scripts/atoma-consumer-source-gate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0
set -euo pipefail
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
mkdir -p "$root/build/atoma-evidence/source-consumers"
out=$(mktemp -d "$root/build/atoma-evidence/source-consumers/run.XXXXXXXX")
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
for profile in decoder registry; do
case "$profile" in

Check failure on line 10 in scripts/atoma-consumer-source-gate.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a default case (*) to handle unexpected values.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_zigprove&issues=AaIQX6xfoC6wk5LOKlvY&open=AaIQX6xfoC6wk5LOKlvY&pullRequest=32
decoder) repo=proven; pin=proven.pin; runner=scripts/test-refc-decoder.sh
helper=ffi/zig/src/refc/bits8_decode_word.zig; wrapper=ffi/zig/src/refc/bits8.zig ;;
registry) repo=unified-api-adapter; pin=uaa.pin; runner=scripts/check-registry-state.sh
helper=src/interface/ffi/src/registry_state.zig; wrapper=src/interface/ffi/src/registry.zig ;;
esac
revision=$(cat "$root/tests/consumer-word/$pin")
[[ $revision =~ ^[0-9a-f]{40}$ ]]
checkout="$work/$repo"
git init -q "$checkout"
git -C "$checkout" remote add origin "https://github.com/hyperpolymath/$repo.git"
git -C "$checkout" fetch -q --depth 1 origin "$revision"
git -C "$checkout" checkout -q --detach FETCH_HEAD
[[ $(git -C "$checkout" rev-parse HEAD) == "$revision" ]]
mkdir "$out/$profile"
echo "$revision" > "$out/$profile/revision.txt"
cp "$checkout/$wrapper" "$out/$profile/consumer-wrapper.zig"
EVIDENCE_DIR="$out/$profile/native" bash "$checkout/$runner"
[[ $(cat "$out/$profile/native/result.txt") == PASS ]]
if [[ $profile == decoder ]]; then
imported="$checkout/ffi/zig/src/refc/bits8_word.zig"
cmp "$checkout/$helper" "$out/$profile/native/bits8_decode_word.zig"
cmp "$imported" "$out/$profile/native/bits8_word.zig"
else
imported=-
cmp "$checkout/$helper" "$out/$profile/native/registry_state.zig"
fi
bash "$root/scripts/atoma-source-profile-replay.sh" "$profile" "$checkout/$helper" "$imported" "$out/$profile/replay"
(cd "$checkout"; sha256sum "$helper" "$wrapper" "$runner") > "$out/$profile/consumer-inputs.sha256"
done
[[ -s "$out/decoder/replay/receipt.json" && -s "$out/registry/replay/receipt.json" ]]
echo 'SOURCE CONSUMERS PASS: fresh Idris2 authority, actual Zig helpers, native controls and independent replay'

4 changes: 3 additions & 1 deletion scripts/atoma-gate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ 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"
bash scripts/atoma-consumer-scalar-gate.sh | tee "$evidence/scalar-consumers.txt"
bash scripts/atoma-consumer-source-gate.sh | tee "$evidence/source-consumers.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 \
Expand All @@ -84,4 +85,5 @@ 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); finite-model replay checked, program refinement unproved'
echo 'ATOMA GATE PASS — INCOMPLETE (Warrant); closed source profiles replayed; compiler and foreign-boundary refinement unproved'

25 changes: 25 additions & 0 deletions scripts/atoma-registry-capsule.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0
# Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
set -euo pipefail
[[ $# == 1 && -f "$1" && $(wc -c < "$1") -le 65536 ]] || exit 2
cat <<'COQ'
From Coq Require Import List Bool ZArith.
Require Import RegistrySource.
Import ListNotations.
Open Scope nat_scope.
COQ
printf 'Definition source_bytes : list nat := '
od -An -v -tu1 "$1" | awk 'BEGIN {printf "["} {for(i=1;i<=NF;i++) {if(n++) printf ";"; printf "%s",$i}} END {print "]."}'
cat <<'COQ'
Lemma source_accepted : RegistrySource.check source_bytes = true.
Proof. vm_compute. reflexivity. Qed.
Theorem source_checked : exists p, RegistrySource.parse source_bytes = Some p /\
(forall A (s : RegistrySource.state A) k e, RegistrySource.register p s k e = RegistrySource.spec_register s k e) /\
(forall A (s : RegistrySource.state A) k, RegistrySource.unregister p s k = RegistrySource.spec_unregister s k) /\
(forall A (s : RegistrySource.state A) k, RegistrySource.begin p s k = RegistrySource.spec_begin s k) /\
(forall A (s : RegistrySource.state A), RegistrySource.finish p s = RegistrySource.busy_state s false) /\
(forall z, RegistrySource.sanitize p z = if (0 <=? z)%Z && (z <=? 11)%Z then z else 6%Z).
Proof. apply RegistrySource.source_refines. exact source_accepted. Qed.
Print Assumptions source_checked.
COQ
34 changes: 34 additions & 0 deletions scripts/atoma-registry-proof-gate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0
set -euo pipefail
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
out="$root/build/scalar-proof-evidence/registry-theory"
mkdir -p "$out"
work=$(mktemp -d)
trap 'status=$?; if ((status)); then tail -n 50 "$out"/*.txt >&2; fi; rm -rf "$work"' EXIT
cp "$root/verification/atoma/consumer/agda/RegistryState"*.agda "$work/"
cp "$root/verification/atoma/consumer/lean4/RegistryState.lean" "$work/"
cd "$work"
agda --safe --without-K --cubical-compatible --double-check --warning=error RegistryState.agda > "$out/agda.txt" 2>&1
lean RegistryState.lean > "$out/lean.txt" 2>&1
# Exactly these six declarations, with no axioms (including no sorryAx).
awk '
BEGIN {names["updateFrame"]=1; names["updateIdentity"]=1; names["beginIdentity"]=1;
names["reentrantRefused"]=1; names["normalReturnFrame"]=1; names["normalReturnIdle"]=1}
{
found=0
for (n in names) {
expected = "\047RegistryState." n "\047 does not depend on any axioms"
if ($0 == expected && names[n] == 1) {names[n]=2; found=1; count++}
}
if (!found) exit 1
}
END {if (count != 6) exit 1}' "$out/lean.txt"
agda --safe --cubical --double-check --warning=error RegistryStateCubical.agda > "$out/cubical.txt" 2>&1
sed -e 's/module RegistryState where/module RegistryStateMutant where/' \
-e 's/state e (mcp s) (active s)/state e e (active s)/' RegistryState.agda > RegistryStateMutant.agda
if agda --safe --cubical-compatible --double-check --warning=error RegistryStateMutant.agda > "$out/reject-frame.txt" 2>&1; then exit 1; fi
grep -q '!=' "$out/reject-frame.txt"
sha256sum ./*.agda ./*.lean > "$out/inputs.sha256"
echo 'REGISTRY THEORY PASS: compatible Agda, independent axiom-free Lean witnesses, full Cubical paths'

Loading
Loading