def
definition
singleton
show as:
view math explainer →
open explainer
Generate a durable explainer page for this declaration.
open lean source
IndisputableMonolith.RRF.Foundation.Ledger on GitHub at line 88.
browse module
All declarations in this module, on Recognition.
explainer page
depends on
used by
-
clauseUnit_correct -
parityOf_nil -
bool_absolute_floor -
floor_status -
distinguishability_iff_nontrivial_specifiability -
reality_forced_by_any_distinction -
meta_language_distinguishes_props -
cubicArea -
cubicDeficitFunctional -
cubicDeficit_singleton -
singletonHinge_product -
distinction_arithmetic_equiv_logicNat -
universal_cost_certificate -
isRecognitionConnected_empty -
separating_quotient_bijective -
empty
formal source
85}
86
87/-- A singleton ledger. -/
88def singleton (t : Transaction) : Ledger := {
89 transactions := [t],
90 total_debit := t.debit,
91 total_credit := t.credit,
92 global_balance := t.balanced
93}
94
95/-- Append a transaction to a ledger. -/
96def append (L : Ledger) (t : Transaction) : Ledger := {
97 transactions := L.transactions ++ [t],
98 total_debit := L.total_debit + t.debit,
99 total_credit := L.total_credit + t.credit,
100 global_balance := by
101 have hL := L.global_balance
102 have ht := t.balanced
103 omega
104}
105
106/-- The net balance of a ledger (should always be 0). -/
107def net (L : Ledger) : ℤ := L.total_debit + L.total_credit
108
109/-- Ledger net is always zero. -/
110theorem net_zero (L : Ledger) : L.net = 0 := L.global_balance
111
112/-- Concatenate two ledgers. -/
113def concat (L₁ L₂ : Ledger) : Ledger := {
114 transactions := L₁.transactions ++ L₂.transactions,
115 total_debit := L₁.total_debit + L₂.total_debit,
116 total_credit := L₁.total_credit + L₂.total_credit,
117 global_balance := by
118 have h₁ := L₁.global_balance