UC composition notation #
Scoped notation for open-system boundaries and the free composition syntax.
All notation is scoped to Interaction.UC; use open Interaction.UC
to bring it into scope.
Typeclasses #
The notation is backed by three typeclasses (HasPar, HasWire, HasPlug)
with instances for Raw, Expr, and Interp. Each instance is accompanied
by a @[simp] bridge lemma that normalizes the typeclass method back to
the concrete operation, ensuring that existing simp lemmas (e.g.,
interpret_par, interpret_wire) continue to fire on notation-introduced
terms.
Boundary-level #
| Notation | Meaning | Input method |
|---|---|---|
Δ₁ ⊗ᵇ Δ₂ | PortBoundary.tensor Δ₁ Δ₂ | \otimes ^b |
Δᵛ | PortBoundary.swap Δ (dual) | \^v |
Expression-level #
| Notation | Meaning | Precedence |
|---|---|---|
e₁ ∥ e₂ | HasPar.par e₁ e₂ (parallel) | 70, right |
e₁ ⊞ e₂ | HasWire.wire e₁ e₂ (wire) | 65, right |
e ⊠ k | HasPlug.plug e k (plug/close) | 60, right |
Parsing rules #
Precedence ensures natural parenthesization:
A ∥ B ∥ C=A ∥ (B ∥ C)(right-associative)A ∥ B ⊞ C=(A ∥ B) ⊞ C(par binds tighter than wire)A ⊞ B ⊠ C=(A ⊞ B) ⊠ C(wire binds tighter than plug)A ∥ B ⊞ C ∥ D ⊠ E=((A ∥ B) ⊞ (C ∥ D)) ⊠ EΓᵛ ⊗ᵇ Δ=tensor (swap Γ) Δ(postfixᵛat max precedence)(Δ₁ ⊗ᵇ Δ₂)ᵛ=swap (tensor Δ₁ Δ₂)(parentheses required)
Boundary-level notation #
Tensor (parallel) of port boundaries: Δ₁ ⊗ᵇ Δ₂.
Instances For
Dual (swap) of a port boundary: Δᵛ means PortBoundary.swap Δ.
The superscript v (typed \^v) visually suggests "flip" or "invert,"
matching the operation that swaps inputs and outputs. Avoids the
Mathlib-global ᵒᵖ (which denotes Opposite).
Instances For
Composition typeclasses #
Parallel composition on boundary-indexed types.
- par {Δ₁ Δ₂ : PortBoundary} : F Δ₁ → F Δ₂ → F (Δ₁.tensor Δ₂)
Instances
Wiring (partial internal connection) on boundary-indexed types.
- wire {Δ₁ Γ Δ₂ : PortBoundary} : F (Δ₁.tensor Γ) → F (Γ.swap.tensor Δ₂) → F (Δ₁.tensor Δ₂)
Instances
Plugging (full closure) on boundary-indexed types.
- plug {Δ : PortBoundary} : F Δ → F Δ.swap → F PortBoundary.empty
Instances
Notation #
Parallel composition: e₁ ∥ e₂.
Instances For
Plug (full closure): e ⊠ k.
Instances For
Instances and bridge lemmas for Raw #
Instances and bridge lemmas for Expr #
Instances and bridge lemmas for Interp #
Verification #
The following examples verify correct elaboration, precedence, and
that bridge lemmas fire correctly with simp.