|
1 | | -# PROOF-NEEDS.md |
| 1 | +<!-- SPDX-License-Identifier: MPL-2.0 --> |
| 2 | +<!-- SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell (hyperpolymath) --> |
| 3 | +<!-- Defines proof obligations. Completion tracked in PROOF-STATUS.md. --> |
| 4 | +<!-- Aligned to the AffineScript estate PROOF-NEEDS format. --> |
2 | 5 |
|
3 | | -## Template ABI Cleanup (2026-03-29) |
| 6 | +# PROOF-NEEDS.md — BetLang |
4 | 7 |
|
5 | | -Template ABI removed -- was creating false impression of formal verification. |
6 | | -The removed files (Types.idr, Layout.idr, Foreign.idr) contained only RSR template |
7 | | -scaffolding with unresolved {{PROJECT}}/{{AUTHOR}} placeholders and no domain-specific proofs. |
| 8 | +This file defines *what* must be proven. Completion is tracked in |
| 9 | +`PROOF-STATUS.md`; the phased plan is in |
| 10 | +`docs/AFFINESCRIPT-ALIGNMENT.adoc`; the trusted-base ledger is in |
| 11 | +`docs/proof-debt.adoc`. |
8 | 12 |
|
9 | | -When this project needs formal ABI verification, create domain-specific Idris2 proofs |
10 | | -following the pattern in repos like `typed-wasm`, `proven`, `echidna`, or `boj-server`. |
| 13 | +## Obligation Categories |
| 14 | + |
| 15 | +| Code | Category | Default prover | Rationale | |
| 16 | +|------|----------|----------------|-----------| |
| 17 | +| TP | Typing / metatheory | Lean4 | Core calculus soundness (progress/preservation, monad laws) | |
| 18 | +| SEM | Semantics | Lean4 | Operational ↔ denotational adequacy; continuous measure semantics | |
| 19 | +| STAT | Statistics | Lean4 | Limit theorems, entropy bounds, MC convergence | |
| 20 | +| ABI | ABI / FFI | Idris2 | Rust/Julia FFI boundary safety (mandatory, mirrors AffineScript) | |
| 21 | +| CONC | Concurrency | TLA+ | Parallel bet-execution model | |
| 22 | + |
| 23 | +## Required Proofs |
| 24 | + |
| 25 | +| ID | Obligation | Category | Prover | Priority | Status | |
| 26 | +|----|------------|----------|--------|----------|--------| |
| 27 | +| TP-1 | Progress (well-typed ⇒ value or steps) | TP | Lean4 | P1 | ✅ done | |
| 28 | +| TP-2 | Preservation (typing preserved under step) | TP | Lean4 | P1 | ✅ done | |
| 29 | +| TP-3 | Distribution monad laws (×3) | TP | Lean4 | P1 | ✅ done | |
| 30 | +| TP-4 | Discharge `substTop_preserves_typing` axiom | TP | Lean4 | P1 | remaining | |
| 31 | +| SEM-1 | Continuous measure-theoretic denotation | SEM | Lean4 | P2 | remaining | |
| 32 | +| STAT-1 | Maximum entropy of uniform ternary = log₂3 | STAT | Lean4 | P2 | remaining | |
| 33 | +| STAT-2 | SLLN for bet sample means | STAT | Lean4 | P2 | remaining | |
| 34 | +| ABI-1 | FFI non-null pointer safety | ABI | Idris2 | P1 | remaining | |
| 35 | +| ABI-2 | FFI memory-layout correctness | ABI | Idris2 | P1 | remaining | |
| 36 | +| ABI-3 | Platform type-size proofs | ABI | Idris2 | P1 | remaining | |
| 37 | +| ABI-4 | Foreign return-type proofs | ABI | Idris2 | P1 | remaining | |
| 38 | +| ABI-5 | C-ABI compliance | ABI | Idris2 | P1 | remaining | |
| 39 | +| CONC-1 | Parallel bet-execution model | CONC | TLA+ | P3 | remaining | |
| 40 | + |
| 41 | +## Banned Patterns |
| 42 | + |
| 43 | +No `sorry` / `admit` (Lean), `Admitted` (Coq), `postulate` / |
| 44 | +`believe_me` / `assert_total` (Idris2/Agda), `unsafeCoerce`. A single |
| 45 | +**classified** `axiom` is permitted under the standards#203 |
| 46 | +trusted-base-reduction policy and must be registered in |
| 47 | +`docs/proof-debt.adoc`. Enforced by `tools/proof-scan.sh`. |
| 48 | + |
| 49 | +## How to Add a Proof |
| 50 | + |
| 51 | +1. Choose the prover (see categories above). |
| 52 | +2. Place the file in the correct home (Lean: `proofs/`; others: |
| 53 | + `proofs/<prover>/`, exposed via `verification/proofs/`). |
| 54 | +3. Lean: rely on `lake build`; Idris2: `%default total`. |
| 55 | +4. Run `just proof-check-all`. |
| 56 | +5. Update `PROOF-STATUS.md` and, for any new escape hatch, |
| 57 | + `docs/proof-debt.adoc`. |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +## Historical Note — Template ABI Cleanup (2026-03-29) |
| 62 | + |
| 63 | +Template ABI removed — was creating a false impression of formal |
| 64 | +verification. The removed files (`Types.idr`, `Layout.idr`, |
| 65 | +`Foreign.idr`) contained only RSR template scaffolding with unresolved |
| 66 | +`{{PROJECT}}`/`{{AUTHOR}}` placeholders and no domain-specific proofs. |
| 67 | + |
| 68 | +When this project needs formal ABI verification (obligations **ABI-1..5** |
| 69 | +above, Phase 3), create domain-specific Idris2 proofs following the |
| 70 | +pattern in repos like `typed-wasm`, `proven`, `echidna`, or |
| 71 | +`boj-server`, and in the AffineScript estate |
| 72 | +(`affinescript-vite/verification/proofs/idris2/ABI/`). |
0 commit comments