Hello World! An Invitation to Computer Science
Lecture Slides
Turing Machines
Monday May 5, 2008
- models are easier to reason about than real world
- simplifying assumptions, like unlimited memory
- Turing Machines:
finite states, infinite tape
help us reason about what is computable
What Turing machine program corresponds to this state diagram?
What state diagram corresponds to this Turing machine program?
state content write move next state
=====================================================
START 0 0 right B
START 1 1 right A
A 0 0 right C
A 1 1 right C
B 0 0 right D
B 1 1 right C
C * 1 no move HALT
C 0 1 no move HALT
C 1 1 no move HALT
D * 0 no move HALT
D 0 0 no move HALT
D 1 0 no move HALT
Building up our arsenal
- As with other models (pseudocode, circuits), once we build primitives
we can build more complex machines/programs from those primitives
- we have seen how to represent simple arithmetic
- from book, we see how to build a NOT machine
- and now we can construct AND and OR
Making Turing machines more robust
- find first non-blank before starting
- reset head after main computation
- what to do if input is "poorly formatted"
Representing different kinds of data
- Counting in unary
(+) : TMs are standard for reasoning about computability
(-) : would not use either TMs or unary counting in practice
(-) : unary requires exponentially more space than binary
- how could we represent lists with TMs?
- can we represent Turing machines themselves?