Section Decomposition.
Context `{d : Decomposition}.
(* Fixpoint remove_one {A : Type} (A_eq_dec : forall x y : A, {x = y} + {x <> y}) a l := match l with | x :: xs => if A_eq_dec a x then xs else x :: remove_one A_eq_dec a xs | [] => [] end. *)
Definition packet_eq_dec :
forall p1 p2 : packet,
{p1 = p2} + {p1 <> p2}.
Proof using.
intros.
in_crush; destruct x; simpl in *; eauto.
Qed.

(* NB: generalizing this over R makes it useless to [eauto using] because the conclusion is too general. *)
Lemma nw_nw_distinct_pairs_and_elim :
forall xs a b ys l,
l = xs ++ a :: ys ->
In b (xs ++ ys) ->
distinct_pairs_and network_network_invariant l ->
network_network_invariant a b.