Skip to content

ABI: make Idris2 proofs genuinely compile + add machine-checked theorems#32

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

ABI: make Idris2 proofs genuinely compile + add machine-checked theorems#32
hyperpolymath merged 3 commits into
mainfrom
claude/iseriser-proofs-review-rtdcwb

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Idris2 ABI proofs — genuinely compile + machine-checked theorems

Part of the family-wide ABI-proofs review. The hand-written ABI did not typecheck under Idris2 0.7.0; this makes it real and verified, following the merged iseriser reference.

Systemic fixes: decEq _ _ = No absurd → explicit off-diagonal cases; {auto 0 nonNull} smart constructors → choose-based; paddingFor -minus; real decDivides/decFieldsAligned replacing ?fieldsAlignedProof; honest offsetInBounds; thisPlatform de-%runElab'd; buildable nested layout + ipkg; new Proofs.idr with real theorems.

Verified: idris2 --build clean (0/0); adversarial re-verify found no believe_me/postulate/holes.

🤖 Generated with Claude Code


Generated by Claude Code

Jonathan D.A. Jewell and others added 3 commits June 26, 2026 11:20
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
Make the repo's licensing single and consistent, matching the wokelangiser
reference policy and the merged iseriser pattern:

- Remove contradictory PMPL-1.0-or-later / Palimpsest self-claims from README
  badges/footers, QUICKSTART, RSR_OUTLINE, STATE-VISUALIZER, and machine-readable
  governance (META, stapeln, deny.toml allow-list, copilot/AGENTIC SPDX
  directives, Trust/Must LICENSE-content checks, per-project CLAUDE.md).
- Encode the docs split in REUSE dep5: *.adoc/*.md/docs/** -> CC-BY-SA-4.0,
  everything else -> MPL-2.0.
- READMEs show MPL-2.0 (code) + CC-BY-SA-4.0 (docs) badges; full texts live in
  LICENSES/; root LICENSE stays MPL-2.0 for GitHub's licence chip.

Preserves legitimate non-self references: cargo-deny's AGPL deny-list, the
"never use AGPL" estate policy, and the Contributor Covenant CoC.

Verified: standards/scripts/check-licence-consistency.sh passes; no residual
PMPL/Palimpsest self-claims remain.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DF9CcCuL4YJoqs26eHsYiA
The src/interface/abi/{Types,Layout,Foreign}.idr files were scaffolded from
a template and never compiler-checked. They now build clean under Idris2
0.7.0 with zero errors and zero warnings.

Fixes:
- Types.idr: replace `%runElab` thisPlatform stub with `thisPlatform = Linux`
  (ElabReflection was not enabled).
- Types.idr: createHandle now obtains a real `So (ptr /= 0)` witness via
  `choose` instead of leaving the MkHandle auto-implicit unsolved.
- Types.idr: add a genuine `DecEq Result` instance with explicit off-diagonal
  disequality cases (`No (\case Refl impossible)`) — a `No absurd` catch-all
  does not typecheck.
- Layout.idr: paddingFor uses `minus` instead of Nat subtraction (`-`).
- Layout.idr: lift record-local `requiredAlloc` (illegal `where` on a record)
  to a top-level definition.
- Layout.idr: interleaved/planar/video layouts and the new mkDim/mkLayout
  smart constructors decide their `So` extent/stride/coverage obligations with
  `choose`, returning Maybe, instead of leaving unprovable symbolic auto
  proofs unsolved.
- Layout.idr: checkCompatibility binds n,m as runtime implicits so decEq has
  access to them.
- Layout.idr: add the C-ABI proof machinery (Divides, decDivides, StructLayout,
  FieldsAligned, decFieldsAligned, CABICompliant, checkCABI, offsetInBounds)
  plus concrete StructLayout values for halide_buffer_t and halide_dimension_t,
  with their erased proofs supplied explicitly ({sizeCorrect = Oh},
  {aligned = DivideBy k Refl}). checkCABI is a sound decision procedure
  (no `?fieldsAlignedProof` hole). offsetInBounds returns Maybe (So ...) via
  choose rather than asserting an unsound universal bound.

New machine-checked theorems (src/interface/abi/Halideiser/ABI/Proofs.idr):
- halideBufferTCompliant   : CABICompliant halideBufferTStruct
- halideDimensionTCompliant : CABICompliant halideDimensionTStruct
  (each built directly from per-field DivideBy k Refl witnesses)
- okIsZero, dimensionMismatchIsSeven : result-code encoding pins
- avx512Width, float64Bytes : codegen sanity equalities

Buildability:
- Move flat files into src/interface/abi/Halideiser/ABI/ so paths match the
  Halideiser.ABI.* namespaces.
- Add src/interface/abi/halideiser-abi.ipkg listing all four modules.
- .gitignore: ignore **/build/, *.ttc, *.ttm.

No believe_me / assert_total / idris_crash / postulate / %hint / holes are
used anywhere; every obligation is discharged genuinely.

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 14:55
@hyperpolymath hyperpolymath merged commit 695cc51 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.

2 participants