merge: a tie between shares goes to the earlier part, exactly (K-U10b, D-76)

The rule (BS-partner-1, bookspec's Apportion) is that leftover cents go
to the largest remainders, ties to the earlier part. The engine ranked
the difference of quotients rounded at Decimal's 28th digit, so an exact
tie went where that digit sent it: 20.00 by 4/1/1 came out 13.33 / 3.34 /
3.33. It now ranks the exact remainder, whole x weight - part x total,
and gives 13.34 / 3.33 / 3.33. The owner decided for the exact ranking on
2026-11-09 (D-76, recorded here).

What moves: no golden, nothing between two parts or by equal weights, at
most a cent a part elsewhere (tests/kernel_bridge/ties.rs measures it).
Of the engine's splits only the K-1 worksheet's share of contributed
property divides by a total that is not one; a convention's split and the
frozen close rule already ranked exactly. Posted splits are not
recomputed.

Changed in the merge:
- The ranking's two products are the rounding ones (checked_mul_rounded).
  The kernel's checked_mul is exact or refused since K-U10a, and would
  refuse a split by weights of 27 places; the split is made, ranked by
  the nearest figures Decimal holds. A test splits by thirds, sevenths,
  ninths and elevenths at 27 and 28 places, both signs.
- Kani failed the unit as it came: with the exact ranking a part whose
  share is exact never takes a leftover unit (5 by 2/3/5 is 1, 2, 2, where
  i64's truncated quotients gave 2, 1, 2), so the cover "a part exactly
  one step above its truncated share" could not be reached. The harness
  split_by_weights_within_one_step now asserts the strict bound and that
  an exact share takes no unit; both covers are reached.
- docs/verification.md also takes K-U10a's account (sums and products
  exact or refused), which closes the edges it listed as pinned.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude committed 2026-11-09 22:39:13 -07:00
commit 5e9591725a
9 files changed
+613 -149

No files matched your search

+1
View File
@@ -2198,6 +2198,7 @@ The owner decisions of 2026-10-16 (at the top of this document) replace the form
| D-73 | A reversal's date (owner, 2026-11-08, the question tool: "Every reversal on or after") | **Every reversal MUST be dated on or after the entry it reverses, for every kind of entry (was enforced only for document reversals and schedule runs): a correction comes after what it corrects. bookspec BS-ledger-5 states it; the engine's `check_reversal` refuses an earlier date; the Lean model's `reverse` step requires it (unit L-G1).** Found when the Lean model was made executable. In the same pass, a close with nothing to close was confirmed to post no entry and still close the period (the engine's INVARIANT 5; an entry needs two lines), and BS-period-1 is worded to say so. |
| D-74 | A refusal when several rules are broken (owner, 2026-11-08, the question tool: "Any broken rule counts") | **When one command breaks several rules, an engine may refuse it with any rule it actually breaks; bookspec's examples test one broken rule at a time, and the Lean-model differential test (L-G5) checks that the engine's reason is one of the rules the command breaks.** Found by L-G5: the engine checks each line as it is added, the model checks the date and the whole entry first, so a command with two faults was refused with different words. |
| D-75 | Foreign amounts and FX rates are bounded (owner, 2026-11-08, the question tool: "Cap them at 10 places") | **A new line's foreign amount and its FX rate take at most 10 decimal places each, as a base amount already does (B-28's bounds; never on replay), so foreign × rate always fits a Decimal exactly and the booked base amount is rounded once.** Found by the K-U1 review: with a 26-place foreign amount, rust_decimal rounded the product to 28 places before the engine rounded it to the cent, booking a cent the exact product doesn't reach. |
| D-76 | A tie between shares (owner, 2026-11-09, the question tool: "Exact, from now on") | **When a split leaves cents over and two parts have the same exact remainder, the cent goes to the earlier part. The remainders ranked are the exact ones, `whole × weight − part × total`, never the difference of quotients rounded at Decimal's 28th digit.** Found by K-U10b: the docs and bookspec's Lean (`Apportion`) said a tie goes to the earlier part, and the engine ranked rounded quotients, so 20.00 by 4/1/1 came out 13.33 / 3.34 / 3.33 where the rule gives 13.34 / 3.33 / 3.33. No golden file moves; no part moves by more than a cent; a split between two parts, or by equal weights, cannot differ. Splits already posted are not recomputed (posted is forever). Of the engine's splits by largest remainder only one can differ: the K-1 worksheet's share of contributed property among the members' credits in one entry (`k1::share_property`), computed on reading, which divides by the credits' total. A convention's template split and the close rule of 2026-10-13 (`periods::allocate`, frozen for replay) split by shares that sum to one, where nothing is divided and the old ranking was already the exact one. Where a weight of 27 places makes a product past Decimal's 28 digits, the split is still made, ranked by the nearest figures Decimal holds. Kani then showed 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, not 2, 1, 2), and the harness asserts it. |
### 10.2 Deferred