diff --git a/crates/ledger-core/src/ledger.rs b/crates/ledger-core/src/ledger.rs index 6e14fca1..c241f48e 100644 --- a/crates/ledger-core/src/ledger.rs +++ b/crates/ledger-core/src/ledger.rs @@ -1907,7 +1907,8 @@ impl Ledger { // under Decimal's 28) and keeps its scale: the booked amount is // rounded once, not after Decimal's own rounding of the product. // (A 20-place product past about 7.9e8 still outgrows Decimal's 96 - // bits; kernel::fx_booked's spec block names that open edge.) + // bits; since K-U10 the kernel holds that product in 256 bits for + // the one rounding, so it too is booked from the exact product.) // The command's bound, never replay's: a journal's older line with // a finer foreign amount opens as it was booked (replay_add_line_fx). if !crate::parties::is_replaying() { diff --git a/docs/delegation-log.md b/docs/delegation-log.md index 1ddb18bc..915b92bd 100644 --- a/docs/delegation-log.md +++ b/docs/delegation-log.md @@ -9,3 +9,6 @@ Columns: date | type (scout, run/verify, implement, refactor, debug, review) | p 2026-11-09 | implement | muse / muse-wonder-1.0 / reasoningEffort high | small | 2h25m (machine at load 90+; the code was done in ~13 min) | | accepted after fixes | me, ~10 min: boundary assertions a tenth of a unit past the bound; its raw arithmetic in audit.rs still to route through the kernel | V-D3; sent before the tier policy; the bound covers one legacy close, not several 2026-11-09 | refactor | muse / muse-wonder-1.0 / reasoningEffort high | medium (17 files, +498/-62) | 4h13m (machine at load 50-90) | | accepted after one fix | me, ~5 min: the demo books' booked fee was put on the display rounding; back on the kernel's, rule unchanged | K-U9; sent before the tier policy; worked from a base 16 commits old, so it reported a traceability failure that main does not have; its report matched its diff 2026-11-09 | implement | opencode / opencode-go/deepseek-v4.1-flash / variant high | medium (10 files, 369 lines beside the generated file) | 1h15m | | accepted after rework | me, ~1 h: the check takes 2 minutes, not seconds; a failure hint; why `--offline`; and the real gap, 70 crates whose notice was a licence text with a placeholder copyright line, closed with a second script | third-party notices; the brief was followed to the letter and every DONE-MEANS output matched; it did not look at whether the generated text carried what the licences ask for, which the brief did not ask it to +2026-11-09 | debug/hard implement | claudeAgent / claude-sonnet-5-5 / effort high | large (14 files, +1144/-152) | 6h20m (machine shared with three other workers) | | accepted after rework | me, ~1 h: `checked_div_exact` accepted a rounded quotient (10 / 3), fixed with tests; then the review's fixes (below) | K-U10a, exact Decimal sums and products; the design (256-bit product, a sticky digit, one rounding) was its own and held up under review; its properties proved a figure returned is exact, not that an exact figure is never refused +2026-11-09 | review | muse / muse-wonder-full-1.0 / reasoningEffort high | large (the K-U10a diff) | 1h05m | | six findings, all reproduced: one refusal the docs did not state (a step of 27 or 28 places), four gaps in what the properties covered, stale sentences; no wrong figure in 400,000 sampled pairs | me, ~1 h: the properties now also prove nothing representable is refused; the refusal stated and pinned | worth its cost: the completeness gap is the kind the author's own tests cannot see; it ran no cargo, Kani or Lean itself +2026-11-09 | debug/hard implement | claudeAgent / claude-sonnet-5-5 / effort high | medium (7 files) | 4h (machine shared) | | accepted after rework | me, ~1.5 h: its ranking used the exact product, which K-U10a makes a refusal for weights of 27 places (now the rounding product, with a test); it ran no Kani, and Kani then failed the unit: a cover in `split_by_weights_within_one_step` could no longer be reached, since the exact ranking makes the bound strict on i64 (harness tightened) | K-U10b, ties by the exact remainder; its measurement of what moves (`ties.rs`) was what the owner's decision needed; worked from a stale base again diff --git a/docs/proofs/k-u1.md b/docs/proofs/k-u1.md index 63eb9130..86579db0 100644 --- a/docs/proofs/k-u1.md +++ b/docs/proofs/k-u1.md @@ -49,7 +49,7 @@ the precondition, and states that `Decimal::checked_mul`'s two behaviours outside it are inherited, not hidden: rounding past scale 28 (and past 96 bits), and `1e-28 x 1e-28` underflowing to zero. -**An open edge, not closed by D-75.** The 96-bit half of the +**An open edge, not closed by D-75 (closed since by K-U10, `docs/proofs/k-u10.md`).** The 96-bit half of the precondition is not enforced: ten places each still allow a product of twenty places past about 7.9e8, which needs more than 96 bits. `1050000010.0000000001 x 9.9999999999` is 10500000099.89499999999999999999 diff --git a/docs/proofs/k-u10.md b/docs/proofs/k-u10.md index a51b398f..33bc5fb8 100644 --- a/docs/proofs/k-u10.md +++ b/docs/proofs/k-u10.md @@ -1,7 +1,7 @@ # K-U10: `Decimal`'s sums and products are exact or refused (`kernel/decimal_exact.rs`) -_Folded into `docs/verification.md` by the integrator; this note is the -unit's own record._ +_Folded into `docs/verification.md` ("The kernel sweep" and "What is and +isn't proved"); this note is the unit's own record._ Plan unit K-U10a (`plan/p14-bookspec.md`, the K-U10 row). Rules: BS-ledger-1 (a product the arithmetic cannot hold MUST be refused; a foreign amount is diff --git a/plan/2026-11-09_TRIAGE.md b/plan/2026-11-09_TRIAGE.md index c10d1d2b..e9922ce0 100644 --- a/plan/2026-11-09_TRIAGE.md +++ b/plan/2026-11-09_TRIAGE.md @@ -35,20 +35,35 @@ books. The gaps are in what the gates do not see. - K-U11a, ledger-core: every site routed through the kernel (branch `k-u11a`; a script driven by the compiler's own spans, so no site is hand-copied). 199 of the 210 are done and committed there; the last - 11 wait for K-U10a's exact operations. Mine. + 11 waited for K-U10a's exact operations, now on main. Mine. - K-U12, the outer crates. Worker or script, decided on the counts. - The script in `just check` at zero, so the count cannot rise again. -2. **Decimal sums and products round silently** (K-U10a, in flight). - `Decimal::checked_add` and `checked_mul` return a rounded answer when - the exact one needs more than 28 digits. The kernel's `Amount for - Decimal` should refuse instead. Independent review before it merges. -3. **An exact tie between shares goes where Decimal's 28th digit sends - it** (K-U10b, written and measured). The docs and bookspec's Lean say - a tie goes to the earlier part; the engine ranked rounded remainders, - so 20.00 by 4/1/1 came out 13.33 / 3.34 / 3.33. The owner decided on - 2026-11-09 (D-76): exact ranking from now on (13.34 / 3.33 / 3.33). - No golden moves, two-member books cannot differ, at most one cent per - part. Merges after K-U10a (the same file). +2. **Decimal sums and products rounded silently.** Done (K-U10a, merged + e632855f1). `Decimal::checked_add` and `checked_mul` return a rounded + answer when the exact one needs more than 28 digits; the kernel's + `Amount for Decimal` now gives the exact answer or refuses, and a + foreign amount is rounded once from a 256-bit product. Within the line + cap no sum moves and no golden moved. One figure a new line can book + does move: 1050000010.0000000001 at 9.9999999999 books 10500000099.89, + the exact product's cent, where the double rounding booked .90 (posted + lines are not recomputed). What the worker's own run missed and the + checks found: `checked_div_exact` accepted a rounded quotient (10 / 3); + the independent review's six findings, all reproduced (a refusal at + steps of 27 and 28 places the docs did not state, four gaps in what + the properties covered, stale sentences). Not proved: the 256-bit + helpers have no Kani harness (checked against exact rationals by + property instead; `docs/proofs/k-u10.md` says why). +3. **An exact tie between shares went where Decimal's 28th digit sent + it.** Done (K-U10b, merged 5e9591725). The docs and bookspec's Lean + say a tie goes to the earlier part; the engine ranked rounded + remainders, so 20.00 by 4/1/1 came out 13.33 / 3.34 / 3.33. The owner + decided on 2026-11-09 (D-76): exact ranking from now on (13.34 / 3.33 + / 3.33). No golden moved; of the engine's splits only the K-1 + worksheet's share of contributed property can differ, by a cent a + part. Kani then found the same rule on whole numbers: a part whose + share is exact never takes a leftover unit (5 by 2/3/5 is 1, 2, 2), + and the harness now asserts it with the strict bound. The worker had + not run Kani; its cover would have failed `just prove`. 4. **The audit's close check** (V-D3, merged abafa94a5, 09a8707e2): it checked a JPY close at a cent, and its pre-true-up bound ignored the member count. Left open: the bound covers one legacy close, not @@ -165,8 +180,7 @@ signing (D-64); the re-audit (P10); Q-6 before P9b. ## Order of work -1. Land what is in flight: V-D3 (done), K-U9 (done), K-U10a (reviewed), - K-U10b (the owner answered: exact; after K-U10a). +1. Land what is in flight: V-D3, K-U9, K-U10a, K-U10b (all four done). 2. K-U11a on top of them, then K-U12, then the detector in `just check`. 3. `overflow-checks`, the CI split, `just prove`'s cap, `cargo-deny` (all four done). diff --git a/plan/STATUS.md b/plan/STATUS.md index 083cff46..5bfc894f 100644 --- a/plan/STATUS.md +++ b/plan/STATUS.md @@ -40,6 +40,8 @@ merged. bookspec main is at 2b3b6c9 (wanderbooks pinned there). of bookspec's theorem list (151 of 177). Kept and pinned: an exact tie between shares goes where Decimal's 28th digit sends it, as it always has (K-U10 puts exact ranking to the owner, with the cents it moves). + Decided since (D-76, merged 5e9591725): a tie goes to the earlier + part, ranked on exact remainders. **Next**: X-H1d's fixes, X-H1e; S-C8, S-E4, V-D3 (small, from the reviews); K-U6..U9, K-U10 (with the owner's tie-break decision); X-K2, @@ -78,7 +80,8 @@ reviewed by a second model before it merged: refuse; a reversal could be dated before its original (D-73); a 26-place foreign amount booked a cent the product never reached (D-75). Found, scheduled: rust_decimal's add and multiply round at - their edges (K-U10). + their edges (K-U10; closed 2026-11-09, merged e632855f1: the kernel's + sums and products are exact or refused). - **Coverage**: a report and floor (core 90%, store 92%, weekly), and rust_decimal checked against exact rationals (V-D).