Documentation

Cslib.Languages.Mech.LocalComputation

Local expressions, stores, and evaluation #

Choreographic programming and associated languages (like process calculi for modelling distributed protocol implementations) are typically defined abstracting from how processes locally compute and store values [Mon23]. This module defines this interface, as well as the derived concept of global store.

Implementation notes #

The module is currently developed with minimality in mind. In the future, we plan on adding facilities for typing expressions and easy integration with Lean and other IRs/FFIs.

References #

inductive Cslib.Mech.Expr (Var : Type u_1) (Val : Type u_2) (FunId : Type u_3) :
Type (max (max u_1 u_2) u_3)

Expressions for local computation.

  • var {Var : Type u_1} {Val : Type u_2} {FunId : Type u_3} (x : Var) : Expr Var Val FunId

    Read variable x.

  • val {Var : Type u_1} {Val : Type u_2} {FunId : Type u_3} (v : Val) : Expr Var Val FunId

    Value v.

  • call {Var : Type u_1} {Val : Type u_2} {FunId : Type u_3} (f : FunId) (args : List (Expr Var Val FunId)) : Expr Var Val FunId

    Call function f with arguments args.

Instances For
    @[instance_reducible]
    instance Cslib.Mech.instCoeExpr {Var : Type u_1} {Val : Type u_2} {FunId : Type u_3} :
    Coe Var (Expr Var Val FunId)

    Utility instance to write variables directly as expressions.

    Equations
    @[instance_reducible]
    instance Cslib.Mech.instCoeExpr_1 {Val : Type u_1} {Var : Type u_2} {FunId : Type u_3} :
    Coe Val (Expr Var Val FunId)

    Utility instance to write values directly as expressions.

    Equations
    @[reducible, inline]
    abbrev Cslib.Mech.LocalStore (Var : Sort u_1) (Val : Sort u_2) :
    Sort (imax u_1 u_2)

    A local store represents the memory state of a process, mapping variables to values.

    Equations
    Instances For
      @[reducible, inline]
      abbrev Cslib.Mech.FunCallEval (FunId : Sort u_1) (Val : Type u_2) :
      Sort (max u_1 (u_2 + 1))

      Type of (potentially nondeterministic) evaluation relations for local function calls at processes.

      Equations
      Instances For
        inductive Cslib.Mech.FunCallEval.EvalExpr {FunId : Type u_1} {Val : Type u_2} (eval : FunCallEval FunId Val) {Var : Type u_3} (σ : LocalStore Var Val) (e : Expr Var Val FunId) (v : Val) :

        Evaluation relation for expressions.

        Instances For
          @[reducible, inline]
          abbrev Cslib.Mech.GlobalStore (Pid : Sort u_1) (Var : Sort u_2) (Val : Sort u_3) :
          Sort (imax u_1 u_2 u_3)

          A global store represents the memory state of an entire system, mapping each process to its local store.

          Equations
          Instances For
            @[reducible, inline]
            abbrev Cslib.Mech.AtPid (Pid : Type u_1) (α : Type u_2) :
            Type (max u_1 u_2)

            Type of an element of type α located at a process.

            Equations
            Instances For
              @[reducible, inline]
              abbrev Cslib.Mech.AtPid.pid {Pid : Type u_1} {α : Type u_2} (a : AtPid Pid α) :
              Pid

              The process name of a located element.

              Equations
              Instances For
                @[reducible, inline]
                abbrev Cslib.Mech.AtPid.elem {Pid : Type u_1} {α : Type u_2} (a : AtPid Pid α) :
                α

                The element of a located element.

                Equations
                Instances For
                  @[instance_reducible]
                  instance Cslib.Mech.instHasSubstitutionGlobalStoreAtPidOfDecidableEq {Pid : Type u_1} {Var : Type u_2} {Val : Type u_3} [DecidableEq Pid] [DecidableEq Var] :
                  HasSubstitution (GlobalStore Pid Var Val) (AtPid Pid Var) Val
                  Equations
                  • One or more equations did not get rendered due to their size.