Skip to content

ABI Layer 4: prove the FFI result-code seam is injective + faithful#43

Merged
hyperpolymath merged 3 commits into
mainfrom
claude/new-session-znxgm7
Jun 28, 2026
Merged

ABI Layer 4: prove the FFI result-code seam is injective + faithful#43
hyperpolymath merged 3 commits into
mainfrom
claude/new-session-znxgm7

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Layer 4 (seal the ABI↔FFI seam): proves the FFI result-code encoding (resultToInt) is a sound, lossless wire encoding — decoder intToResult with resultRoundTrip, from which resultToIntInjective is derived. Distinct ABI outcomes never collide on the C wire. Complements the structural abi-ffi-gate.py.

New module *.ABI.FfiSeam (imports Types). Positive + non-vacuity controls.

Testing

Idris2 0.7.0 --build → exit 0, zero warnings. Adversarial rejection confirmed. build/ removed. No believe_me/postulate/sorry.

🤖 Generated with Claude Code

https://claude.ai/code/session_01A6PSzJWpRxtzGDjUCEh7Mx


Generated by Claude Code

claude and others added 3 commits June 27, 2026 22:31
Adds Chapeliser.ABI.Invariants, a new machine-checked theorem deeper than
and distinct from the Layer-2 Partition tiling proof. Partition.idr proved
the block partition is a gapless, non-overlapping tiling for all n,k but
explicitly left open the arithmetic residual `sumNat (perItemCounts n k) = n`
("the only div/mod obligation"). This module discharges exactly that.

blockCountsComplete : (n,k') -> sumNat (blockCounts n k') = n proves every
item is covered exactly once, for ALL n and all k>0, via the Euclidean
division theorem (contrib Data.Nat.Division) plus a self-contained count of
remainder slots. Counts are expressed with the public-export divNatNZ/modNatNZ
(the reducing form of Prelude div/mod on a positive divisor) so the proof and
its concrete controls reduce at the type level.

Includes: a sound+complete Dec (decCoversExactly), positive controls
(covers10over3, covers12over4 by Refl + via the general theorem), and
non-vacuity/negative controls (notCovers10as9, dec10over3as9No,
remainderCountMatters). Genuine proof: no believe_me/postulate/assert_total/
sorry/admitted. Builds clean (0 warnings); a deliberately false variant is
rejected by the type checker.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A6PSzJWpRxtzGDjUCEh7Mx
…I.FfiSeam)

Add a new module proving the Result FFI encoding is sound:
- intToResult decoder + resultRoundTrip: the C integer faithfully
  round-trips back to the ABI Result (lossless/faithful encoding).
- resultToIntInjective: distinct ABI outcomes never collide on the wire,
  derived from the round-trip via justInj . cong intToResult.
- Positive controls (concrete decode = Refl) and a machine-checked
  non-vacuity control: distinct codes have distinct ints.

Genuine total proofs, no believe_me/postulate/assert_total/etc.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A6PSzJWpRxtzGDjUCEh7Mx
Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com>
@hyperpolymath hyperpolymath marked this pull request as ready for review June 28, 2026 06:47
@hyperpolymath hyperpolymath merged commit d9a214c into main Jun 28, 2026
4 checks passed
@hyperpolymath hyperpolymath deleted the claude/new-session-znxgm7 branch June 28, 2026 06:47
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