From: Thomas Walker Lynch Date: Tue, 21 Jul 2026 06:34:12 +0000 (+0000) Subject: going on to the arch chapter X-Git-Url: https://git.reasoningtechnology.com/%27%20%20%20resolved_path%20%20%20%27?a=commitdiff_plain;h=49f5a1f4083f8bc5a6555e54866eee25ba48dd40;p=TM-2026 going on to the arch chapter --- diff --git a/document/book/TM-2026.html b/document/book/TM-2026.html index b529b10..228b689 100644 --- a/document/book/TM-2026.html +++ b/document/book/TM-2026.html @@ -506,40 +506,41 @@ done • 0 1 1 -

Reversing a string does not intrinsically require making decisions based on the values in the string that is being reversed; however, a Turing Machine must use the value under the head for the next state transitions. Also, the only memory a controller has through adding control path branches, so to "carry the symbol right" requires a branch in the state controller to remember what the symbol is. Consequently had the input alphabet been larger, this controller would have required proportionally more states, as noted on the diagram.

- -

The total number of states in the machine for reversing an input string, when data symbols come from an alphabet of cardinality n:

- -

The total number of states in the machine for reversing an input string, when data symbols come from an alphabet of cardinality n:

+

The total number of steps for reversing an n symbol string:

- \text{states} = n + 8 + \text{steps} = + \begin{cases} + 2 & \text{if } n = 0 \\ + 3n^2 + 6n + 5 & \text{if } n \ge 1 + \end{cases}
-

The number of arcs in the machine, when data symbols come from an alphabet of cardinality n:

+

This shows string reversal to be an O(n^2) complexity problem, which might appear to some to be a peculiar result, as the same problem can be solved in O(n) time with a C program. This justifies further analysis.

+ +

Reversing a string does not intrinsically require making decisions based on the values in the string that is being reversed; however, a Turing Machine must use the value under the head for the next state transitions. Also, the only memory a controller has is through adding control path branches, so to "carry the symbol right" requires a branch in the state controller to remember what the symbol is. Consequently, had the input alphabet been larger, this controller would have required proportionally more states, as noted on the diagram.

+ +

For a real machine, symbols are machine word encodings. For example, ASCII uses 7 data bits, so there are 128 symbols available. If the width of the word for encoding symbols is n bits, then the total number of states required for this string reverse machine is:

- \text{arcs} = n^2 + 9n + 12 + \text{states} = 2^n + 8
-

Given that the number of symbols expands with 2^ϡ, where ϡ is the number of bits in a word, doing a reverse string operation with a Turing Machine becomes impractical even for small word widths. So it isn't the infinite tape, per sé that binds the Turing Machine to the abstract, but it is this attribute of enumerating symbols on branches that does so.

- -

The total number of steps for reversing an n symbol string:

+

The number of arcs in the machine:

- \text{steps} = - \begin{cases} - 2 & \text{if } n = 0 \\ - 3n^2 + 6n + 5 & \text{if } n \ge 1 - \end{cases} + \text{arcs} = 2^{2n} + 9(2^n) + 12
+

These equations show that the state controller size explodes with word width. It would be impractical to implement for all but the smallest of word sizes. This is one of the reasons that computation theory books use modest-sized symbol alphabets in their examples, perhaps the first few letters of the Latin alphabet, or the letter 's' for unary arithmetic. Previous sections discussed challenges transitioning the Turing Machine to a real architecture due to the tape length, and how this could be mitigated. In contrast, there is no practical mediation for implementing a Turing Machine controller even for modest-sized real problems.

+ +

This raises a question: if the Turing machine is to instruct upon the limitations of real computation, what are the implications to its state controller being impractical? When a Turing Machine proof shows that a number is computable, it doesn't necessarily instruct upon how it could be computed. When a reader picks up a text on applied number theory, also called computer arithmetic, he is unlikely to find a chapter on Turing Machines.

Blank, empty, SP

@@ -548,7 +549,7 @@

The abstract concept here is that of a container. A piece of paper is a container for symbols. When it contains no symbols, the container is empty. Only when we say the container is a piece of paper does it make sense to call it blank. But we are speaking of abstractions, not of paper. As a point of perspective, when computation theory texts are translated into French, the blank symbol is called the "symbole vide", or literally "empty symbol", as apparently blank paper is empty.

-

Because emptiness is a property of a container, Turing's first statement can be modeled with a sequence of sets. For a Turing Machine tape, each sequence member is either an empty set or a singleton set. The mathematician who desires an initial empty tape, in the language of mathematics, defines it as an open sequence of empty sets: +

Because emptiness is a property of a container, Turing's first statement can be modeled with a sequence of sets. For a Turing Machine tape, each sequence member is either an empty set or a singleton set. In the language of mathematics an empty tape can be defined as a empty sets:

@@ -556,9 +557,7 @@
-

Each tape member set is called a cell. So an empty tape has all empty cells.

- -

An empty sequence container is one that has zero length, so this definition for an empty tape is custom to Turing Machine tapes. An empty tape is not an empty sequence, rather it is an infinite sequence where every member is an empty set. In one sense this is a little peculiar that something said to be empty is infinite, in another sense it is consistent for the model that an empty Turing Machine tape keeps its defining characteristics. That is, it remains a single ended Turing Machine tape, where any cell of the tape could be written with a symbol value, while the basic form of the tape will not change.

+

Here, each tape member set is called a cell. This definition for an empty tape is specific to Turing Machines, as in mathematics an empty sequence has zero length. An empty tape is not an empty sequence, rather it is an infinite sequence where every member is an empty set. In one sense this is a little peculiar that something said to be empty is infinite, in another sense it is consistent for the model that an empty Turing Machine tape keeps its defining characteristics. That is, it remains a single ended Turing Machine tape, where any cell of the tape could be written with a symbol value, while the basic form of the tape will not change.

A conventionally defined Turing Machine will break if reading a cell does not yield a symbol, because the next state function has the read symbol as an argument.

@@ -843,11 +842,10 @@

The TTCA Machine programmed string reverse

-

Because the TTCA Machine cleanly separates the data path from the control path, it is possible to reverse a string without inspecting the payload. The programmed controller only needs to recognize the structural boundaries of the data protocol.

+

Because the TTCA Machine separates the data path from the control path, it is possible to reverse a string without inspecting the payload. The programmed controller only needs to recognize the structural boundaries of the data protocol. When a payload symbol is encountered, the controller executes a read_d action, placing the value into a data register, which is not examined for decision-making purposes. When a value is used to base a decision upon, the controller executes a read_g, placing the value into a register connected to the arc comparators.

-

With a Turing Machine, the controller is forced to read the data payload and branch into parallel states. If the input alphabet were expanded from binary to the full ASCII set, that controller would require a proportional increase in state definitions just to ferry symbols across the tape. When the number of symbols increases exponentially when represented binary words that are expanded, there is an explosion in the number of states. The TTCA Machine does not have this property. It uses the gate register g exclusively to scan for control symbols (the protocol terminator 'SP', the EOM marker 'E', and the read marker '*'). When a payload symbol is encountered, the controller executes a read_d action, placing the value into a data register, which is not examined for decision making purposes.

+

Here is the programmed controller for the TTCA Machine string reverse. Because actions (λ) are bound to states rather than transitions, reading and stepping are distinct states, resulting in a threads of serialized execution.

-

Here is the programmed controller for the TTCA Machine string reverse. Because actions (λ) are bound to states rather than transitions, reading and stepping are distinct states, resulting in a strictly serialized execution.

# TTCA Machine String Reverse @@ -1217,13 +1215,14 @@ } -

This machine has a single tape, with two heads marking two separate context areas. Because the areas do not overlap, this situation is indistinguishable from the case of the machine having two separate tapes, each with its own head. Hartmanis and Stearns established the original proof that simulating a multiple tape or multi-head Turing Machine on a single-tape machine incurs a quadratic time penalty J. Hartmanis and R. E. Stearns, "On the computational complexity of algorithms," Transactions of the American Mathematical Society 117 (1965): 285-306.. Hopcroft and Ullman formalize this relationship in their text John E. Hopcroft and Jeffrey D. Ullman, Introduction to Automata Theory, Languages, and Computation (Reading: Addison Wesley, 1979), 292.. The quadratic term in the step formula that disappeared when we added the second head was the quadratic penalty incurred by shuttling the head between two context areas.

+

This machine has a single tape with two heads marking two separate context areas. Because the areas do not overlap, this situation is indistinguishable from the case of the machine having two separate tapes, each with its own head. Hartmanis and Stearns established the original proof that simulating a Turing Machine with multiple tapes, each with its own head, on a single-tape single-head machine incurs a quadratic time penalty J. Hartmanis and R. E. Stearns, "On the computational complexity of algorithms," Transactions of the American Mathematical Society 117 (1965): 285-306.. Hopcroft and Ullman formalize this relationship in their text John E. Hopcroft and Jeffrey D. Ullman, Introduction to Automata Theory, Languages, and Computation (Reading: Addison Wesley, 1979), 292.. This explains why in this example of a string reverse machine, when the second head was added to eliminate the head shuttling, the quadratic term disappeared. Not all quadratic terms are due to shuttling, but this one happens to be such a case.

-

Thus, adding heads to a Turing Machine tape, or adding tapes with their own heads, can prevent head shuttling. For the two reverse machines, the time complexity of the longest compute time input of length n dropped from O(n^2) to O(n). Because the answer to a specific question of time complexity changes, the transformation is computation theoretic consequential. Furthermore, real computers have multiple pointers into different memory contexts, making the multi-head Turing Machine a more suitable model for our purposes.

+

The time complexity of the longest compute time input of length n dropping from O(n^2) to O(n) is computation theoretic consequential, so we should make a choice as to which machine to use as a reference. Given that real computers have multiple pointers into different memory contexts, the multi-head Turing Machine is the more suitable reference model.

+ +

Adding heads is not a general method for improving performance complexity. A quadratic performance improvement does not always occur and when it does it is not strong enough to change the asymptotic performance if there are higher-order terms in a step count polynomial. Furthermore, eliminating shuttling will never reduce a linear step count to a constant time step count; the simple reason is that n is unbounded, while adding k heads can only divide the work by a fixed constant k. Consequently, while the transformation is consequential in specific cases, it cannot change the broader time complexity class. +

-

This is not a general method for improving performance complexity. A quadratic performance improvement is not strong enough to change the asymptotic performance if there are higher-order terms in a step count polynomial. Also, eliminating shuttling will never reduce a linear step count to a constant time step count; the simple reason is that n is unbounded, while adding k heads can only divide the work by a fixed constant k. Consequently, while the transformation is consequential for this specific asymptotic bound, it cannot change the broader time complexity class.

- The Turing Machine architecture/organization

diff --git a/document/book/temp.c b/document/book/temp.c deleted file mode 100644 index b3ef2a6..0000000 --- a/document/book/temp.c +++ /dev/null @@ -1,50 +0,0 @@ -void TTCA·reverse_string() { - // Phase 1: Scan right to EOM and initialize the EOR marker - read_g(); - while(g != EOM){right(); read_g();} - right(); - write_σ(EOR); - - // Phases 2 through 5: The main shuttle cycle - while(true){ - - // Phase 2: Fetch next unprocessed character and check boundaries - left(); - read_g(); - while(g == EOM || g == SP){ - status(); - if(g == on_leftmost) return; - left(); - read_g(); - } - - read_d(); - status(); - - // Phase 6: Final character carry and clean halt - if(g == on_leftmost){ - write_σ(SP); - right(); - read_g(); - while(g != EOR){right(); read_g();} - write_d(); - right(); - write_σ(EOR); - return; - } - - // Phase 3 & 4: Mark location, carry opaque data, advance EOR - write_σ(SP); - right(); - read_g(); - while(g != EOR){right(); read_g();} - write_d(); - right(); - write_σ(EOR); - - // Phase 5: Return left to EOM to begin the next fetch cycle - left(); - read_g(); - while(g != EOM){left(); read_g();} - } -} diff --git a/document/book/temp.txt b/document/book/temp.txt deleted file mode 100644 index f2ea1cc..0000000 --- a/document/book/temp.txt +++ /dev/null @@ -1,303 +0,0 @@ - - q_init . 1 1 0 - q0 .1 1 0 - q_scan 1.1 0 - q_scan 1 1.0 - q_scan 1 1 0. - q1 1 1.0 E - q2 1 1 *.E - q2 1 1 * E. - q4 1 1 *.E 0 - q4 1 1.* E 0 - q4 1.1 * E 0 - q4 .1 1 * E 0 - q4 . 1 1 * E 0 - q5 .1 1 * E 0 - q5 1.1 * E 0 - q5 1 1.* E 0 - q1 1.1 * E 0 - q3 1 *.* E 0 - q3 1 * *.E 0 - q3 1 * * E.0 - q3 1 * * E 0. - q4 1 * * E.0 1 - q4 1 * *.E 0 1 - q4 1 *.* E 0 1 - q4 1.* * E 0 1 - q4 .1 * * E 0 1 - q4 . 1 * * E 0 1 - q5 .1 * * E 0 1 - q5 1.* * E 0 1 - q1 .1 * * E 0 1 - q3 *.* * E 0 1 - q3 * *.* E 0 1 - q3 * * *.E 0 1 - q3 * * * E.0 1 - q3 * * * E 0.1 - q3 * * * E 0 1. - q4 * * * E 0.1 1 - q4 * * * E.0 1 1 - q4 * * *.E 0 1 1 - q4 * *.* E 0 1 1 - q4 *.* * E 0 1 1 - q4 .* * * E 0 1 1 - q4 . * * * E 0 1 1 - q5 .* * * E 0 1 1 - q1 . * * * E 0 1 1 - q6 .* * * E 0 1 1 - q6 .* * E 0 1 1 - q6 .* E 0 1 1 - q6 .E 0 1 1 - q6 .0 1 1 - don . 0 1 1 - - - - - q_init · 1 1 0 - q0 ·1 1 0 - q_scan 1·1 0 - q_scan 1 1·0 - q_scan 1 1 0· - q1 1 1·0 E - q2 1 1 *·E - q2 1 1 * E· - q4 1 1 *·E 0 - q4 1 1·* E 0 - q4 1·1 * E 0 - q4 ·1 1 * E 0 - q4 · 1 1 * E 0 - q5 ·1 1 * E 0 - q5 1·1 * E 0 - q5 1 1·* E 0 - q1 1·1 * E 0 - q3 1 *·* E 0 - q3 1 * *·E 0 - q3 1 * * E·0 - q3 1 * * E 0· - q4 1 * * E·0 1 - q4 1 * *·E 0 1 - q4 1 *·* E 0 1 - q4 1·* * E 0 1 - q4 ·1 * * E 0 1 - q4 · 1 * * E 0 1 - q5 ·1 * * E 0 1 - q5 1·* * E 0 1 - q1 ·1 * * E 0 1 - q3 *·* * E 0 1 - q3 * *·* E 0 1 - q3 * * *·E 0 1 - q3 * * * E·0 1 - q3 * * * E 0·1 - q3 * * * E 0 1· - q4 * * * E 0·1 1 - q4 * * * E·0 1 1 - q4 * * *·E 0 1 1 - q4 * *·* E 0 1 1 - q4 *·* * E 0 1 1 - q4 ·* * * E 0 1 1 - q4 · * * * E 0 1 1 - q5 ·* * * E 0 1 1 - q1 · * * * E 0 1 1 - q6 ·* * * E 0 1 1 - q6 ·* * E 0 1 1 - q6 ·* E 0 1 1 - q6 ·E 0 1 1 - q6 ·0 1 1 - don · 0 1 1 - - ----- - - -

The Hopcroft and Ullman Turing Machine

- -

This definition comes from Hopcroft and Ullman's book with minor terminology changes to make it flow into the text here John E. Hopcroft and Jeffrey D. Ullman, Introduction to Automata Theory, Languages, and Computation (Reading: Addison Wesley, 1979).. -

- - - M = (Q, Σ, Γ, δ, q_0, □, F) - - -

Where the components have the following meanings:

- - - -

I have introduced the qualifier programmed in front of the finite state machine controller because each Turing Machine that accomplishes a different task has a different finite state machine controller. The rest of the Turing Machine remains fixed. Hence, when a mathematician defines a custom task controller, he is essentially programming the machine.

- -

Here the input alphabet is said to be a subset of a larger alphabet. This allows some symbols to be set aside and only used by the machine. In the architecture description given below, those symbols exclusive to the larger set are called control symbols. Hopcroft and Ullman include the empty symbol as a control symbol. However, they have simultaneously listed it as a separate component.

- -

State transitions are gated by the read value from the tape. Each state transition function includes actions to be taken; hence, their programmable controller is a Mealy style state machine. The step action is mandatory, though it can be in either direction. The write action must be specified, but the write could be the same symbol that is read, making it effectively an optional action.

- -

Hopcroft and Ullman explain a step of the machine by showing a representation of the tape with the state variable melded in to the left of the currently scanned symbol. Suppose δ(q, X_i) = (p, Y, L); i.e., the next move is leftward. Then, -

- - - X_1 X_2 \cdots X_{i-1} q X_i X_{i+1} \cdots X_n \underset{M}{\vdash} X_1 X_2 \cdots X_{i-2} p X_{i-1} Y X_{i+1} \cdots X_n - - -

So first the tape is X_1 X_2 \cdots X_{i-1} X_i X_{i+1} \cdots X_n, with the head over X_i, and in state q. Then after a step of the machine, the tape is X_1 X_2 \cdots X_{i-1} Y X_{i+1} \cdots X_n, with the head over X_{i-1}, and in state p. Thus X_i was overwritten with Y, and the head stepped left. -

- -

Here is the programmed controller for a Turing Machine that reverses a binary string.

- - HU reverse machine - -

Provided the site is still alive, the following YAML can be entered at TuringMachine.io to watch the machine run.

- - - # YAML - # Reverses a binary string using a single marker and an EOM terminator. - input: ' 110' - blank: ' ' - start state: q_init - table: - # Machine starts on the leftmost cell (a blank marker). Step right to the first input symbol. - q_init: - ' ': {R: q0} - - # Check for an empty string; exit if true. Otherwise, scan right. - q0: - ' ' : {L: done} - [0, 1]: {R: q_scan} - - # Scan to the rightmost digit and place the EOM terminator 'E' - q_scan: - [0, 1]: R - ' ' : {write: 'E', L: q1} - - # process the rightmost unmarked digit, writing the uniform marker '*' - q1: - 0 : {write: '*', R: q2} - 1 : {write: '*', R: q3} - ' ': {R: q6} # all digits processed, begin cleanup - - # carry '0' to the right end - q2: - ['*', 'E', 0, 1]: R - ' ' : {write: 0, L: q4} - - # carry '1' to the right end - q3: - ['*', 'E', 0, 1]: R - ' ' : {write: 1, L: q4} - - # return all the way to the left blank space - q4: - ['*', 'E', 0, 1]: L - ' ' : {R: q5} - - # step right to find the next unmarked digit - q5: - [0, 1] : R - ['*', 'E']: {L: q1} - - # erase the markers and EOM terminator, leaving only the reversed string - q6: - ['*', 'E'] : {write: ' ', R: q6} - [0, 1, ' ']: {L: done} - - done: - - -

By definition, this machine always starts on the leftmost tape cell. To accommodate this single ended tape model, the input is specified to be placed one square past the initial blank on the tape. This allows the leftmost blank to be used as a reliable start of input marker, effectively establishing a left physical boundary. The machine begins by reading this initial blank and stepping right. If it immediately encounters another blank, the string is empty and the machine exits. Otherwise, it sweeps right to place an end of message marker, E, immediately after the string. It then enters a repetitive process: it walks left to locate the next unprocessed input symbol, overwrites it with an asterisk to mark it as read, and then carries that remembered value rightward to deposit it at the new end of the sequence. By executing this back and forth shuttle, the machine systematically builds the reversed string to the right of the E, finishing by sweeping through to erase its temporary markers.

- -

Reversing a string does not in general require knowing the constituent symbols; however, a Turing Machine is incapable of ignoring their actual values. The 1 and 0 here are explicitly stated in the state transitions, and specific states are reserved to keep track of which symbol is being transferred. Had the input alphabet been large, this controller would have required proportionally more states.

- -

Although by definition each state transition matches one value under the head, as a practical matter, disjunctive selection is allowed via a comma list. A conjunctive phrasing for the state transition proposition would require stringing intermediate states in series.

- -

The following trace demonstrates the reversal of the string "110". Thanks to Unicode, the head position is indicated directly on the tape using a bullet character, while the current state is listed in the left column. The empty symbol prints as a space. If you align the first line at the top of your window and scroll down, the execution plays out like an animation.

- - - q_init • 1 1 0 - q0 •1 1 0 - q_scan 1•1 0 - q_scan 1 1•0 - q_scan 1 1 0• - q1 1 1•0 E - q2 1 1 *•E - q2 1 1 * E• - q4 1 1 *•E 0 - q4 1 1•* E 0 - q4 1•1 * E 0 - q4 •1 1 * E 0 - q4 • 1 1 * E 0 - q5 •1 1 * E 0 - q5 1•1 * E 0 - q5 1 1•* E 0 - q1 1•1 * E 0 - q3 1 *•* E 0 - q3 1 * *•E 0 - q3 1 * * E•0 - q3 1 * * E 0• - q4 1 * * E•0 1 - q4 1 * *•E 0 1 - q4 1 *•* E 0 1 - q4 1•* * E 0 1 - q4 •1 * * E 0 1 - q4 • 1 * * E 0 1 - q5 •1 * * E 0 1 - q5 1•* * E 0 1 - q1 •1 * * E 0 1 - q3 *•* * E 0 1 - q3 * *•* E 0 1 - q3 * * *•E 0 1 - q3 * * * E•0 1 - q3 * * * E 0•1 - q3 * * * E 0 1• - q4 * * * E 0•1 1 - q4 * * * E•0 1 1 - q4 * * *•E 0 1 1 - q4 * *•* E 0 1 1 - q4 *•* * E 0 1 1 - q4 •* * * E 0 1 1 - q4 • * * * E 0 1 1 - q5 •* * * E 0 1 1 - q1 • * * * E 0 1 1 - q6 •* * * E 0 1 1 - q6 •* * E 0 1 1 - q6 •* E 0 1 1 - q6 •E 0 1 1 - q6 •0 1 1 - done • 0 1 1 - - -

The total number of states for supporting n symbols:

- -
- - \text{states} = n + 8 - -
- -

The total number of steps for reversing an n character string:

- -
- - \text{steps} = 3n^2 + 6n + 5 - -
- -

The number of arcs that make decisions based on the data being reversed:

- -
- - \text{steps} = - -
-