Documentation

VCVio.Interaction.UC.OpenSyntax.Raw

Raw syntax trees for open composition #

This module defines the raw (un-quotiented) syntax trees for open-system expressions, together with a structural interpretation function into any target OpenTheory.

The inductive Raw Atom Δ has five native constructors (atom, map, par, wire, idWire) forming the minimal generating set for a compact closed open-system algebra. The derived operations plug and unit are defined as abbreviations. The raw tree is not quotiented, so syntactically distinct trees are distinct values even when they would evaluate the same way in any lawful OpenTheory; Raw.map (Hom.id Δ) e is a fresh .map node, not definitionally equal to e.

The quotient of Raw by the OpenTheory equations is defined in OpenSyntax.Expr. The tagless-final (Church-encoded) companion is defined in OpenSyntax.Interp.

Main definitions #

inductive Interaction.UC.OpenSyntax.Raw (Atom : PortBoundaryType u) :
PortBoundaryType (u + 1)

Raw Atom Δ is the raw syntax tree for open-system expressions of boundary Δ generated by primitive atoms Atom.

The five native constructors form the minimal generating set for a compact closed open-system algebra. The derived operations plug and unit are abbreviations defined below.

See Expr for the quotiented version.

Instances For
    @[reducible, inline]

    The monoidal unit: idWire on the trivial boundary, mapped through a unitor. Derived from the two primitives map and idWire.

    Instances For
      @[reducible, inline]
      abbrev Interaction.UC.OpenSyntax.Raw.plug {Atom : PortBoundaryType u} {Δ : PortBoundary} (e : Raw Atom Δ) (k : Raw Atom Δ.swap) :

      Close an open system against a matching context. Derived from wire by embedding both operands into a tensored boundary and collapsing via a unitor.

      Instances For
        def Interaction.UC.OpenSyntax.Raw.interpret {Atom : PortBoundaryType u} {Δ : PortBoundary} (e : Raw Atom Δ) (T : OpenTheory) (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ) (idWireVal : (Γ : PortBoundary) → T.Obj (Γ.swap.tensor Γ)) :
        T.Obj Δ

        Interpret a raw expression in an arbitrary target open theory.

        This is structural recursion: each constructor maps to the corresponding OpenTheory operation. The target theory need not be lawful; lawfulness is only required when reasoning about equivalence of interpretations.

        Instances For
          @[simp]
          theorem Interaction.UC.OpenSyntax.Raw.interpret_atom {Atom : PortBoundaryType u} {T : OpenTheory} {interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ} {idWireVal : (Γ : PortBoundary) → T.Obj (Γ.swap.tensor Γ)} {Δ : PortBoundary} (a : Atom Δ) :
          (atom a).interpret T (fun {Δ : PortBoundary} => interp) idWireVal = interp a
          @[simp]
          theorem Interaction.UC.OpenSyntax.Raw.interpret_map {Atom : PortBoundaryType u} {T : OpenTheory} {interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ} {idWireVal : (Γ : PortBoundary) → T.Obj (Γ.swap.tensor Γ)} {Δ₁ Δ₂ : PortBoundary} (f : Δ₁.Hom Δ₂) (e : Raw Atom Δ₁) :
          (map f e).interpret T (fun {Δ : PortBoundary} => interp) idWireVal = T.map f (e.interpret T (fun {Δ : PortBoundary} => interp) idWireVal)
          @[simp]
          theorem Interaction.UC.OpenSyntax.Raw.interpret_par {Atom : PortBoundaryType u} {T : OpenTheory} {interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ} {idWireVal : (Γ : PortBoundary) → T.Obj (Γ.swap.tensor Γ)} {Δ₁ Δ₂ : PortBoundary} (e₁ : Raw Atom Δ₁) (e₂ : Raw Atom Δ₂) :
          (e₁.par e₂).interpret T (fun {Δ : PortBoundary} => interp) idWireVal = T.par (e₁.interpret T (fun {Δ : PortBoundary} => interp) idWireVal) (e₂.interpret T (fun {Δ : PortBoundary} => interp) idWireVal)
          @[simp]
          theorem Interaction.UC.OpenSyntax.Raw.interpret_wire {Atom : PortBoundaryType u} {T : OpenTheory} {interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ} {idWireVal : (Γ : PortBoundary) → T.Obj (Γ.swap.tensor Γ)} {Δ₁ Γ Δ₂ : PortBoundary} (e₁ : Raw Atom (Δ₁.tensor Γ)) (e₂ : Raw Atom (Γ.swap.tensor Δ₂)) :
          (e₁.wire e₂).interpret T (fun {Δ : PortBoundary} => interp) idWireVal = T.wire (e₁.interpret T (fun {Δ : PortBoundary} => interp) idWireVal) (e₂.interpret T (fun {Δ : PortBoundary} => interp) idWireVal)
          @[simp]
          theorem Interaction.UC.OpenSyntax.Raw.interpret_idWire {Atom : PortBoundaryType u} {T : OpenTheory} {interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ} {idWireVal : (Γ : PortBoundary) → T.Obj (Γ.swap.tensor Γ)} (Γ : PortBoundary) :
          (idWire Γ).interpret T (fun {Δ : PortBoundary} => interp) idWireVal = idWireVal Γ
          inductive Interaction.UC.OpenSyntax.Raw.Equiv {Atom : PortBoundaryType u} {Δ : PortBoundary} :
          Raw Atom ΔRaw Atom ΔProp

          Raw.Equiv e₁ e₂ is the smallest equivalence relation on raw expressions at the same boundary that contains the OpenTheory equations and is closed under all constructors.

          The equation constructors capture functoriality of map, naturality of par and wire, monoidal coherence (par_assoc, par_comm, unit laws), and the zig-zag identity (wire_idWire). The congruence constructors ensure that equivalent sub-expressions can be substituted anywhere in a larger tree.

          Since plug and unit are abbreviations, laws like plug_eq_wire and congr_plug are now definitional and do not need dedicated constructors.

          Instances For
            theorem Interaction.UC.OpenSyntax.Raw.Equiv.interpret_eq {Atom : PortBoundaryType u} {Δ : PortBoundary} {e₁ e₂ : Raw Atom Δ} (h : e₁.Equiv e₂) (T : OpenTheory) [T.CompactClosed] (interp : {Δ : PortBoundary} → Atom ΔT.Obj Δ) :

            Equivalent raw expressions interpret the same way in any lawful OpenTheory.

            @[implicit_reducible]

            The Setoid on Raw Atom Δ induced by Raw.Equiv.