ABI: make Idris2 proofs genuinely compile + add machine-checked theorems#34
Merged
Merged
Conversation
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. This makes the ABI build clean (zero errors,
zero warnings) under Idris2 0.7.0 and adds machine-checked theorems.
Types.idr:
- Replace %runElab thisPlatform (needs ElabReflection) with plain `Linux`.
- mkComplexityScore: solve the erased `inBounds : So (score <= 100)` proof via
`choose`, binding the witness explicitly.
- layerMonotonic: its universally-quantified `So (...)` return type was unsound;
change to `Maybe (So (...))` decided via `choose`.
- DecEq Result: replace the non-compiling `decEq _ _ = No absurd` catch-all with
all 42 explicit off-diagonal cases `No (\case Refl impossible)`.
- createHandle: solve the erased `nonNull : So (ptr /= 0)` via `choose`.
- import Decidable.Equality (for the DecEq instance).
- CPtr: `Bits (ptrSize p)` is not a valid type (no `Bits : Nat -> Type`); map to
the platform-word integer type (Bits64/Bits32) instead.
Layout.idr:
- paddingFor: `alignment - ...` is invalid on Nat; use `minus`. import Data.Nat.
- Add sound `decDivides` (verifies q*(S k) == m propositionally) and
`decFieldsAligned`; checkCABI now builds a real witness or returns Left.
- import Decidable.Equality.
- verifyLayout: solve both erased proofs (`sizeCorrect` via choose, `aligned` via
decDivides) instead of leaving the auto-implicit `Divides` unsolved.
- alignUpAligned: replace the unprovable `DivideBy (... div ...) Refl` with a sound
decision procedure over decDivides.
- offsetInBounds: its universal `So (...)` was unsound; change to `Maybe (So (...))`.
- Concrete StructLayouts (apiSurface/endpoint/wrapper): supply the erased
auto-implicit proofs explicitly ({sizeCorrect = Oh}, {aligned = DivideBy k Refl}).
- Rename shadowing `n` binders (vs StructLayout.n) to k/len to clear warnings.
Proofs.idr (new): machine-checked theorems, all `export`:
- apiSurfaceCompliant / endpointDescriptorCompliant / wrapperDescriptorCompliant:
CABICompliant of each layout, built directly via ConsField/DivideBy k Refl
(one per field, offset = k * alignment), layout names qualified as Layout.*.
- okIsZero, beginnerIsZero (Refl); okErrorDistinct (encoding injectivity).
Buildability:
- git mv flat files into nested Mylangiser/ABI/ layout matching the namespace.
- Add src/interface/abi/mylangiser-abi.ipkg.
- .gitignore: add **/build/, *.ttc, *.ttm.
cd src/interface/abi && idris2 --build mylangiser-abi.ipkg exits 0, clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DF9CcCuL4YJoqs26eHsYiA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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; realdecDivides/decFieldsAlignedreplacing?fieldsAlignedProof; honestoffsetInBounds;thisPlatformde-%runElab'd; buildable nested layout + ipkg; newProofs.idrwith real theorems.Verified:
idris2 --buildclean (0/0); adversarial re-verify found nobelieve_me/postulate/holes.🤖 Generated with Claude Code
Generated by Claude Code