Proof using rlmli.
intros.
unfold haveNewEntries in *. do_bool. intuition;
[unfold not_empty in *; break_match; subst; simpl in *; intuition; congruence|].
break_match; try congruence.
do_bool. find_apply_lem_hyp findAtIndex_elim. intuition.
assert (es <> nil) by (destruct es; subst; simpl in *; intuition; congruence).
find_eapply_lem_hyp maxIndex_non_empty.
break_exists. intuition.
find_copy_eapply_lem_hyp entries_sorted_nw_invariant; eauto.
match goal with
| H : In e es |- _ => copy_eapply maxIndex_is_max H; eauto
end.
repeat find_rewrite.
find_eapply_lem_hyp entries_match_nw_host_invariant; eauto.
Qed.

Lemma maxIndex_le :
forall l1 l2,
sorted l1 ->
contiguous_range_exact_lo l1 0 ->
findAtIndex l1 (maxIndex l2) = None ->
l2 = nil
\/ (exists e, In e l2 /\ eIndex e = 0)
\/ maxIndex l1 <= maxIndex l2.