Library ABP.INTERPRETER.Processes


Section Processes.

Variable Chnl : Set.
Variable A : ChnlSet.

CoInductive Guarded : Set :=
  | TALK :
       c1 : Chnl,
      A c1Guarded c2 : Chnl, (A c2Guarded) → Guarded
  | LISTEN : c : Chnl, (A cGuarded) → Guarded.

Inductive Process : Set :=
  | INJ : GuardedProcess
  | PAR : ProcessProcessProcess.

Coercion INJ : Guarded >-> Process.


Section Semantics.

Variable c : Chnl.

Inductive Signal : Set :=
  | Noise : Signal
  | Clear : A cSignal.

Inductive Action : Set :=
  | Transmit : SignalAction
  | Receive : A cAction.

Coercion Transmit : Signal >-> Action.

 Inductive SafeProcTrans : ProcessActionProcessProp :=
   | sttalk1 :
        (v : A c) (c2 : Chnl) (f : A c2Guarded) (p : Guarded),
       SafeProcTrans (TALK c v p c2 f) (Clear v) p
   | sttalk2 :
        (c1 : Chnl) (v1 : A c1) (f : A cGuarded)
         (p1 p2 : Guarded) (v : A c),
       f v = p2SafeProcTrans (TALK c1 v1 p1 c f) (Receive v) p2
   | sttalk3 :
        (c1 c2 : Chnl) (v1 : A c1) (f : A c2Guarded)
         (p : Guarded) (v2 : A c),
       c2 c
       SafeProcTrans (TALK c1 v1 p c2 f) (Receive v2) (TALK c1 v1 p c2 f)
   | stlisten1 :
        (f : A cGuarded) (v : A c) (p1 p2 : Guarded),
       f v = p2SafeProcTrans (LISTEN c f) (Receive v) p2
   | stlisten2 :
        (d : Chnl) (f : A dGuarded) (v : A c),
       d cSafeProcTrans (LISTEN d f) (Receive v) (LISTEN d f)
   | stpar1 :
        (p1 p2 p3 p4 : Process) (v : A c),
       SafeProcTrans p1 (Transmit (Clear v)) p2
       SafeProcTrans p3 (Receive v) p4
       SafeProcTrans (PAR p1 p3) (Clear v) (PAR p2 p4)
   | stpar2 :
        (p1 p2 p3 p4 : Process) (v : A c),
       SafeProcTrans p1 (Receive v) p2
       SafeProcTrans p3 (Clear v) p4
       SafeProcTrans (PAR p1 p3) (Clear v) (PAR p2 p4)
   | stpar3 :
        (p1 p2 p3 p4 : Process) (v : A c),
       SafeProcTrans p1 (Receive v) p2
       SafeProcTrans p3 (Receive v) p4
       SafeProcTrans (PAR p1 p3) (Receive v) (PAR p2 p4).


 Inductive UnrelProcTrans : ProcessActionProcessProp :=
   | uttalk1 :
        (v : A c) (c2 : Chnl) (f : A c2Guarded) (p : Guarded),
       UnrelProcTrans (TALK c v p c2 f) (Clear v) p
   | uttalk2 :
        (c1 : Chnl) (v1 : A c1) (f : A cGuarded)
         (p1 p2 : Guarded) (v : A c),
       f v = p2UnrelProcTrans (TALK c1 v1 p1 c f) (Receive v) p2
   | uttalk3 :
        (c1 : Chnl) (v1 : A c1) (c2 : Chnl) (f : A c2Guarded)
         (p : Guarded) (v2 : A c),
       c2 c
       UnrelProcTrans (TALK c1 v1 p c2 f) (Receive v2) (TALK c1 v1 p c2 f)
   | uttalk4 :
        (v : A c) (c2 : Chnl) (f : A c2Guarded) (p : Guarded),
       UnrelProcTrans (TALK c v p c2 f) Noise p
   | utlisten1 :
        (f : A cGuarded) (v : A c) (p : Guarded),
       f v = pUnrelProcTrans (LISTEN c f) (Receive v) p
   | utlisten2 :
        (d : Chnl) (f : A dGuarded) (v : A c),
       d cUnrelProcTrans (LISTEN d f) (Receive v) (LISTEN d f)
   | utpar1 :
        (p1 p2 p3 p4 : Process) (v : A c),
       UnrelProcTrans p1 (Clear v) p2
       UnrelProcTrans p3 (Receive v) p4
       UnrelProcTrans (PAR p1 p3) (Clear v) (PAR p2 p4)
   | utpar2 :
        (p1 p2 p3 p4 : Process) (v : A c),
       UnrelProcTrans p1 (Receive v) p2
       UnrelProcTrans p3 (Clear v) p4
       UnrelProcTrans (PAR p1 p3) (Clear v) (PAR p2 p4)
   | utpar3 :
        (p1 p2 p3 p4 : Process) (v : A c),
       UnrelProcTrans p1 (Receive v) p2
       UnrelProcTrans p3 (Receive v) p4
       UnrelProcTrans (PAR p1 p3) (Receive v) (PAR p2 p4)
   | utpar4 :
        p1 p2 p3 p4 : Process,
       UnrelProcTrans p1 Noise p2
       UnrelProcTrans (PAR p1 p3) Noise (PAR p2 p4)
   | utpar5 :
        p1 p2 p3 p4 : Process,
       UnrelProcTrans p3 Noise p4
       UnrelProcTrans (PAR p1 p3) Noise (PAR p2 p4).

End Semantics.

End Processes.