DiagramProcess
(WIP) Construct a computable diagram of an underlying abstract process
ResourceFunction["DiagramProcess"][expr] returns a process object with computable diagram properties. |
Details and Options
| DiagramProcess Options | ||
| "Simplify" | False | simplify diagram by dropping topological processes |
| "Double" | None | double or undouble a process |
| "Composite" | None | composite or uncomposite a process |
| Diagram Options | also work for "Diagram" property | |
| "Outline" | False | outline all processes with dashed contour |
| "ComposeDistance" | Automatic | vertical distance between processes |
| "ParallelComposeDistance" | Automatic | horizontal distnace between processes |
| "Size" | Automatic | size of a diagram |
| "ShowProcessLabels" | True | whether to show process labels |
| "ShowWireLabels" | True | whether to show wire labels |
| "ShowArrowLabels" | False | whether to show arrow labels |
| "ShowProcessArrows" | False | whether to show arrows inside processes |
| "ArrowPosition" | Automatic | relative position of arrowheads |
| "AddTerminals" | False | whether to show ingoing and outgoing diagram wires |
| "ThickDoubleWires" | False | thicken double wires |
| "ShowComposites" | False | whether to show internals of composite processes |
| "Interactive" | False | return graph with draggable vertices |
| Property | Description |
| "Properties" | list all available properties |
| "Diagram"|"Graph" | return a digram for a process |
| "Process" | return an underlying process object |
| "Tensor" | tensor interpretation of a process |
| "Matrix" | matrix interpretation of a process |
Examples
Basic Examples
A process with no inputs or outputs:
| In[1]:= |
| Out[1]= |
Inputs are specified with Subscript or Underscript:
| In[2]:= |
| Out[2]= |
Ouputs are specified with Power, Superscript or Overscript:
| In[3]:= |
| Out[3]= |
Specify multiple inputs/ouputs with List or Row:
| In[4]:= |
| Out[4]= |
Composition builds diagram vertically:
| In[5]:= |
| Out[5]= |
Parallel composition (CircleTimes) builds diagram horizontally:
| In[6]:= |
| Out[6]= |
Scope
Special processes
| In[8]:= |
| Out[8]= |
| In[9]:= |
| Out[9]= |
| In[10]:= |
| Out[10]= |
| In[11]:= |
| Out[11]= |
| In[12]:= |
| Out[12]= |
| In[13]:= |
| Out[13]= |
| In[14]:= |
| Out[14]= |
| In[15]:= |
| Out[15]= |
| In[16]:= |
| Out[16]= |
| In[17]:= |
| Out[17]= |
| In[18]:= |
| Out[18]= |
| In[19]:= |
| Out[19]= |
| In[20]:= |
| Out[20]= |
| In[21]:= |
| Out[21]= |
| In[22]:= |
| Out[22]= |
| In[23]:= |
| Out[23]= |
| In[24]:= |
| Out[24]= |
| In[25]:= |
| Out[25]= |
| In[26]:= |
| Out[26]= |
| In[27]:= |
| Out[27]= |
| In[28]:= |
| Out[28]= |
| In[29]:= |
| Out[29]= |
Transposition
Transposition rotates diagram 180°:
| In[31]:= |
| Out[31]= |
Trace
Trace creates a loop using cup and cap processes:
| In[34]:= |
| Out[34]= |
Specify indices to be traced:
| In[35]:= |
| Out[35]= |
Smart composition
Permutation and identity processes are added automatically to complete composition:
| In[36]:= |
| Out[36]= |
Simplify diagram
Simplification drops all topological processes from a diagram:
| In[37]:= |
| Out[37]= |
Summation
| In[38]:= |
| Out[38]= |
Doubling
Doubling process parallel composes it with its dual conjugate currying inputs and outputs, then wrapping it in a special bold border process:
| In[39]:= |
| Out[39]= |
Execution
Sequential and parallel process execution:
| In[40]:= |
| In[41]:= |
| Out[41]= |
| In[42]:= |
| Out[42]= |
| In[43]:= |
| Out[43]= |
| In[44]:= |
| Out[44]= |
Tensor notation
Overscript \[Breve] and \[DownBreve] indicate input and output respectively:
| In[45]:= |
| Out[45]= |
Matrix and tensor interpretation
Perform tensor products and contractions of a tensor process:
| In[46]:= |
| Out[46]= |
Circuits
There is a way to build circuit like diagrams using empty types and some hackery (parallel composition: NW→SE, composition: SW→NW):
| In[47]:= |
| Out[47]= |
Options
Outline
Some special processes render differently than generic ones, "OutlineProcess" draws an additional dashed outline around all processes:
| In[48]:= |
| Out[48]= |
AddTerminals
Terminal processes are added by default on top and bottom of a diagram's summary box to make ingoing and outgoing wires visible, specify "AddTerminals" → False to turn it off:
| In[49]:= |
| Out[49]= |
ShowProcessLabels
Show or hide process labels:
| In[50]:= |
| Out[50]= |
| In[51]:= |
| Out[51]= |
ShowWireLabels
Summary box doesn't include wire labels by default, "ShowWireLabels"→True to show them:
| In[52]:= |
| Out[52]= |
| In[53]:= |
| Out[53]= |
ShowArrowLabels
Show or hide composition arrow labels:
| In[54]:= |
| Out[54]= |
| In[55]:= |
| Out[55]= |
Size
Size of a digram can be controlled:
| In[56]:= |
| Out[56]= |
ComposeDistance
Specify vertical distance between processes:
| In[57]:= |
| Out[57]= |
ParallelComposeDistance
Specify horizontal distance between processes:
| In[58]:= |
| Out[58]= |
ArrowPosition
Specify relative position of wire arrows:
| In[59]:= |
| Out[59]= |
ThickDoubleWire
Thicken double wires:
| In[60]:= |
| Out[60]= |
ShowComposites
Reveal composit processes:
| In[61]:= |
| Out[62]= |
ShowProcessArrows
There is no arrows draws inside topological processes by default:
| In[63]:= |
| Out[63]= |
Show them:
| In[64]:= |
| Out[64]= |
Neat Examples
Quantum Teleportation
A diagram of quantum teleportation protocol teleporting state ρ with simplest quantum isometry map U that realizes it and classical channel between them, with its matrix interpretation:
| In[65]:= |
| Out[66]= |
Which is equivalent to:
| In[67]:= |
| Out[67]= |
Dense coding
| In[68]:= |
| In[69]:= |
| Out[69]= |
Entanglement swapping
| In[70]:= |
| In[71]:= |
| In[72]:= |
| Out[72]= |
| In[73]:= |
| In[74]:= |
| Out[74]= |
| In[75]:= |
| Out[76]= |
| In[77]:= |
| Out[77]= |
Quantum teleportation spider circuit
| In[78]:= |
| Out[78]= |