Turing_completeness
Turing_completeness
Turing completeness
ece.uwaterloo.ca
[email protected]
Outline
Computability
Computability
Consider INTERCAL
– 16-bit integers .1 … .65535
– 32-bit integers ,1 … ,65535
– Arrays of 16-bit integers :1 … :65535
– Arrays of 32-bit integers ;1 … ;65535
– Each variable has its own stack
• You can push the current value onto the stack, or pop back a previous value
– There are five operations: interleave, select, and, or, xor
Computability
Computability
Computability
Computability
Computability
Computability
There is at most one entry in this table for each pair of current
settings
Turing completeness
11
Computability
Current Next
Symbol Symbol
State State Direction
read to write
b B c 0 R
c B e B R
e B f 1 R
f B b B R
Turing completeness
12
Computability
Computability
The state and symbol under the head have been updated
Current Next
Symbol Symbol
State State Direction
read to write
b B c 0 R
c B e B R
e B f 1 R
f B b B R
Turing completeness
14
Computability
The state is f and the symbol under the head is the blank B:t
– The state is set to b
– A blank is printed to the tape
– Move one entry to the right Current Next
Symbol Symbol
State State Direction
read to write
b B c 0 R
c B e B R
e B f 1 R
f B b B R
Turing completeness
15
Computability
Computability
The result is the state c and a blank symbol is under the head:
– Set the state to e
– Write a blank to the tape
– Move one entry to the right Current Next
Symbol Symbol
State State Direction
read to write
b B c 0 R
c B e B R
e B f 1 R
f B b B R
Turing completeness
17
Computability
The result is the state e and a blank symbol B under the head
– This is the state we were in four steps ago
– This machine never halts...
Current Next
Symbol Symbol
State State Direction
read to write
b B c 0 R
c B e B R
e B f 1 R
f B b B R
Turing completeness
18
Computability
Computability
Computability
After 22 steps, a group of five ones and a group of six ones are
merged into a single group of eleven ones
– This represents 5 + 6 = 11
Turing completeness
21
Computability
A computational system
– e.g., a programming language compiled into machine code and run on a
processor
is said to be Turing complete if it can compute every function
computable on a Turing machine
Turing completeness
22
Computability
Computability
http://en.wikipedia.org/wiki/Computers
Turing completeness
24
Computability
Computability
http://en.wikipedia.org/wiki/Brainfuck
Turing completeness
26
References
Wikipedia, http://en.wikipedia.org/wiki/Computability
Wikipedia, http://en.wikipedia.org/wiki/Turing_machine
Wikipedia, http://en.wikipedia.org/wiki/Church–Turing_thesis
These slides are provided for the ECE 250 Algorithms and Data Structures course. The
material in it reflects Douglas W. Harder’s best judgment in light of the information available to
him at the time of preparation. Any reliance on these course slides by any party for any other
purpose are the responsibility of such parties. Douglas W. Harder accepts no responsibility for
damages, if any, suffered by any party as a result of decisions made or actions based on these
course slides for any other purpose than that for which it was intended.