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 <noreply@opencode.ai>
This commit is contained in:
swaitsandDeepSeek V4.1 Flash committed 2026-11-08 21:20:45 -07:00
1 parent 2ef945ae3f
commit 5703657957
3 files changed
+37

No files matched your search

+10
View File
@@ -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**
+15
View File
@@ -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
+12
View File
@@ -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