Section Always.
Variable this : nid.
Variable W : world.
Notation coherent := (Coh W).
Arguments proc [this W].
Fixpoint always_sc A (s1 : state) p scs (P : state -> proc A -> Prop) : Prop :=
s1 \In coherent /\
if scs is sc :: scs' then
forall s2, network_rely W this s1 s2 ->
[/\ safe p sc s2, P s2 p &
forall s3 q, @pstep this W A s2 p sc s3 q -> always_sc s3 q scs' P]
else forall s2, network_rely W this s1 s2 -> P s2 p.
Definition always A s (p : proc A) P := forall scs, always_sc s p scs P.
(* Some basic properties of the alwas predicate *)
(* The predicates, corresponding to weakest postconditions, necessary for defining safe executions of programs.  *)
Notation alwsafe_sc s p scs := (always_sc s p scs (fun _ _ => True)).
Notation alwsafe s p := (always s p (fun _ _ => True)).

Lemma alwA A B s (p : proc A) (P : B -> state -> proc A -> Prop) :
alwsafe s p ->
(always s p (fun s' p' => forall x, P x s' p') <->
forall x, always s p (fun s' p' => P x s' p')).