|
| 1 | +# P-037 Phase B0: the formal/production proof-boundary audit (pre-registered) |
| 2 | + |
| 3 | +> Status: **PRE-REGISTERED. No manifest, checker, or audit code written.** |
| 4 | +> §§A–D are committed before any audit artifact, so the result is judged |
| 5 | +> against them rather than an impression afterwards. Governance: |
| 6 | +> `docs/notes/p037-formal-kernel.md` §10.1 (finding classes), §10.4 (the |
| 7 | +> Phase-B proof boundary), §10.6 (the R ruling). Base: A2.2 closed on #371 at |
| 8 | +> `0ae821356ae03cd185e845cc46be45b700f1e064`. Branch: |
| 9 | +> `research/p037-phase-b-proof-boundary`. |
| 10 | +> |
| 11 | +> Evidence tags as elsewhere: `REPOSITORY FACT`, `MEASURED OBSERVATION`, |
| 12 | +> `INFERENCE`, `OWNER RULING`. |
| 13 | +
|
| 14 | +This change **starts no semantic wiring**. It does not touch guarded summary |
| 15 | +values, solver output, MOS, verdicts, `ConsumesParam`, Roslyn sidecar facts, |
| 16 | +the OwnIR schema, or kernel semantics. |
| 17 | + |
| 18 | +## A. Question |
| 19 | + |
| 20 | +Can every load-bearing formal assumption of P-037 be honestly linked to one of |
| 21 | +two things? |
| 22 | + |
| 23 | +- a **production guarantor** that exists today, with a concrete mechanism and |
| 24 | + an executable control; |
| 25 | +- an explicit **outside-the-Kani-boundary** declaration, stating what is not |
| 26 | + proved, why, and what controls it. |
| 27 | + |
| 28 | +And can this be done without finding a hidden precondition between the Roslyn |
| 29 | +facts and the guarded kernel? |
| 30 | + |
| 31 | +If not: **STOP** before any semantic implementation. |
| 32 | + |
| 33 | +### A.1 What was already seen before registration (disclosed, not hindsight) |
| 34 | + |
| 35 | +Reading the governing text and the kernel, and running two extractor probes |
| 36 | +(scratch `.cs` files, not committed), established the following before these |
| 37 | +criteria were written. They are listed so they are judged by the rule below, |
| 38 | +not argued afterwards. |
| 39 | + |
| 40 | +- `REPOSITORY FACT`: nothing in production (`rust/`, `ownlang/`) references |
| 41 | + the kernel crate `formal/p037-kernel`. The A1 production landing has not |
| 42 | + happened. The only production code on the P-037 path today is the fact |
| 43 | + producer (Roslyn `BuildGuardedFacts`) and the OwnIR doors, which validate the |
| 44 | + sidecar and keep it inert. |
| 45 | +- `REPOSITORY FACT`: the kernel is bounded (`MAX_COORDS = 3`, |
| 46 | + `MAX_EDGES = 2`), and its `System` holds one SCC. It models neither |
| 47 | + composition across SCCs nor a dynamic driver. |
| 48 | +- `REPOSITORY FACT`: `solve` / `elect` are Jacobi, so they visit every live |
| 49 | + coordinate on every pass by construction. `solve_with` / `elect_with` take an |
| 50 | + arbitrary schedule, which is the #368 hazard. |
| 51 | +- `MEASURED OBSERVATION` (probe): the kernel's G-S4 mask ("which forward sits |
| 52 | + under which literal") has no field in the sidecar. |
| 53 | + - A hypothesis was tested and **refuted**: that two programs differing only in |
| 54 | + whether a borrowing forward sits inside or after an eligible `if` produce |
| 55 | + byte-identical facts. They don't. Legacy lowering emits a `use` op placed in |
| 56 | + the body tree, and the sidecar call carries its `statement_line`. |
| 57 | + - Placement is therefore recoverable only by *joining* the sidecar to the |
| 58 | + legacy body by line (the §10.5 call-site identity). Body `if` ops carry no |
| 59 | + column, so two `if`s on one line make the guard↔`if` join ambiguous |
| 60 | + (observed). |
| 61 | +- `REPOSITORY FACT`: the legacy `ConsumesParam` and the whole-analyzer summary |
| 62 | + keying read the *statically resolved* callee's body. Virtual or override |
| 63 | + dispatch is not represented anywhere in the facts. |
| 64 | + |
| 65 | +## B. Necessary conditions (all must hold) |
| 66 | + |
| 67 | +- **N1 — harness inventory complete.** |
| 68 | + - The set of `#[kani::proof]` functions under `formal/p037-kernel/src` is |
| 69 | + derived from source, never from a maintained number. |
| 70 | + - The fast set (`ci.yml` job `formal-p037`) and the heavy set |
| 71 | + (`formal-p037-gate.yml`) are also derived from source. |
| 72 | + - It must hold that `fast ∩ heavy = ∅` and `fast ∪ heavy = source`, with |
| 73 | + `missing = extra = overlap = 0`. |
| 74 | + - A harness in no set, or a CI name that is no harness, is a FAIL. |
| 75 | +- **N2 — every harness has a human claim.** Each records: |
| 76 | + - the harness; |
| 77 | + - its P-037 claim; |
| 78 | + - a concrete production subject: kernel symbols such as `Transfer::join`, |
| 79 | + `System::step`, `solve`, `apply`, never "kernel correctness"; |
| 80 | + - its assumptions; |
| 81 | + - its CI class. |
| 82 | +- **N3 — every load-bearing assumption is classified exactly once**, as |
| 83 | + `PRODUCTION_GUARANTOR` or `OUTSIDE_KANI_BOUNDARY`. |
| 84 | + - A `PRODUCTION_GUARANTOR` needs a mechanism that exists today. It must say |
| 85 | + what it guarantees, where, up to which consumer, and what happens on |
| 86 | + violation. It also needs an executable control. |
| 87 | + - An `OUTSIDE_KANI_BOUNDARY` entry states what is not proved, why that is |
| 88 | + deliberate, and what controls it. "Nothing yet, because nothing consumes |
| 89 | + it" is allowed only when a named obligation binds the first consumer (B1). |
| 90 | + - An assumption that holds only on a comment fails. |
| 91 | + - "assumed", "obvious", "frontend handles this" and "well_formed somehow" |
| 92 | + are rejected. |
| 93 | +- **N4 — the bounded adapter is stated honestly.** |
| 94 | + - Kani `MAX_COORDS = 3`, `MAX_EDGES = 2`, checked against `lib.rs`. |
| 95 | + - Production is a dynamic coordinate/edge count. |
| 96 | + - No claim that Kani proved a production-size bound. The generic Rocq result |
| 97 | + (#369/#370) may be cited as external research evidence only, never as a |
| 98 | + dependency. |
| 99 | +- **N5 — production well-formedness has guarantors.** Election shape and |
| 100 | + import, `Uncond` diagonality, `id`/`neg` admissibility, guard stability |
| 101 | + (G-V4), cell-local release consistency, finalization before application, |
| 102 | + fair/full visitation, and missing record/sidecar under R. Each must have one |
| 103 | + of: |
| 104 | + - a producer invariant; |
| 105 | + - runtime/kernel validation; |
| 106 | + - construction-by-API; |
| 107 | + - an executable negative control; |
| 108 | + - `OUTSIDE_KANI_BOUNDARY`. |
| 109 | +- **N6 — application ordering is pinned.** F2 (`fin` before |
| 110 | + select/collapse/apply) has a control that breaks if raw solver state is |
| 111 | + applied before finalization, and a mutant proves it breaks. A Kani harness |
| 112 | + alone does not count. |
| 113 | +- **N7 — fairness / #368 is not hidden.** The production-side contract is one |
| 114 | + of three: |
| 115 | + - (A) full visitation by construction; |
| 116 | + - (B) validated coverage; |
| 117 | + - (C) #368 as a mandatory blocker before any schedule-taking API is used. |
| 118 | + |
| 119 | + "The caller is expected to pass a fair schedule" is a FAIL. So is any |
| 120 | + production path that could call the solver with an unchecked, externally |
| 121 | + supplied schedule. |
| 122 | +- **N8 — R stays fail-closed.** A missing `functions[]` record and a missing |
| 123 | + `guarded_facts` are both recorded as `NO_GUARDED_EVIDENCE`. They are never |
| 124 | + `no effects`, borrow, unconditional, guard-irrelevant, or `must`. |
| 125 | + `record-absence-boundary` is the Phase-B negative control. |
| 126 | + |
| 127 | +## C. Cheap falsifiers (each must be demonstrated to fire) |
| 128 | + |
| 129 | +| id | mutation | must happen | |
| 130 | +|---|---|---| |
| 131 | +| F1 | drop one real harness from a CI set; add a fake harness name | audit FAIL (missing / extra) | |
| 132 | +| F2 | put one harness in both fast and heavy | audit FAIL (overlap) | |
| 133 | +| F3 | a manifest assumption with no class, or a vague guarantor | audit FAIL | |
| 134 | +| F4 | a guarantor or control pointing to a path/symbol that does not exist | audit FAIL | |
| 135 | +| F5 | the kernel's `apply` stops finalizing (`apply before fin`) | the finalize-before-apply control goes red (`cargo test`, temp copy) | |
| 136 | +| F6 | R absence reinterpreted as any positive claim | audit FAIL | |
| 137 | +| F7 | a minimal #368-class unfair schedule | an executable witness shows `Some(non-fixpoint)`, and the audit fails if fairness is "the caller's job" | |
| 138 | + |
| 139 | +Additional falsifiers found before registration (§A.1), judged by the same |
| 140 | +rule: |
| 141 | + |
| 142 | +| id | mutation | must happen | |
| 143 | +|---|---|---| |
| 144 | +| F8 | a production file (outside `formal/`) that calls a schedule-taking kernel API (`solve_with`, `elect_with`, `lfp_chaotic`) | audit FAIL: this makes N7 option (C) executable, not prose | |
| 145 | +| F9 | a production file that imports the kernel and lowers or collapses cells directly instead of through `apply` | audit FAIL: the N6 bypass | |
| 146 | +| F10 | a harness whose body uses an assumption-bearing generator or predicate (`any_system`, `any_schedule`, `release_cells_have_no_edges`, `no_unknown_seed`, …) without listing the matching assumption | audit FAIL: load-bearing assumptions are derived from source, not only declared | |
| 147 | + |
| 148 | +## D. Hard KILL / PASS rule |
| 149 | + |
| 150 | +**KILL**: `RESULT: FAIL — PHASE B BLOCKED`, with the blockers listed and no |
| 151 | +semantic code fixed here, if any of these holds: |
| 152 | + |
| 153 | +1. the harness inventory does not match the CI partition; |
| 154 | +2. a load-bearing assumption is unclassified; |
| 155 | +3. a `PRODUCTION_GUARANTOR` lacks an existing mechanism plus a control; |
| 156 | +4. no fairness production contract exists; |
| 157 | +5. the finalization ordering is not pinned by an executable control at the |
| 158 | + seam production will use; |
| 159 | +6. R absence can be interpreted positively; |
| 160 | +7. a bounded Kani result has to be presented as a production-unbounded proof; |
| 161 | +8. going green requires changing P-037 semantics; |
| 162 | +9. an assumption whose only possible guarantor is the future B1 adapter cannot |
| 163 | + be discharged fail-closed from the A2 fact surface. That is a **hidden |
| 164 | + precondition between the Roslyn facts and the kernel**: STOP. Such an |
| 165 | + amendment is case 5 (§10.1), not case 2. |
| 166 | + |
| 167 | +**PASS**: `RESULT: PASS — PROOF BOUNDARY CLOSED FOR PHASE B SHADOW` only if: |
| 168 | + |
| 169 | +- the inventory is exact and the CI partition exact; |
| 170 | +- every assumption is classified and every guarantor concrete; |
| 171 | +- negative controls are mapped; |
| 172 | +- #368 is explicitly handled; |
| 173 | +- R is explicitly fail-closed; |
| 174 | +- no semantic wiring was done; |
| 175 | +- F1–F10 all fire. |
| 176 | + |
| 177 | +A PASS authorizes the separate step B1 (guarded shadow read, no verdict). It |
| 178 | +also carries the list of B1 entry obligations recorded in the manifest. B0 |
| 179 | +does not implement B1. |
| 180 | + |
| 181 | +Assumptions discovered by this audit are case 2 (a proof-boundary manifest |
| 182 | +amendment) when they can be discharged fail-closed. They are case 5 (STOP) |
| 183 | +under KILL 9. |
| 184 | + |
| 185 | +**Budget.** One small checker (`scripts/p037_proof_boundary.py`), one manifest |
| 186 | +(`formal/p037-kernel/proof-boundary.json`), this note, small selftests and |
| 187 | +mutants. A new general verification framework is a STOP. |
0 commit comments