Section RaftMsgRefinement.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Proof using.
intros.
unfold handleMessage, update_elections_data_net in *.
break_match; repeat break_let; repeat find_inversion;
[eapply_prop msg_refined_raft_net_invariant_request_vote|
eapply_prop msg_refined_raft_net_invariant_request_vote_reply|
eapply_prop msg_refined_raft_net_invariant_append_entries|
eapply_prop msg_refined_raft_net_invariant_append_entries_reply]; eauto;
unfold send_packets in *; simpl in *; intros; subst; auto; find_apply_hyp_hyp; intuition.
Qed.
Proof using.
intros.
unfold handleInput, update_elections_data_input in *.
break_match; repeat break_let; repeat find_inversion;
[eapply_prop msg_refined_raft_net_invariant_timeout|
eapply_prop msg_refined_raft_net_invariant_client_request]; eauto; subst; auto.
Qed.

Theorem msg_refined_raft_net_invariant :
forall P net,
msg_refined_raft_net_invariant_init P ->
msg_refined_raft_net_invariant_client_request P ->
msg_refined_raft_net_invariant_timeout P ->
msg_refined_raft_net_invariant_append_entries P ->
msg_refined_raft_net_invariant_append_entries_reply P ->
msg_refined_raft_net_invariant_request_vote P ->
msg_refined_raft_net_invariant_request_vote_reply P ->
msg_refined_raft_net_invariant_do_leader P ->
msg_refined_raft_net_invariant_do_generic_server P ->
msg_refined_raft_net_invariant_state_same_packet_subset P ->
msg_refined_raft_net_invariant_reboot P ->
msg_refined_raft_intermediate_reachable net ->
P net.