Documentation

Cslib.Languages.StatefulProcesses.Basic

Stateful Processes #

The language of Stateful Processes (SP for short), a process calculus where processes communicate via message passing [Mon23]. Stateful processes or similar languages are typically used to model implementations of choreographic programs (concurrent and/or distributed protocols), but they are also designed to be used as abstract representations that can be later compiled to executable mainstream languages.

Limitations #

The current formalisation does not cover process polymorphism (procedures do not take process parameters) nor general recursion (this is the tail-recursive fragment of Stateful Processes). For recursion, only the syntax is currently implemented. Its semantics will follow a similar approach to that for CCS.

Implementation notes #

This development follows the presentation in [Mon23], with one difference: we adopt a modular approach to the definition of operational semantics, by first defining a symbolic semantics from which a concrete semantics is then derived by adding stores (process memory). This approach is described in [AMMQ26].

References #

Syntax of process terms #

inductive Cslib.StatefulProcesses.Prefix (Pid : Type u_1) (Var : Type u_2) (Val : Type u_3) (FunId : Type u_4) (SelLabel : Type u_5) :
Type (max (max (max (max u_1 u_2) u_3) u_4) u_5)

Prefixes.

  • assign {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} (x : Var) (e : Mech.Expr Var Val FunId) : Prefix Pid Var Val FunId SelLabel

    Assign to x the result of evaluating e.

  • sendValue {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} (p : Pid) (e : Mech.Expr Var Val FunId) : Prefix Pid Var Val FunId SelLabel

    Send to p the result of evaluating e.

  • recvValue {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} (p : Pid) (x : Var) : Prefix Pid Var Val FunId SelLabel

    Receive a value from p and store it in x.

  • sendLabel {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} (p : Pid) (l : SelLabel) : Prefix Pid Var Val FunId SelLabel

    Send to p the label l.

Instances For
    inductive Cslib.StatefulProcesses.Process (Pid : Type u_1) (Var : Type u_2) (Val : Type u_3) (FunId : Type u_4) (SelLabel : Type u_5) (ProcName : Type u_6) :
    Type (max (max (max (max (max u_1 u_2) u_3) u_4) u_5) u_6)

    Processes.

    • nil {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} {ProcName : Type u_6} : Process Pid Var Val FunId SelLabel ProcName

      The terminated process.

    • pre {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} {ProcName : Type u_6} (prf : Prefix Pid Var Val FunId SelLabel) (pr : Process Pid Var Val FunId SelLabel ProcName) : Process Pid Var Val FunId SelLabel ProcName

      Execute the prefix prf and proceed as the continuation pr.

    • recvLabel {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} {ProcName : Type u_6} (p : Pid) (branches : List (SelLabel × Process Pid Var Val FunId SelLabel ProcName)) : Process Pid Var Val FunId SelLabel ProcName

      Branching process: receives a selection label and continues accordingly.

    • cond {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} {ProcName : Type u_6} (e : Mech.Expr Var Val FunId) (pr₁ pr₂ : Process Pid Var Val FunId SelLabel ProcName) : Process Pid Var Val FunId SelLabel ProcName

      Conditional: evaluate e to choose between pr₁ and pr₂.

    • call {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} {ProcName : Type u_6} (proc : ProcName) (ps : List Pid) : Process Pid Var Val FunId SelLabel ProcName

      Call the procedure proc.

    Instances For
      @[instance_reducible]
      instance Cslib.StatefulProcesses.instZeroProcess {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} {ProcName : Type u_6} :
      Zero (Process Pid Var Val FunId SelLabel ProcName)
      Equations
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Syntactic category for prefixes.

        Equations
        Instances For

          Assign to x the result of evaluating e.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Send to p the result of evaluating e.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Receive a value from p and store it in x.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Send to p the label l.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Prefixes.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Syntactic category for processes.

                    Equations
                    Instances For
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        The terminated process.

                        Equations
                        Instances For

                          Execute the prefix prf and proceed as the continuation pr.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Branching process: receives a selection label and continues accordingly.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              Conditional: evaluate e to choose between pr₁ and pr₂.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For

                                Processes.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  Semantics #

                                  inductive Cslib.StatefulProcesses.Act (Pid : Type u_1) (Var : Type u_2) (Val : Type u_3) (FunId : Type u_4) (SelLabel : Type u_5) :
                                  Type (max (max (max (max u_1 u_2) u_3) u_4) u_5)

                                  Actions.

                                  • assign {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} (x : Var) (e : Mech.Expr Var Val FunId) : Act Pid Var Val FunId SelLabel

                                    Assign to x the result of evaluating e.

                                  • sendValue {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} (p : Pid) (e : Mech.Expr Var Val FunId) : Act Pid Var Val FunId SelLabel

                                    Send to p the result of evaluating e.

                                  • recvValue {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} (p : Pid) (x : Var) : Act Pid Var Val FunId SelLabel

                                    Receive a value from p and store it in variable x.

                                  • sendLabel {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} (p : Pid) (l : SelLabel) : Act Pid Var Val FunId SelLabel

                                    Send to p the selection label l.

                                  • recvLabel {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} (p : Pid) (l : SelLabel) : Act Pid Var Val FunId SelLabel

                                    Receive from p the selection label l.

                                  • condThen {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} (e : Mech.Expr Var Val FunId) : Act Pid Var Val FunId SelLabel

                                    Choose the then-branch of a conditional guarded by e.

                                  • condElse {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} (e : Mech.Expr Var Val FunId) : Act Pid Var Val FunId SelLabel

                                    Choose the else-branch of a conditional guarded by e.

                                  Instances For
                                    def Cslib.StatefulProcesses.Act.isInternal {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} :
                                    Act Pid Var Val FunId SelLabelBool

                                    An action is internal if it is not meant to interact with another process.

                                    Equations
                                    Instances For
                                      inductive Cslib.StatefulProcesses.Process.Tr {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} {ProcName : Type u_6} :
                                      Process Pid Var Val FunId SelLabel ProcNameAct Pid Var Val FunId SelLabelProcess Pid Var Val FunId SelLabel ProcNameProp

                                      Symbolic transition relation for processes. Do not use this directly, use Process.lts instead.

                                      Instances For
                                        def Cslib.StatefulProcesses.Process.lts {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} {FunId : Type u_4} {SelLabel : Type u_5} {ProcName : Type u_6} :
                                        LTS (Process Pid Var Val FunId SelLabel ProcName) (Act Pid Var Val FunId SelLabel)

                                        Symbolic LTS of processes.

                                        Equations
                                        Instances For