Counting down to a mapped list element #
List.foldl_countdown describes a left fold that decrements a counter and captures a mapped
element when the counter reaches one. A zero counter preserves the captured value. This lets
streaming input readers share the same selection argument across symbol representations.
theorem List.foldl_countdown {α : Type u_1} {β : Type u_2} (f : α → β) (l : List α) (k : ℕ) (cur : β) (d : α) :
Counting down from k captures the mapped element at position k - 1 if k is positive
and at most the list length; otherwise it preserves cur. The counter saturates at zero.