CAs and Turing Machines The Basis for Universal Computation
What We Mean By Universal When we claim universal computation we mean that the CA is capable of calculating anything that could possibly be calculated*. It takes some input, runs a program, and produces some output. Or really, we mean it can calculate any algorithm. Algorithms are a well-defined finite sequence of instructions that will always terminate (eventually) with an answer. Oh, get it? Those are just computer programs. *Some things are impossible to calculate with any computer.
Your Laptop Is Universal So how about your desktop or laptop? Intuitively, you know it is universal you ve used it enough to know it can do just about anything with the correct hardware and software. You know it will run any algorithm (program). So let s dissect your computer and see what s inside. That will help us see what parts of a CA correspond to the parts of your real computer.
Parts of a Computer output input
Guts of a Computer More I/O (CDs, USB, etc.) Processor (on mother board ) Memory cards (RAM) Power supply
Important Parts: Power Supply? No, not power supply! Turns out energy is unnecessary for computation. Why? Can make reversible computers. Kind of like reversible CA! Copying or measuring a bit is ultimately free. Just can t erase anything that costs energy (increases entropy). So don t erase anything just copy bits into new space. All information is preserved (nothing erased) so no energy expended. Cool proof by Landauer. Ok, so we can t build a powerless computer yet (but we re working on it).
Important Parts Input Yes, need a way to get the program (algorithm) and the data (initial state) into the machine. Output Yes, need a way to get the result of the computation. But could share with the input device! E.g., read and write from the same disk. Memory Yes, need a place for temporary storage. But could share the input and output device! E.g., read, write, and store temporarily on the same disk. Processor Yes, need something that actually does the calculation. Typically filled with lots of boolean gates or circuits. And has a clock. Keeps all the operations in sync.
Parts of CA Computers Have to be built from the same parts! Memory/input/output Processor and clock Turing in 1936 mathematically formalized these parts. Was interested in what can and can t be computed. Created very simple concept of a Turing Machine (TM) built from these parts. So we ll start with TMs and then show equivalence to some CA.
Turing Machine Has a finite-sized control. The processor. Has a tape and a tape head. For reading, writing, memory on the tape. Tape can be magnetic (like floppy disk), paper, legos, piles of cookies, etc. Tape is infinite! Ok, so that is one difference. But practically speaking we can create as big a tape as we would like for our desktop.
Turing Machine Picture Blank tape (often written with the symbol #) # 0 1 0 1 0 0 1 0 # # # #... Tape head for reading and writing Tape with symbols (I/O and memory) Put you program and data here! q 4 q 0 q 1 q 3 q 2 Finite control (processor)
Finite State Control This is just an automata. Take automata theory. Has a finite number of states q o through q n. The current state is indicated by the arrow. At discrete steps (the clock!), the automata does two things. 1. State changes to a new q i that depends on (1) the current state, and (2) the symbol on the tape. q 4 q 3 q 0 q 1 q 2 2. Either writes a new symbol on the tape, or moves tape head left or right to a new position.
How s That Transition Work? Define the transition from one state to another as d(q i, X) = (q j, Y, D) where q i is the current state q j is the next state X is the current symbol on the tape Y is the symbol that is written in place of X D is the direction that the tape head moves L = left, R = right, S = stay put
Picture of Transition Function Draw transition d(q i, X) = (q j, Y, D) as q i X/Y, D q j So can draw entire TM this way show all possible transitions
Example TM: Accept Input With aba Looks like a typical automata! (Take Automata Theory.) This TM accepts all strings that contain a substring aba. Assumes an alphabet of a, b, and # (could be 0, 1, and #). Program quits when reaches h a or h r. h a is an accepting state indicating that input does contain aba. h r is a reject state indicating that input does not contain aba. b/b, R h r #/#, R #/#, R q 0 q 1 #/#, R #/#, R a/a, R a/a, R q 2 q 3 h a b/b, R a/a, R Try it! b/b, R tape not shown
TM Example: n mod 2 This TM calculates n mod 2. Assumes an alphabet of 1 and # (could be 0, 1, and #). Represents a number in unary. E.g., 1111 is 4, 11111 is 5. On tape will leave a single 1 or nothing. 1/1, R #/#, R #/#, R q 0 q 1 #/#, L 1/#, L q 2 q 3 q 4 h a 1/#, L #/#, R #/1, R Try it on #111# and #1111# tape not shown
So What s the Big Deal? This simple computer is as powerful as it gets. Extensions to the model add no new power. Extra tape heads, two-dimensional tapes, etc. Or even CD-ROMS, USB ports, etc. Lots of proofs of this. Take Theory of Computation. E.g., Having 2 tapes is same as 1 tape. The proof essentially takes one tape and splits it into two. May not be as efficient as your desktop, but can do all the same stuff. May not be as pretty (the output is on tape, not a nice display), but gives the same answers.
Church s Thesis Church-Turing Thesis: Turing Machines are formal versions of algorithms. Can t be proved. Why? Because an algorithm isn t mathematically defined. In fact, this thesis says that the TM is the mathematical definition. Can be disproved. Why? Someone could invent something more powerful tomorrow. Not likely to be disproved. Every other type of computation has been proven identical. Lambda-calculus, general recursive functions, quantum computing, etc. In fact, we will prove that CA computation is identical to the Turing Machine!
Philosophical Implication Anything you want to calculate can be done on a Turing Machine. So if you want to prove that something can do any calculation, you have to show it is equivalent to all possible Turing Machines. All TMs? Yup! i.e., we have to show that Rule 110, Life and other Universal CA are equivalent to all TMs. Sounds like a pain. So we ll create a Universal TM that makes life easier.
Universal TMs Our current TM can only do one kind of task at a time. We fix the finite state machine (i.e., control/automata) to solve that particular task. Your desktop can do many different tasks. We don t have to rebuild your desktop for every new application. So what s the difference? We need to build a so called universal TM. A Universal TM can read in (as input) any other TM and run its program! Ah, a programmable TM. So now we just have to show that a CA is equivalent to this one Universal TM!
Turing Machine: Definition A Turing Machine is a quadruple (Q, S, d, q 0 ) where Q is a finite set of states, not including the halt state q h. S is an alphabet including the blank symbol but not the symbols L, R, S. q 0 Q is the initial state. d is the transition function from Q S to (Q {q h }) S {L, R, S} Note: The transition function is the same as what we defined before, but here we were careful to show that we can t transition away from the halt state. Note: Sometimes the definition for the transition function is Q S to (Q {q h }) (S {L, R}) with no S symbol. i.e., the TM can (1) move L or R, or (2) write a new symbol on the tape, but it can t do both at the same time. This changes nothing fundamental.
Building A Universal TM If a Universal TM is going to read any other TM as input (from its tape), then we need a way to encode a TM (so we can write it on a tape). Our Universal TM will use the alphabet {0, 1, #}. Then everything about the TM it is reading must be represented in this alphabet. Let state q 0 be 0 q 1 be 00 q 2 be 000 and in general q i be 0 i+1. (The exponent means concatenation.) Continuing in this way, we can build a table representing the symbols of a TM (see next slide).
Mapping TM Symbols Onto a Universal Tape The a i are the alphabet. For example, 0 and 1. Or 0, 1, and 2. Or a and b. Etc. Original TM symbol # 0 a i 0 i+2 h a 0 h r 00 q i 0 i+1 S 0 L 00 R 000 Code for input on Universal TM
Mapping Transitions And Input Onto a Universal Tape d(q i, a i ) = (q k, a k, D) is represented by q i 1a i 1q k 1a k 1D1. Just separate by ones. For example, d(q 0, a 2 ) = (q 1, a 4, L) is 01000010010000001001 An input string W is W = 1a i 1a k 1a m 1a n 1 a p 1 Begin and end with a 1.
Encoding The Whole TM Suppose there are n states and m letters in the TM alphabet. Q = n, S = m Then there are n m possible transitions. Call them S ik where 1 i n and 1 k m Then we can list the whole Turing machine (Q, S, d, q 0 ) and its input in this order 1q 0 1S 11 S 12...S 1m S 21 S 22...S 2m...S n1 S n2...s nm 1W We ll abbreviate this input as MW M for Turing Machine
Universal TM Operation So how s the Universal TM (UTM) work on this input MW? To make the explanation easier, let s use a UTM that has three tapes. Recall, this adds no new powers to the UTM. Tape 1 will initially hold the input state MW. Tell the UTM to copy W onto tape 2. Writing automata to copy and shift input states is straightforward. Note M and W are easy to find it s the only part of the input that is separated by three 1 s. Tell the UTM to copy the initial state q 0 onto tape 3. Again, easy to find.
Input Universal TM Picture So far we have W used to be here. And of course, M and W actually occupy many cells. # M # # # # # # # # # # #... The init state of the TM State of M # W # # # # # # # # # # #... # q 0 # # # # # # # # # # #...... q 0 q 1 q 4 q 2 q 3
Universal TM Operation (cont.) 1. Tell the UTM to move the head of tape 2 to the first simulated tape cell of the TM. 2. UTM now finds the transition on tape 1 that corresponds to the current state (on tape 3) and the current cell value (on tape 2). 3. Execute this transition as follows. 1. Change the contents of tape 2 to reflect the new cell value. (i.e., update W) 2. Move the tape head on tape 2 in the direction indicated. i.e., move right or left to the next (or previous) simulated tape cell of the TM. 3. Change the contents of tape 3 to the new state. 4. Repeat until can t find a transition (in which case it halts and rejects) or enters accepting state (halt and accept). Sweet! (And phew!)
Taking Stock Ok, we have a Universal TM that can simulate any other TM. So now, to show that we have a Universal CA, we just have to prove it is equivalent to a Universal TM. In other words, that will prove that the CA can calculate any algorithm. And next, we do that for the Game of Life!