Enter loads · ↓ lists the programs · space plays · ← → a clock, with shift a rewrite · R restarts · B turns the drive round · V view · G GPU · D details · F fit
Drag to pan, wheel to zoom. Click a site to see what is in it. shift+click an agent to read what it computes, as disp, in the details (hold shift to preview); Esc lets go.
Matter and what carries interactions. Leaves, stems and forks are the matter: data and code alike. Applications, choices, pairs, duplicators and erasers carry the interactions between them. Two agents rewrite when their principal ports meet, in one 2×2 square of the lattice, with no walker and nothing global: every reaction that is ready happens where it is, so the net works on many things at once, and a function that copies itself (the S rule's duplicator) makes more places where work happens.
Every rewrite keeps a record of the two agents it used up, and what it made carries the record's number. A rule that joins two wires into one (a pair coming apart, an un-copy) marks the two ends it joined. A record ties what its rewrite made together (the bonds, drawn faint violet), so it stays close.
Undoing. While everything a rewrite made is still there, unused, and lies in one 2×2 square, the rewrite can be undone: what it made goes and the two agents come back, with their own ids, wired as they were. A flash in blue is a rewrite undone. Undoing what came later first, a run can go all the way back to the net as loaded.
The drive. A rewrite forward is taken with chance min(1, eε/T), and undone with chance min(1, e−ε/T) (T = 1.5). With ε = 8 most rewrites stay done and the run goes forward about as fast as the plain lattice; with ε near 0 it wanders back and forth; with ε below 0 it runs backward, and the bonds pull harder (by −ε/T), drawing apart products back together so they can be undone. Each step forward gives ε of heat and each step back takes it back: the drive is what forward costs.
Copying and erasing are decisions with prices. A duplicator copies a value a layer at a time, each new agent made from fuel; an un-copy (an eraser reaching a copy nobody wants) gives it back. K and triage drop what they do not take, as an eraser: it takes the value apart, but every step of that is a recorded rewrite, so what was dropped is still in the records. At a leaf it stops. Taking the leaf is the decision ("erase leaves"): the leaf is gone for good, a unit of heat, and every record that only it could have led back through is forgotten too.
Forgetting. A record can just be forgotten ("forget"): a unit of heat, and from then on nothing it used up can come back, so neither can anything before that. Keeping every record costs room (the history grows with the run); forgetting costs heat and the way back. Which information counts as lost depends on what the system still holds: a copy it can see is a copy is given back free.
The ledger. Agents are made from fuel and give it back when unmade, so the fuel spent is the agents added plus the heat: the drive's, and a unit for every leaf erased and every record forgotten.
The lattice. A wire is a path of strands along the links between neighbouring sites; each site holds two agents and a switchboard joining the strand ends that meet there. Agents step, wires fold and flip, all by random local proposals accepted by an energy (wires pull like springs, crowding pushes, the bonds pull). Every clock the lattice is cut into 2×2×2 blocks and each site takes a turn. A wanted reader sends a demand pulse along its principal wire; nothing reacts until wanted.
Going back on the time bar is exact: the run is saved at some clocks, ids and records included, and a clock is shown by putting back the nearest saved state before it and running on, the settings changing where they changed. Changing a setting starts a new future from the clock on show.
The rest is the plain lattice, below.
Step. An agent moves to a neighbouring site. The strand it walks along is eaten; its other wires are dragged one strand longer. Wanted readers mostly step along their principal wire, toward what they need. After a clock stepped by hand, a faint arrow marks each agent that moved in it (the moves toggle).
Fold and flip. A wire that goes out and straight back snaps shut; a corner can flip to the other side of its square. Together they let wires straighten like strings under tension.
Exchange. In a full site, an agent may trade places with a resident, so walkers get through crowds.
Rewrite. When a wanted reader and the value it reads meet (same site, or one strand apart), the rule fires inside a 2×2 block: fresh agents take the free seats and are wired with fresh strands. A rewrite flashes a ring for about four clocks of the run as shown, at most 0.6 s, and the more fire at once the fainter each is.
Demand. Nothing reacts until wanted. A wanted reader sends a pulse (white dot) along its principal wire, one strand per clock; when it reaches another computation's output, that computation is wanted too, and when it reaches the value the reader needs, that value is called (orange ring): it counts as wanted, and walks along its wire toward its reader. A pulse whose strand gets moved is dropped, and the reader sends another.
Demand field. Every site, empty or not, keeps a number from 0 to 3 (amber tint): 3 where a wanted reader or a pulse is, falling by one a site and a clock. Idle matter pays to climb it, and so does wire it lays down, so it gets out of the way along the reader's wire and around both of its ends; a called value is drawn up it, toward its reader.
Fork. Demand alone runs one computation at a time, each waiting on the next like a call stack. The S rule is where a program forks: △(△s) b c becomes (s c)(b c), sharing c between two computations. Both halves start wanted, so (b c) runs alongside (s c) rather than after it, and several reactions run at once. When (s c) turns out to throw (b c) away, erasers collect it and what it did is lost.
Tension. At temperature 1.5 a loose wire gains more from wiggling than it loses to its tension, so over long runs it swells until no lane is free. A site whose switchboard holds p pairings costs p²/4, so wire stays loose in open space but cannot crowd every lane around a reaction.
Density. Wires pull matter together until, left alone, three quarters of occupied sites are full, and wanted readers and rewrites stall against full sites. Two idle agents (anything but a wanted reader) sharing a site cost energy, so idle matter spreads out to about one agent per site and keeps a seat free for traffic, while wanted readers pass through.
Garbage. Agents the answer no longer depends on are drawn dimmed. An eraser that touches a computation's output collects it: a duplicator becomes a plain wire from its input to its other output; a dead apply becomes erasers on its inputs; an unpair with both parts erased becomes one eraser on the pair. Once the answer is in, the machine keeps running until only the answer is left. Then it cools: the temperature drops to 0.05, every site takes a move that lowers the energy if it has one, idle agents trade places rather than crowd, and a corner turn that leaves a U-turn snaps it in the same move, so the wire straightens and the answer contracts as far as it will go.
Going back. Every move is a hash of its site and its clock, so a run repeats exactly from any state of it. The run is saved at some clocks, densely near the clock on show and more sparsely away from it, in at most 64 MB; going to a clock puts back the nearest saved state before it and runs on. The faint ticks on the time bar are the saved states.
Clocks. Every clock the lattice is cut into disjoint 2×2×2 blocks at a random offset, and in each block every site takes a turn, a site with a wanted reader or a called value spending half of its on it: what a synchronous chip does, with no move ever reaching outside its block.
Views. Layers stacked draws every layer of the 3D lattice offset over the others: compact, but layers overlap. Layers side by side gives each layer its own panel: exact, and every site is easy to click. 3D shows the lattice as it is, each layer over a faint labelled floor and each wire one path in the colour of its segment: drag to orbit, right-drag to pan, the wheel zooms toward the pointer, F fits the whole net; spread the layers apart (and further, every site too), show one layer at a time, or follow the action. Graph leaves the lattice out: each agent is a node and each wire a line, laid out by springs along wires, a push between nodes that crowd, and a pull that hangs what feeds an input below its reader, so the term reads as a tree from the root down. Nodes keep their places as the run plays, and a gold wire with a spark joins two agents about to rewrite. Since only rewrites change it, a step there is one rewrite.
Shapes. An agent's shape says what kind it is, so its colour is free to say where it is in the term. Values are triangles △, with a dark hole for each child (a stem one, a fork two); applications are disks, a suspended one hollow; choices are diamonds, triage whole and its second dispatch split in two; the arms of a choice travel as a pill, which an unpair splits in two; a duplicator is a Y, an eraser a ×, a normalizer a hexagon and the root a ring around a dot. The dot with a white rim is the principal port, where an agent interacts: on top in the lattice views, and in the graph view toward its wire, a value, pair, unpair or duplicator turning to point its tip there. In 3D the same families are solids: pyramids (a knob under one for each child), balls, a ring, octahedra, a capsule, a Y, a ×, a hexagonal nut. Small on screen, holes go first, then shapes become squares.
Segments. The term the root computes is a tree of applications. With segments on, an application's function and each of its arguments get colours of their own, and an application nested inside one of them splits that colour again, so each part of the term shows as a region of the net. Hues go to the parts by how many applications each holds, so nested parts take hues near the part around them; lightness alternates with how deep a part is nested. A value (code or data) is one segment, however big, and stays grey, only tinted toward its part's hue: the colour is on applications and the agents that carry them out. With something picked, the segments are the pick's, and its term in the details is tinted the same way.
Reduction state. Every output of the net means a term: a value is a tree, a suspension or an apply is an application f x, a triage on a with arms b, c is t a b c, and a duplicator's two copies are one value, shared. Shift+click an agent to pick the computation it heads, that is, it and every agent feeding its inputs. Its term is written as disp, with numbers, lists and strings as literals, code that is a known definition by its name, other code as ‹its size›, shared computations as x₁ in a where, and what is being computed underlined in blue. Picks follow their agents as they move and rewrite; one whose value is used up by a rewrite drops out.
Programs are trees. A two-way program is a △ tree like any value, each of its instructions a bijection on trees. An instruction is k stems on a leaf, or on a fork of its two parts: k = 0: the leaf is id, the fork (a, b) is a; b; 1: swap (u, v) ↔ (v, u), or (a | b) on the two halves at once; 2: flip, or cond(a, b); 3: assocl, or loop(a); then assocr, uniti x → (△, x), unite, copy x → (x, x), merge, eval, uneval, triage, untriage, s2f △t → (△, t) and f2s, 4 to 14 stems, each next to its inverse. A choice is a pair whose tag says the side: (△, v) the left, (△△, v) the right. cond runs a on the left and b on the right, keeping the tag; loop runs a while it gives the left side; flip swaps the sides. Numbers are 0 = (△, △) and n + 1 = (△△, n).
Running. A run (the disk with ▶) has four ports: the program, the input, the program handed back, and the result. It reads its program a node at a time: a stem sends it on to read the next (still a run's disk), and each node goes back out as it is read, so once a run is done its program is whole again beside the result. That is why a loop needs no copy of its body: each round's run hands the body back for the next.
Most of it is wiring. A run reading swap leaves a splitter (the split pill) that takes the input fork apart and a fresh fork that joins the halves crossed; assocl and assocr are two splitters and two forks; a; b becomes two runs in a row, the first's result the second's input and their programs joined again as they come back; (a | b) a splitter and two runs side by side; eval a splitter and a run of the first half on the second; copy a duplicator. None of these waits for data: the walkers they leave meet it wherever it is, and a run reads the next instruction while the data is still on its way.
Reading data. Five steps decide something, and leave a walker that reads: cond's (the whole diamond) reads the tag and starts a run of a or of b, the other coming back untouched; loop's (the holed diamonds) take each round's state apart and read its tag, to run the body again or let the result out; flip's (the split diamond) turns △ into △△ and back; merge's (the upside-down Y) read the two halves a layer at a time, joining them into one tree; and triage (green) tells a leaf, stem and fork apart: △ → (△, (△, △)), △t → (△, (△△, t)), △ab → (△△, (a, b)), so a cond can choose by the shape of any tree.
Programs about programs. A program being a tree, everything that works on trees works on programs: copy, merge, triage. twice copies p into (p, p), which is the program p; p, and runs it with eval. mirror swaps every fork's parts: on a fork it calls itself on both parts at once, through eval on copies of itself merged back afterwards (recursion that branches), and run on a program it gives another program.
Partial and eager. Where no rule fits (a swap of a leaf, a merge of two different halves) the walker waits for good, and the run is stuck, as the reference interpreter is. Every walker is wanted from the start, since in a bijection every step's result is used: there is no garbage, and no eraser.
Running back. The inverse of a program is read off its text (~p: each instruction's inverse, a sequence's steps reversed) and run forward on the result: sub is ~add. A program that arrives as data is inverted as it runs: uneval, eval's inverse, sends it through a walker (the pink disks) that makes its inverse a node at a time, runs that, and inverts it back. Nothing is recorded, and the net has no rules for going backward.