Proof using rmri rri.
unfold msg_refined_raft_net_invariant_client_request, commit_invariant.
intros. split.
- { unfold commit_invariant_host in *. break_and.
unfold commit_recorded_committed, commit_recorded in *.
intros. simpl in *.
repeat find_higher_order_rewrite.
rewrite update_fun_comm with (f := snd).
repeat match goal with H : _ |- _ => rewrite update_fun_comm with (f := snd) in H end.
simpl in *.
repeat match goal with
| [H : _ |- _] => rewrite (update_fun_comm _ raft_data _) in H
end.
rewrite (update_fun_comm  _ raft_data).
rewrite update_nop_ext' by (now erewrite <- handleClientRequest_currentTerm by eauto).
match goal with
| [H : _ |- _] => rewrite update_nop_ext' in H
by (now erewrite <- handleClientRequest_commitIndex by eauto)
end.
update_destruct_simplify.
- find_copy_apply_lem_hyp handleClientRequest_log.
break_and. break_or_hyp.
+ repeat find_rewrite.
eapply lifted_committed_log_allEntries_preserved; eauto.
* simpl. intros. find_higher_order_rewrite.
update_destruct_simplify; repeat find_rewrite; auto.
* simpl. intros. find_higher_order_rewrite.
update_destruct_simplify; eauto using update_elections_data_client_request_preserves_allEntries.
+ break_exists. break_and. repeat find_rewrite.
simpl in *.
match goal with
| [ H : _ \/ In _ _ |- _ ] => invc H
end.
* find_eapply_lem_hyp (lift_max_index_sanity net h0); auto.
break_and. simpl in *. omega.
* { eapply lifted_committed_log_allEntries_preserved; eauto.
- simpl. intros. find_higher_order_rewrite.
update_destruct_simplify; repeat find_rewrite; auto.
find_reverse_rewrite.
eapply handleClientRequest_preservers_log; eauto.
- simpl. intros. find_higher_order_rewrite.
update_destruct_simplify; eauto using update_elections_data_client_request_preserves_allEntries.
}
- eapply lifted_committed_log_allEntries_preserved; eauto.
+ simpl. intros. find_higher_order_rewrite.
update_destruct_simplify; repeat find_rewrite; eauto using handleClientRequest_preservers_log.
+ simpl. intros. find_higher_order_rewrite.
update_destruct_simplify; eauto using update_elections_data_client_request_preserves_allEntries.
}
- unfold commit_invariant_nw in *.
simpl. intros.
find_apply_hyp_hyp.
intuition.
+ eapply hCR_preserves_committed; eauto. simpl. subst. auto.
+ unfold send_packets in *.
do_in_map.
unfold add_ghost_msg in *.
do_in_map.
subst. simpl in *.
exfalso. eapply handleClientRequest_no_append_entries; eauto 10.
Qed.

(* Specifications: *)
Lemma handleTimeout_preserves_committed :
forall h (net net' : ghost_log_network) out d' l e t,
handleTimeout h (snd (nwState net h)) = (out, d', l) ->
(forall h', nwState net' h' = update name_eq_dec (nwState net) h (update_elections_data_timeout h (nwState net h), d') h') ->
lifted_committed net e t ->
lifted_committed net' e t.