Proof using.
induction l; intros; simpl in *; intuition.
- subst. break_if; do_bool; try omega.
reflexivity.
- break_if; simpl in *.
+ do_bool.
match goal with
| H : forall _, In _ _ -> _ |- _ =>
specialize (H2 e)
end. intuition. omega.
+ eauto.
Qed.

Lemma maxIndex_gt_0_nonempty :
forall es,
0 < maxIndex es ->
es <> nil.