Proof using.
intros. unfold doLeader, advanceCommitIndex in *.
break_match; try solve [find_inversion; simpl in *; intuition].
break_if; try solve [find_inversion; simpl in *; intuition].
find_inversion. simpl. do_in_map. subst.
simpl in *. find_inversion.
eauto using findGtIndex_in.
Qed.

(* Specifications: *)
Lemma lifted_one_leader_per_term :
forall net h h',
refined_raft_intermediate_reachable net ->
currentTerm (snd (nwState net h)) = currentTerm (snd (nwState net h')) ->
type (snd (nwState net h)) = Leader ->
type (snd (nwState net h')) = Leader ->
h = h'.
Theorem handleAppendEntries_log_term_type :
forall h st t n pli plt es ci st' ps,
handleAppendEntries h st t n pli plt es ci = (st', ps) ->
(log st' = log st /\ currentTerm st' = currentTerm st /\ type st' = type st) \/
type st' = Follower.