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 msg_spec_consumeE i d from to from' to' t c' t' cond:
valid d ->
find  i d = Some (Msg (TMsg t' c') from' to' true) ->
msg_in_soup' from to t cond d ->
[|| (from != from'), (to != to') | (t != t')] ->
msg_in_soup' from to t cond (consume_msg d i).