Section CommonTheorems.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Proof using.
unfold uniqueIndices.
eauto using NoDup_map_elim.
Qed.
Proof using.
intros.
simpl in *. intuition;
find_apply_hyp_hyp; intuition.
Qed.
Proof using.
induction ys; intros; simpl in *.
- break_match; intuition.
- break_match; intuition.
subst. apply sorted_cons; eauto.
intros. eauto using subseq_In.
Qed.
Proof using.
induction l; intros.
- simpl in *. intuition.
- simpl in *. intuition.
+ subst. auto with *.
+ find_apply_hyp_hyp. lia.
Qed.
Proof using.
induction l; intros.
- simpl in *. intuition.
- simpl in *. intuition.
+ subst. auto with *.
+ find_apply_hyp_hyp. lia.
Qed.
Proof using.
intros. intro.
find_apply_lem_hyp maxIndex_is_max; auto.
subst. lia.
Qed.

Lemma maxIndex_non_empty :
forall l,
l <> nil ->
exists e,
In e l /\ maxIndex l = eIndex e /\ maxTerm l = eTerm e.