Documentation

Determinize.Spec.Syntax

Reviewer-facing paper syntax #

Only sample sites carry affinity labels; subtyping is silent; literals and arithmetic are unannotated, as in the paper's grammar, and a literal types at either affinity. Types are assigned separately by Typed; no expression constructor contains a type annotation. Each primitive distribution is its own constructor with the paper's operands and a site. In the paper syntax (Expr with its default parameters), a site samples with an E/G affinity or computes the primitive’s mean without an affinity annotation. Programs may contain both sampling and mean sites; their operands may be arbitrary expressions. Spec/Frontend.lean reuses the constructors with rational literals and other sites for the programs of the front end.

inductive Determinize.Spec.Paper.Expr (Literal : Type := ℝ) (Site : Type := DistributionAction) :

Untyped paper expressions with de Bruijn variables. Site is the annotation of a primitive distribution; in the paper syntax it is a DistributionAction.

Instances For
    def Determinize.Spec.Paper.instReprExpr.repr {Literal✝ Site✝ : Type} [Repr Literal✝] [Repr Site✝] :
    Expr Literal✝ Site✝ → ℕ → Std.Format
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[instance_reducible]
      instance Determinize.Spec.Paper.instReprExpr {Literal✝ Site✝ : Type} [Repr Literal✝] [Repr Site✝] :
      Repr (Expr Literal✝ Site✝)
      Equations
      def Determinize.Spec.Paper.instDecidableEqExpr.decEq {Literal✝ Site✝ : Type} [DecidableEq Literal✝] [DecidableEq Site✝] (x✝ x✝¹ : Expr Literal✝ Site✝) :
      Decidable (x✝ = x✝¹)
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Determinize.Spec.Paper.Expr.mapVars {Literal Site : Type} (replace : ℕ → ℕ → Expr Literal Site) (depth : ℕ) :
        Expr Literal Site → Expr Literal Site

        Apply replace depth index to variables, increasing depth beneath binders.

        Equations
        Instances For
          @[reducible, inline]
          abbrev Determinize.Spec.Paper.Expr.shift {Literal Site : Type} (amount cutoff : ℕ) :
          Expr Literal Site → Expr Literal Site

          Add amount to every variable index that is at least cutoff.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            @[reducible, inline]
            abbrev Determinize.Spec.Paper.Expr.substAt {Literal Site : Type} (depth : ℕ) (replacement : Expr Literal Site) :
            Expr Literal Site → Expr Literal Site

            Substitute replacement for the variable depth and lower the indices above it.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              def Determinize.Spec.Paper.Expr.substHead {Literal Site : Type} (body replacement : Expr Literal Site) :
              Expr Literal Site

              Substitute replacement for the innermost variable of body.

              Equations
              Instances For
                def Determinize.Spec.Paper.Expr.substTwo {Literal Site : Type} (body argument function : Expr Literal Site) :
                Expr Literal Site

                Substitute argument for the innermost variable of body and function for the next one, as when a recursive function is applied.

                Equations
                Instances For
                  def Determinize.Spec.Paper.Expr.determinize {Literal : Type} :
                  Expr Literal → Expr Literal

                  Replace E stochastic samples by their atomic means.

                  Equations
                  Instances For
                    def Determinize.Spec.Paper.Expr.map {Literal Literal' Site Site' : Type} (literal : Literal → Literal') (site : Site → Site') :
                    Expr Literal Site → Expr Literal' Site'

                    Apply literal to every literal and site to every site.

                    Equations
                    Instances For

                      Typing of de Bruijn variables in a paper context.

                      Instances For

                        Core typing with affinity-annotated sample sites and silent structural subtyping.

                        Instances For