We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

UT6

From Esolang
Jump to navigation Jump to search

UT6 is a very small universal tag system discovered by User:wraitii in 2026 using GPT 6.2 Astra. It has deletion number 2 and 6 symbols, and the machine halts if and only if the starting queue eventually repeats identically. It has the following production rules:

Read Append Read Append Read Append
I ezII D DDez z e
a b b aaaeaeae (= W below) e (empty)

The symbols split into three roles:

  • I, D, z — clocks
  • a, b — counters
  • e — shared eraser, also used by clocks.

The machine is Turing-universal: any deterministic counter machine and input can be compiled into a single finite starting queue. It was created in an attempt to find the smallest universal tag system. Two-symbol 2-tag systems are decidable (De Mol, 2010), and three symbols already reach Collatz-type dynamics (De Mol, 2008), so the smallest universal 2-tag alphabet has between 3 and 6 symbols (down from UT19 at 19 symbols, by ais523).

How it works

This section describes a compiler that's provably universal (see paper / lean proof in external links), but that does not mean it's necessarily the simplest/best compiler for this tag system. Its main tradeoffs are that counters are exponential in size: encoding the value 4 takes 8 * 2^20 characters, and the macro-cycle makes ambiguous joins (see below) quite complex to implement.

1. Sweeps, lanes, and the "cut"

A 2-tag system reads the first symbol of a queue, deletes the first two, and appends a word at the back. Processing the whole queue once is a sweep. Because two symbols are deleted at a time, a sweep only reads every second symbol:

  • Even-length queue (s0 s1 s2 s3): reads s0, then s2 → finishes cleanly. The next sweep starts at index 0 (lane 0).
  • Odd-length queue (s0 s1 s2): reads s0, then s2 deletes s2 plus the first symbol of the new output. That leftover bite is a cut: the next sweep starts 1 symbol in, reading odd positions (lane 1).

In general, passing through an even-length block preserves the lane (0→0, 1→1), while an odd-length block flips it (0→1, 1→0). That bit (even or odd positions) is the only control wire in the machine.

2. Counters and clocks

A counter stores a number by repeating a tile W = aaaeaeae. There is no separate CPU executing instructions on it: a counter reacts directly to whichever lane sweeps over it, taking two sweeps (one command) to complete an update:

  1. Sweep 1 (choose direction): The incoming lane decides the sign: lane 0 turns each W into bbbb (growing), while lane 1 turns each W into b (shrinking).
  2. Sweep 2 (rebuild): Every pair bb turns back into one W, leaving either twice as many W tiles (+1) or half as many (−1).

There is no "do nothing" command: every command must push every counter either +1 or −1. To hold a counter constant, opposite commands are paired: + − or − + cancels to 0, while + + gives +2 and − − gives −2.

Encoding the program in clock bitmasks

Between the counters sit clocks, alternating down the queue as C0 X C1 Y C2. Each clock stores a fixed, repeating bitmask of 0s and 1s (one bit per sweep) and XORs its current bit onto the passing lane. The whole program lives in these bitmasks: they decide which lane reaches each counter on each sweep.

For example, for two commands on X and Y (showing Sweep 1 of each command, starting on lane 0):

  • Cmd 1 (want X: −, Y: +): C0 flips 0→1 (X gets −), C1 flips 1→0 (Y gets +), C2 keeps 0.
  • Cmd 2 (want X: +, Y: −): C0 keeps 0 (X gets +), C1 flips 0→1 (Y gets −), C2 flips 1→0 so the sweep ends cleanly on lane 0.

Together, Cmd 1 and Cmd 2 cancel out (− + on X, + − on Y). Adding a counter widens each sweep by one counter + one clock; adding more instructions lengthens the clocks' repeating bitmasks.

How W = aaaeaeae implements ±1 in 2 sweeps

Exponent E is stored as 2E copies of W = aaaeaeae (always even input length 8 · 2E, so Sweep 1 never flips the lane). On Sweep 1 (W → b), each W outputs bbbb (×4) on lane 0 and b (×1) on lane 1, producing an even run of bs whenever E > 0. On Sweep 2 (b → W), any even run b2k turns into Wk on either lane without flipping it, giving E + 1 or E − 1.

3. Micro scale: branching with an underflow cut

So far, the clock bitmasks only play back a fixed, repeating script of + and −. The machine branches on a counter's value through one special case: underflow.

Decrementing a counter at its minimum (E = 0, a single W1) turns it into a singleton b (odd length 1). The two sweeps handle this as follows:

  • On Sweep 1 (W → b): W1 still has even length 8, so the lane does not flip yet, and downstream counters like Y still execute their normal Sweep 1 sign.
  • On Sweep 2 (b → W, pure reconstruction): Reading X's singleton b on lane 0 rebuilds W1 and flips the lane to 1. Every other counter holds an even number of bs, and even runs reconstruct identically on either lane, so the flip passes Y unchanged and leaves as a sign-flip carry (a cut) into the next command.

The 2-command probe

Replaying Cmd 1 and Cmd 2 from Section 2 when X starts at E = 0, with Sweep 2 clock bits included (all clocks keep on Cmd 1's Sweep 2; C0 and C1 both flip on Cmd 2's Sweep 2):

  1. Cmd 1 · Sweep 1 (enters 0): C0 flips 0→1 (X gets − → becomes b1); C1 flips 1→0 (Y still gets +); C2 keeps 0.
  2. Cmd 1 · Sweep 2 (enters 0, reconstruct; all clocks keep): X's singleton b1 is read on lane 0, rebuilding W1 and flipping 0→1; Y reconstructs harmlessly on lane 1 → exits with a sign-flip carry (1).
  3. Cmd 2 · Sweep 1 (enters 1, the carry inverts signs): C0 keeps 1 (X gets − instead of + → b1 again); C1 flips 1→0 (Y gets + instead of −); C2 flips 0→1.
  4. Cmd 2 · Sweep 2 (enters 1, reconstruct): C0 flips 1→0 so X's b1 is read on lane 0 (on lane 1, the cut would eat the lone b and destroy X), rebuilding W1 and flipping 0→1; C1 flips 1→0; Y reconstructs → exits cleanly on 0 (the carry is cancelled).

With the carry, Y's cancelling pair (+ −) turns into a doubling pair (+ +, net +2), while X, despite receiving − −, clamps at W1 (E = 0) both times. If X > 0, no underflow occurs and no carry is created, and C0/C1 flipping on Cmd 2's Sweep 2 is a harmless no-op because X's even run of bs reconstructs identically on lane 1 before C1 flips back to 0, so both commands cancel to 0.

Putting it together: the 12-command Guard gadget

One probe forces every other counter to move either +2 or −2 when X == 0. Running two probes back-to-back lets an unchanged counter move +2 then −2 (net 0), while an incremented counter moves +2 + 2 = +4 (and a decremented one mirrors it with −2 − 2 = −4).

That is why logical value v is stored at exponent 4 + 4v: the 4v matches the ±4 step size, and the +4 safety bias keeps non-tested counters at logical 0 safely above E = 0 so they never accidentally underflow during − steps in no-op pairs or probe halves. Four commands before and after the two probes strip and restore only X's +4 bias, giving 12 commands (24 sweeps) in total. Because X has to sit at E = 0 for both probes, a guard cannot conditionally modify the counter it tests.

Below is the structure of if X == 0: Y += 1 while a third counter Z stays unchanged (signs in parentheses are inverted by the underflow carry when X == 0):

Stage Cmds X (tested) Y (Y += 1) Z (unchanged)
Strip X bias 1–4 − − − − + − + − (net 0) + − + − (net 0)
Probe 1 5–6 − + → (− −, clamps) + − → (+ +, +2) + − → (+ +, +2)
Probe 2 7–8 − + → (− −, clamps) + − → (+ +, +2) − + → (− −, −2)
Restore X bias 9–12 + + + + + − + − (net 0) + − + − (net 0)
Net (X > 0) 0 0 0
Net (X == 0) 0 +4 (+1 logical) 0

4. Macro scale: how the program counter advances

The clocks only march forward in a fixed loop and cannot jump. Instead of moving a program counter inside the clocks, the program's state is stored in ordinary counters and every guard in the program runs on every full clock cycle (a period), movfuscator-style.

Each state gets a state flag counter (0 = currently here, 1 = elsewhere), and each transition gets an edge latch counter (0 = chosen, 1 = idle). One period simulates one machine step in three phases:

  1. Choose the edge: For each edge, temporarily bump state_src if its condition is false (for an X == 0 test, bump unconditionally then undo via if X == 0: state_src -= 1), run:
    if state_src == 0: edge_k -= 1
    then undo the bump. Only the single enabled edge drops to 0.
  2. Execute the edge: Scan all edges; only the one with edge_k == 0 updates the state flags and data:
    if edge_k == 0: state_src += 1, state_dst -= 1, X += 1
  3. Clear the latch: Every latch must return to 1 for the next period. Because a guard cannot test edge_k to modify edge_k itself, Clear runs Phase 1 in reverse from state_dst to reset the taken edge's latch.

How the clocks are built from symbols

Each clock is L zeroed differentiators (D0 = DDez, D1 = DDeze) followed by L seeded integrators (I0 = ezII, I1 = eezII), where L is the power-of-two period (≥ 24 × #guards). Letting S be the 1-sweep shift operator over GF(2), (1 + S)L(1 + S)−L = 1 cancels on the incoming lane so flips pass unsmeared, while choosing L to be a power of two gives (1 + S)L = 1 + SL, making the seeded integrators emit an L-periodic bitmask m—giving outgoing lane lane_in ⊕ mt mod L.

5. Joins and exact repetition

Phase 3 (Clear) has to recognize which incoming edge just fired purely from the destination state and registers:

  • Easy joins (free): One incoming edge, or two edges with disjoint post-conditions (e.g. one checked X == 0, the other ran inc X so X > 0).
  • Ambiguous joins: Two edges can land in the same state with the same register values. Clear cannot tell which latch to reset unless we record which path arrived.

Recording ambiguous joins as a base-k stack

Suppose two edges, left and right, both arrive at join with X = 1. To remember which one arrived (even across loops), we keep a history counter and push a nonzero digit onto it: left pushes 2 and right pushes 1, updating history ← 2 · history + digit (in general, for k incoming edges indexed 0 ≤ i < k, edge i pushes k − i, giving k · history + (k − i)). Keeping the digit nonzero guarantees that every subsequent step in the chain enters with history > 0, cleanly separated from a fresh entry where history == 0.

Since a counter machine only has +1, −1, and == 0, multiplying by k is done with a scratch counter history_work (initially 0) in three steps:

  1. Drain old history: Each incoming edge redirects to its own private entry state and moves history into history_work one unit at a time until history == 0.
  2. Push the new digit: Enter a shared chain of k inc history states at offset i, so left (i = 0) runs both increments (+2), while right (i = 1) skips the first and runs one (+1).
  3. Multiply back by k: While history_work > 0, decrement history_work and loop back through all k increments on history. When history_work == 0, exit into join.

Every state inside this loop has at most two incoming edges separated by a clean zero/positive test (history == 0 vs. > 0, or history_work == 0 vs. > 0), and join itself now has a single incoming edge. The trade-off is that history grows by a factor of k each time an ambiguous join is crossed, which makes its exponential counter grow fast.

Halting as exact repetition

Eliminating ambiguous joins gives every step a unique predecessor, making the entire machine reversible. Pairing a forward copy of the machine with a backward copy then makes halting runs bounce in a bounded loop forever (forcing the entire queue to repeat identically), whereas non-halting runs that keep advancing (growing a register or crossing an ambiguous join—which can always be guaranteed by incrementing a dedicated step counter) grow without bound and never repeat.

Examples

Doubling a counter (lane 0)

One copy of W = aaaeaeae, read on lane 0. Each line is one 2-tag step; sweep 1 reads four as, sweep 2 reads two bs:

aaaeaeae
aeaeaeb
aeaebb
aebbb
bbbb               (sweep 1 done: W → bbbb)
bbaaaeaeae
aaaeaeaeaaaeaeae   (sweep 2 done: bbbb → WW, E = 0 → 1)

Halving a counter (lane 1)

A leading e shifts the reading onto lane 1, so only one a per W is read; the trailing e keeps the total length even:

eaaaeaeaeaaaeaeaee
aaeaeaeaaaeaeaee
eaeaeaaaeaeaeeb
eaeaaaeaeaeeb
eaaaeaeaeeb
aaeaeaeeb
eaeaeebb
eaeebb
eebb
bb                 (sweep 1 done: WW → bb)
aaaeaeae           (sweep 2 done: bb → W, E = 1 → 0)

Since the queue is now back on lane 0, it continues by doubling again, as in the previous example.

External links

See also

  • UT19, an earlier very small universal 2-tag system.
  • Tag_system, describing the general architecture.