Install

In[]:=
PacletInstall["https://www.wolframcloud.com/obj/nikm/ProcessTheoryLoader.paclet",ForceVersionInstall->True]
Out[]=
PacletObject
Name: ProcessTheory
Version: 0.0.1

In[]:=
<<ProcessTheoryLoader`

Updates

* Diagram port frames
* Port mutation: DiagramSplit, DiagramPermute, DiagramAssignPorts
* DiagramCases, DiagramPattern
* SimplifyDiagram
* DiagramFunction
* TensorDiagram/DiagramTensor
* SingletonDiagram
* Neutral and Power ports

Port

In[]:=
Port[a]
Out[]=
a
In[]:=
Port[a⊗b]
Out[]=
a⊗b
In[]:=
Port[a⊕b]
Out[]=
a⊕b
In[]:=
Port[a⊕
*
b
]
Out[]=
a⊕
*
b

Diagrams

Name (Function/Data/Layer/SystemModel/...) + Inputs + Outputs:
In[]:=
Diagram[A,x,y]
Out[]=
In[]:=
PortDual@PortDual[a]
Out[]=
a
In[]:=
Diagram[A,{
*
a
,b},{x,y,z}]
Out[]=
Port
*
b
,
*
T.

Port[y]
Port overwriting:
In[]:=
Diagram[Diagram[A,a,b],{1,2,3},{x,y}]
Out[]=
Customizable graphics:
In[]:=
Diagram[A,x,y,"Shape"->"Circle","PortLabels"->{Placed["X",{-0.5,1}],"Y"},"PortArrows"->{Placed[Red,Left],Automatic},"Width"->1,"Height"->2,"Angle"->Pi/4,"Outline"->True,"ShowLabel"->False,"LabelFunction"->(Style[#["Name"],Bold]&)]
Out[]=
In[]:=
Diagram[A,x,y,"Shape"->"Wire","PortLabels"->{Placed["X",{-0.5,1}],"Y"},"PortArrows"->{Placed[Red,Left],Automatic},"Width"->1,"Height"->2,"Angle"->Pi/4,"Outline"->True,"ShowLabel"->False,"LabelFunction"->(Style[#["Name"],Bold]&)]
Out[]=
DiagramComposition[​​Diagram[B,y,z],​​Diagram[A,x,y,"Shape"->"Wire","PortLabels"->{Placed["X",{-0.5,1}],"Y"},"PortArrows"->{Placed[Red,Left],Automatic},"Width"->1,"Height"->2,"Angle"->Pi/4,"Outline"->False,"ShowLabel"->False,"LabelFunction"->(Style[#["Name"],Bold]&)]​​]
Out[]=

Unary operations

In[]:=
Diagram[A,{x,y},z]
Out[]=
In[]:=
DiagramFlip[Diagram[A,{x,y},z]]
Out[]=
In[]:=
DiagramReverse[Diagram[A,{a,b},{c,d}]]
Out[]=
In[]:=
DiagramDual[Diagram[A,{a,b},{c,d}]]
Out[]=

Diagram composition

Monoidal product ⊗ (horizontal composition):
In[]:=
DiagramProduct[Diagram[A,a,b],Diagram[B,x]]
Out[]=
Categorical composition (vertical composition):
Diagram sum:
Network:
“PortFunction” specifies how ports should be connected when composed:
“PortFunction” is used to identify ports and can be used to define general connections (should only return HoldForm for now):

ColumnDiagram, RowDiagram and DiagramGrid

ColumnDiagram and RowDiagram arranges diagrams into a grid by introducing wire nodes:
Alignment- Right | Left | Center | Scaled | “Circuit” | x
Dividers - True | False | All
“Outline” - True | False
“Rotate” - Left | Right | Up | Down | angle
“VerticalGapSize”
“HorizontalGapSize”
“Width”
“Height”
“Frames”
Frames (unmatched ports displayed as wrapping frame automatically):

DiagramCases

SimplifyDiagram

Turning network diagram to grid arranged diagrams and back introduces extra wire nodes:
SimplifyDiagram removes wire nodes:

Network options

“BinarySpiders” - True | False | All
“UnarySpiders”
“RemoveCycles”
“ShowPortLabels”
“ShowWireLabels”
“Scale”
“ArrowSize”
“SpiderRadius”
“Orientation”

Grid + Network

DiagramDraw

ToDiagram

Graph:
Hypergraph:

DiagramTensor

TensorDiagram

DiagramFunction

() : ()

HVM