You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
checked_add: make it genuinely checked (overflow traps) — resolve the wrapping misnomer (#40)
## Summary
Follow-up to #39. `checked_add` was a wrapping `a +% b` despite its name
— the GAP-1b metamorphic gate surfaced the misnomer in #39. This makes
it a genuinely **checked** add.
- **zig** (`safe_nif.zig`): `@addWithOverflow` + `unreachable` →
overflow **traps** (WASM `unreachable`, all build modes, like
`crash_unreachable`) → wasmex `{:error, _}`, BEAM survives; a
non-overflowing add returns the **exact sum**. Signature unchanged.
- **metamorphic gate** (`snif_metamorphic_test.exs`): flipped from the
`wrap32` ring oracle to *non-overflow = exact sum / overflow =
`{:error,_}`*; added the boundary-trap test.
- **bench + docs**: fixed the stale "intentional wrap" row + comments in
`benches/snif_eval.sh`; reconciled `CHANGELOG` + `PROOF-STATUS` GAP-1b.
The `AFFIRMATION.adoc` (merged in #39, anchored to `a82bb31`) is
intentionally **not** edited — at that anchor `checked_add` genuinely
*was* wrapping, and the affirmation is a frozen, signed snapshot. A
fresh affirmation can be stamped at a later commit if desired.
## Verification (green this commit)
- `just proof-check-all` → exit 0 (signature-only ABI unaffected)
- `just abi-conformance` → 15/15 (signature unchanged)
- `mix test` → 30/30 (OTP 25); metamorphic 9/9 under the new checked
semantics
- Zig 0.15.2 compiles `@addWithOverflow` + tuple indexing +
`unreachable`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Copy file name to clipboardExpand all lines: PROOF-STATUS.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -223,7 +223,7 @@ obligations (e.g. the Coq slot → the WasmCert-Coq isolation theorem).
223
223
| SEC-1-TCB | Discharge **"wasmtime ⊨ FaithfulRuntime"** in-prover: prove that wasmtime + the wasmex embedding actually realise the primitive single-step facts (WASM trap-soundness; trap → `{:error,_}`; host scheduler resumed unchanged) that `SnifIsolation.agda` assumes as its TCB record | SEC | Coq (WasmCert-Coq) | SEC-1's **operational** layer is now PROVEN-MODULO-EXPLICIT-TCB in Agda (`Model.isolation`). This row is the REMAINING half: machine-verifying the runtime-faithfulness assumption that is currently in the theorem's *type* but not proven. |
224
224
| ABI-6 | Buffer/array marshalling round-trip + in-bounds (unblocks "powerful" NIFs; FFT) | ABI | Idris2 |`Compliance.WasmArray*` is only a framework today |
225
225
| ABI-7 | ◐ **Coverage 15 of 20 — buffer_abi DONE 2026-06-16.**`safe_nif` (8, `Foreign.idr`) + `buffer_abi` (7, `BufferAbi.idr`, incl. 3 void returns) are modelled+gated, both in the `abi_conformance.py` guest manifest. **Remaining (ledgered):**`zig/src/burble_fft.zig` (5 — `fft`/`ifft`/… use `(ptr,len)` slice marshalling = ABI-6, and it is not built into any artifact) + the Rust buffer guest | ABI | Idris2 + Python | Buffer guest closed; FFT + Rust pending the multi-language buffer-ABI gate |
226
-
| GAP-1b | ◐ **Behaviour faithfulness — scalar kernels DONE 2026-06-16.**`demo/test/snif_metamorphic_test.exs` (dep-free, 9 metamorphic tests, green on OTP 25). **Load-bearing relations (do not delete):** the `fibonacci` recurrence n=2..40 + base cases (uniquely determines fib), and the `checked_add``wrap32`oracle over a 100-case boundary-spanning family + the boundary-wrap test. Buffer kernels (`sum_f32` permutation/additivity) are next | TP | metamorphic tests (extraction long-term) |Surfaced a finding: `checked_add`is a **misnomer**— it is wrapping (`a +% b`), not trapping (the trapping demo is `crash_overflow`); doc-comment corrected|
226
+
| GAP-1b | ◐ **Behaviour faithfulness — scalar kernels DONE 2026-06-16.**`demo/test/snif_metamorphic_test.exs` (dep-free, 9 metamorphic tests, green on OTP 25). **Load-bearing relations (do not delete):** the `fibonacci` recurrence n=2..40 + base cases (uniquely determines fib), and the `checked_add` oracle over a 100-case boundary-spanning family (non-overflow = exact sum; overflow = `{:error,_}`) + the boundary-trap test. Buffer kernels (`sum_f32` permutation/additivity) are next | TP | metamorphic tests (extraction long-term) |The gate first surfaced that `checked_add`was a **misnomer**(wrapping `a +% b`); **resolved 2026-06-16 by making it genuinely checked** — overflow traps (`@addWithOverflow` + `unreachable`, all modes)|
227
227
| CI-1 | ✅ **DONE 2026-06-16**: `abi-conformance` now runs as a CI job in `.github/workflows/proofs.yml` (builds both guests, fails on signature drift) | ABI | CI wiring | Making it a *required* status check is the owner-only branch-protection step |
228
228
| MODEL-1 | ◐ **Largely RESOLVED by F2 (SNIFs 2).** The 6 `error_reason` origins are now modelled via `TrapOrigin` (guestFault/hostBudget/preExec) + the `call` front-end in `SnifIsolation`. **Residual:** the `snif_alloc`-returns-0 OOM "third outcome" is not yet modelled as a distinct verdict | TP | Agda | Taxonomy half done; only the OOM-sentinel nuance remains |
229
229
@@ -235,4 +235,4 @@ obligations (e.g. the Coq slot → the WasmCert-Coq isolation theorem).
235
235
| 2026-04-16 | (Claimed) all 7 proofs complete — see History correction; not actually compiling | Claude Code |
236
236
| 2026-06-16 | All 7 proofs **genuinely** machine-checked (clean-cache); real gate wired; scaffold de-counted; scope honesty added | Claude Opus 4.8 |
237
237
| 2026-06-16 |**SEC-1 (`Model.isolation`) PROVEN-MODULO-EXPLICIT-TCB** in Agda (`SnifIsolation.agda`, `--safe --without-K`, clean-cache exit 0); TCB = `FaithfulRuntime` record hypothesis (primitive single-step facts), non-circularity + non-vacuity confirmed by mutation; WASM-opsem discharge ("wasmtime ⊨ FaithfulRuntime") remains as SEC-1-TCB | Claude Opus 4.8 (1M context) |
238
-
| 2026-06-16 |**SNIFs 2.** SEC-1 sharpened: F1 deniability wired operationally (`run-deniable`/`fault-via-observe` + `SecretWitness`), F2 6-origin `TrapOrigin` taxonomy + `call` front-end (`PreExecWitness`), F5 non-trivial-`Alive` recovery witness (`PartialAlive`) — all mutation-confirmed load-bearing by a 4-skeptic re-audit. ABI-7: `buffer_abi` modelled+gated (`BufferAbi.idr`, 15/20 sites); guest-aware `abi_conformance.py`; CI-1 conformance job added; GAP-1b scalar metamorphic gate (found + corrected the `checked_add` misnomer). | Claude Opus 4.8 (1M context) |
238
+
| 2026-06-16 |**SNIFs 2.** SEC-1 sharpened: F1 deniability wired operationally (`run-deniable`/`fault-via-observe` + `SecretWitness`), F2 6-origin `TrapOrigin` taxonomy + `call` front-end (`PreExecWitness`), F5 non-trivial-`Alive` recovery witness (`PartialAlive`) — all mutation-confirmed load-bearing by a 4-skeptic re-audit. ABI-7: `buffer_abi` modelled+gated (`BufferAbi.idr`, 15/20 sites); guest-aware `abi_conformance.py`; CI-1 conformance job added; GAP-1b scalar metamorphic gate (found the `checked_add` misnomer, then made it genuinely checked — overflow traps). | Claude Opus 4.8 (1M context) |
add_row "{\"kind\":\"control\",\"fn\":\"checked_add(MAX-1,1)\",\"safe_out\":$(jstr "$ca_safe"),\"fast_out\":$(jstr "$ca_fast"),\"expect\":\"2147483647 (exact sum; an overflowing add would trap in both modes)\"}"
155
156
156
157
# ── (4) liveness / DoS guard (language-agnostic) ──────────────────────────────
157
158
# Too little fuel -> deterministic "all fuel consumed" trap; enough -> result.
0 commit comments