T6.fyi

An Illustrated Guide to Interaction Nets

Interaction nets are an alternate model of computation that is inherently parallel. An interaction net consists of several agents.

This is an agent of type A. All agents have one principal port and any number of auxiliary ports (based on the agent type).

An interaction net is a group of agents whose ports are connected in pairs with wires. Nets can also have free ports at their boundary. When two principal ports are connected, they form an active pair.

Interaction nets are interpreted in the context of an interaction system, a collection of agent types and interaction rules. Active pairs are replaced according to the interaction rule corresponding to their agent types.

Tangles in the net don't matter; wires can be moved at will.

Agents can be used to represent both values and operations. (We're representing numbers in unary here, for simplicity, even though it's inefficient.)

Then, interaction rules specify how the operations operate on different values.

Using this system, we can now compute 1 + 1 = 2.

All free ports on the left side of a rule must appear exactly once on the right side. If we want to erase or duplicate values, we can introduce eraser (ε) and duplicator (δ) agents.

We of course need to define interaction rules for these agents:

We can use these agents to define operations like multiplication:

Now we can start to compute 1 * 1 = 1:

After the first interaction, we're in an interesting situation: there are two active pairs that could interact. Because interactions only change local parts of the net, it does not matter what order we process these active pairs in – and in fact we can process them in parallel: