Proof using.
intros.
unfold handleMessage, update_elections_data_net in *.
break_match; repeat break_let; repeat find_inversion;
[eapply_prop refined_raft_net_invariant_request_vote'|
eapply_prop refined_raft_net_invariant_request_vote_reply'|
eapply_prop refined_raft_net_invariant_append_entries'|
eapply_prop refined_raft_net_invariant_append_entries_reply']; eauto;
unfold send_packets in *; simpl in *; intros; subst; auto; find_apply_hyp_hyp; intuition.
Qed.

Lemma refined_raft_invariant_handle_input' P :
forall h inp net st' ps' gd out d l,
refined_raft_net_invariant_timeout' P ->
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 ->
refined_raft_intermediate_reachable net ->
refined_raft_intermediate_reachable (mkNetwork ps' st') ->
(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 l)) ->
P (mkNetwork ps' st').