Skip to content

ABI Layer 5: end-to-end soundness capstone certificate#45

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

ABI Layer 5: end-to-end soundness capstone certificate#45
hyperpolymath merged 6 commits into
mainfrom
claude/new-session-znxgm7

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Layer 5 (the capstone, completing the 5-layer proof track): a new *.ABI.Capstone module importing every prior layer and assembling a single inhabited ABISound certificate (abiContractDischarged) from the real exported witnesses of the flagship property (L2 translation preservation), the deeper invariant (L3 compositionality), and the FFI-seam injectivity (L4). One end-to-end soundness statement.

Genuine composition only — reuses real exported names.

Testing

Idris2 0.7.0 --build → exit 0, zero warnings. Adversarial: a bogus-field certificate was rejected. 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 6 commits June 27, 2026 19:32
Add the flagship Layer-2 semantic proof for julianiser. Models a shared
arithmetic + array-indexing expression AST with two evaluators: evalSrc
(Python/R, 0-based indexing) and evalJulia (translated Julia, 1-based
indexing). Proves the headline correctness property:

    translatePreserves : (env) -> (e) ->
      evalSrc env e = evalJulia env (translate e)

as a genuine propositional equality by structural induction, with the
index case discharged by the 0-to-1 re-basing round-trip lemma
(juliaRoundTrip), mirroring IndexRemapCorrect in Types.idr.

Includes a sound certifier (certifyEquiv/certifyEquivSound), a positive
control (sampleAgrees, fully evaluated 10*2+30=50), and a negative
control: a deliberately unshifted "buggy" Julia evaluator together with
buggyDivergesWitness proving it genuinely diverges (30 /= 20). The
property is non-vacuous: an adversarial Refl claiming the buggy
translation preserves results is rejected by idris2 (Mismatch 20 vs 30).

No believe_me/postulate/assert_total. Builds clean, zero warnings.

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

Raises the julianiser Idris2 ABI from Layer 2 to Layer 3 with a new
Julianiser.ABI.Invariants module built over the existing Semantics model
(no datatypes redefined). Proves three deeper, distinct properties:

- Compositionality: translate is a homomorphism over syntactic linking
  (translateHom) and correctness is closed under composition
  (preserveCompose) — a modular argument, not the Layer-2 induction.
- Determinism: evalJulia congruence + pipeline determinism, plus
  translate injectivity (deterministic, information-preserving codegen).
- A second sound+complete Dec checker for faithful (source,julia) pairs
  (decFaithful + soundness + completeness), with DecEq for JExpr/JuliaIdx.

Includes positive controls (composite round-trip via preserveCompose,
homomorphism Refl, faithful acceptance) and negative/non-vacuity controls
(translate injectivity disequality, checker rejection). %default total,
no believe_me/postulate/assert. Clean build, zero warnings; adversarial
false-equality check rejected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A6PSzJWpRxtzGDjUCEh7Mx
Prove the FFI result-code wire encoding is sound for Julianiser:
- intToResult decoder + resultRoundTrip: faithful/lossless round-trip
- resultToIntInjective: derived from round-trip via cong + justInj
- positive controls (decode 0/6/7) and negative non-vacuity controls
  (distinct codes have distinct ints, machine-checked)

Genuine proof only; no believe_me/postulate/etc. %default total, zero
warnings. Julianiser has only Result/resultToInt as an FFI enum encoder
(no ProofStatus/statusToInt), so clause (c) is vacuous.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A6PSzJWpRxtzGDjUCEh7Mx
Assemble the existing per-layer proofs into one inhabited value
`abiContractDischarged : ABISound`, wiring the flagship semantic
preservation (Semantics.sampleAgreesGeneric), the Layer-3 invariants
(Invariants.compositeAgrees compositionality + translateInjective
deterministic codegen), and the Layer-4 FFI seam injectivity
(FfiSeam.resultToIntInjective) into a single end-to-end soundness
statement. No new domain theorem; genuine composition only. Builds with
zero warnings; a false-certificate adversarial probe is rejected.

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 07:24
@hyperpolymath hyperpolymath merged commit 4a5ac2a into main Jun 28, 2026
6 checks passed
@hyperpolymath hyperpolymath deleted the claude/new-session-znxgm7 branch June 28, 2026 07:24
hyperpolymath added a commit that referenced this pull request Jul 2, 2026
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
## Summary

Closes the **G34** hole: the ABI-FFI gate ran a Julia *structural*
conformance check and a Zig FFI build, but **nothing ever ran `idris2`
on the ABI itself**. The 8 proof modules (`Types`, `Layout`, `Foreign`,
`Proofs`, `Semantics`, `Invariants`, `FfiSeam`, `Capstone` — landed
across PRs #38/#42/#43/#44/#45) were authored and locally verified
against Idris2 0.7.0 but never compiler-checked in CI. A future edit
could break a proof and the gate would stay green.

## Changes

- **`.github/workflows/abi-ffi-gate.yml`**: new `idris2-abi` job running
`idris2 --typecheck julianiser-abi.ipkg` in the SHA-pinned
`ghcr.io/stefan-hoeck/idris2-pack` container (the same prebuilt image
the `Axiom.jl` `idris2-abi-check` job uses — avoids a ~10-min
Chez/Idris2 source build). Header comment updated to describe all three
jobs.
- **`.tool-versions`**: uncomment `idris2 0.7.0` (pins the version the
proofs were verified against, for local `asdf` use). Nothing
auto-installs from it, so this is documentation-only.

## RSR Quality Checklist

### Required

- [x] Tests pass — `idris2 --typecheck julianiser-abi.ipkg` and `idris2
--build julianiser-abi.ipkg` both exit 0 on all 8 modules (verified
locally, Idris2 0.7.0)
- [x] No banned language patterns (YAML workflow + `.tool-versions`
only)
- [x] No banned functions (`believe_me`/`postulate`/`sorry`) — the ABI
modules are unchanged by this PR; the new job *enforces* their absence
going forward
- [x] SPDX headers intact (workflow retains its `MPL-2.0` header; no
source files added)
- [x] No secrets, credentials, or `.env` files included

### As Applicable

- [x] ABI/FFI changes validated — CI now typechecks `src/interface/abi/`
on every push/PR; the existing structural + Zig jobs are untouched

## Testing

Ground-truthed with Idris2 0.7.0:
- `cd src/interface/abi && idris2 --typecheck julianiser-abi.ipkg` →
exit 0
- `idris2 --build julianiser-abi.ipkg` → exit 0
- YAML parses; job list = `conformance`, `zig-build`, `idris2-abi`;
`working-directory` path `src/interface/abi/julianiser-abi.ipkg` exists.

The pinned container image is the identical digest already green in
`Axiom.jl`'s equivalent `idris2-abi-check` job.

🤖 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>
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