Skip to content

Commit a6c97f9

Browse files
docs(policies): trusted-base reduction policy for proof debt (#203)
## Summary - Adds `docs/TRUSTED-BASE-REDUCTION-POLICY.adoc` — formalises the boj-server backend-assurance harness pattern as estate-wide policy. - Defines three permissible dispositions for every soundness-relevant escape hatch (`Axiom`, `Admitted`, `sorry`, `postulate`, `believe_me`, `assume val`, `unsafePerformIO`, …): - **(a) DISCHARGED** — proof exists. - **(b) BUDGETED** — covered by property tests at a documented refutation budget. - **(c) NECESSARY AXIOM** — metatheoretic assumption with citation. - **(d) DEBT** — everything else, lives in `docs/proof-debt.md` with deadline + owner. - Includes `docs/proof-debt.md` schema, per-language annotation conventions (`TRUSTED:`/`AXIOM:` leading comments), and an enforcement plan (future `scripts/check-trusted-base.sh` wired into `governance-reusable.yml`). - Closes **Item 5** of the 2026-05-26 estate tech-debt audit follow-up. ## Initial migration order - **P0**: `ephapax` (3 Admitteds with discharge plan in memory), `boj-server` (reference impl). - **P1**: `absolute-zero` (387 markers), `maa-framework` (134 in 25 files), `betlang` (1 named axiom), `proven` (372 TODO PROOF). - **P2**: `standards` itself, `typed-wasm`, `stapeln`, `vcl-ut`, `hypatia`, `snifs`, `somethings-fishy`. ## Companion PRs - standards#195 — proof debt audit (the empirical motivation) - standards#201 — licence-consistency CI check (the precedent for `check-trusted-base.sh`) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e0caf11 commit a6c97f9

1 file changed

Lines changed: 220 additions & 0 deletions

File tree

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
// SPDX-License-Identifier: MPL-2.0
2+
// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell (hyperpolymath)
3+
= Trusted-Base Reduction Policy
4+
:revdate: 2026-05-26
5+
:status: PROPOSED
6+
:audit: hyperpolymath/standards#195
7+
:audit-licence: hyperpolymath/standards#196
8+
:audit-docs: hyperpolymath/standards#197
9+
:precedent: hyperpolymath/boj-server backend-assurance harness
10+
11+
This document is the canonical estate-wide policy for managing
12+
*soundness-relevant escape hatches* in proof-bearing code — the
13+
unconditional, unproven primitives that every formal-methods toolchain
14+
provides for ergonomic or extraction-boundary reasons:
15+
16+
[cols="1,2", options="header"]
17+
|===
18+
| Language | Escape hatches in scope
19+
20+
| Coq | `Axiom`, `Admitted`, `admit.`
21+
| Lean | `axiom`, `sorry`, `noncomputable`
22+
| Agda | top-level `postulate`
23+
| Idris2 | `believe_me`, `really_believe_me`, `assert_total`, top-level `partial`
24+
| F\* | `assume val`, `admit_p`
25+
| Dafny | top-level `:axiom`
26+
| Cross-lang | `TODO PROOF` / `OWED:` / `FIXME PROOF` markers
27+
| Rust/Haskell | `unsafePerformIO`, `unsafeCoerce` (where used in soundness-relevant positions)
28+
|===
29+
30+
The 2026-05-26 estate proof-debt audit (link:{audit}[#195]) found these
31+
markers spread across ~30 active repos, with concentrations of
32+
`believe_me` at extraction boundaries (Rust↔Idris2 FFI, codec runtime)
33+
and `partial` clusters that conflate "totality just hard to prove" with
34+
"totality genuinely impossible". This policy gives every such marker a
35+
canonical disposition path so the trusted base shrinks over time
36+
instead of accreting.
37+
38+
== Three permissible dispositions
39+
40+
Every soundness-relevant escape hatch in the estate MUST be one of:
41+
42+
[cols="1,1,3", options="header"]
43+
|===
44+
| Disposition | Marker | Definition
45+
46+
| (a) DISCHARGED
47+
| —
48+
| A proof exists. The escape hatch has been deleted or replaced with a
49+
proof term / total function / proven instance.
50+
51+
| (b) BUDGETED
52+
| `// TRUSTED: <kind>; <budget>`
53+
| The escape hatch is necessary at this layer (FFI boundary, foreign
54+
extraction target, performance corner case). It is covered by
55+
property-based or adversarial tests at a documented refutation budget
56+
(e.g. "tested at N=10⁹ inputs across `cargo test --release --features fuzz`").
57+
The budget is the load-bearing component — without it, "covered by
58+
tests" is unfalsifiable.
59+
60+
| (c) NECESSARY AXIOM
61+
| `-- AXIOM: <name>; <justification>`
62+
| The escape hatch encodes a metatheoretic assumption that cannot be
63+
discharged within the working logic (e.g. function extensionality,
64+
propositional truncation, classical choice, certain decision procedures).
65+
It is enumerated in `docs/proof-debt.md` with a one-paragraph
66+
justification and a citation pointing to the canonical formalisation
67+
elsewhere (echo-types, MathLib4, agda-stdlib, etc.).
68+
|===
69+
70+
A marker that is *none of (a)/(b)/(c)* is **debt**, and must appear in
71+
the repo's `docs/proof-debt.md` with a deadline (or "INDEFINITE" with a
72+
reason) and an owner.
73+
74+
== `docs/proof-debt.md` schema
75+
76+
Every proof-bearing repo MUST maintain a `docs/proof-debt.md` (or `.adoc`)
77+
with the following structure:
78+
79+
[source,markdown]
80+
----
81+
# Proof debt
82+
83+
## (a) Discharged in this repo
84+
- (none — entries removed when proof lands)
85+
86+
## (b) Budgeted — tested with refutation budget
87+
- `path/to/file.rs:LINE` — `unsafe_extract_bytes`
88+
- **Kind**: extraction boundary (Rust→Idris2 ABI)
89+
- **Test**: `cargo test --release --features fuzz extract_bytes_qc`
90+
- **Budget**: 10⁹ inputs / N=10000 shrinks
91+
- **Last run**: 2026-05-26 (CI run #12345 — green)
92+
93+
## (c) Necessary axiom
94+
- `formal/Foo.v:LINE` — `axiom funExt`
95+
- **Justification**: function extensionality; not derivable in
96+
constructive Coq without UIP. Standard practice; see Mathlib4
97+
`Mathlib.Logic.Function.Basic`.
98+
- **Citation**: Univalent Foundations §2.9; Mathlib4 commit abc1234.
99+
100+
## (d) DEBT — actively to be closed
101+
- `formal/Bar.v:LINE` — `Admitted` `preservation_lemma`
102+
- **Owner**: @maintainer
103+
- **Plan**: discharge by induction on typing-derivation; subgoals
104+
(1)-(7); blocked on (4) which needs the substitution lemma.
105+
- **Deadline**: 2026-08-01 / "INDEFINITE: dependent on echo-types
106+
Lift ⊤ rung-C settlement".
107+
----
108+
109+
Disposition (d) is the only category that should *shrink* over time.
110+
(a) shrinks too, but only by promotion through proof; (b) and (c) are
111+
load-bearing and should stay stable.
112+
113+
== Annotation conventions in source
114+
115+
Mark every escape hatch inline so the disposition is local to the code:
116+
117+
[source,rust]
118+
----
119+
// TRUSTED: extraction-boundary; tested via `cargo test fuzz` (10⁹ inputs).
120+
// See docs/proof-debt.md §(b) entry "unsafe_extract_bytes".
121+
unsafe fn unsafe_extract_bytes(...) -> ... { ... }
122+
----
123+
124+
[source,idris]
125+
----
126+
-- TRUSTED: extraction-boundary; tested via `idris2 --test` (Hedgehog, N=10⁶).
127+
-- See docs/proof-debt.md §(b) entry "wasm_marshal_u64".
128+
wasm_marshal_u64 : Bits64 -> ByteArray
129+
wasm_marshal_u64 x = believe_me ...
130+
----
131+
132+
[source,coq]
133+
----
134+
(* AXIOM: function extensionality.
135+
Necessary; see docs/proof-debt.md §(c) entry "funExt".
136+
Cited from echo-types. *)
137+
Axiom funExt : forall (A B : Type) (f g : A -> B),
138+
(forall x, f x = g x) -> f = g.
139+
----
140+
141+
[source,agda]
142+
----
143+
-- AXIOM: propositional truncation; necessary; see proof-debt.md §(c).
144+
postulate
145+
∥_∥ : Set → Set
146+
----
147+
148+
The leading-comment marker (`TRUSTED:` / `AXIOM:`) is itself part of the
149+
contract — the audit script in section "Enforcement" below greps for it.
150+
151+
== Enforcement
152+
153+
A future PR will wire `scripts/check-trusted-base.sh` into
154+
`governance-reusable.yml`. The script:
155+
156+
. Counts every soundness-relevant escape hatch in the caller repo.
157+
. Verifies each is either preceded by a `TRUSTED:` or `AXIOM:` comment,
158+
OR enumerated in `docs/proof-debt.md`.
159+
. Fails CI when a marker is naked (no annotation AND no proof-debt.md
160+
entry).
161+
. Optionally fails CI when `docs/proof-debt.md` §(d) DEBT entries are
162+
past their deadline.
163+
164+
This is the same shape as `check-licence-consistency.sh`
165+
(standards#201) — local script, called from the governance bundle, no
166+
network dependencies.
167+
168+
== Precedent: boj-server backend-assurance harness
169+
170+
The pattern this policy codifies is already deployed in
171+
link:{precedent}[boj-server's backend-assurance harness] (memory:
172+
`project_boj_server_backend_assurance_harness`):
173+
174+
* 5 class-J axioms identified as irreducible in Idris2 0.8.0 (cannot
175+
be discharged within the type theory).
176+
* Each one is property-tested *and* extracted to Rust where the
177+
property runs against the real Idris2 RTS implementation, not a
178+
mocked one.
179+
* The trusted base is documented in `docs/proof-debt.md` and shrinks
180+
one entry per PR over a ~3-month roadmap.
181+
182+
That harness is the reference implementation. New proof-bearing repos
183+
adopting this policy should adapt it rather than reinvent it.
184+
185+
== Initial migration order (proof-bearing repos with active debt)
186+
187+
Per the audit, the high-density repos that should adopt this policy
188+
first (rough P0/P1/P2 ordering):
189+
190+
[cols="1,1,2", options="header"]
191+
|===
192+
| Priority | Repo | Why this one first
193+
194+
| P0 | `ephapax` | 3 `Admitted`s in `formal/Semantics.v` already have a discharge plan (memory: `project_ephapax_preservation_closure_plan`); annotate while closing.
195+
| P0 | `boj-server` | Reference implementation — formalise the existing harness as the canonical example.
196+
| P1 | `absolute-zero` | 72 Coq + 315 Lean markers across 6638 proof files; needs the schema before any single-repo close-out is tractable.
197+
| P1 | `maa-framework` | 134 markers in 25 files (high density); investigate whether vendored or original.
198+
| P1 | `betlang` | Single named axiom (`substTop_preserves_typing`) — clean (b) or (c) classification.
199+
| P1 | `proven` | 372 `TODO PROOF` markers; convert to §(d) entries with deadlines.
200+
| P2 | `standards` | 4 Agda postulate + 11 Idris partial — set the example for downstream.
201+
| P2 | `typed-wasm`, `stapeln`, `vcl-ut`, `hypatia`, `snifs`, `somethings-fishy` | Each 5–15 `believe_me`; audit and classify in a single PR each.
202+
|===
203+
204+
== Status
205+
206+
[cols="1,3", options="header"]
207+
|===
208+
| Date | Event
209+
210+
| 2026-05-26 | Policy filed (standards#202).
211+
| TBD | `scripts/check-trusted-base.sh` filed (separate PR).
212+
| TBD | Per-repo `docs/proof-debt.md` files seeded across P0 repos.
213+
|===
214+
215+
== Companion documents
216+
217+
* link:{audit}[standards#195] — estate proof-debt audit (the empirical motivation)
218+
* link:{audit-licence}[standards#196] — estate licence-debt audit
219+
* link:{audit-docs}[standards#197] — estate documentation-debt audit
220+
* `scripts/check-licence-consistency.sh` (standards#201) — the precedent for the eventual `check-trusted-base.sh`

0 commit comments

Comments
 (0)