English
For any a, l, b, bs, zipRight(a :: l, b :: bs) equals (Some a, b) :: zipRight l bs.
Русский
Для любых a, l, b, bs, zipRight(a :: l, b :: bs) равно (Some a, b) :: zipRight l bs.
LaTeX
$$$ \operatorname{zipRight}(a :: as, b :: bs) = (\mathrm{Some}\, a, b) :: \operatorname{zipRight}(as, bs)$$$
Lean4
theorem argmax_cons (f : α → β) (a : α) (l : List α) :
argmax f (a :: l) = Option.casesOn (argmax f l) (some a) fun c => if f a < f c then some c else some a :=
List.reverseRecOn l rfl fun hd tl ih =>
by
rw [← cons_append, argmax_concat, ih, argmax_concat]
rcases h : argmax f hd with - | m
· simp
dsimp
rw [← apply_ite, ← apply_ite]
dsimp
split_ifs <;> try rfl
· exact absurd (lt_trans ‹f a < f m› ‹_›) ‹_›
· cases (‹f a < f tl›.gt_or_lt _).elim ‹_› ‹_›