# The Matrix: Unified Computations

The largest computations of our time happen in one place. A frontier model is trained in a data center that its owner built and runs to its own schedule. Training over the open internet has started, and Prime Intellect, Pluralis and Nous Research have pretrained models on GPUs contributed from many places. Epoch AI [estimates](https://epoch.ai/gradient-updates/how-far-can-decentralized-training-over-the-internet-scale) that the largest of those runs used about a thousand times less compute than the frontier, and that they are growing faster without being likely to catch up this decade.

Bitcoin made the opposite trade. Thousands of machines that do not trust one another agree on a single ledger, and they pay for its single order with proof of work: energy spent so that rewriting history costs more than it could earn, at a block every ten minutes or so. Proof-of-stake chains pay with locked capital instead. Either way, one global order is the dearest thing a distributed system can buy, and a chain buys it for every record, including the many whose order never mattered.

The cloud's answer is to give each thing a home. A [Durable Object](https://developers.cloudflare.com/durable-objects/) is a program with a globally unique name and storage of its own, placed near whoever first asked for it, and everyone who needs it is routed there. Agents run the same way. Cloudflare's [agent platform](https://www.cloudflare.com/products/agents/) gives every agent instance a Durable Object with its own SQLite database, so an agent remembers between calls. One home per object makes coordination easy, and it puts every home in the provider's network.

Homes go dark, and lately they have gone dark often. On 20 October 2025 a race condition in the automation that manages DNS for DynamoDB in AWS's us-east-1 region [left the database's endpoint with an empty record](https://aws.amazon.com/message/101925), and services around the world that lean on that region failed with it, [some for more than fifteen hours](https://www.thousandeyes.com/blog/the-top-internet-outages-of-2025-analyses-and-takeaways). A month later [an oversized configuration file](https://blog.cloudflare.com/18-november-2025-outage/), pushed to every machine in Cloudflare's network, crashed its proxies and took a large part of the web down for hours. In March 2026 drones damaged Amazon's data centers in the UAE and Bahrain, AWS [advised customers to move their workloads to other regions](https://www.theregister.com/2026/03/02/amazon_outages_middle_east/), and six months later it [still could not restore](https://www.khaleejtimes.com/tech/amazon-aws-unable-restore-access-bahrain-one-uae-cloud-data-zone) the Bahrain region or one zone in the UAE. On 12 November 2026 Microsoft 365 [went down for most of a day](https://bleepingcomputer.com/news/microsoft/massive-microsoft-365-outage-disrupts-outlook-teams-copilot-worldwide), mail, Teams and Copilot together, after a network change. The causes differ and the shape repeats: one record, one file or one place reached everything that depended on it, all at once.

The fediverse already contains its outages. When one server goes down only its members go quiet, and the rest of the network carries on. Each server delivers activities to the others and retries while they are down, so posts arrive late or out of order and no two servers hold quite the same thread, and no server needs any other to keep working.

That is the case for designing peers into every platform we already run. Nothing has to be torn down for it. Each client keeps its own copy of what its user needs, the local-first idea, so an outage pauses sync and leaves the work going. Records are named by their content hashes and parties by their keys, so any peer that holds a copy can serve it, and nobody's identity depends on one DNS name or one identity service staying up. Devices sync directly over whatever carrier is up, a local network, Bluetooth or a phone carrying mail, and the provider's region becomes one carrier among several, an always-on peer that relays and keeps backups without being anyone's only home. Changes roll out as each party adopts them, so a bad push reaches one party before it can reach every edge. When the region comes back, the parts of the work that only add merge in any order and nothing has to be reconciled by hand. The steps that need agreement, a payment or a deletion, wait for their co-signatures, which is all they could have done during the outage anyway.

Those are the trades the computation column weighs. What does it cost for many machines to compute as one, which steps of a collaboration need a single order, and how far can the rest go on merges that agree in any order, over whatever network is up?

The computation column of the matrix asks what each row costs when many machines compute as one, and it ends with teams doing the computing. Its twelve cells read *Co-computation*, *Network latencies*, *Map of shortcuts*, *Map of maps*, *EXPSPACE*, *Pseudo Infinite Space*, *Time vs Space*, *ST Invariance*, *STI Computation*, *Team's problem solving*, *Teams for TPS* and *Meta Teams for TTPS*. The later names are built from earlier ones, the way the language column's chain of Cs is. ST is the space and time of *Time vs Space*, and *ST Invariance* is their invariance; STI abbreviates that whole name, so *STI Computation* is computation that is the same in any place and at any time. TPS abbreviates *Team's problem solving*, and TTPS abbreviates *Teams for TPS*, so *Meta Teams for TTPS* are meta teams for teams for team problem solving: teams that form teams.

This is the third of four posts on the matrix, after [The Matrix, Then and Now](https://risav.dev/matrix) and *Language Understanding: From Words to Core Creation*. It is the post where the paper does most of the work. [Collaboration Is Composition](https://zenodo.org/records/24026645) models each party as a Mealy machine over its own signed records, proves what such machines can agree on without anyone keeping them in step, and checks every proof in Lean. The Lean that states its results and the TypeScript that builds them are gathered in an appendix at the end, so the argument can be read without them, and the text notes which part of the appendix goes with which step.

## Co-computation and latency

Rows 1 and 2. The notes describe nodes that are "some simple programs clustering to form complex automatons", and a mesh "that acts as an abstract virtual network within a host network". On the computation side the first gives co-computation, the second its price.

A node in the matrix is a small program with a state, an inbox and an outbox. On each input it returns a new state and whatever should leave. That is a Mealy machine, and the paper starts there (appendix A1).

Two boxes collaborate when the outbox of one is wired to the inbox of the other, through a mailbox. A collaboration is again one Mealy machine, whose inputs are events: a record arriving from outside at one unit, or a record collected from one mailbox and handed to its recipient. A schedule is a stream of such events, and since a stream is just an input, one theorem covers every schedule at once. The paper calls it congruence (appendix A2).

Congruence is what makes co-computation safe to build. Swap one party's box for another that behaves the same, a new phone for an old one, a rewritten client, a server in place of a laptop, and the collaboration as a whole cannot tell. A cluster of boxes wired together reads, one level up, as one more box; the essay calls the same node a box over a log of signed records, and [Anarchitecture](https://risav.dev/anarchitecture) called them plugins around a functional core.

Row 2's price is latency. The mesh rides on whatever host network is up: the internet, a local network, Bluetooth, a phone carrying mail to the next phone. A party is addressed by its key, so the address does not change when the carrier does, and a relay can carry sealed mail for parties it cannot read. Latency is then a fact about a carrier and never about correctness. A collaboration that works with mail delivered tomorrow works with mail delivered in a millisecond, and the converse does not hold.

## Shortcuts and maps of maps

Rows 3 and 4. The notes say that following references from dictionary to dictionary gives "so many maps of shortcuts that you now need maps of maps of said shortcuts". An index is a map of shortcuts: the `entry_refs_to` index on the incidence table, in the fifth section of [Mathematics' Architecture & Processes](https://risav.dev/mathematics-architecture-and-processes), turns "which rows name this key as their audience" from a scan into a lookup. A map of maps is an index over indexes, and a party builds those for the questions it asks often.

The rule that keeps these maps honest is the encoding's own law. Every index is derived from the rows, and every index can be rebuilt from them; none of them is a source. A shortcut that cannot be rebuilt from the records it shortens is a second copy of the truth, and second copies drift.

## EXPSPACE and pseudo-infinite space

Row 5 carries the column's warning.

> We also demonstrate how the naive solutions to problems in the understanding of a semiotic h-graph are often too hard to solve in limited memory space since these problems are in what is called EXPSPACE complexity.

Our answer is structural: no one computes over the whole graph. Each party ranks and clusters from its own position, over what it holds and what its neighbors share with it, and every aggregate names the algebra it obeys, so partial results from different places can be combined without a center to combine them.

Naming the algebra also means naming what an aggregate refuses to do. A vote count on a post is a good example (appendix A3).

The count takes each voter's latest vote, which is a join: it does not care in which order the votes arrive, and seeing a vote twice changes nothing. It returns two numbers for one post and has no way to compare two posts, so no feed can be ordered by it. The algebra is in its type.

Row 5 opened with additions, and this is where they pay. A collective grows by adding a record, a relation, a co-signature, each a step that leaves everything already there in place. The CALM theorem says a problem has a consistent implementation without coordination exactly when it is monotone, and the essay states the same thing as Only Adding: more records never take outputs away. The paper proves it for boxes over signed logs. A box is monotone when what it has emitted is a monotone function of its log, and its own emissions add nothing new to what it emits (appendix A4).

A schedule is fair when every record that waits in a mailbox is eventually collected. Any two fair schedules then end in the same place, the least fixed point, and nobody had to choose the order. The two lemmas underneath are the ones a programmer can feel: reading a set of records in any order gives the same state, and reading a record already in the log changes nothing.

Row 6's *Pseudo Infinite Space* is how we think with limited memory: a function problem that keeps coming back is replaced by its general solution, held in memory, so the next instance costs a lookup. Husserl hoped sedimentation would work this way, the result used without being rediscovered and its construction one step away for anyone who wants to redo it. [Mt. Kolmogorov: A Complex Climb](https://risav.dev/mt-kolmogorov-a-complex-climb) made the same move in code: one generic controller over every entity, written once, in place of a controller per entity. And its warning sits beside row 5's: Kolmogorov complexity is not computable, so we never find the shortest description of a system; we compare the descriptions we have and keep the shorter.

## Time against space

Row 7's cell is *Time vs Space*, and the notes describe sinks whose movement "is chaotic with respect to time but deterministic with respect to the time invariant h-space". That is how an append-only log works. Entries arrive in an order no one controls, and the state they merge into does not depend on that order. We spend space keeping every entry, and in return the order of arrival stops mattering.

Keeping every entry is also what makes the log the bottom tier of everything else: the incidence index, the views and the current state can all be rebuilt from it. [Mathematics' Anarchitecture & Processes](https://risav.dev/mathematics-anarchitecture-and-processes) calls it the one ring.

Time still needs an order for people to read, and the log gives one without a central clock. A new row's time is the wall clock, or just past the latest row this computer already holds, if that is later. That is Kulkarni's hybrid logical clock folded into the id (appendix A5).

A row is placed after everything its writer had seen, a computer whose clock is behind writes after the rows it has heard from the others, and two computers that hold the same rows put them in the same order: by time, then device, then id.

A sink keeps the other half of row 7. A relay that carries messages for many groups belongs to none of them; a backup holds everyone's records and sits in no one's circle. They receive, keep and serve, and a sink never becomes a source: when what a sink holds disagrees with where it came from, the source wins. The essay's gated platform is a sink that has made itself a source, which is the one move this tier forbids. The eleventh section of [Mathematics' Architecture & Processes](https://risav.dev/mathematics-architecture-and-processes) defines sinks, links and sources together, with the gluing law that holds them.

## Space-time invariance

Rows 8 and 9: *ST Invariance*, then *STI Computation*. The same steps placed on a phone, a server or a relay give the same result. Without that, a simulation run on one host cannot speak for another, and a party cannot check another's work by redoing it.

Invariance is a property of the code we let run, and the place to enforce it is where code is loaded. A plugin in the matrix is a WebAssembly module, and the host refuses it before it runs unless its bytes are the size and digest its manifest pins, and every import it declares is a host function the manifest grants. No clock, no randomness, no file system, nothing from the host it was not given. Then each event gets a fresh instance, so a plugin keeps nothing from one event to the next (appendix A6).

A module that knows only its event and the projections it reads during it computes the same function everywhere. We check that with vectors: a fixed set of events, the expected outputs written down, the same module run on every host the collaboration uses, and the outputs compared byte for byte.

Row 9 adds the arrows that must not exist. What a system can do is a set of arrows between kinds of records and between parts of the code, and some must never be drawn: a reading must not turn into a dose without a clinician in between, a private record must not reach a party it was never shared with, and the app must not reach the sync layer except through one door. A rule about what must never happen is only as strong as the check that it does not, so we write the absences as checks that run with the tests. The check for the app's one door to the sync layer reads every source file and fails the build when any file other than the door imports that layer (appendix A7).

The door is a file, and creating it is the deliberate act that says the app now reaches the layer. A flag would be a thing to forget; a file is a thing you have to write.

## Team problem solving to meta teams

Rows 10 to 12 hand the computation to people. *Team's problem solving* is many people and their machines working on one problem at once, the multiplayer case. *Teams for TPS* forms teams around the problems they solve. *Meta Teams for TTPS* are teams that form teams.

A multiplayer session in the matrix is a set of parties with logs over a shared problem, syncing as above. Almost every move is monotone: a proposal, a comment, a reading, a vote, a co-signature, each an addition that leaves the rest in place. A few moves depend on something being absent. An approval that requires no open objection, a revocation, a slot that can be taken once: none of these is monotone, because a record that arrives later can make them false. The paper's answer is to make the absence itself a record that the parties sign together. The step happens when the co-signatures it needs are present, which is monotone again.

What counts as a signature is itself spelled out. A record's grade in a log is the set of roles and keys that have signed it there, with accountable keys; an agent's key counts only when the log holds a record saying who operates it, signed by a person who holds the unit the agent works for (appendix A8).

Agents draft and people sign. A team of people and their agents can work at machine speed on everything monotone and stop for the few signatures that settle what the work depends on.

Teams that form teams are wiring that changes. The paper treats a change of wiring as a map of polynomials with identity and nesting laws, and a registry of pairings as a dynamic multicategory in the sense of Shapiro and Spivak; the short version is that a team forming a team is one more box added with a few wires, and the boxes already there do not change. Conway's law does the rest. A collective that collaborates through signed additions ends up with systems shaped like that collaboration, which is the non-coercive consensus [Anarchitecture](https://risav.dev/anarchitecture) ended on.

## What to build

1. A party as a box. The box of appendix A1, one per party, with an inbox and an outbox and nothing else shared. Write two implementations of one party and check, on recorded schedules, that the collaboration cannot tell them apart.
2. A transport over any carrier. Parties addressed by keys; sealed mail; relays that carry what they cannot read; and one sync session that runs unchanged over the internet, a local network, Bluetooth or a phone passing mail along.
3. An append-only log with a merge by identity. ULIDs for ids, the clock of appendix A5 for their times, `max(id)` per device for the cursor as in the sixth section of [Mathematics' Architecture & Processes](https://risav.dev/mathematics-architecture-and-processes), and a stated sync time: rows written while two parties share a carrier reach each other within one session.
4. One monotone query and one co-signed step. The tally, or any query whose answer only grows with the log; then one step that needs an absence, made monotone by the co-signatures that settle it.
5. The same steps on three hosts. A WebAssembly module with pinned digest and granted imports, run on a phone, a server and a relay, with test vectors compared byte for byte.
6. A multiplayer session. A small team solves one problem over shared logs, with agents drafting and people signing, and a fence check that runs in CI for every arrow that must not exist.

## Readings

- Risav Karna, [Collaboration Is Composition: Mealy Machines over Signed Records in Poly and Org](https://zenodo.org/records/24026645) (2026).
- Risav Karna, [The Matrix, Then and Now](https://risav.dev/matrix) and [Collaborative Systems in the Age of Codes and Weights](https://risav.dev/socioware) (2026).
- Risav Karna, [Mathematics' Architecture & Processes](https://risav.dev/mathematics-architecture-and-processes), [Mathematics' Anarchitecture & Processes](https://risav.dev/mathematics-anarchitecture-and-processes) and [Anarchitecture](https://risav.dev/anarchitecture) (2020).
- Joseph Hellerstein and Peter Alvaro, "Keeping CALM: When Distributed Consistency Is Easy" (2020).
- Tom Ameloot, Frank Neven and Jan Van den Bussche, "Relational Transducers for Declarative Networking" (2011).
- Sandeep Kulkarni, Murat Demirbas and others, "Logical Physical Clocks" (2014).
- Nelson Niu and David Spivak, *Polynomial Functors: A Mathematical Theory of Interaction* (2023).
- Brandon Shapiro and David Spivak, "Dynamic Categories, Dynamic Operads: From Deep Learning to Prediction Markets" (2022).
- Melvin Conway, "How Do Committees Invent?" (1968).

## Appendix: the code

The code below is in the order the text uses it. Each part names the section it belongs to.

### A1. A Mealy machine and a box

*From Co-computation and latency. The paper's definition in Lean, then the same box in TypeScript.*

```lean
/-- A Mealy machine with inputs `I` and outputs `O`. -/
structure Mealy (I O : Type) where
  S : Type
  δ : S → I → S
  out : S → I → O
  init : S

/-- A box: a Mealy machine from records to finite lists of records. -/
abbrev Box (R : Type) := Mealy R (List R)
```

```ts
// box.ts
export interface Box<S, R> {
  readonly init: S;
  /** One input in; the next state and the records that leave through the outbox. */
  step(state: S, input: R): { readonly state: S; readonly out: readonly R[] };
}
```

### A2. Congruence

*From Co-computation and latency.*

```lean
/-- **Congruence.** If each unit's box is bisimilar to another, the collaborations built from the
two families are bisimilar. -/
theorem congruence (N : Wiring ι R) (B B' : ι → Box R) (h : ∀ i, Mealy.Bisimilar (B i) (B' i)) :
    Mealy.Bisimilar (N.collab B) (N.collab B')
```

### A3. A tally that ranks nothing

*From EXPSPACE and pseudo-infinite space.*

```ts
// tally.ts
/** Totals are shown, and nothing is ordered by them: this compares no two posts. */
export interface Tally {
  readonly up: number;
  readonly down: number;
  readonly mine: 'up' | 'down' | null;
}

export function tallyOf(post: string, votes: readonly Vote[], me: string): Tally {
  const latest = new Map<string, Vote>();
  for (const v of votes) {
    if (v.post !== post) continue;
    const seen = latest.get(v.voter);
    if (seen === undefined || v.id > seen.id) latest.set(v.voter, v); // each voter once, by their latest vote
  }
  const counted = [...latest.values()];
  return {
    up: counted.filter((v) => v.vote === 'up').length,
    down: counted.filter((v) => v.vote === 'down').length,
    mine: latest.get(me)?.vote ?? null,
  };
}
```

### A4. Monotone boxes and order independence

*From EXPSPACE and pseudo-infinite space.*

```lean
/-- `Out` is monotone, and the box's own emissions add nothing to what it emits. -/
def MonotoneBox (Out : Set R → Set R) : Prop :=
  Monotone Out ∧ ∀ X, Out (X ∪ Out X) = Out X

/-- **Order independence (i).** With finitely many units, and finitely many records that can be
input or emitted, every fair schedule reaches the least fixed point above the initial logs and the
outside inputs, and stays there. -/
theorem order_finite [Finite ι]
    (hfin : ∃ E : Set R, E.Finite ∧ ∀ u, N.In u ⊆ E ∧ N.Out u (N.least hbox hP u) ⊆ E)
    (σ : ℕ → LogNet.Ev ι R) (hσ : N.Fair σ) :
    ∃ n, ∀ m, n ≤ m → N.logs σ m = N.least hbox hP
```

The two lemmas underneath are `fold_order`, for reading a set of records in any order, and `recv_dup`, for reading a record the log already holds.

### A5. The clock

*From Time against space.*

```ts
// clock.ts
/** The time to give a new row's id: the wall clock, or just past what this computer holds. */
export function nextRowTime(now: number, own: string | null, others: string | null, maxAheadMs = 86_400_000): number {
  const ownTime = idTime(own);
  const otherTime = idTime(others);
  return Math.max(
    Math.floor(now),
    ownTime === null ? -Infinity : ownTime + 1, // my own ids never go back
    otherTime === null || otherTime > now + maxAheadMs ? -Infinity : otherTime + 1, // a clock set to the wrong year is not followed
  );
}
```

### A6. One event, one fresh instance

*From Space-time invariance.*

```ts
// host.ts
export async function call(compiled: WebAssembly.Module, event: Uint8Array, imports: Granted): Promise<Output | null> {
  // One event, one fresh instance: a plugin keeps nothing between events.
  const instance = await WebAssembly.instantiate(compiled, { host: imports });
  try {
    const input = writeInput(instance, event);
    const ptr = (instance.exports.handle as (p: number, n: number) => number)(input.ptr, input.len);
    return readOutput(instance, ptr, OUTPUT_MAX);
  } catch {
    return null; // a trap ends this call with no output; the next call starts clean
  }
}
```

### A7. A fence check

*From Space-time invariance.*

```js
// check-fence.mjs: nothing under the app imports the sync layer except through its one door.
const DOOR = 'src/lib/peer.ts';
const IMPORT = /(?:from|import\s*\(|import|require\()\s*['"]([^'"]+)['"]/g;
const failures = [];
for (const file of sourceFiles('src')) {
  if (file === DOOR) continue;
  for (const [, spec] of stripComments(read(file)).matchAll(IMPORT))
    if (spec.startsWith('#peer') || spec.includes('/peer/src/')) failures.push(`${file} imports ${spec}`);
}
if (failures.length > 0) { console.error(failures.join('\n')); process.exit(1); }
```

### A8. Accountable keys

*From Team problem solving to meta teams.*

```lean
/-- A key is accountable in `L` when a person holds it, or when `L` holds an `operated_by` record
for it naming a unit, signed by a person key that holds that unit. -/
def Accountable (L : Set R) (k : Key) : Prop :=
  ¬ S.isAgent k ∨
    ∃ s ∈ L, ∃ u, S.operatedBy s = some (k, u) ∧ ¬ S.isAgent (S.author s) ∧ S.holds (S.author s) u
```
