mirror of
https://github.com/achlipala/frap.git
synced 2025-01-23 23:06:11 +00:00
MessagesAndRefinement: trace refinement
This commit is contained in:
parent
c3935ce842
commit
d18dc3044e
1 changed files with 63 additions and 0 deletions
|
@ -39,3 +39,66 @@ Inductive step : channels * procs -> channels * procs -> Prop :=
|
|||
ps $? i = Some (Dup pr)
|
||||
-> ps $? j = None
|
||||
-> step (chs, ps) (chs, ps $+ (i, Dup pr) $+ (j, pr)).
|
||||
|
||||
|
||||
(** * Labeled semantics *)
|
||||
|
||||
Record message := {
|
||||
Channel : channel;
|
||||
TypeOf : Set;
|
||||
Value : TypeOf
|
||||
}.
|
||||
|
||||
Inductive action :=
|
||||
| Output (m : message)
|
||||
| Input (m : message).
|
||||
|
||||
Inductive label :=
|
||||
| Silent
|
||||
| Action (a : action).
|
||||
|
||||
Coercion Action : action >-> label.
|
||||
|
||||
Inductive lstep : proc -> label -> proc -> Prop :=
|
||||
| LStepSend : forall ch {A : Set} (v : A) k,
|
||||
lstep (Send ch v k)
|
||||
(Output {| Channel := ch; Value := v |})
|
||||
k
|
||||
| LStepRecv : forall ch {A : Set} (k : A -> _) v,
|
||||
lstep (Recv ch k)
|
||||
(Input {| Channel := ch; Value := v |})
|
||||
(k v)
|
||||
| LStepDup : forall pr,
|
||||
lstep (Dup pr) Silent (Par (Dup pr) pr)
|
||||
| LStepNew : forall k l k',
|
||||
(forall ch, lstep (k ch) l (k' ch))
|
||||
-> lstep (NewChannel k) l (NewChannel k')
|
||||
| LStepPar1 : forall pr1 pr2 l pr1',
|
||||
lstep pr1 l pr1'
|
||||
-> lstep (Par pr1 pr2) l (Par pr1' pr2)
|
||||
| LStepPar2 : forall pr1 pr2 l pr2',
|
||||
lstep pr2 l pr2'
|
||||
-> lstep (Par pr1 pr2) l (Par pr1 pr2')
|
||||
| LStepRendezvousLeft : forall pr1 ch {A : Set} (v : A) pr1' pr2 pr2',
|
||||
lstep pr1 (Input {| Channel := ch; Value := v |}) pr1'
|
||||
-> lstep pr2 (Output {| Channel := ch; Value := v |}) pr2'
|
||||
-> lstep (Par pr1 pr2) Silent (Par pr1' pr2')
|
||||
| LStepRendezvousRight : forall pr1 ch {A : Set} (v : A) pr1' pr2 pr2',
|
||||
lstep pr1 (Output {| Channel := ch; Value := v |}) pr1'
|
||||
-> lstep pr2 (Input {| Channel := ch; Value := v |}) pr2'
|
||||
-> lstep (Par pr1 pr2) Silent (Par pr1' pr2').
|
||||
|
||||
Inductive couldGenerate : proc -> list action -> Prop :=
|
||||
| CgNothing : forall pr,
|
||||
couldGenerate pr []
|
||||
| CgSilent : forall pr pr' tr,
|
||||
lstep pr Silent pr'
|
||||
-> couldGenerate pr' tr
|
||||
-> couldGenerate pr tr
|
||||
| CgAction : forall pr a pr' tr,
|
||||
lstep pr (Action a) pr'
|
||||
-> couldGenerate pr' tr
|
||||
-> couldGenerate pr (a :: tr).
|
||||
|
||||
Definition refines (pr1 pr2 : proc) :=
|
||||
forall tr, couldGenerate pr1 tr -> couldGenerate pr2 tr.
|
||||
|
|
Loading…
Reference in a new issue