Skip to content

Commit 47c4517

Browse files
docs(proof-debt): add canonical AXIOM: annotations to SafetyLemmas.idr (#163)
## Summary Follow-up to #161 (which seeded `docs/proof-debt.md` per the estate [Trusted-Base Reduction Policy](https://github.com/hyperpolymath/standards/blob/main/docs/TRUSTED-BASE-REDUCTION-POLICY.adoc) — hyperpolymath/standards#203, enforcement hyperpolymath/standards#211). `docs/proof-debt.md` already enumerates the 5 class-(J) `believe_me` sites in `src/abi/Boj/SafetyLemmas.idr`, so the `check-trusted-base.sh` gate passes via the "documented in proof-debt.md" path. This PR closes the second path: each marker now also has an inline `AXIOM:` leading comment, the canonical keyword the script greps. The result: boj-server satisfies **both** halves of the check, making it the fully canonical reference implementation cited in standards#203 §"Precedent". ## Changes - `src/abi/Boj/SafetyLemmas.idr` (38 lines, 5 sites + 1 module header): - `charEqSound`, `charEqSym`, `unpackLength`, `appendLengthSum`, `substrLengthBound` each gain an `AXIOM: <name>; class-(J) — ...` header line citing `docs/proof-debt.md §(c)` and the per-primitive `docs/backend-assurance/<primitive>.md`. - Module-header summary updated from "Five axiomatic believe_me" to use the policy vocabulary ("AXIOM-tagged", "disposition-§(c) NECESSARY-AXIOM"). - `PROOF-NEEDS.md`: new header note cross-linking `docs/proof-debt.md` (strategic-goals doc ↔ schema-conformant per-repo index) — mirrors the pattern from standards#213. ## Marker inventory (unchanged) 5 escape hatches, all `believe_me`, all in `src/abi/Boj/SafetyLemmas.idr`, all class-(J) NECESSARY AXIOM (§(c)), all externally validated under `docs/backend-assurance/`: | Site | Function | Disposition | |------|----------|-------------| | `SafetyLemmas.idr:61` | `charEqSound` | §(c) NECESSARY AXIOM | | `SafetyLemmas.idr:68` | `charEqSym` | §(c) NECESSARY AXIOM | | `SafetyLemmas.idr:226` | `unpackLength` | §(c) NECESSARY AXIOM | | `SafetyLemmas.idr:236` | `appendLengthSum` | §(c) NECESSARY AXIOM | | `SafetyLemmas.idr:246` | `substrLengthBound` | §(c) NECESSARY AXIOM | §(a) DISCHARGED: 0. §(b) BUDGETED: 0 (the externally-validated harness under `docs/backend-assurance/` is §(b)-style discipline applied to §(c) items per standards#203 §"Precedent"). §(d) DEBT: 0. ## Test plan - [ ] `bash scripts/check-trusted-base.sh .` (when the standards#211 `trusted-base` job runs against this branch) reports `[OK] All 5 escape hatch(es) are documented (inline annotation or entry in: docs/proof-debt.md PROOF-NEEDS.md).` - [ ] CI green on the trusted-base job specifically. - [ ] No behavioural change in Idris2 build — `believe_me` bodies and signatures untouched; only doc-comments edited. Refs: hyperpolymath/standards#203 (policy), hyperpolymath/standards#211 (enforcement), #161 (proof-debt.md seed). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fabfbbe commit 47c4517

2 files changed

Lines changed: 37 additions & 11 deletions

File tree

PROOF-NEEDS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# PROOF-NEEDS.md — boj-server
22

3+
> **See also**: [`docs/proof-debt.md`](docs/proof-debt.md) is the
4+
> schema-conformant per-repo index under the estate
5+
> [Trusted-Base Reduction Policy](https://github.com/hyperpolymath/standards/blob/main/docs/TRUSTED-BASE-REDUCTION-POLICY.adoc)
6+
> (standards#203, enforcement standards#211). PROOF-NEEDS.md is the
7+
> *strategic-goals* narrative — full audit table, classification
8+
> rationale, and external-validation pointers. `docs/proof-debt.md` is
9+
> the *machine-checked* index that `scripts/check-trusted-base.sh`
10+
> greps. Keep both in sync when the marker count in
11+
> `src/abi/Boj/SafetyLemmas.idr` changes.
12+
313
## Current State (Updated 2026-05-18)
414

515
- **src/abi/Boj/**: 16 Idris2 ABI files

src/abi/Boj/SafetyLemmas.idr

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
||| proofs in SafeHTTP, SafeCORS, SafeWebSocket, SafePromptInjection,
77
||| SafeAPIKey, and Safety modules.
88
|||
9-
||| Five axiomatic believe_me primitives are declared here. Each is
10-
||| class (J) — genuinely unavoidable in Idris2 0.8.0 because `Char`
11-
||| and `String` are opaque primitive types whose operations are
9+
||| Five AXIOM-tagged believe_me primitives are declared here (per the
10+
||| estate trusted-base reduction policy — hyperpolymath/standards#203).
11+
||| Each is class (J) — genuinely unavoidable in Idris2 0.8.0 because
12+
||| `Char` and `String` are opaque primitive types whose operations are
1213
||| foreign functions with no constructors and no in-language induction
13-
||| principle. They are documented as principled assumptions, not
14-
||| unproven debt; see PROOF-NEEDS.md for the per-site audit.
14+
||| principle. They are documented as principled disposition-§(c)
15+
||| NECESSARY-AXIOM assumptions, not unproven debt; see
16+
||| `docs/proof-debt.md` (schema-conformant index) and `PROOF-NEEDS.md`
17+
||| (audit narrative) for the per-site disposition.
1518
|||
1619
||| charEqSound — soundness of prim__eqChar (c1 == c2 = True → c1 = c2)
1720
||| charEqSym — symmetry of prim__eqChar (x == y = y == x)
@@ -54,14 +57,19 @@ notTrueNotTrue : not True = True -> Void
5457
notTrueNotTrue Refl impossible
5558

5659
||| Primitive char equality soundness: c1 == c2 = True implies c1 = c2.
57-
||| Axiomatic: correctness of Idris2's prim__eqChar backend primitive.
60+
||| AXIOM: charEqSound; class-(J) — correctness of Idris2's prim__eqChar
61+
||| backend primitive. `Char` is an opaque primitive; no in-language
62+
||| induction principle exists in Idris2 0.8.0. See docs/proof-debt.md §(c)
63+
||| and docs/backend-assurance/prim__eqChar.md for external validation.
5864
%unsafe
5965
export
6066
charEqSound : (c1, c2 : Char) -> c1 == c2 = True -> c1 = c2
6167
charEqSound _ _ _ = believe_me ()
6268

6369
||| Helper: symmetry of Char equality.
64-
||| Axiomatic: symmetry of prim__eqChar on the BEAM/Chez backend.
70+
||| AXIOM: charEqSym; class-(J) — symmetry of prim__eqChar on the BEAM/Chez
71+
||| backend. Same root cause as charEqSound. See docs/proof-debt.md §(c)
72+
||| and docs/backend-assurance/prim__eqChar.md.
6573
%unsafe
6674
export
6775
charEqSym : (x, y : Char) -> (x == y) = (y == x)
@@ -212,22 +220,30 @@ allNeqImpliesNotElem {target} {xs = x :: xs'} prf with (x == target) proof xEq
212220
--------------------------------------------------------------------------------
213221

214222
||| `unpack s` has the same length as `s`.
215-
||| Axiomatic: prim__strToCharList preserves length (backend primitive guarantee).
223+
||| AXIOM: unpackLength; class-(J) — prim__strToCharList preserves length
224+
||| (backend primitive guarantee). `String` is opaque with no induction
225+
||| principle. See docs/proof-debt.md §(c) and
226+
||| docs/backend-assurance/prim__strToCharList.md for external validation.
216227
%unsafe
217228
export
218229
unpackLength : (s : String) -> length (unpack s) = length s
219230
unpackLength _ = believe_me ()
220231

221232
||| String concatenation length equals the sum of both argument lengths.
222-
||| Axiomatic: prim__strAppend is a backend primitive not reducible at the
223-
||| Idris2 type level. Established by semantics of all supported backends.
233+
||| AXIOM: appendLengthSum; class-(J) — prim__strAppend is a backend
234+
||| primitive not reducible at the Idris2 type level. Established by
235+
||| semantics of all supported backends. See docs/proof-debt.md §(c) and
236+
||| docs/backend-assurance/prim__strAppend.md for external validation.
224237
%unsafe
225238
export
226239
appendLengthSum : (s, t : String) -> length (s ++ t) = length s + length t
227240
appendLengthSum _ _ = believe_me ()
228241

229242
||| Substring of a string has length at most the requested count.
230-
||| Axiomatic: prim__strSubstr semantics — result is never longer than `len`.
243+
||| AXIOM: substrLengthBound; class-(J) — prim__strSubstr semantics: result
244+
||| is never longer than `len`. Backend primitive guarantee with no in-
245+
||| language proof. See docs/proof-debt.md §(c) and
246+
||| docs/backend-assurance/prim__strSubstr.md for external validation.
231247
%unsafe
232248
export
233249
substrLengthBound : (s : String) -> (start, len : Nat) -> LTE (length (substr start len s)) len

0 commit comments

Comments
 (0)