From 5703657957e53f37da53b9f2afb6fdc9ed34ec7d Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 21:15:16 -0700 Subject: [PATCH] docs(proofs): number each kernel-sweep harness's law The kernel sweep's proof notes described each harness's law in prose. The traceability gate needs the number to check it against a row of bookspec's spec/laws.md, so each note now carries a machine-readable Harness | Law table: fx_booked's harnesses law 41, round_step's law 40, and total's law 4 (the engine-bound law whose Lean row says why it has no theorem). The prose tables and times stay as they were. Co-Authored-By: DeepSeek V4.1 Flash --- docs/proofs/k-u1.md | 10 ++++++++++ docs/proofs/k-u2.md | 15 +++++++++++++++ docs/proofs/k-u4.md | 12 ++++++++++++ 3 files changed, 37 insertions(+) diff --git a/docs/proofs/k-u1.md b/docs/proofs/k-u1.md index 62c2dcdc..fae036f9 100644 --- a/docs/proofs/k-u1.md +++ b/docs/proofs/k-u1.md @@ -88,6 +88,16 @@ carries the same laws to every `Decimal` step, and Lean to any step. | `fx_booked_positive_for_positive` | positive inputs book non-negative, positive once the product reaches half a unit | 3.2 s (2 covers) | | `fx_booked_refuses_overflow` | an overflowing product and a non-positive rate are `None`, never a panic | 2.6 s (2 covers) | +The bookspec law each harness proves (machine-readable for the +traceability gate, `crates/ledger-core/tests/bookspec/traceability.rs`): + +| Harness | Law | +|---|---| +| `fx_booked_is_whole_unit` | 41 | +| `fx_booked_within_half_unit` | 41 | +| `fx_booked_positive_for_positive` | 41 | +| `fx_booked_refuses_overflow` | 41 | + What the harnesses do and do not prove, stated plainly: - `fx_booked_refuses_overflow` proves **two concrete overflow cases** diff --git a/docs/proofs/k-u2.md b/docs/proofs/k-u2.md index 2065584f..28f59568 100644 --- a/docs/proofs/k-u2.md +++ b/docs/proofs/k-u2.md @@ -54,6 +54,21 @@ bookspec's Lean proves them for any step. | `round_step_sign_preserved` | every mode: `0 <= x` gives `0 <= r`, `x <= 0` gives `r <= 0` | 13 s wall incl. build (3 covers) | | `round_step_refuses_nonpositive_step` | a step of zero or less is `None` | 8 s total (1 cover) | +The bookspec law each harness proves (machine-readable for the +traceability gate, `crates/ledger-core/tests/bookspec/traceability.rs`): + +| Harness | Law | +|---|---| +| `round_step_is_multiple` | 40 | +| `round_step_is_nearest` | 40 | +| `round_step_ties` | 40 | +| `round_step_is_idempotent` | 40 | +| `round_step_never_negative_zero` | 40 | +| `round_step_toward_zero_bounds` | 40 | +| `round_step_toward_neg_inf_is_floor` | 40 | +| `round_step_sign_preserved` | 40 | +| `round_step_refuses_nonpositive_step` | 40 | + The three directed-mode harnesses were added after review: the spec block's invariants 3, 4 and 6 had no proof of their own (Lean had the ties, Kani checked these two modes only at exact ties). Demonstrated: with diff --git a/docs/proofs/k-u4.md b/docs/proofs/k-u4.md index 69292181..0f10b3e6 100644 --- a/docs/proofs/k-u4.md +++ b/docs/proofs/k-u4.md @@ -34,6 +34,18 @@ model-checking/kani#4904), each with `kani::cover!`. | `total_try_is_map_sum` | `total_try` of differences is the sum of the differences; a failing map fails the total | 0..=4 pairs, in-range | 5.3 s | | `total_overflow_is_none` | for two arbitrary `i64`s, `total` is `Some` exactly when the true sum fits; both overflow directions covered | all `i64` pairs | 0.5 s | +The bookspec law each harness proves (machine-readable for the +traceability gate, `crates/ledger-core/tests/bookspec/traceability.rs`): + +| Harness | Law | +|---|---| +| `total_empty_is_zero` | 4 | +| `total_append` | 4 | +| `total_is_sound` | 4 | +| `total_of_is_map_sum` | 4 | +| `total_try_is_map_sum` | 4 | +| `total_overflow_is_none` | 4 | + Times: alone, `cargo kani --exact --harness`, the shared dev machine under `nice -n 10`, 2026-11-08. `total_append` was 115 s at runs of up to 4 and was reduced to up to 3 (the same law; 60 s) to keep `just prove` fast. A