Skip to content

audit: 2 Idris2 postulates in src/abi/Layout.idr — alignment + alignedSize correctness #27

@hyperpolymath

Description

@hyperpolymath

Context

A 2026-05-20 cross-estate trust-escape sweep surfaced 2 Idris2 postulates in `src/abi/Layout.idr` that aren't tracked under the standards#133 POST-T0 axiom audit (that audit covered `proofs/lean4/` + `proofs/coq/` model-layer axioms — 117 declarations triaged to 73 Axioms + 42 Parameters, all owner-classified as legitimate model-layer assumptions about abstract Parameters).

The two Layout.idr postulates are a different kind: they're concrete number-theoretic lemmas about `mod` arithmetic, deferred awaiting a div/mod lemma library.

The two postulates

1. `alignmentMatchesPlatformWord` (line 251)

```idris
export
postulate alignmentMatchesPlatformWord :
(p : Platform) -> {0 t : Type} -> {n : Nat} ->
HasAlignment t n -> So (n `mod` (ptrSize p `div` 8) == 0)
```

Comment cites "the same deferral pattern as civic-connect/src/Abi/Layout.idr (alignUpDivides, mkFieldsAligned, offsetInBoundsPrf)" — so this is a known cross-repo pattern.

The obligation moves to the producer: `AlignProof` must only be constructed for types whose alignment genuinely matches platform word size. But the postulate itself sits in the trusted base.

2. `alignedSizeCorrect` (line 297)

```idris
export
postulate alignedSizeCorrect : (size : Nat) -> (align : Nat) -> {auto 0 nonZero : So (align /= 0)} ->
So (alignedSize size align `mod` align == 0)
```

Comment: "showing `(size + align - remainder) mod align = 0` needs the div/mod identity `size = (size `div` align) * align + remainder` plus congruence lemmas, i.e. the same `div_mod_lemma` infrastructure civic-connect's `alignUpDivides` defers."

Why this is worth filing

  • These are provable (standard Nat-mod algebra), unlike the model-layer Parameters tracked under standards#133 (which are abstract physics/quantum/POSIX assumptions).
  • They are concentrated in one ABI module + replicated across the estate per the comment trail (civic-connect, presumably others).
  • A div/mod lemma library — once written — would discharge both at once, plus civic-connect's three deferrals, plus any future ABI alignment work.

Suggested labels

`audit` / `technical-debt` / `idris2` / `abi` — leave priority/timing to owner.

Audit scope context

Trust-escape sweep audit: 2026-05-20 evening, by Claude session bee4abf8-11ea-4236-bada-c4173ba54b3b. Other absolute-zero trust-escapes (52 Lean axioms + 114 Coq axioms/parameters) are all owner-authorised under standards#133.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions