Review found two holes in K-U2's evidence.
1. The spec block's invariants 3, 4 and 6 (toward zero: |r| <= |x| and
|r - x| < step; toward negative infinity: r <= x < r + step; no mode
flips the sign) had no proof: Kani checked those modes only at exact
ties. Three harnesses now assert them for every amount over the fixed
steps (round_step_toward_zero_bounds, round_step_toward_neg_inf_is_floor,
round_step_sign_preserved), each with covers for a non-tie and a negative
non-multiple; bookspec's Lean carries the same laws for any step. With
TowardZero mutated to round 7 at step 10 up to 10, the first harness
fails ("magnitude never grows"); reverted.
2. The bridge never ran checked_round_to_step's finer-step branch (step
with more places than the amount and a mantissa above one). Three
properties compare the kernel with a second, independent i128 reference
that takes any step (mantissa 1..1000 at scales 0..10, amounts at scales
0..28, small amounts, and constructed exact ties). Replacing
.checked_add(remainder / b) with .checked_add(0) in the digit loop fails
all three; reverted.
docs/proofs/k-u2.md also states the one exception to "no result changes":
a negative-zero input (round_dp keeps -0.00; round_places gives 0.00; no
call site can produce one).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Proof notes for the kernel sweep
docs/verification.md is the one place the proofs are described: the law
table, the bounds, the times, and what is and isn't proved. The kernel
sweep (plan/kernel-sweep-audit.md) runs several units in parallel, so
editing that file from every branch would collide on every hunk. The rule
instead:
- Each unit that adds proofs writes
docs/proofs/<unit>.md, where<unit>is the lowercase name of its code files (fx,round,allocate,total,schedule,ratio,payroll,control;U9display adds no proofs). The note lists, for that unit:- every Kani harness it added, with the law each proves;
- the bounds Kani explores (lines, accounts, amounts, scales), and why they are enough;
- the measured time, alone or in a
just proverun, with the machine and date; - every bridge property in
tests/kernel_bridge/<unit>.rs, and every Lean theorem it added; - anything the solver could not do, and what carries it instead (Lean at any size, a bridge property, an exhaustive unit test).
- Workers do not edit
docs/verification.mdorverify/lean/Audit.lean. The integrator folds the unit notes intoverification.md's tables and prose, and adds the#print axiomslines toAudit.leanin one place, in one edit per batch, after the batch's merges. - A unit's note lands in the same commit as its harnesses, so the proof and its description are never apart in history.
just prove finds the harnesses by scanning crates/ledger-core/src/proofs/
(mod.rs plus every <unit>.rs), not one file; just prove-list prints
each harness, its module path, and whether it runs in prove or
prove-slow.