fix(core): a tie between shares goes to the earlier part, exactly (held for the owner's decision)

split_by_weights_into's largest-remainder policy ranked the leftover
cents by the rounded quotient's remainder (Decimal keeps 28 significant
digits), so an exact tie was decided by the quotient's last digit, not
given to the earlier part as apportion's docs and bookspec's Lean model
(Apportion.lean: remW = x*w % W, ties to the earlier member) say.
20.00 by 4/1/1 over 6 gave 13.33, 3.34, 3.33 where the exact tie of
remainders (0.02 over 6 each) belongs to the first: 13.34, 3.33, 3.33.

It now ranks the exact integer remainder whole x weight - part x total
(the quantity share_floor_with returns), sign-flipped for a negative
total so the order stays the share's own. The parts still sum to the
whole and each is within one step; only which part takes a tied cent
changes. Stored entries never move (posted is forever); a report
recomputed for a past period can move a cent between parties.

The finding test is flipped into the law (ties_go_to_the_earlier_part),
the bridge's ranking property now includes ties, and the spec block,
k-u3.md and verification.md say ties go to the earlier part, exactly.

This branch is held: the owner decides whether the cents may move
(see tests/kernel_bridge/ties.rs for what it moves).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-09 15:37:06 -07:00
1 parent 4da1c5b30f
commit 294cb99a58
5 files changed
+112 -96

No files matched your search

+12 -8
View File
@@ -885,7 +885,7 @@ replay rules.
`largest_remainder_ranks_like_the_exact_reference`,
`the_absorbing_parts_keep_the_old_scale`,
`split_into_matches_the_allocating_split`,
`finding_ties_follow_the_rounded_quotient`,
`ties_go_to_the_earlier_part`,
`share_floor_refuses_past_the_correction_cap`,
`finding_the_quotients_rounding_can_cross_a_step`
- `split_by_weights_with` is an `EXCEPTIONS` wrapper (it allocates two
@@ -1024,13 +1024,17 @@ kernel. What the proofs and their reviews found, beyond the tidying:
337.50`, the kernel `4050.00, …`), and that scale reaches `Part.amount`.
The kernel computes the old expression, pinned by
`the_absorbing_parts_keep_the_old_scale`.
- **Ties follow the rounded quotient.** The split ranks the rounded
quotients' remainders, not exact rationals, so an exact tie goes where
the 28th digit sends it: 20.00 split 4/1/1 over 6 is `13.33, 3.34,
3.33` (exact ranking `13.34, 3.33, 3.33`), and 20 whole is `13, 4, 3`
(exact `14, 3, 3`). The pre-sweep sites did the same;
`finding_ties_follow_the_rounded_quotient` pins it, and the owner decides
the exact ranking in K-U10, unchanged here.
- **Ties go to the earlier part, exactly (K-U10).** The split ranked the
rounded quotients' remainders, so an exact tie went where the 28th digit
sent it: 20.00 split 4/1/1 over 6 was `13.33, 3.34, 3.33` and 20 whole
was `13, 4, 3`. The pre-sweep sites did the same, and K-U3 kept it and
pinned it. It now ranks the exact remainder `whole x weight - part x
total` (as `share_floor_with` does), so a tie goes to the earlier part:
`13.34, 3.33, 3.33` and `14, 3, 3`, which is what bookspec's
`Apportion.lean` models (`remW`, ties to the earlier member).
`ties_go_to_the_earlier_part` pins it, and `tests/kernel_bridge/ties.rs`
measures what it moves against the old ranking (held for the owner's
decision).
- **The sweep changed no posted figure.** Every golden and existing test
passed unchanged. `round_places` reproduces `round_dp_with_strategy` to
the character except a negative-zero input (which no call site can