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.

Lemma msg_refined_raft_invariant_handle_input P :
forall h inp net st' ps' gd out d l,
msg_refined_raft_net_invariant_timeout P ->
msg_refined_raft_net_invariant_client_request P ->
handleInput h inp (snd (nwState net h)) = (out, d, l) ->
update_elections_data_input h inp (nwState net h) = gd ->
P net ->
msg_refined_raft_intermediate_reachable net ->
(forall h', st' h' = update name_eq_dec (nwState net) h (gd, d) h') ->
(forall p', In p' ps' -> In p' (nwPackets net) \/
In p' (send_packets h (@add_ghost_msg _ _ ghost_log_params h (gd, d) l))) ->
P (mkNetwork ps' st').