Skip to content

Commit c1384ba

Browse files
docs(proof-needs): reconcile believe_me audit (5 justified axioms) (#81)
Closes the boj-server arm of the estate proof-debt epic. **Finding (P0 #125):** the 5 `believe_me` in `src/abi/Boj/SafetyLemmas.idr` (lines 53/60/211/219/226) are all class **(J)** genuinely-unavoidable axioms — soundness/symmetry of `prim__eqChar` and length semantics of `prim__strToCharList`/`prim__strAppend`/`prim__strSubstr`. These are irreducible within Idris2 0.8.0 (no in-language soundness principle for foreign primitives; stdlib `DecEq Char` does the same). They are `%unsafe`, individually documented, and isolated in one module. **No removable proof debt** — the defect was the doc. **Change:** `PROOF-NEEDS.md` reconciled — origin/main wrongly stated "4 believe_me"; ground-truth is 5 axiom sites (raw grep returns 9 = 5 real + 4 comment mentions). Adds a per-site Axiom Audit table. Refs hyperpolymath/standards#124 Refs hyperpolymath/standards#125 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 87cb65f commit c1384ba

1 file changed

Lines changed: 59 additions & 12 deletions

File tree

PROOF-NEEDS.md

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,47 @@
11
# PROOF-NEEDS.md — boj-server
22

3-
## Current State (Updated 2026-04-25)
3+
## Current State (Updated 2026-05-18)
44

55
- **src/abi/Boj/**: 16 Idris2 ABI files
6-
- **Dangerous patterns**: 4 `believe_me` (all documented axioms in SafetyLemmas.idr;
7-
`logSafeBounded` restructured to use them structurally — down from 31)
6+
- **Dangerous patterns**: **5** `believe_me` invocations, **all** in
7+
`src/abi/Boj/SafetyLemmas.idr`, **all** classified `(J)` genuinely
8+
unavoidable (see audit table below). `logSafeBounded` (SafeAPIKey.idr)
9+
consumes these structurally and contains no direct `believe_me`
10+
down from 31 historically.
11+
- Note: a raw `grep believe_me *.idr` returns **9** hits. 4 of these
12+
are documentation/comment mentions of the word (1 in SafeHTTP.idr
13+
line 15, 1 in SafetyLemmas.idr line 9, 2 in
14+
cartridges/fleet-mcp/abi/FleetMcp/SafeFleet.idr lines 14 & 34) and
15+
are **not** axiom uses. The audited true count is 5.
816
- **LOC**: ~5,400 (Elixir + Idris2)
917
- **ABI layer**: Comprehensive dependent-type ABI
1018

19+
## Axiom Audit (2026-05-18)
20+
21+
Every real `believe_me` invocation, with its classification.
22+
Classification key: **(J)** genuinely unavoidable, documented as an axiom;
23+
**(R)** replaceable with a real proof / total definition;
24+
**(S)** stub/laziness to fix.
25+
26+
| # | Site | Function | Type | Class | Rationale |
27+
|---|------|----------|------|-------|-----------|
28+
| 1 | `SafetyLemmas.idr:53` | `charEqSound` | `(c1,c2:Char) -> c1 == c2 = True -> c1 = c2` | **J** | `Char` is an opaque primitive; `==` is `prim__eqChar` (foreign `Bool`). Idris2 0.8.0 has no in-language soundness principle for primitive equality. Standard, well-understood axiom. |
29+
| 2 | `SafetyLemmas.idr:60` | `charEqSym` | `(x,y:Char) -> (x == y) = (y == x)` | **J** | Symmetry of `prim__eqChar`. Same reason as #1 — opaque primitive, no decision procedure to recurse on. |
30+
| 3 | `SafetyLemmas.idr:211` | `unpackLength` | `length (unpack s) = length s` | **J** | `unpack` = `prim__strToCharList` (foreign). `String` is opaque with no induction principle; the relation between primitive `String` length and `List Char` length is not reducible in-language. |
31+
| 4 | `SafetyLemmas.idr:219` | `appendLengthSum` | `length (s ++ t) = length s + length t` | **J** | `++` on `String` = `prim__strAppend` (foreign). Length additivity is a backend-semantics guarantee, not type-level reducible. |
32+
| 5 | `SafetyLemmas.idr:226` | `substrLengthBound` | `LTE (length (substr start len s)) len` | **J** | `substr` = `prim__strSubstr` (foreign). The "result no longer than `len`" bound is a primitive-semantics guarantee with no in-language proof. |
33+
34+
**Verdict: 5/5 are class (J).** All five reduce to the same root cause:
35+
Idris2 treats `Char` and `String` as opaque primitive types whose
36+
operations are foreign functions with no constructors and no induction
37+
principle. There is no constructive in-language proof for any of them; a
38+
`believe_me` (or an equivalent `%foreign` postulate) is the only option
39+
short of changing the trusted computing base. They are correctly marked
40+
`%unsafe`, individually documented, and isolated in one module.
41+
42+
No **(R)** or **(S)** sites were found. The audit's "9" was a raw text
43+
count conflating 5 real axioms with 4 comment mentions.
44+
1145
## Completed Proofs
1246

1347
| File | Covers | REQUIREMENTS-MASTER.md |
@@ -32,22 +66,35 @@ All P1/P2 proof obligations are now closed.
3266
| BJ2 | Auth/credential handling — full isolation model | ✅ DONE (`CredentialIsolation.idr`) |
3367
| BJ3 | API contract compliance — protocol/domain coverage | ✅ DONE (`APIContractCoverage.idr`) |
3468

35-
### Remaining axiomatic surface (4 believe_me, all in SafetyLemmas.idr)
69+
### Remaining axiomatic surface (5 believe_me, all in SafetyLemmas.idr)
70+
71+
All five are class **(J)** — genuinely unavoidable in Idris2 0.8.0
72+
(opaque `Char`/`String` primitives, foreign-backed operations). See the
73+
**Axiom Audit (2026-05-18)** table above for per-site detail.
3674

37-
| Axiom | Justification |
38-
|-------|---------------|
39-
| `charEqSound` | Soundness of `prim__eqChar` — backend primitive correctness |
40-
| `charEqSym` | Symmetry of `prim__eqChar` — backend primitive correctness |
41-
| `unpackLength` | `prim__strToCharList` preserves length — backend primitive correctness |
42-
| `appendLengthSum` | `prim__strAppend` length semantics — not reducible at type level |
43-
| `substrLengthBound` | `prim__strSubstr` length bound — not reducible at type level |
75+
| Axiom | Site | Justification |
76+
|-------|------|---------------|
77+
| `charEqSound` | `SafetyLemmas.idr:53` | Soundness of `prim__eqChar` — backend primitive correctness |
78+
| `charEqSym` | `SafetyLemmas.idr:60` | Symmetry of `prim__eqChar` — backend primitive correctness |
79+
| `unpackLength` | `SafetyLemmas.idr:211` | `prim__strToCharList` preserves length — backend primitive correctness |
80+
| `appendLengthSum` | `SafetyLemmas.idr:219` | `prim__strAppend` length semantics — not reducible at type level |
81+
| `substrLengthBound` | `SafetyLemmas.idr:226` | `prim__strSubstr` length bound — not reducible at type level |
4482

4583
Note: `logSafeBounded` in SafeAPIKey.idr no longer uses `believe_me` directly;
4684
it calls the documented SafetyLemmas axioms via structural proof.
85+
`charEqSound` is consumed by `Safety.idr` (`shellContra`, `sqlContra`);
86+
`unpackLength` by `SafeAPIKey.idr` (`sufficientEntropyNonEmpty`).
4787

4888
## Priority Going Forward
4989

5090
**LOW** — All named proof obligations closed. Future work:
5191
- Proofs for Dap/Bsp/CodeIntel domains when those cartridges reach Ready status
5292
- Proof that `dispatch` is surjective onto all BJ3-covered (domain, protocol) pairs
53-
- Eliminate string-primitive axioms via a trusted extraction layer
93+
- The 5 string/char-primitive axioms are **irreducible within Idris2**
94+
(opaque primitive types). They cannot be "proved away" in-language;
95+
the only reduction path is to shrink the trusted base by validating
96+
`prim__eqChar` / `prim__strToCharList` / `prim__strAppend` /
97+
`prim__strSubstr` against the chosen backend (Chez/BEAM) via an
98+
external trusted-extraction or property-test harness, then citing
99+
that evidence here. This is a backend-assurance task, not a proof
100+
obligation — keep it tracked but do not expect a constructive proof.

0 commit comments

Comments
 (0)