Skip to content

Atoma: Phase 0 gates, extract/check frontend, Agda soundness for the store-free core, spec + ultraplan - #1

Merged
hyperpolymath merged 6 commits into
mainfrom
arena/4f8f5ab1-zigprove
Oct 22, 2026
Merged

hyperpolymath merged 6 commits into
mainfrom
arena/4f8f5ab1-zigprove

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Lands the Atoma Phase 0/1 work: the toolchain, the worked example, the metatheory, the specification and the ultraplan.

What is in it

  • tools/atoma — CLI (canon, hash, vc-hash, dk-hash, src-hash, extract, check, equiv, mutate, ops, selftest), 15 tests. frontend.zig extracts contract directives from std.zig.Ast doc comments and scans the subset with 21 E-* codes.
  • examples/atoma/frame-v1 — the worked example: verified frame parser (11 tests, 4 target classes), 60 compiler-witnessed layout rows, two contract faces at one seam digest, 14 SMT obligations, negative corpus, and verify.sh running gates G1–G11 into a JCS receipt.
  • verification/atoma — Bv, Lin, Core, Soundness under agda --safe --without-K. The adequacy theorem for the store-free core fragment, plus unguarded-not-valid, whose witness (λ _ → 0) is the same model z3 returns for V1_needle_drop_requires.
  • docs/spec/ATOMA-SPEC.adoc — the specification: Core Spec IR, two faces, subset, semantics, VC→certificate pipeline, worked example, roadmap, claims ledger.
  • docs/plan/ULTRAPLAN.adoc — 40 task cards with acceptance commands, falsifiers and honest blockers.

Gate evidence (./verify.sh, exit 0)

G1 ok  unit tests (frame_parse)                11/11
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:f5f97a7b…f265756
G5 ok  divergence probe                        blake3:d49201f2…ffca70
G6 ok  mutation sweep                          11 applied, 11 distinct
G7 ok  14 VCs discharged by z3                 blake3:72c74c01…5e3698
G8 ok  Face B extracted from source            blake3:ee4d77f0…eb2358
G9 ok  subset clean                            6 exports, 6 contracts, 0 diagnostics
G10 ok negative corpus rejected                20 diagnostics, 17 codes
G11 ok metatheory typechecks                   4 modules, 0 postulates
STATUS: INCOMPLETE (Warrant)

What this does not claim

  • No .dk exists; nothing has passed dkcheck, coqchk or lean4checker. The receipt's status_class is Warrant and must stay so.
  • No mutation kill score yet (artefact distinctness only).
  • abi/FrameAbi.idr is normative text and has never been typechecked (F0.1, blocked on idris2).
  • The soundness theorem relates vc to safe — two Agda functions. The step to a compiled Zig function is reviewed, not proved (non-claim N3).
  • atoma check is a token scan, not a type checker.

The claims ledger in the spec states all of this row by row, and docs/plan/ULTRAPLAN.adoc says what unblocks each item.

Summary by CodeRabbit

  • New Features
    • Added Atoma, a command-line tool for canonicalizing and comparing verification contracts, extracting contracts from Zig code, and checking code against supported-subset rules.
    • Added a frame-parsing example with documented ABI contracts, cross-platform layout checks, and verification scenarios.
    • Added verification gates and reports; some checks depend on installed tools, and the example’s receipt remains marked incomplete.
  • Documentation
    • Added a design specification, execution plan, and guides to the tool and frame-parsing example.

Atoma and others added 4 commits October 22, 2026 15:43
…undness (store-free core)

- tools/atoma: std.zig.Ast frontend (extract doc-comment contracts, subset
  check with 21 E-* codes), src-hash command, canonicaliser + mutation ops
- examples/atoma/frame-v1: verified frame parser (11 tests, 4 targets),
  Face A/B .cspec at the same seam hash, 14 discharged VCs, negative corpus
  (20 diagnostics / 17 codes), verify.sh gates G1-G11 + receipt
- verification/atoma: Bv/Lin/Core/Soundness under agda --safe --without-K;
  the adequacy theorem for the store-free core fragment, with the refinement
  gap stated as a non-claim
- docs/spec: specification v0.1 with the claims ledger, soundness statement,
  worked example, roadmap with falsifiers, and reproduction appendix

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
- canon.zig: a test that the four BLAKE3 domains (spec, vc, dk, src) separate
- verify.sh: derive the tool test count from `zig test` instead of hard-coding
  it, so the receipt cannot claim a stale number
- spec: §3.5 status note separating the two obligations the metatheory covers
  from the eight that are solver-discharged but argued, plus section-reference
  and numbering repairs (the claims ledger is now unnumbered front matter, so
  the printed numbers match the §-references throughout)

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Replaces the template placeholders with Atoma's identity: title, abstract (with
the honest Phase 0/1 status), release date, url, MPL-2.0, and 17 keywords that
mirror the GitHub topics (zig, idris2, agda, formal-verification, qtt, ffi,
c-abi, smt-lib, z3, dedukti, proof-carrying-code, coq, lean4, ...).

GitHub renders this file as "Cite this repository", so the About text has a
versioned home in the tree rather than only in repository settings.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…eople

docs/plan/ULTRAPLAN.adoc: milestones A/K/T/S/C/H, 40 task cards with an
acceptance command, a falsifier and an honest blocker each; gate table G1-G15
plus F0.1; environment recipes for a cold sandbox and the estate; the traps
already paid for; definitions of done; a deviations log; risk register; eight
open questions with defaults.

Written to be followed, not admired:
- every task names the command whose exit status decides, and the observation
  that would show the command passed for the wrong reason
- blocked tasks say what unblocks them and refuse a stub (I4 depends on it)
- the four structural gaps are named: identity (88 files still carry template
  tokens), kernel chain, theory width, estate conformance
- §15 records 26 measured failures so they are not paid for twice

Also: docs/README.adoc gains the plan/ row and a start-here link;
docs/spec/README.adoc and the spec's repository map point at it;
REPOSITORY-MAP.adoc regenerated (tools/ is no longer empty, examples/ exists).

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-22T15:55:20.004466Z
We couldn’t complete this review. Comment @codex review to try again.
223ece0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 529afae and 223ece0.

📒 Files selected for processing: 52
  • .gitignore
  • CITATION.cff
  • docs/README.adoc
  • docs/architecture/REPOSITORY-MAP.adoc
  • docs/plan/ULTRAPLAN.adoc
  • docs/spec/ATOMA-SPEC.adoc
  • docs/spec/README.adoc
  • examples/atoma/frame-v1/README.adoc
  • examples/atoma/frame-v1/abi/FrameAbi.idr
  • examples/atoma/frame-v1/abi/FrameAbi.ipkg
  • examples/atoma/frame-v1/abi/Linearity.idr
  • examples/atoma/frame-v1/fixtures/violations.zig
  • examples/atoma/frame-v1/spec/face-a.cspec
  • examples/atoma/frame-v1/spec/face-b.cspec
  • examples/atoma/frame-v1/spec/layout.cspec
  • examples/atoma/frame-v1/src/atoma.zig
  • examples/atoma/frame-v1/src/frame_parse.zig
  • examples/atoma/frame-v1/tools/layout.sh
  • examples/atoma/frame-v1/tools/layout_check.zig
  • examples/atoma/frame-v1/tools/layout_negative.zig
  • examples/atoma/frame-v1/tools/layout_witness.zig
  • examples/atoma/frame-v1/vc/V1_needle_drop_requires.smt2
  • examples/atoma/frame-v1/vc/V1_no_underflow.smt2
  • examples/atoma/frame-v1/vc/V2_mutant_off_by_one.smt2
  • examples/atoma/frame-v1/vc/V2_needle_drop_payload_bound.smt2
  • examples/atoma/frame-v1/vc/V2_slice_in_bounds.smt2
  • examples/atoma/frame-v1/vc/V3_intcast_range.smt2
  • examples/atoma/frame-v1/vc/V3_needle_drop_ffi_bound.smt2
  • examples/atoma/frame-v1/vc/V4_maxplus_bound.smt2
  • examples/atoma/frame-v1/vc/V5_magic_wire_order.smt2
  • examples/atoma/frame-v1/vc/V5_mutant_wrong_endian.smt2
  • examples/atoma/frame-v1/vc/V6_mutant_offset_drift.smt2
  • examples/atoma/frame-v1/vc/V6_padding_zeroed.smt2
  • examples/atoma/frame-v1/vc/V7_post_payload_len.smt2
  • examples/atoma/frame-v1/vc/V8_premise_satisfiable.smt2
  • examples/atoma/frame-v1/vc/gen_vcs.py
  • examples/atoma/frame-v1/verify.sh
  • examples/atoma/frame-v1/witness/agda-report.txt
  • examples/atoma/frame-v1/witness/phase0.receipt.json
  • examples/atoma/frame-v1/witness/subset-report.txt
  • examples/atoma/frame-v1/witness/vc-report.txt
  • examples/atoma/frame-v1/witness/violations-report.txt
  • tools/atoma/.zig-version
  • tools/atoma/build.zig
  • tools/atoma/src/canon.zig
  • tools/atoma/src/frontend.zig
  • tools/atoma/src/main.zig
  • verification/atoma/agda/Bv.agda
  • verification/atoma/agda/Core.agda
  • verification/atoma/agda/Lin.agda
  • verification/atoma/agda/Soundness.agda
  • verification/atoma/check-agda.sh
+---------------------------------------------------------------------------------------------------------+
| If a system is to serve the creative spirit, it must be entirely comprehensible to a single individual. |
+---------------------------------------------------------------------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

K9 L0–L2 green

🟢 conformant · commit 45e13a628242 · run 39811006798 · validator hyperpolymath/standards@b3ce78e1a8cb

Category Status Pass Fail Indeterminate N/A Since previous revision
K9 contract typecheck 🟢 conformant 1 0 0 0 ↔ unchanged
K9 validator self-test 🟢 conformant 37 0 0 0 ↔ unchanged
K9 live corpus (L0–L2) 🟢 conformant 13 0 0 0 ↔ unchanged

Scope: K9 components L0–L2 against contract v1.0.0 at the named standards commit. L3 signature verification and routed coordination-dialect files are not certified. Green is limited to this scope. Orange is missing evidence; yellow is grandfathered debt or warnings; grey is an explicit scope exclusion. report.json, badge.json and the validator logs are in the k9-grid artifact on the linked run.


pub fn castsAround(p: *u8) void {
// E-PTR-CAST
const q: *u8 = @ptrCast(p);

const banned_builtins = [_]BannedBuiltin{
.{ .text = "@ptrFromInt", .code = "E-PTR-INT" },
.{ .text = "@ptrCast", .code = "E-PTR-CAST" },
const banned_builtins = [_]BannedBuiltin{
.{ .text = "@ptrFromInt", .code = "E-PTR-INT" },
.{ .text = "@ptrCast", .code = "E-PTR-CAST" },
.{ .text = "@alignCast", .code = "E-PTR-CAST" },
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Hypatia grid purple

🟣 critical · commit 45e13a628242 · run 39811006590

Reporter Status Critical High Medium Minor Since previous revision
Hypatia scan 🔴 high 0 9 6 0 ↔ unchanged
panic-attack assail 🟣 critical 5 2 4 0 ↔ unchanged
pons asinorum 🟢 clean 0 0 0 0 ↔ unchanged
Hypatia scan: 15 finding(s)
  • high code_scanning_alerts/CSA001 — 0-AI-MANIFEST.a2ml — Code scanning (Hypatia): hypatia/root_hygiene/missing -- Hypatia root_hygiene: missing -- 0 day(s) old
  • high code_scanning_alerts/CSA001 — .github/workflows/actions.lock — Code scanning (Hypatia): hypatia/workflow_audit/invalid_actions_lock -- Hypatia workflow_audit: invalid_actions_lock -- 0 day(s) old
  • high code_scanning_alerts/CSA001 — .github/workflows/actions.lock — Code scanning (Hypatia): hypatia/workflow_hardening/invalid_actions_lock -- Hypatia workflow_hardening: invalid_actions_lock -- 0 day(s) old
  • high code_safety/zig_align_cast — tools/atoma/src/frontend.zig:221 — Zig @aligncast performs unchecked alignment cast (1 occurrences, CWE-704, line 221)
  • high code_safety/zig_ptr_cast — tools/atoma/src/frontend.zig:220 — Zig @ptrCast performs unchecked pointer type conversion (1 occurrences, CWE-704, line 220)
  • high code_safety/zig_ptr_cast — examples/atoma/frame-v1/fixtures/violations.zig:46 — Zig @ptrCast performs unchecked pointer type conversion (1 occurrences, CWE-704, line 46)
  • high workflow_hardening/invalid_actions_lock — .github/workflows/actions.lock — actions.lock failed closed: {:line, 4, {:unsupported_version, "v0.0.3"}}
  • high workflow_audit/invalid_actions_lock — .github/workflows/actions.lock — Invalid .github/workflows/actions.lock: {:line, 4, {:unsupported_version, "v0.0.3"}}. Regenerate and verify it with gh actions-lock.
  • high root_hygiene/missing — 0-AI-MANIFEST.a2ml — Required file missing
  • medium content_patterns/npx_in_workflow — .github/copilot/coding-agent.yml:3 — npx / `npm run` banned in CI -- use `bunx` or `bun run` instead (npm banned 2026-05-25; Deno banned 2026-09-22, standards LANGUAGE-POLICY §1.3)
  • medium code_scanning_alerts/CSA001 — .github/workflows/dogfood-gate.yml — Code scanning (Hypatia): hypatia/workflow_audit/missing_timeout_minutes -- Hypatia workflow_audit: missing_timeout_minutes -- 0 day(s) old
  • medium code_scanning_alerts/CSA001 — . — Code scanning (Hypatia): hypatia/scorecard/DependencyPinning -- Hypatia scorecard: DependencyPinning -- 0 day(s) old
  • medium code_scanning_alerts/CSA001 — .github/copilot/coding-agent.yml — Code scanning (Hypatia): hypatia/content_patterns/npx_in_workflow -- Hypatia content_patterns: npx_in_workflow -- 0 day(s) old
  • medium scorecard/DependencyPinning — . — 1 action-pinning integrity finding(s) in atoma; verify .github/workflows/actions.lock with gh actions-lock
  • medium workflow_audit/missing_timeout_minutes — .github/workflows/dogfood-gate.yml — Job `rsr-score-self` in dogfood-gate.yml has no `timeout-minutes:` declaration. Default is 6 hours — a stuck codeload fetch or runner hang can burn budget. Add `timeout-minutes: 10` (or proportional).
panic-attack assail: 11 finding(s)
  • critical CommandInjection — tests/e2e/julia_mint_test.sh — eval usage in tests/e2e/julia_mint_test.sh
  • critical CommandInjection — tests/workflows/self_name_pass_test.sh — eval usage in tests/workflows/self_name_pass_test.sh
  • critical UnboundedAllocation — scripts/strip-instruction-blocks.rs — Potential unbounded allocation pattern detected in scripts/strip-instruction-blocks.rs
  • critical UnboundedAllocation — scripts/merge-actions-lock.rs — Potential unbounded allocation pattern detected in scripts/merge-actions-lock.rs
  • critical UnboundedAllocation — scripts/prune-dependabot-ecosystems.rs — Potential unbounded allocation pattern detected in scripts/prune-dependabot-ecosystems.rs
  • high UnsafeFFI — examples/atoma/frame-v1/fixtures/violations.zig — 1 C interop imports in examples/atoma/frame-v1/fixtures/violations.zig
  • high UnsafeCode — examples/atoma/frame-v1/fixtures/violations.zig — 1 unsafe pointer casts in examples/atoma/frame-v1/fixtures/violations.zig
  • medium InsecureProtocol — tests/workflows/container_kyaml_test.sh — 5 HTTP (non-HTTPS) URLs in tests/workflows/container_kyaml_test.sh
  • medium CommandInjection — tests/workflows/resolve_template_pin_test.sh — 21 potentially unquoted variable expansions in tests/workflows/resolve_template_pin_test.sh
  • medium CommandInjection — scripts/check-proofs.sh — 26 potentially unquoted variable expansions in scripts/check-proofs.sh
  • medium MutationGap — archetypes/julia-library/overlay/test/cases/smoke.jl — 1 @test assertion(s) in archetypes/julia-library/overlay/test/cases/smoke.jl are all type-only (no value/equality checks) — mutation tests will pass trivially; add @test x == expected assertions

Scope: static findings reported by each row's tool at the named commit. Purple, red, yellow and blue grade the worst finding present; orange is evidence missing, malformed or a scanner that did not run; grey is an explicit scope exclusion with its reason. No row is a security certification. report.json, badge.json and the raw findings are in the verdict-grid artifact on the linked run.

hyperpolymath and others added 2 commits October 22, 2026 16:05
The estate bans Python, and `vc/gen_vcs.py` was the only Python in the gate
path. It is replaced by `atoma vc` (tools/atoma/src/vc.zig): the same 14
obligations, emitted as hand-readable SMT-LIB instead of z3 `sexpr()` dumps,
byte-stable, and with no dependencies beyond the tool itself.

The port is not a transliteration, and it fixes a real weakness:

* the query set is now pinned to the contract — `--cspec` canonicalises it and
  refuses to emit anything unless the five facts the queries encode are still
  present verbatim (`checkContract`). G7 exercises that refusal with a drifted
  contract, so the binding cannot be vacuous;
* the reviewed verdict table `vc/expected.tsv` is the oracle: G7 diffs it
  against the generator's manifest, runs z3 on the freshly generated queries and
  fails on any disagreement;
* a committed `.smt2` the generator would not reproduce is a hard failure, so a
  hand-edited artefact cannot survive;
* `atoma vc` gained 5 tests (20 tool tests now), and z3 is invoked directly —
  its exit code is 0 for both sat and unsat, so the verdict is parsed from
  stdout.

The VC-set digest moves from blake3:72c74c01…5e3698 to blake3:dec3d833…9ce35d
because the serialisation changed; the obligations, the 8-unsat/6-sat split and
every verdict are unchanged. ULTRAPLAN A6 recorded byte-identity as its
acceptance criterion; that was unachievable without reproducing the dump, which
A6's own falsifier forbids, so the card now records what actually happened
instead of being quietly rewritten.

Also in this commit:

* `.machine_readable/root-allow.txt`: `tools/` is an optional root entry —
  untrusted tool sources, outside the TCB; the trusted tree stays under `src/`.
  This is the step that was failing `Estate Rules`.
* `docs/architecture/REPOSITORY-MAP.adoc` regenerated (byte-identical across
  locales; the freshness check passes).
* spec, frame-v1 README, CHANGELOG and the plan updated to match, with the
  stale section references corrected and the receipt regenerated
  (status INCOMPLETE / Warrant, unchanged).

Local gate status: G1–G11 pass; root-shape, no-md-in-docs, no-vlang, no-a2ml
pass; all 164 tracked .adoc files render with no warnings.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
GitHub repository metadata is part of the project's public description, so it
belongs in the tree rather than in a chat log. `scripts/set-repo-metadata.sh`
carries the description (215 characters) and exactly 20 topics — the 7 that
nearly every hyperpolymath repository carries, then 13 specific to Atoma — and
validates them against GitHub's rules (lowercase, hyphens, <= 50 characters,
exactly 20) before spending an API call.

The application token here is contents-scoped, so `PATCH /repos/...` returns
403. The script is therefore a maintainer action, not a gate: it exits 1 with
the `gh auth refresh -s administration` hint. `--dry-run` prints both payloads,
which is how the wording was reviewed.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@hyperpolymath
hyperpolymath merged commit 8d78985 into main Oct 22, 2026
57 of 62 checks passed
@hyperpolymath
hyperpolymath deleted the arena/4f8f5ab1-zigprove branch October 22, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants