From mathcomp.ssreflect
From mathcomp
From fcsl
From DiSeL
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
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.

(* 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).
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).
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).