Section NewSoupPredicates.
(*****************************************************)
(*        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 msg_spec' from to tg cnt :=
msg_in_soup' from to tg (fun y => (y == cnt)).
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.

Lemma no_msg_spec_consume s from to tg cnt cond i :
valid s ->
find i s = Some {| content := TMsg tg cnt;
from := from; to := to; active := true |} ->
msg_in_soup' from to tg cond s ->
no_msg_from_to' from to (fun x y => (x == tg)) (consume_msg s i).