(*****************************************************)
(*        More elaborated message predicates         *)
(*****************************************************)


Definition msg_in_soup' from to t (cond : seq nat -> bool) (d : soup) :=
  (exists! i, exists c,
        find i d = Some (Msg (TMsg t c) from to true)) /\
  forall i c, find i d = Some (Msg (TMsg t c) from to true) -> cond c.Definition no_msg_from_to' from to
           (criterion : nat -> seq nat -> bool) (d : soup) :=
  forall i t c,
    find i d = Some (Msg (TMsg t c) from to true) -> ~~criterion t c.

(* Specifications: *)
Lemma no_msg_from_to_consume' from to cond s i: valid s -> no_msg_from_to' from to cond s -> no_msg_from_to' from to cond (consume_msg s i).