Skip to content

Commit 9acb0ef

Browse files
Axiom flagship hardening (2) — honest proof claims (G03–G05) + design diary (#47)
## Summary Follow-up to the merged #46 (which closed the first two P1 soundness holes). This branch was **restarted from the post-merge `main`** — it does not re-stack the squashed pilot. It closes three "proof honesty" gaps and captures the initiative's decision record in-repo. ### G03 — proof-assistant import verification was fake (high) `proof_export.jl` judged a Lean/Coq/Isabelle proof "complete" merely for **lacking** `sorry`/`Admitted`/`oops` — so an empty file, or `theorem foo : True := trivial`, passed as verified. Now a proof must contain **at least one substantive** (non-vacuous, non-boilerplate) theorem/lemma statement; empty/trivial proofs report `:incomplete`. *(Fixing this exposed two pre-existing test fixtures that were themselves vacuous `:= trivial` proofs — updated to substantive statements.)* ### G04 — `@prove` overclaim (high) `dsl/prove.jl` (+ `docs/wiki/Verification.md`) documented `@prove` as "symbolic execution" / "formal verification", but it is a **substring match on the printed AST**. Relabelled honestly (experimental heuristic; **not** symbolic execution or a theorem prover; real proving is the SMT/Idris2 path). No behaviour change — every remaining mention is now an explicit negation. ### G05 — Idris2 ABI is a disconnected demo (high; honest relabel) `src/Abi/*.idr` declare a generic surface that does **not** match the ~36 real `axiom_*` zig exports used by `src/backends/zig_ffi.jl`. Labelled as an **illustrative scaffold** (not a proof of the production FFI boundary) in each file + `ABI-FFI-README.md`, pointed at the real boundary (`zig/` + `zig_ffi.jl`), and flagged the **orphan `ffi/zig/` tree (zero `axiom_*` exports)** as a KNOWN ISSUE. Full ABI↔zig connection is tracked follow-up (Idris2 is CI-only here). ### Design record captured online `docs/design-diary/PEPYS-DESIGN-DIARY.adoc` (the running "Samuel Pepys" decision log) and `docs/design-diary/ULTRAPLAN.adoc` (executive summary, 41-item gap register, phased plan, decision forks, estate wiring, risks). ## Verification (independent re-run, not self-graded) - `Pkg.test()` on the rebased base → **670 / 670 pass** (651 + 19 new G03 assertions). - Grep confirms no affirmative "symbolic execution" / "formal verification" claim remains attached to `@prove`. ## Residuals (tracked) Real hybrid **Ed448+Dilithium5** certificate signing (G01 auth layer, reusing `opsm`'s `pqcrypto` crates), full Idris2-ABI↔zig connection (G05), plus the broader flagship work (Aqua/JET/Documenter, RegistryCI, panic-attack gate, RSR completeness, doc reconciliation). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01UPFC9YQ7g9gc3VnRox42Q1 --- _Generated by [Claude Code](https://claude.ai/code/session_01UPFC9YQ7g9gc3VnRox42Q1)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 070905f commit 9acb0ef

10 files changed

Lines changed: 851 additions & 55 deletions

File tree

ABI-FFI-README.md

Lines changed: 70 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,28 @@
22

33
This file documents the current ABI/FFI split for Axiom.jl.
44

5-
## Canonical ABI Spec (Idris2)
5+
## Idris2 ABI Scaffold (illustrative, not the production ABI proof)
66

7-
The Idris2 ABI scaffold now lives under:
7+
The Idris2 ABI scaffold lives under:
88

99
- `src/Abi/Types.idr`
1010
- `src/Abi/Layout.idr`
1111
- `src/Abi/Foreign.idr`
1212

13-
These modules use concrete `axiom_*` symbol names and no unresolved template placeholders.
13+
These modules use concrete `axiom_*` symbol names and no unresolved template
14+
placeholders, but they declare a **generic** lifecycle/callback surface
15+
(`axiom_init`, `axiom_process`, `axiom_register_callback`, ...) that does
16+
**not** match the ~36 real Zig kernel exports (`axiom_matmul`, `axiom_relu`,
17+
`axiom_conv2d`, and the rest of `zig/src/axiom.zig`) actually consumed by
18+
`src/backends/zig_ffi.jl`. Treat this scaffold as a
19+
worked illustration of the hyperpolymath ABI-FFI pattern (Idris2 ABI + Zig
20+
FFI), not as a proof binding Axiom's production kernels. The `Verify.*`
21+
functions in `Types.idr` are `putStrLn` stubs, not executed proofs.
22+
23+
**ROADMAP (future work, not yet started):** extend the `.idr` declarations
24+
to cover the real `axiom_*` Zig exports and replace the `Verify` stubs with
25+
genuine size/alignment/signature proofs checked against `zig/src/axiom.zig`
26+
and `ffi/zig/include/axiom.h`.
1427

1528
### Idris2 validation
1629

@@ -25,20 +38,55 @@ idris2 --source-dir src --check src/Abi/Foreign.idr
2538
Current production-tested backend FFI path is Julia <-> Zig:
2639

2740
- Julia bridge: `src/backends/zig_ffi.jl`
28-
- Zig C ABI exports: `ffi/zig/src/main.zig`
41+
- Zig C ABI exports: `zig/src/axiom.zig` (compiled to `libaxiom_zig.so` via
42+
`zig/build.zig`; this is the artifact CI, benchmarks, and
43+
`AXIOM_ZIG_LIB`/`ZigBackend(...)` actually load -- see `.github/workflows/ci.yml`,
44+
`benchmark/*.jl`, `README.md`)
2945

3046
This path is covered by CI/readiness checks (backend parity + runtime smoke).
3147

32-
## Zig FFI Status
33-
34-
`ffi/zig/` is now concrete (non-template) and exports concrete `axiom_*` symbols:
35-
36-
- implementation: `ffi/zig/src/main.zig`
37-
- build/test entry: `ffi/zig/build.zig`
38-
- integration coverage: `ffi/zig/test/integration_test.zig`
39-
- C header: `ffi/zig/include/axiom.h`
40-
41-
Validation:
48+
## KNOWN ISSUE: orphan second Zig FFI tree (`ffi/zig/` vs `zig/`)
49+
50+
There are **two** Zig trees in this repository and they are not the same
51+
code:
52+
53+
- **`zig/`** (repo root) -- the real, production Zig backend. `zig/src/axiom.zig`
54+
exports the ~36 real `axiom_*` kernels (`axiom_matmul`, `axiom_relu`,
55+
`axiom_conv2d`, activations, norm, pooling, attention, ...) consumed by
56+
`src/backends/zig_ffi.jl` and built into `libaxiom_zig.so`.
57+
- **`ffi/zig/`** -- a separate, smaller Zig tree (`ffi/zig/src/main.zig`,
58+
`ffi/zig/build.zig`, `ffi/zig/include/axiom.h`) that exports **zero**
59+
`axiom_*` kernel symbols (`grep -c "export fn axiom_"` = 0) and instead
60+
implements a different, generic lifecycle/callback C ABI matching the
61+
`src/Abi/*.idr` scaffold's naming (`axiom_init`, `axiom_process`,
62+
`axiom_register_callback`, ...). Its header comment even points at
63+
`src/abi/Foreign.idr`, a stale/incorrect path (the real directory is
64+
`src/Abi/`, capital A) -- further evidence this tree has drifted from the
65+
rest of the repo and is not wired into anything Julia actually loads.
66+
67+
**This is flagged, not fixed here.** `ffi/zig/` is not deleted -- it may be
68+
salvageable as the eventual real implementation backing the `src/Abi/*.idr`
69+
scaffold (see ROADMAP notes above), but as of this writing it is disconnected
70+
from both the production Zig backend and the Idris2 ABI's stated symbol
71+
surface. Anyone relying on "the Zig FFI" should confirm which of the two
72+
trees they mean; for release/readiness purposes only `zig/` is authoritative
73+
(next section).
74+
75+
## Zig FFI Status (production: `zig/`)
76+
77+
`zig/` is the sole production-tested native backend and exports concrete
78+
`axiom_*` symbols (~36, see `TOPOLOGY.md`):
79+
80+
- implementation: `zig/src/axiom.zig`
81+
- build entry: `zig/build.zig`
82+
- Julia-side wiring: `src/backends/zig_ffi.jl`
83+
84+
The separate `ffi/zig/` tree (`ffi/zig/src/main.zig`, `ffi/zig/build.zig`,
85+
`ffi/zig/test/integration_test.zig`, `ffi/zig/include/axiom.h`) is also
86+
concrete (non-template) and internally self-consistent, but -- per the
87+
orphan-tree note above -- exports a different, generic `axiom_*` surface
88+
that is not the production kernel FFI. Its own validation still works
89+
in isolation:
4290

4391
```bash
4492
cd ffi/zig
@@ -55,6 +103,11 @@ zig build test
55103

56104
## Practical Guidance
57105

58-
For release/readiness decisions, treat the Zig FFI path as authoritative.
59-
Treat Idris2 ABI files as formal scaffold/specification that now typechecks and
60-
uses concrete Axiom naming.
106+
For release/readiness decisions, treat `zig/` + `src/backends/zig_ffi.jl` as
107+
the authoritative production FFI boundary. Treat the Idris2 `src/Abi/*.idr`
108+
files as an illustrative ABI-FFI scaffold that typechecks and uses concrete
109+
Axiom naming, but does **not** prove or specify the production kernel FFI --
110+
see the ROADMAP notes above for what closing that gap would require. Treat
111+
`ffi/zig/` as a flagged, currently-disconnected second Zig tree (see
112+
"KNOWN ISSUE" above) pending a decision on whether to wire it to the
113+
`src/Abi/*.idr` scaffold, fold it into `zig/`, or retire it.

0 commit comments

Comments
 (0)