Lemma 2 — Greedy recursion on a consecutive block
ProvedCappedBaseStock.greedy_windowFix an integer and two nonnegative real sequences and . Suppose that, for every integer ,
Then, for every integer starting index and every integer length ,
The recurrence includes the terms preceding the block; they are not reset to zero at its beginning. Blocks are nonempty so their ordinary finite maximum is defined. No inventory, independence, or expectation hypotheses are needed.
import Mathlib open scoped BigOperators
namespace CappedBaseStock
theorem greedy_window
(L : ℕ) (hL : 1 ≤ L)
(a b : ℤ → ℝ)
(ha : ∀ t : ℤ, 0 ≤ a t)
(hb : ∀ t : ℤ, 0 ≤ b t)
(hrec : ∀ t : ℤ,
a t = max (b t - ∑ i ∈ Finset.Icc 1 L, a (t - (i : ℤ))) 0)
(start : ℤ) (n : ℕ) (hn : 0 < n) (hlen : n ≤ L + 1) :
(∑ i ∈ Finset.range n, a (start + (i : ℤ))) ≤
(Finset.range n).sup'
(Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hn))
(fun i => b (start + (i : ℤ))) := by sorry
end CappedBaseStockRead-back
What the Lean code literally says, in plain math · GPT-6 (independent Codex sub-agent)
For every natural number with , every pair of functions satisfying and for every integer , and the recurrence for every integer , every integer , and every natural number satisfying , one has . The maximum on the right is the maximum over the finite nonempty set of indices . The starting index may be negative, zero, or positive, and the recurrence is required at all integer indices, including indices before the displayed block; its preceding terms are not truncated at . The assumptions exclude and , include , , and , and permit zero values of either function, including the identically zero pair.
Confirmed by the mission captain (proposal self-audit).