iseriser: make Phase 0 ABI proofs genuinely compile and verify by hyperpolymath · Pull Request #67 · hyperpolymath/iseriser · GitHub
Skip to content

iseriser: make Phase 0 ABI proofs genuinely compile and verify#67

Merged
hyperpolymath merged 2 commits into
mainfrom
claude/iseriser-proofs-review-rtdcwb
Jun 26, 2026
Merged

iseriser: make Phase 0 ABI proofs genuinely compile and verify#67
hyperpolymath merged 2 commits into
mainfrom
claude/iseriser-proofs-review-rtdcwb

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

This is the foundation pass of the family-wide proofs review: make iseriser's own (Phase 0) Idris2 ABI proofs actually compile and machine-verify, so it can serve as the verified reference template before the per-iser fan-out.

Key finding: the hand-written ABI was never compiler-checked — it did not typecheck under Idris2 0.7.0 (the pinned version). The two advertised ?holes were only part of it; several constructs simply don't elaborate. This is almost certainly systemic across the -iser family (same template-derived patterns seen verbatim in e.g. affinescriptiser).

What was broken (and is now fixed)

Layout.idr

  • Discharged the two open holes ?fieldsAlignedProof / ?offsetInBoundsProof.
  • Added a sound decDivides decision procedure (builds genuine m = k*n witnesses) + decFieldsAligned; checkCABI now returns a real CABICompliant proof or an error.
  • offsetInBounds had an unsound signature (asserted every field fits any layout — false); now an honest decidable Maybe.
  • paddingFor used Nat subtraction via Neg (doesn't exist) → minus.
  • The three concrete struct layouts now carry explicit alignment witnesses.
  • alignUpCorrect's Refl proof can't hold for symbolic inputs → replaced with a sound alignUpDivides decision (general lemma noted as residual).

Types.idr

  • FullyResolved / GenerationComplete proved nothing → real So-obligations (no {{/}} markers remain; all seven artifact categories present).
  • thisPlatform was a %runElab stub needing ElabReflection → made total.
  • DecEq Result used No absurd with no Uninhabited (x=y) instance → off-diagonal cases discharged explicitly.
  • createHandle left auto So (ptr /= 0) unsolved → uses choose.

Proofs.idr (new) — machine-checked theorems (compile-time, not runtime tests):

  • the three concrete FFI struct layouts are provably C-ABI aligned;
  • Result → C-int encoding pins (okIsZero, nullPointerIsFive);
  • generation-completeness predicate accepts the full set / rejects a short one.

Structure & tooling

  • Moved ABI into src/interface/abi/Iseriser/ABI/ so it builds as an Idris2 package (matches the chapeliser layout); added iseriser-abi.ipkg.
  • just proofs recipe; ignore Idris build artifacts; verification/proofs/ now documents and points at the verified proofs.

Verification

  • idris2 --build iseriser-abi.ipkg → clean, 0 warnings (Idris2 0.7.0, bootstrapped in-CI-env from source).
  • cargo test → green (57 unit + 9 integration).

Next (per the review plan)

Fan out reverse-alphabetically, layer-by-layer, applying the same transform + real obligations, flagging per-repo blockers (notably AffineScriptiser, whose target toolchain is mid-migration).

🤖 Generated with Claude Code


Generated by Claude Code

Jonathan D.A. Jewell and others added 2 commits June 26, 2026 11:13
The hand-written Idris2 ABI was never compiler-checked and did not
typecheck under Idris2 0.7.0. Make the foundation real and machine-verified.

Layout.idr
- Discharge the two open holes: ?fieldsAlignedProof and ?offsetInBoundsProof.
- Add a sound decDivides decision procedure (builds genuine m = k*n
  witnesses) and decFieldsAligned; checkCABI now returns a real
  CABICompliant proof or an error.
- offsetInBounds had an unsound signature (claimed every field fits any
  layout); make it an honest decidable Maybe.
- Fix paddingFor (Nat has no Neg; use minus) and give the three concrete
  struct layouts explicit alignment witnesses.
- Replace alignUpCorrect's non-compiling Refl proof with a sound
  alignUpDivides decision; the general lemma is noted as residual work.

Types.idr
- FullyResolved and GenerationComplete carried no obligation; give them
  real So-proofs (no {{/}} markers remain; all seven categories present).
- thisPlatform was a %runElab stub needing ElabReflection; make it total.
- DecEq Result used `No absurd` with no Uninhabited instance; discharge
  the off-diagonal cases explicitly.
- createHandle left the auto So (ptr /= 0) unsolved; use choose.

Proofs.idr (new)
- Machine-checked theorems: the three concrete FFI struct layouts are
  provably C-ABI aligned; Result→C-int pins; generation-completeness.

Structure / tooling
- Move ABI into src/interface/abi/Iseriser/ABI/ so it builds as an Idris2
  package (matches the chapeliser layout); add iseriser-abi.ipkg.
- Add `just proofs` recipe; ignore Idris build artifacts.
- verification/proofs/ now documents and points at the verified proofs.

Verified: `idris2 --build iseriser-abi.ipkg` clean (0 warnings);
cargo test green (57 unit + 9 integration).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DF9CcCuL4YJoqs26eHsYiA
The governance/licence-consistency check requires an SPDX-License-Identifier
header on the LICENSE file and a `license` field in the manifest. The LICENSE
body is MPL-2.0 text, so stamp `SPDX-License-Identifier: MPL-2.0` (matching the
actual body) and set `license = "MPL-2.0"` (replacing `license-file`).

Verified with standards/scripts/check-licence-consistency.sh (passes).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DF9CcCuL4YJoqs26eHsYiA
@hyperpolymath hyperpolymath marked this pull request as ready for review June 26, 2026 11:21
@hyperpolymath hyperpolymath merged commit 6f102af into main Jun 26, 2026
20 of 22 checks passed
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.

1 participant