# clocks · weather and clocks from the triangular XOR systems

**Lars Rocha's theorem and design tool** · `sitoolz/clocks.py` (the door to `tri_xor`, `txs`, `driver_lab` and the almanac in `rangeblends`) ↔ `js/clocks.js` · fixture `fixtures/clocks.json`

## The arithmetic

`x_j(t+1) = x_j(t) XOR G(x_{j−1}, x_{j−2})` for any of the sixteen 2-input drivers `G`, bit `j`
reading only bits below it (a T-function). Theorem: every coordinate is exactly periodic in `t`,
from `t = 0`, with a power-of-two period. Rule 30's light-cone edge is the driver OR, and its
spectrum `p(j)` is the prefix law's. For a linear register `x' = x XOR Σ (x << s)` the spectrum
needs no simulation: one generation is multiplication by `1 + P(z)` over GF(2), Frobenius gives
`(1+P)^(2^k) = 1 + P(z^(2^k))`, Lucas factors the orbit over the binary digits of `t`, and
`p(j)` is the least `k` at which coordinate `j` stops moving. `synthesize(spec)` searches shift
sets against that exact spectrum, so a bank of signals with periods known at design time comes
off one shift-xor update in one register. The almanac is three coordinates read as cloud, rain
and wind: a lookup at any tick, correct rather than forecast.

## Both signatures

| Python | JavaScript |
|---|---|
| `evolve(driver, nbits, steps, seed)`, `period_exp(col, kmax)`, `spectrum`, `delta`, `plateaus`, `edge_table(vmax)`, `edge_run(g)`, `edge_measure(g)`, `survey()`, the driver constants and `NAMES` | `evolve`, `periodExp`, `spectrum`, `delta`, `plateaus`, `edgeTable`, `edgeRun`, the constants, `NAMES` |
| `spectrum_linear(S, jmax)`, `pmul(a, b, N)`, `clock_bank(S, width)`, `tap(S, k)`, `synthesize(spec, smax, jmax, limit)`, `cheapest(sets)`, `cost`, `predictable`, `live_lattice`, `Bank.linear(S, width, seed)` with `step`, `run`, `tapped(j, steps)`, `verify_period` | `spectrumLinear`, `pmul` (BigInt), `clockBank`, `tap`, `synthesize`, `cheapest`, `cost`, `Bank.linear` with `step`, `tapped`, `verifyPeriod` |
| `tri_xor_cols(driver, nbits, steps)`, `weather(driver, t, cols)`, `WEATHER_COORD`, `DRIVER_NAMES` | `triXorCols`, `weather`, `WEATHER_COORD` |

## The fixture

The measured spectra of all sixteen drivers to 40 coordinates, delta and plateaus of the edge,
the edge table to rung 20 and runs at far generations, the exact linear spectra of all 31 shift
sets in `1..5` to coordinate 63, clock banks, taps, three syntheses, three tapped signals and the
weather at ticks to `10^12`.

## Provenance

The theorem, the spectrum, the exact linear rule, the tame set and the synthesis are Lars
Rocha's (`AN_INVITATION.md`, `MIXTURE_AND_SPECTRUM.md`, `DRIVER_SPACE.md`, `TRIANGULAR_XOR_SYSTEMS.md`).

## The rhythm

`rhythm(n)` strikes at every doubling bit of the edge spectrum (`p(b) = p(b−1) + 1`, the positions of A094604) and rests
elsewhere: one bar per verified depth, `x.xx.xx.x.....xx.......xx.x.x....x.xx.x.x.`. The post-doubling law (Lars Rocha,
2026-08-25) says a doubling bit is never followed by two more, so the bar can never hold three strikes in a row, and a
strike two past a doubling is decided by the period-weight parity `s(b)`. `doubling_bits`, `no_triples`; the same in
JavaScript from the same spectrum, checked in `fixtures/clocks.json`.

