From mathcomp.ssreflect
From mathcomp
From fcsl
From DiSeL
From DiSeL
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
(* Here we define Nanevski et al.-style modal predicates for giving the meaning to Hoare triples. *)
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 *)

(* Specifications: *)
Lemma alw_coh' A s (p : proc A) scs P :
always_sc s p scs P -> s \In coherent.
Lemma alw_safe A s (p : proc A) P :
always s p P -> forall sc, safe p sc s.
Lemma alw_refl A s (p : proc A) P : always s p P -> P s p.
Lemma alw_envs A s1 (p : proc A) s2 P :
always s1 p P -> network_rely W this s1 s2 -> always s2 p P.
(* Relaxing the predicate P wrt. rely *)
Lemma alwp_envsq A s1 (p1 : proc A) scs (P : _ -> _ -> Prop) :
always_sc s1 p1 scs P ->
always_sc s1 p1 scs
(fun s2 p2 => forall s3, network_rely W this s2 s3 -> P s3 p2).
Lemma alw_envsq A s1 (p1 : proc A) (P : _ -> _ -> Prop) :
always s1 p1 P ->
always s1 p1 (fun s2 p2 => forall s3, network_rely W this s2 s3 -> P s3 p2).
Lemma alw_unfin A s1 (P : state -> proc A -> Prop) :
s1 \In coherent ->
(forall s2, network_rely W this s1 s2 -> P s2 Unfinished) ->
always s1 Unfinished P.
Lemma alw_ret A s1 (v : A) (P : state -> proc A -> Prop) :
s1 \In coherent ->
(forall s2, network_rely W this s1 s2 -> P s2 (Ret v)) ->
always s1 (Ret v) P.