Proof using aersi matchisi mili rlmli rri.
unfold refined_raft_net_invariant_client_request, match_index_all_entries_inv.
simpl. intros. break_and. split.
- unfold match_index_all_entries in *. simpl in *. intros.
repeat find_higher_order_rewrite. update_destruct_simplify_hyp.
+ find_copy_apply_lem_hyp handleClientRequest_type.
find_copy_apply_lem_hyp handleClientRequest_matchIndex_log. intuition.
* repeat find_rewrite.
{ update_destruct_simplify_hyp.
- apply update_elections_data_clientRequest_allEntries_old'.
find_apply_hyp_hyp. repeat find_rewrite. auto.
- find_apply_hyp_hyp. repeat find_rewrite. auto.
}
* break_exists. break_and. repeat find_rewrite.
{ update_destruct_simplify_hyp.
- unfold update_elections_data_client_request. find_rewrite.
break_if.
+ repeat find_rewrite. simpl. break_or_hyp.
* auto.
* right.
find_copy_apply_lem_hyp maxIndex_is_max; [|solve[apply entries_sorted_invariant; auto]].
rewrite <- lifted_match_index_leader in * by auto.
eapply_prop_hyp In In; eauto. repeat find_rewrite. auto.
+ do_bool. find_rewrite. simpl length in *. omega.
- find_erewrite_lem get_set_diff_default.
pose proof lifted_match_index_sanity _ leader h0 ltac:(eauto) ltac:(auto).
break_or_hyp.
+ simpl in *. omega.
+ find_apply_hyp_hyp. repeat find_rewrite. auto.
}
+ find_apply_hyp_hyp. update_destruct_simplify_hyp.
* apply update_elections_data_clientRequest_allEntries_old'.
repeat find_rewrite. auto.
* repeat find_rewrite. auto.
- unfold match_index_all_entries_nw in *.
simpl. intros.
find_apply_hyp_hyp. break_or_hyp.
+ repeat find_higher_order_rewrite. update_destruct_simplify_hyp.
* find_copy_apply_lem_hyp handleClientRequest_type. break_and. repeat find_rewrite.
find_copy_apply_lem_hyp handleClientRequest_log.
{ intuition.
- repeat find_rewrite.
eapply_prop_hyp In In; eauto.
update_destruct_simplify_hyp.
+ apply update_elections_data_clientRequest_allEntries_old'.
repeat find_rewrite. auto.
+ repeat find_rewrite. auto.
- break_exists. break_and. repeat find_rewrite.
assert (es <> nil).
{
apply maxIndex_gt_0_nonempty.
eapply lt_le_trans; [|eauto].
simpl in *. break_or_hyp.
- repeat find_rewrite. omega.
- eapply entries_gt_0_invariant; eauto.
}
pose proof maxIndex_non_empty es. concludes.
break_exists_name max_e. intuition.
find_eapply_lem_hyp lifted_append_entries_reply_sublog; repeat find_rewrite; eauto.
simpl In in *. break_or_hyp.
+ find_apply_lem_hyp maxIndex_is_max; [|solve[apply entries_sorted_invariant; auto]].
omega.
+ eapply_prop_hyp In In; eauto; [|solve[repeat find_rewrite; auto]].
update_destruct_simplify_hyp.
* apply update_elections_data_clientRequest_allEntries_old'.
repeat find_rewrite. auto.
* repeat find_rewrite. auto.
}
* eapply_prop_hyp In In; eauto.
{ update_destruct_simplify_hyp.
- apply update_elections_data_clientRequest_allEntries_old'.
repeat find_rewrite. auto.
- repeat find_rewrite. auto.
}
+ find_apply_lem_hyp handleClientRequest_packets. subst. simpl in *. intuition.
Qed.

(* Specifications: *)
Lemma handleTimeout_matchIndex :
forall h st out st' l,
handleTimeout h st = (out, st', l) ->
matchIndex st' = matchIndex st.