rent_or_buy_num_runs
def
Given a horizon T : ℕ and increments a : Fin (T - 1) → NNReal, rent_or_buy_num_runs T a : ℕ is defined as: if 2 ≤ T, 1 plus the cardinality of the finset of indices i : Fin (T - 2) such that a ⟨i.val + 1, _⟩ ≠ a ⟨i.val, _⟩; and 0 otherwise.
Statement
noncomputable def rent_or_buy_num_runs (T : ℕ) (a : Fin (T - 1) → NNReal) : ℕ
- Defined in
- arXiv:2611.06955 Definition 2
- Verified
- 08 Nov 2026
- Axioms
- none listed
- Used by 1
- threshold_schedule_additive_boundFor every horizon T ≥ 2, nonnegative increments a : Fin (T - 1) → NNReal with P runs (P = rent_or_buy_num_runs T a), every positive reset…
Read back from the Lean
A definition of a function rent_or_buy_num_runs that takes a natural number T and a sequence a : Fin (T - 1) → NNReal, returning a natural number defined as:
- If 2 ≤ T, 1 plus the cardinality of the set of indices i : Fin (T - 2) such that a(i + 1) ≠ a(i) (with i.val + 1 and i.val viewed as indices in Fin (T - 1));
- Otherwise (if T < 2), 0.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
Lean source view module on GitHub
/-- The number of runs of a session with horizon T and increments a : Fin (T - 1) → NNReal. -/ noncomputable def rent_or_buy_num_runs (T : ℕ) (a : Fin (T - 1) → NNReal) : ℕ := if hT : 2 ≤ T then 1 + ((Finset.univ : Finset (Fin (T - 2))).filter (fun i => a ⟨i.val + 1, by omega⟩ ≠ a ⟨i.val, by omega⟩)).card else 0