Proof using.
intros. unfold doLeader in *.
repeat break_match; find_inversion; auto.
Qed.
(* matchIndex *)
Definition matchIndex_preserved st st' :=
type st' = Leader ->
(type st = Leader /\ matchIndex st' = matchIndex st /\ log st' = log st).
Arguments matchIndex_preserved / _ _.
Definition matchIndex_preserved_except_at_host h st st' :=
type st' = Leader ->
(type st = Leader /\
forall h',
h <> h' ->
(assoc_default name_eq_dec (matchIndex st') h' 0) = (assoc_default name_eq_dec (matchIndex st) h') 0).
Arguments matchIndex_preserved_except_at_host / _ _ _.

Lemma handleAppendEntries_matchIndex_preserved:
forall h st (d : raft_data)
(m : msg) (t : term) (n : name) (pli : logIndex)
(plt : term) (es : list entry) (ci : logIndex),
handleAppendEntries h st t n pli plt es ci = (d, m) ->
matchIndex_preserved st d.