Proof using si aersi.
unfold raft_net_invariant_append_entries_reply, nextIndex_safety, getNextIndex.
simpl.
intros.
repeat find_higher_order_rewrite.
update_destruct_simplify.
- erewrite handleAppendEntriesReply_log by eauto.
find_copy_apply_lem_hyp handleAppendEntriesReply_nextIndex; auto.
intuition; repeat find_rewrite.
+ auto.
+ destruct (name_eq_dec h' (pSrc p)).
* subst. rewrite get_set_same_default.
unfold getNextIndex.
apply Max.max_case; auto.
{ destruct es; simpl.
* omega.
* pose proof append_entries_reply_sublog_invariant _ ltac:(eauto).
unfold append_entries_reply_sublog in *.
eapply_prop_hyp pBody pBody; simpl; eauto.
apply maxIndex_is_max; auto.
apply logs_sorted_invariant; auto.
}
* rewrite get_set_diff_default by auto.
auto.
+ destruct (name_eq_dec h' (pSrc p)).
* subst. rewrite get_set_same_default.
unfold getNextIndex.
apply NPeano.Nat.le_le_pred.
auto.
* rewrite get_set_diff_default by auto.
auto.
- auto.
Qed.

(* Specifications: *)
Lemma handleRequestVote_nextIndex_preserved :
forall st h h' t lli llt st' m,
handleRequestVote h st t h' lli llt = (st', m) ->
nextIndex_preserved st st'.