Download presentation
Presentation is loading. Please wait.
Published byTyrone Lane Modified over 9 years ago
1
Turing Machines CS 105: Introduction to Computer Science
2
Some Interesting Questions u What is a computer? What is computation? u Are there problems that some computers can solve but others can’t? u Are there problems that no computer can solve?
3
What is a Computer? u That’s a tough question. u We want to talk about the fundamental properties of computation. u We need a model that captures the essential and throws out the rest.
4
What is Computation? u Mapping an input to an output. u For the sake of concreteness: mapping a binary input to a binary output. u Problems describe a particular mapping we are interested in. u Decision problems are a subset of all problems - map from inputs to 0 or 1.
5
First model of computation: Finite State Automata… A B 1 0 10
6
Finite State Automata u A fixed number of states. u The machine moves from one state to another in response to inputs. u If it ends in an ACCEPT state it accepts, otherwise it rejects. (We’re just considering decision problems for now.) u Let’s see some examples…
7
FSA Example A B 1 0 10Triangle indicates start state. Double circle indicates accepting state. What happens on input 100101?
8
FSA Example A B 1 0 10 100101
9
FSA Example A B 1 0 10 100101
10
FSA Example A B 1 0 10 100101
11
FSA Example A B 1 0 10 100101
12
FSA Example A B 1 0 10 100101
13
FSA Example A B 1 0 10 100101 ACCEPT!
14
The Turing Machine u Problems with the FSA as a model of computation?? –Does an input string have matched parentheses? E.g., 01(0(10)101)110(1 u With a slight modification we get the Turing machine. u First described in 1937 by Alan Turing
15
How does it work?... Tape Read/Write Head Control Device Current State: Rules:
16
What can it do? u Write a character to the current tape cell u Move Read/Write Head one cell to the left or right u Go into a new state... Tape Read/Write Head Control Device Current State: Rules:
17
How does it decide what to do? Behavior is based on: u Input: the character in the current tape cell u State: the current state... Tape Read/Write Head Control Device Current State: Rules:
18
Let’s see one in action... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 1 Rules: 1001
19
What are current state and input?... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 1 Rules: 1001
20
Which rule will the TM follow?... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 1001 1 1 | 1 R 1 1
21
Write to the tape... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 1001 1 1 | 1 R 1 1
22
Move right or left... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 1001 1 1 | 1 R 1 1
23
Go to new state: Done with rule... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 1001 1 1 | 1 R 1 1
24
What are current state and input?... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 1 Rules: 1001
25
Which rule will the TM follow?... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 01 1 0 | 1 R 2 1 10
26
Write to the tape... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 01 1 1 0 | 1 R 2 11
27
Move right or left... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 01 1 1 0 | 1 R 2 11
28
Go to new state: Done with rule... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 01 2 1 0 | 1 R 2 11
29
What are current state and input?... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 101 2 1
30
Which rule will the TM follow?... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 1 2 0 | 1 R 2 10 2 1
31
Write to the tape... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 11 2 0 | 1 R 2 1 2 1
32
Move right or left... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 11 2 0 | 1 R 2 1 2 1
33
Go to new state: Done with rule... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 11 2 0 | 1 R 2 1 2 1
34
What are current state and input?... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 111 2 1
35
Which rule will the TM follow?... Tape Read/Write Head Control Device Current State: State Symbol | Write Move State 1 1 | 1 R 1 1 0 | 1 R 2 2 0 | 1 R 2 Rules: 111 2 1
36
Is the Turing Machine The Right Model? u The Church Turing Thesis: –Any reasonable model of computation is equivalent to the Turing machine. u “Equivalence” here refers to what can be computed, not how fast it can be done. u Not something that can be proved.
37
Why do we believe it? u Every TM extension to make it “more powerful” (e.g., multiple-tape TMs) has been shown to be equivalent to the basic Turing Machine. u Other models of computation have been shown to be weaker (e.g., Finite State Machines) or equivalent.
38
What is the significance of the Church-Turing Thesis? u Church-Turing Thesis: Anything you can do on any computer you can do with a Turing Machine. u So, no computer is more “powerful” (can compute more) than a TM.
39
Is my computer LESS powerful than a Turing Machine? u No. u Given an infinite input device (infinite tape, infinite number of floppies, infinite keyboard input), you can simulate a TM. u Therefore, anything that can be computed on a TM can be computed on your computer.
40
The Important Implication u If there’s anything that we CAN’T do with a Turing Machine then... we can’t do it on any computer now or in the future.
41
Are there things we can’t compute on a Turing Machine? YES An Example: The Halting Problem
42
Last Words. u Turing machines are –Hard to program. –Easy to prove things about. u If we can prove something about the capabilities of Turing machines, we can immediately apply it to all computers.
43
Regular Expressions u Another formalism for selecting strings to accept or reject. u Intimately related to FSAs u Practical applications in searching through strings.
44
Three Operators u Union: (0+1) –accepts/matches either 0 or 1. u Concatenation: 01 –matches 0 followed by 1 u Repetition: 0* –Matches any number of zeros (including 0)
45
Examples u These operators can be applied to regular expressions: –(0+1)*1 (matches any string that ends in a 1) –(0+1)(0+1))* (matches any even length string)
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.