Expressive Power of TMs
The Church-Turing thesis states that any implementable computational model can be simulated by a Turing Machine.
Here is a hand-wavy proof that any program written in a language like C or Java could be simulated with a TM.
- First, recall that to run a C or Java program we compile it to machine code, and then the computer executes that machine code.
- So it suffices to show machine code can be simulated by a TM.
- A machine language program consists of a sequence of instructions of a finite number of simple types.
- For example, (a) read from memory into one of a finite set of registers, (b) write a register's contents to memory, (c) add the contents of two registers and store the results in a third, (d), (e) perform (c) but do multiplication or limited subtraction instead of addition, (f) jump (also called branch) to a location based on whether a register was 0.
- A machine code program operates starting from an initial state of a computer's memory together with the state of its register, and the state of its program counter. (The program counter says which word in memory to look at for the next instruction.)
- We can imagine this starting configuration being suitably encoded as a tuple on the read only input tape of a simulating TM.
- The simulating TM could have a finite set of read-write tapes for the computer's memory, each of its registers, and the program counter. We could maybe have a finite number additional tapes for scratch work.
- At the start of the simulation the TM copies the read only input tape to initialize the computer memory tape, register tape, and program counter tape.
- The TM would then have a subroutine to simulate executing one instruction from the machine code program.
- This might involve (a) rewinding each of the read-write tapes to their start of tape symbols, (b) copying the program counter tape to an auxiliary tape, (c) using the auxiliary tape to count down while advancing memory locations through the memory tape to get to the location in memory of the current instruction, (d) from this location, since there are only finitely many machine code instruction types, we can determine the instruction type using a finite amount of transition function control logic, and then switch to one of finitely many subroutine to simulate the particular instruction, (f) once done simulating the instruction we adjust the program counter to the appropriate next instruction.