Proof using.
intros.
unfold handleMessage in *.
break_match; repeat break_let; repeat find_inversion;
[eapply_prop raft_net_invariant_request_vote|
eapply_prop raft_net_invariant_request_vote_reply|
eapply_prop raft_net_invariant_append_entries|
eapply_prop raft_net_invariant_append_entries_reply]; eauto;
unfold send_packets in *; simpl in *; intros; find_apply_hyp_hyp; intuition.
Qed.

(* Specifications: *)
Lemma raft_invariant_handle_input P :
forall h inp net st' ps' out d l,
raft_net_invariant_timeout P ->
raft_net_invariant_client_request P ->
handleInput h inp (nwState net h) = (out, d, l) ->
P net ->
raft_intermediate_reachable net ->
(forall h', st' h' = update name_eq_dec (nwState net) h d h') ->
(forall p', In p' ps' -> In p' (nwPackets net) \/
In p' (send_packets h l)) ->
P (mkNetwork ps' st').