pith. machine review for the scientific record. sign in
instance

accountRS_atomicTick

definition
show as:
view math explainer →
module
IndisputableMonolith.LedgerPostingAdjacency
domain
LedgerPostingAdjacency
line
48 · github
papers citing
none yet

open explainer

Read the cached plain-language explainer.

open lean source

IndisputableMonolith.LedgerPostingAdjacency on GitHub at line 48.

browse module

All declarations in this module, on Recognition.

explainer page

A cached Ask Recognition explainer exists for this declaration.

open explainer

depends on

formal source

  45claim about nature’s tick scheduling.
  46-/
  47
  48noncomputable instance accountRS_atomicTick (d : Nat) [NeZero d] : Recognition.AtomicTick (AccountRS d) :=
  49{ postedAt := fun t u =>
  50    u = ⟨t % d, Nat.mod_lt _ (Nat.pos_of_ne_zero (NeZero.ne d))⟩
  51  unique_post := by
  52    intro t
  53    refine ⟨⟨t % d, Nat.mod_lt _ (Nat.pos_of_ne_zero (NeZero.ne d))⟩, rfl, ?_⟩
  54    intro u hu
  55    simpa [hu]
  56}
  57
  58abbrev LedgerState (d : Nat) : Type := Recognition.Ledger (AccountRS d)
  59
  60abbrev phiVec {d : Nat} (L : LedgerState d) : Fin d → ℤ :=
  61  Recognition.phi L
  62
  63abbrev parity (d : Nat) (L : LedgerState d) : Pattern d :=
  64  parityPattern (phiVec (d := d) L)
  65
  66/-! ## Posting model -/
  67
  68inductive Side where
  69  | debit
  70  | credit
  71deriving DecidableEq, Repr
  72
  73/-- Apply a single unit post (either debit or credit) at account `k`. -/
  74noncomputable def post {d : Nat} (L : LedgerState d) (k : Fin d) (side : Side) : LedgerState d := by
  75  classical
  76  exact match side with
  77  | Side.debit =>
  78      { debit := fun i => if i = k then L.debit i + 1 else L.debit i