Proof using.
unfold refined_raft_net_invariant_do_leader, match_index_all_entries_inv.
intros. break_and. split.
- unfold match_index_all_entries in *.
simpl in *. intros.
repeat find_higher_order_rewrite.
match goal with
| [ H : nwState ?net ?h = (?x, ?y) |- _ ] =>
replace x with (fst (nwState net h)) in * by (rewrite H; auto);
replace y with (snd (nwState net h)) in * by (rewrite H; auto);
clear H
end.
rewrite update_nop_fst.
update_destruct_simplify_hyp.
+ repeat find_reverse_rewrite.
find_copy_apply_lem_hyp doLeader_type. intuition.
find_copy_apply_lem_hyp doLeader_matchIndex_preserved.
unfold matchIndex_preserved in *. intuition.
match goal with
| [ H : context [ In _ (allEntries _) ] |- _ ] =>
eapply H; eauto; try congruence
end.
+ repeat find_reverse_rewrite.
match goal with
| [ H : context [ In _ (allEntries _) ] |- _ ] =>
eapply H; eauto; try congruence
end.
- unfold match_index_all_entries_nw in *.
simpl in *.
intros.
find_apply_hyp_hyp.
break_or_hyp.
+ repeat find_higher_order_rewrite.
match goal with
| [ H : nwState ?net ?h = (?x, ?y) |- _ ] =>
replace x with (fst (nwState net h)) in * by (rewrite H; auto);
replace y with (snd (nwState net h)) in * by (rewrite H; auto);
clear H
end.
rewrite update_nop_fst in *.
find_copy_apply_lem_hyp doLeader_type. intuition.
update_destruct_simplify_hyp.
* find_copy_apply_lem_hyp doLeader_matchIndex_preserved.
unfold matchIndex_preserved in *. intuition.
match goal with
| [ H : context [ In _ (allEntries _) ] |- _ ] =>
eapply H; eauto; try congruence
end.
* match goal with
| [ H : context [ In _ (allEntries _) ] |- _ ] =>
eapply H; eauto; try congruence
end.
+ do_in_map.
find_eapply_lem_hyp doLeader_sends_AE; [|eauto].
break_exists. subst.
simpl in *. congruence.
Qed.

(* Specifications: *)
Lemma match_index_all_entries_do_generic_server :
refined_raft_net_invariant_do_generic_server match_index_all_entries_inv.