|
| 1 | +// SPDX-License-Identifier: CC-BY-SA-4.0 |
| 2 | +// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk> |
| 3 | += Proof Status — typell Idris 2 ABI modules |
| 4 | +:toc: |
| 5 | + |
| 6 | +*Measured 2026-07-27 under Idris 2 0.7.0 (system) and 0.8.0 (nixpkgs). |
| 7 | +Format and discipline imported from kategoria's PROOF-STATUS.adoc: this |
| 8 | +file records what `idris2 --check` actually says, not what comments |
| 9 | +claim.* |
| 10 | + |
| 11 | +== Verified modules (5 / 5 required PASS) |
| 12 | + |
| 13 | +[cols="2,1,4",options="header"] |
| 14 | +|=== |
| 15 | +| Module (src/abi/) | Status | What it proves |
| 16 | + |
| 17 | +| Soundness.idr | PASS |
| 18 | +| Progress + preservation + type safety for the STLC core modelling |
| 19 | + check.rs/infer.rs/unify.rs. Renaming and PARALLEL-substitution lemmas |
| 20 | + fully proven — no holes. |
| 21 | + |
| 22 | +| InferenceSoundness.idr | PASS |
| 23 | +| Occurs-check/substitution lemmas, unifier soundness statements, |
| 24 | + substitution idempotence for the inference model of unify.rs. |
| 25 | + |
| 26 | +| LevelMonotonicity.idr | PASS |
| 27 | +| The safety-level hierarchy (initial set L1–L10) is monotone: |
| 28 | + `featNMono`/`featureMonotonicity` — higher levels' feature sets |
| 29 | + subsume lower levels' — now proven for ALL level pairs. |
| 30 | + |
| 31 | +| Types.idr | PASS |
| 32 | +| ABI type definitions; decidable equality for Result; So-guarded |
| 33 | + non-null handles; computable C-type sizes over a closed universe with |
| 34 | + definitional layout lemmas. |
| 35 | + |
| 36 | +| Foreign.idr | PASS |
| 37 | +| FFI surface declarations matching ffi/zig. |
| 38 | +|=== |
| 39 | + |
| 40 | +Gate: `just proof-check` → `scripts/check-idris2-proofs.sh` (also run in |
| 41 | +CI by `.github/workflows/proof-gate.yml`). The gate HARD-FAILS when |
| 42 | +idris2 is absent and rejects `postulate` / `believe_me` / `assert_total` |
| 43 | +/ `%hint` / holes (`?name`) outside comments in the required modules. |
| 44 | + |
| 45 | +== Quarantined (1) |
| 46 | + |
| 47 | +`Layout.idr` — RSR-template scaffolding, excluded from the pass-required |
| 48 | +set and reported by the gate on every run. Why: three named holes |
| 49 | +(`?fieldsAlignedProof`, `?exampleFieldsAligned`, `?offsetInBoundsProof`), |
| 50 | +a divisibility "proof" attempted via `Refl` on abstract arithmetic |
| 51 | +(unprovable as stated), `verifyAllPlatforms` returning `Right ()` while |
| 52 | +checking nothing, and `Nat` subtraction/`Divides` machinery that does not |
| 53 | +compile. No module imports it. Disposition (owner): rewrite honestly |
| 54 | +against real mod/div lemmas, or delete. |
| 55 | + |
| 56 | +== History — read this before trusting old claims |
| 57 | + |
| 58 | +Until 2026-07-21 these modules had NEVER been run through idris2: |
| 59 | + |
| 60 | +- 5 of 6 failed `--check` outright. `Soundness.idr` referenced `Step` |
| 61 | + before its definition, returned erased implicits relevantly in its |
| 62 | + canonical-forms lemmas, hid two NAMED HOLES in the substitution lemma |
| 63 | + behind a comment insisting they were "not believe_me or postulate" — |
| 64 | + and its `subst` function was semantically WRONG under binders |
| 65 | + (substituted the lambda's own bound variable; the de Bruijn bug is why |
| 66 | + the original proof could not be completed). `LevelMonotonicity.idr` |
| 67 | + had a `Fin 11`-vs-`Fin 10` off-by-one in the `SafeUp` constructor of |
| 68 | + the monotonicity model itself, a circular (uninhabitable) `SafeL1` |
| 69 | + base case, and stdlib lemma names that no longer exist. |
| 70 | +- The one thing `--check` DID accept silently was a hole: |
| 71 | + `?featureMonoGeneral` — the central feature-subsumption theorem was |
| 72 | + only proven for L1. Holes pass `idris2 --check`; that is exactly why |
| 73 | + the gate scans for them. |
| 74 | +- `applySubst` in InferenceSoundness.idr recursed through the |
| 75 | + substitution's range and was non-terminating on cyclic substitutions; |
| 76 | + it is now single-pass, modelling idempotent (MGU-form) substitutions, |
| 77 | + with the invariant documented. |
| 78 | + |
| 79 | +== Reproduce |
| 80 | + |
| 81 | +[source,sh] |
| 82 | +---- |
| 83 | +just proof-check |
| 84 | +# or directly: |
| 85 | +./scripts/check-idris2-proofs.sh |
| 86 | +# or with the same prover CI uses: |
| 87 | +nix shell nixpkgs#idris2 -c ./scripts/check-idris2-proofs.sh |
| 88 | +---- |
0 commit comments