Proof using.
unfold raft_net_invariant_append_entries, match_index_sanity.
simpl.
intros.
repeat find_higher_order_rewrite.
update_destruct_simplify.
- find_apply_lem_hyp handleAppendEntries_matchIndex_preserved.
eauto using match_index_sanity_preserved.
- auto.
Qed.

(* Specifications: *)
Lemma handleAppendEntriesReply_matchIndex :
forall h st st' m t es res h',
handleAppendEntriesReply h st h' t es res = (st', m) ->
type st' = Leader ->
type st = Leader /\
(matchIndex st' = matchIndex st \/
res = true /\
currentTerm st = t /\
matchIndex st' =
(assoc_set name_eq_dec (matchIndex st) h'
(Nat.max (assoc_default name_eq_dec (matchIndex st) h' 0)
(maxIndex es)))).