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 scaffolded ABI under src/interface/abi was never compiler-checked.
This makes all four modules build cleanly (zero errors, zero warnings)
with /usr/local/bin/idris2 0.7.0 and adds real machine-checked theorems.

Types.idr:
- Replace %runElab thisPlatform (ElabReflection not enabled) with plain Linux.
- DecEq Result: replace uncompilable "decEq _ _ = No absurd" catch-all with
  explicit off-diagonal No (\case Refl impossible) cases for all 56 distinct
  ordered constructor pairs.
- createHandle: solve the {auto 0 nonNull : So (ptr /= 0)} proof via
  choose (ptr /= 0) instead of an unsolved Just (MkHandle ptr).
- Rename the duplicate NimObject record to NimObjectDef (it collided with the
  NimObject constructor of NimTypeKind).
- Fix CPtr to return a concrete pointer-sized integer type per platform.
- Fix cSizeOf/cAlignOf which tried to pattern-match on the type-level
  functions CInt/CSize (illegal); match concrete Bits widths instead.
- import Decidable.Equality.

Layout.idr:
- paddingFor: use minus (Nat has no Neg) instead of (-).
- Add sound decDivides : (n m : Nat) -> Maybe (Divides n m) via div + decEq.
- alignUpCorrect: was an unsound universally-quantified Refl proof; now a
  sound decision returning Maybe (Divides align (alignUp size align)).
- checkCABI: implement decFieldsAligned over the Vect and return a real
  CABICompliant witness (or Left) instead of the ?fieldsAlignedProof hole.
- offsetInBounds: was an unsound universally-quantified So; now returns
  Maybe (So ...) decided via choose.
- verifyLayout: supply the erased sizeCorrect/aligned proofs explicitly
  (choose + decDivides) instead of leaving them unsolved.
- Concrete nimBufferLayout/nimResultLayout: supply {sizeCorrect = Oh} and
  {aligned = DivideBy k Refl}.
- nimBufferLayoutValid/nimResultLayoutValid: build the FieldsAligned witness
  directly (one DivideBy per field) instead of holes; qualify layout names.
- Rename shadowing implicit n to k in Vect signatures.
- import Data.Nat, Decidable.Equality.

Foreign.idr:
- Declare prim__getString before the generation wrappers so it resolves to
  the user Bits64 -> String type rather than the builtin Ptr String shape.

Proofs.idr (new):
- nimBufferCompliant, nimResultCompliant: CABICompliant proofs built directly.
- okIsZero, nullPointerIsFour, okDistinctFromError: result-encoding facts.

Buildability:
- git mv flat files into Nimiser/ABI/ to match module namespaces.
- Add nimiser-abi.ipkg (modules Types, Layout, Foreign, Proofs).
- Add **/build/, *.ttc, *.ttm to .gitignore.

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:54
@hyperpolymath hyperpolymath merged commit be1d62d into main Jun 26, 2026
20 of 23 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