Intertwiner#

class discopy.hopf.Intertwiner(inside, dom, cod, _scan=True)[source]#

Bases: discopy.abc.Result, discopy.tensor.Diagram, discopy.abc.RibbonCategory

The ribbon category \(\mathrm{Rep}(H)\) of representations of the class parameter algebra: given a Algebra H, the class Intertwiner[H] is a category of tensor.Diagrams whose objects are Representation[H], and algebra is accessible on both the class and its instances. Its ribbon structure is given by its classmethods — the braiding is braid() (the R-matrix acting on the two strands, then a swap), the twist() is the trace of the self-braiding, and the (co)evaluations cups/caps pair a module with its dual Representation.r, which carries the antipode-twisted action.

An intertwiner can also be built from concrete data: Intertwiner[H](array, dom, cod) wraps the array in a single box, as for a tensor.Tensor — this is how a ribbon Functor maps its generating boxes.

Example

An intertwiner f between modules is a map that commutes with the action, \(f \circ \rho_V = \rho_W \circ (1_H \otimes f)\). We check this axiom for the braid on \(V \otimes V\), whose product action \(\rho_{V \otimes V}\) goes through the comultiplication (see Representation.tensor()), and draw the left-hand side as the tensor.CMap it contracts to:

>>> import numpy as np
>>> D = Double(Algebra.cyclic(2))
>>> e = Representation[D].anyon(0, -1)
>>> m = Representation[D].anyon(1, 1)
>>> V = Representation[D].direct_sum([e, m])
>>> action = (V @ V).action
>>> braid = Intertwiner[D].braid(V, V)
>>> lhs, rhs = action >> braid, Id(D.ty) @ braid >> action
>>> assert lhs.eval(dtype=complex).is_close(rhs.eval(dtype=complex))
>>> lhs.to_map().draw(  
...   doctest='docs/_static/hopf/intertwiner.dot')

graph cmap { graph [bgcolor="white", fontname="DejaVu Sans", layout="dot", margin="0.04", outputorder="edgesfirst", overlap="false", rankdir="TB", splines="true"]; node [color="black", fontname="DejaVu Sans", fontsize="12", margin="0", shape="plain"]; edge [color="black", fontname="DejaVu Sans", fontsize="9", headclip="true", penwidth="1.4", tailclip="true"]; v0 [label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0"><TR><TD PORT="p4" TOOLTIP="dom 0: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="2" WIDTH="36" HEIGHT="0"></TD></TR><TR><TD BORDER="1" CELLPADDING="6" COLSPAN="2" WIDTH="36">∇</TD></TR><TR><TD PORT="p6" TOOLTIP="cod 0: Dim(2) (down, down)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD><TD PORT="p5" TOOLTIP="cod 1: Dim(2) (down, down)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD></TR></TABLE>>]; v1 [label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0"><TR><TD PORT="p7" TOOLTIP="dom 0: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="2" WIDTH="36" HEIGHT="0"></TD></TR><TR><TD BORDER="1" CELLPADDING="6" COLSPAN="2" WIDTH="36">Δ</TD></TR><TR><TD PORT="p9" TOOLTIP="cod 0: Dim(2) (down, down)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD><TD PORT="p8" TOOLTIP="cod 1: Dim(2) (down, down)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD></TR></TABLE>>]; v2 [label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0"><TR><TD PORT="p10" TOOLTIP="dom 0: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD><TD PORT="p11" TOOLTIP="dom 1: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD><TD PORT="p12" TOOLTIP="dom 2: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD></TR><TR><TD BORDER="1" CELLPADDING="6" COLSPAN="3" WIDTH="54">ρ</TD></TR><TR><TD PORT="p13" TOOLTIP="cod 0: Dim(2) (down, down)" BORDER="0" CELLPADDING="0" COLSPAN="3" WIDTH="54" HEIGHT="0"></TD></TR></TABLE>>]; v3 [label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0"><TR><TD PORT="p14" TOOLTIP="dom 0: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD><TD PORT="p15" TOOLTIP="dom 1: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD><TD PORT="p16" TOOLTIP="dom 2: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD></TR><TR><TD BORDER="1" CELLPADDING="6" COLSPAN="3" WIDTH="54">ρ</TD></TR><TR><TD PORT="p17" TOOLTIP="cod 0: Dim(2) (down, down)" BORDER="0" CELLPADDING="0" COLSPAN="3" WIDTH="54" HEIGHT="0"></TD></TR></TABLE>>]; v4 [label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0"><TR><TD BORDER="1" CELLPADDING="6" COLSPAN="1" WIDTH="18">ε</TD></TR><TR><TD PORT="p18" TOOLTIP="cod 0: Dim(2) (down, down)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD></TR></TABLE>>]; v5 [label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0"><TR><TD BORDER="1" CELLPADDING="6" COLSPAN="1" WIDTH="18">η</TD></TR><TR><TD PORT="p19" TOOLTIP="cod 0: Dim(2) (down, down)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD></TR></TABLE>>]; v6 [label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0"><TR><TD PORT="p20" TOOLTIP="dom 0: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD><TD PORT="p21" TOOLTIP="dom 1: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD><TD PORT="p22" TOOLTIP="dom 2: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD></TR><TR><TD BORDER="1" CELLPADDING="6" COLSPAN="3" WIDTH="54">ρ</TD></TR><TR><TD PORT="p23" TOOLTIP="cod 0: Dim(2) (down, down)" BORDER="0" CELLPADDING="0" COLSPAN="3" WIDTH="54" HEIGHT="0"></TD></TR></TABLE>>]; v7 [label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0"><TR><TD PORT="p24" TOOLTIP="dom 0: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD><TD PORT="p25" TOOLTIP="dom 1: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD><TD PORT="p26" TOOLTIP="dom 2: Dim(2) (up, up)" BORDER="0" CELLPADDING="0" COLSPAN="1" WIDTH="18" HEIGHT="0"></TD></TR><TR><TD BORDER="1" CELLPADDING="6" COLSPAN="3" WIDTH="54">ρ</TD></TR><TR><TD PORT="p27" TOOLTIP="cod 0: Dim(2) (down, down)" BORDER="0" CELLPADDING="0" COLSPAN="3" WIDTH="54" HEIGHT="0"></TD></TR></TABLE>>]; input [label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0"><TR><TD PORT="p0" TOOLTIP="input 0: Dim(2)" BORDER="0" CELLPADDING="4"></TD><TD PORT="p1" TOOLTIP="input 1: Dim(2)" BORDER="0" CELLPADDING="4"></TD><TD PORT="p2" TOOLTIP="input 2: Dim(2)" BORDER="0" CELLPADDING="4"></TD><TD PORT="p3" TOOLTIP="input 3: Dim(2)" BORDER="0" CELLPADDING="4"></TD></TR></TABLE>>]; output [label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0"><TR><TD PORT="p28" TOOLTIP="output 0: Dim(2)" BORDER="0" CELLPADDING="4"></TD><TD PORT="p29" TOOLTIP="output 1: Dim(2)" BORDER="0" CELLPADDING="4"></TD></TR></TABLE>>]; { rank=min; input; } { rank=max; output; } input:p0:s -- v0:p4:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; input:p1:s -- v1:p7:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; input:p2:s -- v2:p12:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; input:p3:s -- v3:p16:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; v0:p5:s -- v2:p10:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; v0:p6:s -- v3:p14:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; v1:p8:s -- v3:p15:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; v1:p9:s -- v2:p11:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; v2:p13:s -- v6:p22:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; v3:p17:s -- v7:p26:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; v4:p18:s -- v6:p20:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; v5:p19:s -- v7:p25:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; v6:p21:n -- v7:p24:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; v6:p23:s -- output:p29:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; v7:p27:s -- output:p28:n [label="Dim(2)", labeldistance="1.6", len="0.85"]; }

The braid contracts to the braiding matrix of the toric code:

>>> matrix = braid.eval(dtype=complex).array.reshape(4, 4)
>>> assert np.allclose(matrix, [[1, 0, 0, 0], [0, 0, -1, 0],
...                             [0, 1, 0, 0], [0, 0, 0, 1]])
Parameters:
  • dom (C0) –

  • cod (C0) –

ob#

alias of Dim

classmethod braid(left, right, is_dagger=False)[source]#

The braiding \(V \otimes W \to W \otimes V\) (its inverse \(R^{-1} = (S \otimes 1) R\) when is_dagger): the R-matrix acting on the two strands, i.e. \((\rho_V \otimes \rho_W)(R)\), then a swap. Raises a ValueError if the algebra has no R-matrix.

classmethod twist(dom)[source]#

The twist of dom: the action of the ribbon element Algebra.twist, computed once as the ribbon trace of the self-braiding of the regular representation.