Documentation

VCVio.Interaction.UC.OpenSyntax.Interp

Tagless-final free model of open composition #

This module defines Interp, the final (tagless-final / Church-encoded) free model of OpenTheory.

An Interp Atom Δ stores no syntax tree. Instead it is determined entirely by its universal interpretation function: for every lawful target OpenTheory and every atom interpretation, it produces an object of boundary Δ in the target.

This representation is convenient for proving universal properties because its lawfulness reduces immediately to the target theory's laws.

See OpenSyntax.Expr for the quotiented initial model that supports pattern matching and inspection.

structure Interaction.UC.OpenSyntax.Interp (Atom : PortBoundaryType u) (Δ : PortBoundary) :
Type (max 4 (u + 2))

Interp Atom Δ is the tagless-final free open-system expression of boundary Δ generated by primitive atoms Atom.

An element stores its universal elimination principle: for every lawful target open theory T and every atom interpretation, it produces an object of boundary Δ in T.

Instances For
    @[reducible, inline]
    abbrev Interaction.UC.OpenSyntax.Interp.interpret {Atom : PortBoundaryType u} {Δ : PortBoundary} (W : Interp Atom Δ) (T : OpenTheory) (hT : T.CompactClosed) (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ) :
    T.Obj Δ

    Interpret a tagless-final expression in a compact closed target theory.

    This is just the run field restated as a named eliminator.

    Instances For
      theorem Interaction.UC.OpenSyntax.Interp.ext {Atom : PortBoundaryType u} {Δ : PortBoundary} {W₁ W₂ : Interp Atom Δ} (h : ∀ (T : OpenTheory) (hT : T.CompactClosed) (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ), (W₁.run T hT fun {Δ : PortBoundary} => interp) = W₂.run T hT fun {Δ : PortBoundary} => interp) :
      W₁ = W₂

      Two tagless-final expressions are equal when they have the same interpretation in every lawful target theory.

      theorem Interaction.UC.OpenSyntax.Interp.ext_iff {Atom : PortBoundaryType u} {Δ : PortBoundary} {W₁ W₂ : Interp Atom Δ} :
      W₁ = W₂ ∀ (T : OpenTheory) (hT : T.CompactClosed) (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ), (W₁.run T hT fun {Δ : PortBoundary} => interp) = W₂.run T hT fun {Δ : PortBoundary} => interp
      def Interaction.UC.OpenSyntax.Interp.atom {Atom : PortBoundaryType u} {Δ : PortBoundary} :
      Atom ΔInterp Atom Δ

      Inject a primitive open component into the tagless-final syntax.

      Instances For
        @[simp]
        theorem Interaction.UC.OpenSyntax.Interp.interpret_atom {Atom : PortBoundaryType u} {Δ : PortBoundary} (a : Atom Δ) (T : OpenTheory) (hT : T.CompactClosed) (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ) :
        ((atom a).interpret T hT fun {Δ : PortBoundary} => interp) = interp a
        def Interaction.UC.OpenSyntax.Interp.map {Atom : PortBoundaryType u} {Δ₁ Δ₂ : PortBoundary} (f : Δ₁.Hom Δ₂) :
        Interp Atom Δ₁Interp Atom Δ₂

        Adapt the exposed boundary of a tagless-final expression.

        Instances For
          @[simp]
          theorem Interaction.UC.OpenSyntax.Interp.interpret_map {Atom : PortBoundaryType u} {Δ₁ Δ₂ : PortBoundary} (f : Δ₁.Hom Δ₂) (W : Interp Atom Δ₁) (T : OpenTheory) (hT : T.CompactClosed) (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ) :
          ((map f W).interpret T hT fun {Δ : PortBoundary} => interp) = T.map f (W.interpret T hT fun {Δ : PortBoundary} => interp)
          def Interaction.UC.OpenSyntax.Interp.par {Atom : PortBoundaryType u} {Δ₁ Δ₂ : PortBoundary} :
          Interp Atom Δ₁Interp Atom Δ₂Interp Atom (Δ₁.tensor Δ₂)

          Place two tagless-final expressions side by side.

          Instances For
            @[simp]
            theorem Interaction.UC.OpenSyntax.Interp.interpret_par {Atom : PortBoundaryType u} {Δ₁ Δ₂ : PortBoundary} (W₁ : Interp Atom Δ₁) (W₂ : Interp Atom Δ₂) (T : OpenTheory) (hT : T.CompactClosed) (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ) :
            ((W₁.par W₂).interpret T hT fun {Δ : PortBoundary} => interp) = T.par (W₁.interpret T hT fun {Δ : PortBoundary} => interp) (W₂.interpret T hT fun {Δ : PortBoundary} => interp)
            def Interaction.UC.OpenSyntax.Interp.wire {Atom : PortBoundaryType u} {Δ₁ Γ Δ₂ : PortBoundary} :
            Interp Atom (Δ₁.tensor Γ)Interp Atom (Γ.swap.tensor Δ₂)Interp Atom (Δ₁.tensor Δ₂)

            Connect one shared boundary between two tagless-final expressions.

            Instances For
              @[simp]
              theorem Interaction.UC.OpenSyntax.Interp.interpret_wire {Atom : PortBoundaryType u} {Δ₁ Γ Δ₂ : PortBoundary} (W₁ : Interp Atom (Δ₁.tensor Γ)) (W₂ : Interp Atom (Γ.swap.tensor Δ₂)) (T : OpenTheory) (hT : T.CompactClosed) (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ) :
              ((W₁.wire W₂).interpret T hT fun {Δ : PortBoundary} => interp) = T.wire (W₁.interpret T hT fun {Δ : PortBoundary} => interp) (W₂.interpret T hT fun {Δ : PortBoundary} => interp)

              Close a tagless-final expression against a matching context.

              Instances For
                @[simp]
                theorem Interaction.UC.OpenSyntax.Interp.interpret_plug {Atom : PortBoundaryType u} {Δ : PortBoundary} (W : Interp Atom Δ) (K : Interp Atom Δ.swap) (T : OpenTheory) (hT : T.CompactClosed) (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ) :
                ((W.plug K).interpret T hT fun {Δ : PortBoundary} => interp) = T.plug (W.interpret T hT fun {Δ : PortBoundary} => interp) (K.interpret T hT fun {Δ : PortBoundary} => interp)

                The monoidal unit (closed system with no boundary).

                Instances For
                  @[simp]
                  theorem Interaction.UC.OpenSyntax.Interp.interpret_unit {Atom : PortBoundaryType u} (T : OpenTheory) (hT : T.CompactClosed) (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ) :

                  The identity wire (coevaluation) on boundary Γ.

                  Instances For
                    @[simp]
                    theorem Interaction.UC.OpenSyntax.Interp.interpret_idWire {Atom : PortBoundaryType u} (Γ : PortBoundary) (T : OpenTheory) (hT : T.CompactClosed) (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ) :
                    ((idWire Γ).interpret T hT fun {Δ : PortBoundary} => interp) = OpenTheory.CompactClosed.idWire Γ
                    @[reducible, inline]

                    The free lawful OpenTheory generated by tagless-final expressions over Atom.

                    Instances For
                      @[implicit_reducible]
                      @[implicit_reducible]