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. intuition.
match goal with
| |- context [pred ?x] =>
remember (pred x) as index
end. break_match; simpl in *.
- right. left. eauto.
-  destruct index; intuition.
right. right. exists x.
match goal with
| _ : S _ = pred ?x |- context [pred ?y] =>
assert (pred x = pred y) by auto
end.
repeat find_rewrite. intuition.
Qed.

(* Specifications: *)
Lemma logs_leaderLogs_inductive_doLeader :
refined_raft_net_invariant_do_leader logs_leaderLogs_inductive.
Lemma lift_nextIndex_safety :
forall net,
refined_raft_intermediate_reachable net ->
nextIndex_safety (deghost net).
Lemma doLeader_in_entries_in_log :
forall st h os st' ms m t n pli plt es ci e,
doLeader st h = (os, st', ms) ->
In m ms ->
snd m = AppendEntries t n pli plt es ci ->
In e es -> In e (log st).