\documentclass[11pt]{article} \usepackage[letterpaper,margin=1in]{geometry} \usepackage[T1]{fontenc} \usepackage{lmodern,microtype,amsmath,amssymb,amsthm,booktabs,array} \usepackage[hidelinks]{hyperref} \hypersetup{pdftitle={Universal function evaluation by a 15-symbol 2-tag system},pdfauthor={Trevor Cappallo}} \newtheorem{theorem}{Theorem} \newtheorem{lemma}[theorem]{Lemma} \newcommand{\bits}{\mathbb F_2} \newcommand{\w}[1]{\mathtt{#1}} \newcommand{\T}{\mathcal T} \newcommand{\eps}{\varepsilon} \setlength{\emergencystretch}{1em} \begin{document} \begin{center} {\LARGE\bfseries Universal function evaluation by a\\[2pt] 15-symbol 2-tag system\par} \vspace{.55em}{\large Trevor Cappallo\par} \vspace{.35em}December 1, 2026 \end{center} \begin{abstract} We give fifteen fixed productions for an ordinary tag system with deletion number two. Any program and input can be encoded in its initial word. On a terminating computation a fixed decoder reads the result from the current word before cleanup, after which the system halts at a single letter. On a divergent computation it runs forever and the decoder stays silent. We prove that the decoder cannot fire early between simulated instructions. Lean checks local rewrite and readout identities. The proof in the text connects these to an entire run. \end{abstract} \section{Fifteen productions} An ordinary 2-tag system has one fixed production \(P(x)\) for each letter \(x\). A word \(xyt\) takes the step \(xyt\to tP(x)\). The queue is the entire configuration. An empty word or a singleton has no successor. We write \(\mathrm{TS}(k,d)\) for alphabet size \(k\) and deletion number \(d\). For a nonempty word \(s\), let \(J(s)\) insert one \(\w r\) between consecutive letters. Put \(U=\w{uruuruff}\) and \(Z=J(\w{uu}(\w{fu})^7)\). The following is the entire production table. \[ \begin{array}{c@{\;\mapsto\;}l@{\qquad}c@{\;\mapsto\;}l@{\qquad}c@{\;\mapsto\;}l} \toprule \w a&\w{rrd}&\w g&\w{ij}&\w m&Z\\ \w b&\w{ahaa}&\w i&\w{ehee}&\w u&\w p\\ \w d&\w{bbrrr}&\w j&\w{rhke}&\w p&\w{lmlr}\\ \w e&\w g&\w k&\w{frgg}&\w h&\w h\\ \w f&\w r&\w l&U&\w r&\eps\\ \bottomrule \end{array} \] \begin{theorem}\label{ordinary} Fix an acceptable numbering \(e\mapsto\varphi_e\) of partial computable functions \(\mathbb N\rightharpoonup\mathbb N\). There is a total computable input word \(I(e,x)\) and a fixed total decoder of a single word, with values in \(\mathbb N\cup\{\bot\}\). Run the displayed system from \(I(e,x)\). If \(\varphi_e(x)=y\), some configuration reports a value. The first report is \(y\), every later report also equals \(y\), and the run subsequently halts at the singleton \(\w h\). If \(\varphi_e(x)\) is undefined, the run is infinite and every observation is \(\bot\). \end{theorem} Cocke and Minsky established universality at deletion number two~\cite{CM}. De Mol derived a 150-symbol bound from a universal Turing machine~\cite[Section~3.3]{DM}. The table here gives an explicit upper bound of fifteen symbols with natural halting and a value readable from a single word. The construction uses ais523's three-phase controller and restart language~\cite{UT19,BP}. Section~\ref{readout} defines the observer and proves that it recognizes the simulated return. Section~\ref{universal} gives the input encoder. Appendix~\ref{prime} works through a prime-finding program. \section{A return value in the physical queue}\label{readout} The output is the first value reported by this readout along the run. On any single finite configuration the test terminates. It uses only the current word. \begin{enumerate} \item Require every letter of the current word to belong to \(\Gamma_C=\{\w b,\w i,\w j,\w r,\w l,\w m\}\). \item Erase \(\w l,\w r\), replace each \(\w m\) by a mark, and replace each \(\w b,\w i,\w j\) by a separator. Take the lengths \(n_1,n_2,n_3\) of the first three nonempty runs of marks. Require all three to exist and \((n_1,n_2)=(8,2)\). \item Require \(n_3=2^k\) with \(k\ge5\) and \(k\equiv1\pmod4\). Return \((k-5)/4\). A failed requirement returns no output. \end{enumerate} For example, third-run lengths 32 and 512 represent outputs zero and one. The alphabet test and the two leading counts can be recognized by a finite automaton, since both leading counts are fixed constants. On legal return configurations the third run is a unary representation of \(2^{4y+5}\). Counting that run and inverting the coding recovers \(y\). \subsection*{Placing the result} The source program has finitely many unbounded natural-number registers, with a distinguished output register \(O\). Finishing the program enters a fresh site \(J\) testing \(O\). Both branches lead to a sequence of drains, which clears every register before a separate halt site is entered. The return value is \(O\) \emph{on entry} to \(J\), before the test or drains can change it. Only successful completion can enter \(J\). Appendix~\ref{source} implements this program with clocks, then with increment and decrement instructions that restart their list on a failed decrement. At the boundary for a site \(j\), its entry clock \(D_j\) is the unique zero, all other entry clocks equal four, and its data clock is \(V_j=2(x_{r_j}+1)\) for the tested register \(r_j\). In particular, on entry to \(J\), \(D_J=0\) and \(V_J=2(y+1)\) where \(y=O\). The corresponding clock values occupy restart cells \(v_{D_J},v_{V_J}\). Add a fresh sampling cell \(\sigma\), initially zero. In the block that advances all clocks one tick, insert \(+\sigma,-\sigma\) immediately \emph{after} the last bulk clock decrement and \emph{before} the first zero test. The increment always succeeds, and the adjacent decrement acts on one and restores zero. Neither changes a clock or a flag. No other instruction touches \(\sigma\). Put \(\sigma,v_{D_J},v_{V_J}\), in that order, in the first three physical counter positions, relabeling the remaining cells consistently. \begin{lemma}[Return at an instruction boundary]\label{marked} At completed restart-instruction boundaries the condition \(\sigma=1,\ v_{D_J}=0\) occurs exactly once on a returning run and never on a divergent run. At that boundary \(v_{V_J}=2(y+1)\). \end{lemma} \begin{proof} The only boundary with \(\sigma=1\) in any tick is the one between the two new instructions. The clock values there are the actual post-tick vector. In particular no tentative additions or inverse lists from a clock test are visible with \(\sigma=1\). Every zero of a clock on this trajectory is a unique event (Appendix~\ref{source}). A zero of the entry clock \(D_J\) therefore marks an arrival at \(J\). Initialization starts one tick above the first boundary, which covers immediate return. The drain sites have no edge back to \(J\), and the final special tick has all clocks positive. Thus the marked tick occurs exactly upon return. The data-clock identity gives the result. \end{proof} \subsection*{Excluding false matches between instructions} At a completed instruction boundary a restart cell with value \(x\) occupies \(B^{2^{2x+1}}\), where \(B=\w{lmlr}\). Each \(B\) contributes one mark. Each intervening Command controller section contributes separators and no marks. Hence the three lengths at the boundary in Lemma~\ref{marked} are \[ 2^{2\cdot1+1}=8,\qquad 2^{2\cdot0+1}=2,\qquad 2^{\,2[2(y+1)]+1}=2^{4y+5}. \] Conversely, at any such boundary the first two counts \(8,2\) force \(\sigma=1,\ v_{D_J}=0\). \begin{lemma}[No premature output]\label{sound} Before the marked boundary, and throughout a divergent computation, the readout gives no output. \end{lemma} \begin{proof} A sweep consumes the symbols present when it starts. At the start of a Parity or Reset sweep the last symbol belongs to the final controller section. In Parity that section ends in \(\w a\) or \(\w e\). In Reset it ends in \(\w d\) or \(\w g\), also on a failed test. These letters lie outside \(\Gamma_C\). That last old symbol remains until the sweep finishes, so every proper intermediate configuration fails the alphabet test. At the start of a Command sweep, there are at least 1024 controller components before the first counter. At most the first virtual symbol has been dropped. Every complete Command controller component produces a word containing a letter outside \(\Gamma_C\) on either lane, as seen in Appendix~\ref{components}. Such a letter has therefore been appended before the sweep can delete any part of the first counter. Appended letters remain behind the old prefix until the last deletion of the sweep. Consequently a proper intermediate configuration that passes the alphabet test has lost only leading controller symbols and has exactly the same first three mark counts as at the start. In fact at most one proper intermediate can pass. The first component is \(\w{bbrrr}\), \(\w{ij}\), or \(\w{rij}\), possibly missing its first letter. Only an intact \(\w{rij}\) begins with an unproductive read, and the next read then sees \(\w j\), which appends a letter outside \(\Gamma_C\). It remains to consider starts of Command sweeps. Each instruction uses two rows, each comprising Command, Parity, and Reset sweeps. Between the first and second rows every counter exponent is even: the first row changes each incoming odd exponent by one, and a failure is possible only on the second row. This also holds between the two compensation rows. An even exponent cannot give the first count \(8=2^3\). At initialization and compensation endpoints the sampling cell is zero, since neither of its two adjacent instructions can cause a restart. All other live pair endpoints represent completed instructions by Appendix~\ref{live}. Lemma~\ref{marked} now excludes a premature match. A proper intermediate repeating the marked counts can only repeat the already available answer. \end{proof} After return, the cleanup also excludes a different answer (Appendix~\ref{cleanup}). \section{Universality for partial functions}\label{universal} For the numbering of Theorem~\ref{ordinary}, choose a universal tape interpreter~\cite{UTM} on \((e,x)\) that runs forever when \(\varphi_e(x)\) is undefined and otherwise finishes with its head at the beginning of \(1^y\#\), where \(y=\varphi_e(x)\). Converting a finite returned answer to unary with an end delimiter is an effective final tape routine, including for \(y=0\). Here is a fixed finite register implementation. Number the tape symbols in base \(b\), with blank zero. Keep the current symbol in finite control and encode the two sides of the head as natural numbers \(L,R\), nearest cell least significant. Unrepresented far cells are blank. For a right move after writing digit \(d\), replace \(L\) by \(bL+d\), take \(R\bmod b\) as the new current symbol, and replace \(R\) by \(\lfloor R/b\rfloor\). A left move interchanges the roles of the sides. To multiply by \(b\), empty the old register into a scratch register with \(b\) increments per unit, then transfer back. To divide, decrement to zero while cycling through \(b\) finite control states, incrementing a scratch quotient on each full cycle. Transfer back the quotient and read the remainder from the control state. These loops use increments and conditional decrements. Unconditional branches can be wired as successors of a test on a permanently zero register. There are finitely many states and fixed \(b\). At successful tape completion the program scans the unary marks, incrementing a fresh \(O\) once for each, then enters \(J\) at the delimiter. The initial \(L,R\), symbol and control label are computable directly from the input tape encoding of \((e,x)\). \begin{proof}[Proof of Theorem~\ref{ordinary}] Compile this fixed program as in Appendix~\ref{source}, with the sampling cell and cell ordering of Section~\ref{readout}. Compile its restart instruction list into controller sections by Appendix~\ref{live}. Place the encoded initial cell values between those sections. This defines a total computable input map \(I(e,x)\). The program, controller sections, transition table and readout are fixed. Only the initial data, including the initial clock configuration, depend on \((e,x)\). All word lengths are finite and effective. If \(\varphi_e(x)=y\), the program reaches \(J\) with \(O=y\). Lemma~\ref{marked} and the run-length calculation give a tag word with readout \(y\). Lemma~\ref{sound} excludes an earlier answer. The simulated return site has yet to execute. The subsequent drains, special clock trigger and perfect halt lead to the terminal letter \(\w h\) by Appendices~\ref{live}--\ref{source}. A singleton admits no further step. The exclusion after return is proved in Appendix~\ref{cleanup}. If \(\varphi_e(x)\) is undefined, \(J\) is never reached. The compiler supplies infinitely many completed sweeps, each containing literal tag steps, and Lemma~\ref{sound} excludes all outputs. The observer neither changes the queue nor controls termination. \end{proof} \appendix \section{Sweeps of the production table}\label{components} We derive the local identities used by the input construction. For a word \(v\), write \(F_b(v)\) for the concatenation of the productions at positions \(b,b+2,\ldots\), indexed from zero, with \(b\in\{0,1\}\). Call \(b\) the \emph{lane}. A sweep processes all symbols present in the queue when it begins. Maintain a virtual word \(V\) and a bit \(\delta\), where the physical word is \(V\) with its first \(\delta\) symbols removed. For \(V=X_1\cdots X_s\), the lane at component \(X_i\) is \[ b_i=\delta+\sum_{j0\). All odd-length sweeps here have an initial productive \(h\) before their last old symbol, so every calculated transition is literal. On a unary word each step reduces length by one because \(P(h)=h\). \end{proof} The same analysis rules out a different answer later. The joint flag condition never recurs in the drains. At terminal setup the sampling cell has value zero, and between setup and pulse its exponent is zero. After the pulse the cleanup word starts with \(\w h\), outside \(\Gamma_C\). Every cleanup sweep in Appendix~\ref{cleanup} starts with at least one \(\w h\), and its first step appends an \(\w h\) that stays in the queue until the sweep ends. The next sweep again starts with \(\w h\). The final unary words also contain \(\w h\). \section{Compiling register computation, return, and cleanup}\label{source} A finite normalized program has a finite list of natural-number registers. A site \(j\) tests \(r_j\). On a positive value it subtracts one; at zero it leaves that register unchanged. Each branch adds a fixed nonnegative vector and selects a successor. An increment or unconditional jump can test a fresh, permanently zero register on its zero branch. This implements the register instructions of Section~\ref{universal}. Route successful completion through a fresh site \(J\) testing \(O\). Both successors of \(J\) lead to the first drain and add nothing. For each register, a drain tests it, loops on the positive branch and advances on the zero branch. After all drains, enter the distinct halt site \(h_*\). All registers there are zero. If the starting program has already returned, initialize at \(J\). The clock and restart construction below follows ais523~\cite{Waterfall,BP}. \paragraph{Clock implementation.} Clocks hold natural values. Between events they all decrease at unit speed. At a unique zero clock add the nonnegative row indexed by that clock to the whole vector before continuing. At \(h_*\) we stop this abstract computation. We shall see that every reached zero is unique. For each test site \(j\) use an entry clock \(D_j\), a race clock \(S_j\), and a data clock \(V_j\). There is one extra entry clock \(D_{h_*}\). At the boundary for site \(j\), require \[ D_j=0,\quad D_k=4\;(k\ne j),\quad S_k=1,\qquad V_k=2(x_{r_k}+1). \] The same convention describes the halt boundary. Initialize the clocks one tick above the desired first boundary. The separate data clock for every test site permits different branches at sites testing the same register. The row for \(D_j\) adds 7 to \(D_j\) and 3 to other entry clocks, 2 to \(S_j\) and 6 to other race clocks, and 0 to \(V_j\) and 2 to other data clocks. The entry clocks are now all 7. The selected race clock is 3, the others 7. For a zero tested value \(V_j=2\) fires after two ticks; otherwise \(S_j=3\) fires after three. All other data clocks are at least 4. Write \(k_*\) for the chosen successor, and \(a(r)\) for the number of increments to register \(r\) on its branch. Both branch rows add 0 to \(D_{k_*}\), 4 to each other entry, 5 to \(S_j\), and 1 to the other race clocks. Their additions to the data clocks are \[ \begin{array}{c|ccc} & k=j & k\ne j,\ r_k=r_j & r_k\ne r_j\\ \hline S_j\text{ (positive)} &5&3&5\\ V_j\text{ (zero)} &7&5&5 \end{array} \quad\text{plus }2a(r_k)\text{ in each column.} \] For a positive branch four more ticks take the target entry to zero. Over the seven ticks the selected data clock changes by \(0+5-7=-2\), sibling copies by \(2+3-7=-2\), and unrelated data by \(2+5-7=0\), before branch additions. For a zero branch five more ticks again give seven overall. The selected data change is \(0+7-7=0\); every other data change is \(2+5-7=0\). Entry and race clocks return to the displayed boundary values in each case. At the endpoint all clocks other than the target are positive, hence no earlier tie is possible on the final countdown. This proves the simulation for every register vector and any finite number of registers. \paragraph{Restart implementation of the clocks.} Number the clocks \(i\), let \(A_i\) be their trigger rows, and write \(h_0\) for the index of \(D_{h_*}\). For every nonterminal \(i\) the diagonal entry \(A_{ii}\) is positive. At \(h_0\) use the special row which adds 2 to every clock. The restart program uses value cells \(v_i\) initialized to the positive initial clock values, flags \(z_i=1\), and a marker \(p=1\), and the independent sampling cell \(\sigma=0\). The physical cell order begins \(\sigma,v_{D_J},v_{V_J}\). The program is the following finite list; repetitions and loops over indices are expanded when constructing it. \begin{enumerate} \item Decrement \(p\). \item For each \(i\), let \(L_i\) be a list of increments with \(A_{ij}-[i=j]\) copies of \(+v_j\) for each \(j\). For the special row include two additional increments of \(p\). Emit \(L_i,\ -z_i,\ +z_i,\ L_i^{-1}\), where the inverse undoes the increments in reverse order. \item Emit \(-v_i\) for every \(i\), then \(+\sigma,-\sigma\). For each \(i\), emit \(-z_i,-v_i,+v_i,+z_i\). Emit \(-p\). \item In the final suffix decrement every flag once and each \(v_i\) exactly \(c_i^*+1\) times, where \(c^*\) is the halt boundary vector. It is known at compile time since all registers have been drained. \end{enumerate} On an ordinary pass the leading decrement consumes \(p=1\). A positive flag makes its test block the identity, since every tentative increment is undone. Every bulk decrement in step 3 starts with \(v_i\geq1\). This holds initially and after a tick whose scan finds no zero. When the scan finds the unique zero, the pending flag forces a restart before another bulk decrement. The trigger row restores the zero clock to a positive value because its diagonal entry is positive, and all its other entries are nonnegative. This also holds for the special row. Thus step 3 advances one clock tick. If all values remain positive, its tests restore each flag and value, and the final decrement of \(p=0\) restarts and sets \(p=1\). If a clock \(i\) has just reached zero, the test leaves \(z_i=0\), changes \(v_i\) from zero to one, and restarts before the final decrement of \(p\). The leading decrement at \(p=0\) first causes one empty restart, then consumes the restored marker. Now the pending test block leaves \(L_i\) in force and resets \(z_i\) to one via its failed decrement. The subtracted diagonal unit is precisely the unit previously added to \(v_i\). All flags have been restored and the true row has been applied. For an ordinary trigger there is again one empty marker restart before the next tick. All inverse lists are executed only after their matching increments, so none of those decrements can fail. For the special trigger the pending block instead leaves \(p=2\). The next leading decrement leaves it one. After the tick all clock values are \(c_i^*+1>0\), all flags are one, and the final decrement of \(p\) succeeds, leaving zero. The sampling cell is already zero. The suffix clears every cell and falls off the list. Only the special trigger permits that last marker decrement to succeed. Every ordinary tick and trigger uses finitely many restart instructions, with seven clock ticks per normalized machine instruction. Consequently a nonhalting machine produces an infinite restart computation and a halting machine produces a perfect halt. The restart computation just constructed consequently has a perfect halt after return and an infinite run on divergence. Its instruction list and initial cell values are inputs to Appendix~\ref{live}. Lemmas~\ref{sim}, \ref{entry}, and \ref{mortal} implement those two outcomes as a tag run ending at \(\w h\) and an infinite tag run, respectively. On the way to a perfect halt, the post-tick mark described in Section~\ref{readout} is attained before the drain sequence. \section{A worked example: the next prime}\label{prime} Let \(f(n)\) be the least prime strictly greater than \(n\). Use the following fixed register program with input and output in \(C\). All scratch registers initially contain zero. Each division in the pseudocode is implemented by repeated subtraction. \begin{quote}\ttfamily \begin{tabbing} xxxx\=xxxx\=xxxx\=xxxx\=\kill \(C\gets\max(2,n+1)\)\\ repeat:\\ \> \(D\gets2\)\\ \> repeat:\\ \>\> compute the quotient and remainder of \(C\) by \(D\)\\ \>\> if the remainder is positive: \(D\gets D+1\); continue the inner loop\\ \>\> if the quotient is one: return \(C\)\\ \>\> \(C\gets C+1\); restart the outer loop \end{tabbing} \end{quote} When \(2\le D