refactor(core): the control, aging and reconciliation identities in the kernel
Three identities were still hand-written chains at their call sites: an aging row's five buckets summing to what is owed (BS-arap-1), the control check's difference, balance less documents less unattached lines (BS-arap-2), and the K-1 reconciliation total, beginning plus built-in gain plus property without a basis less property distributed (BS-partner-4). They move to kernel::aging_total, control_difference and reconciliation_total, generic over Amount, returning None on overflow, so each is a named law with a harness and a Lean theorem rather than a sum. Behaviour is identical: the same checked steps in the same order, so figures, scales and TooLargeToCompute refusals are unchanged; every golden passes untouched. The next commit's bridge compares the old chains and the kernel as strings on 20,000 random Decimals of any scale. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e45c62348a
commit
0df463b703
4 files changed
+132
-16
No files matched your search
@@ -274,10 +274,12 @@ pub struct Reconciliation {
|
||||
impl Reconciliation {
|
||||
/// Book ending less tax ending (as far as known).
|
||||
pub fn total(&self) -> Option<Decimal> {
|
||||
self.beginning
|
||||
.checked_add(self.built_in_gain_704c)?
|
||||
.checked_add(self.property_without_basis)?
|
||||
.checked_sub(self.property_distributed)
|
||||
crate::kernel::reconciliation_total(
|
||||
self.beginning,
|
||||
self.built_in_gain_704c,
|
||||
self.property_without_basis,
|
||||
self.property_distributed,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user