periods.rs conflicted with K-U2: the frozen replay rules delegate to
K-U4's checked twins, whose rounding now goes through K-U2's
round_places (so every rounding stays in the kernel); no figure changes.
The K-U4 note gains the review's list of bounded raw sums left, and the
caveat that the twin test checks delegation (the review's independent
20,000-case comparison found the twins identical).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/proofs/k-u4.md: the six harnesses with bounds and times, the Lean
counterparts (Basic.net_append is total_append for the signed sum; no new
law), the bridge, the sites replaced with file:line, the sites left raw
because their signatures are infallible, the regression tests, and two
findings: Decimal's checked_add rounds dust within a unit of Decimal::MAX,
and the audit's reachability claims for section 2.1 were overstated.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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>
Kani checks the primitive on i64 over fixed steps: a whole multiple, the
half modes nearest, each mode's tie, idempotence, no negative zero, and a
non-positive step refused. A symbolic divisor did not finish in 30 minutes
(CBMC's bit-blasted division), so the steps are fixed constants; the
bridge's exact-reference property carries the laws to every Decimal step.
The bridge agrees i64 with Decimal, checks Decimal against an independent
i128 reference over amounts of up to ten places and steps down to 1e-4,
checks round_places against round_dp_with_strategy to the character, and
has the edge table (.5, -.5, 0.004, 1.005, -1.005, scale 28, Decimal::MAX).
docs/proofs/k-u2.md records the harnesses, bounds, times, bridge properties
and the bookspec Lean theorem names.
Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
kernel.rs is now kernel/: mod.rs keeps the laws and re-exports entries
(the old file, unchanged) plus one file per kernel-sweep unit (U1 fx, U2
round, U3 allocate, U4 total, U5 schedule, U6 ratio, U7 payroll, U8
control). proofs.rs is proofs/: mod.rs holds the original 63 harnesses and
each unit gets a file of its own. tests/kernel_bridge.rs is now
tests/kernel_bridge/main.rs plus one file per unit; Cargo still builds the
single test target named kernel_bridge.
`_kani` now scans proofs/mod.rs and proofs/*.rs and passes the fully
qualified name each file gives its harness (Kani's --exact matches only a
fully qualified name), so a harness resolves wherever it lives. It fails
when kani_slow names no harness, or when two harnesses share a name and
would make the slow list ambiguous; `just prove-list` prints every harness
with its module path and set, showing the slow list resolved without
running it.
Nothing moves in the books: the same 53 fast Kani harnesses and 118 Lean
theorems verify, and the same 1096 tests pass (27 in the bridge).
Docs: verification.md gains the kernel-sweep policy (each unit writes
docs/proofs/<unit>.md; the integrator folds the notes into
verification.md and Audit.lean in one edit per batch), and the file
references in AGENTS.md, testing.md, architecture.md, oracle.md and
spec/rules.md follow the new paths.
Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>