Turing Machines - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Turing Machines

Description:

Turing Machines CS 105: Introduction to Computer Science What are current state and input? ... Tape Read/Write Head Control Device Current State: State Symbol | Write ... – PowerPoint PPT presentation

Number of Views:199
Avg rating:3.0/5.0
Slides: 43
Provided by: Aly101
Category:

less

Transcript and Presenter's Notes

Title: Turing Machines


1
Turing Machines
  • CS 105 Introduction to
  • Computer Science

2
Some Interesting Questions
  • What is a computer? What is computation?
  • Are there problems that some computers can solve
    but others cant?
  • Are there problems that no computer can solve?

3
What is a Computer?
  • Thats a tough question.
  • We want to talk about the fundamental properties
    of computation.
  • We need a model that captures the essential and
    throws out the rest.

4
What is Computation?
  • Mapping an input to an output.
  • For the sake of concreteness mapping a binary
    input to a binary output.
  • Problems describe a particular mapping we are
    interested in.
  • Decision problems are a subset of all problems -
    map from inputs to 0 or 1.

5
First model of computationFinite State Automata

1
0
1
A
B
0
6
Finite State Automata
  • A fixed number of states.
  • The machine moves from one state to another in
    response to inputs.
  • If it ends in an ACCEPT state it accepts,
    otherwise it rejects. (Were just considering
    decision problems for now.)
  • Lets see some examples

7
FSA Example
1
0
Triangle indicates start state.
1
Double circle indicates accepting state.
A
B
0
What happens on input 100101?
8
FSA Example
1
0
1
A
B
0
100101
9
FSA Example
1
0
1
A
B
0
100101
10
FSA Example
1
0
1
A
B
0
100101
11
FSA Example
1
0
1
A
B
0
100101
12
FSA Example
1
0
1
A
B
0
100101
13
FSA Example
1
0
ACCEPT!
1
A
B
0
100101
14
The Turing Machine
  • Problems with the FSA as a model of computation??
  • Does an input string have matched parentheses?
    E.g., 01(0(10)101)110(1
  • With a slight modification we get the Turing
    machine.
  • First described in 1937 by Alan Turing

15
How does it work?
...

Tape
Read/Write Head
Current State
Control Device
Rules

16
What can it do?
...
Tape
Read/Write Head
Current State
Control Device
Rules
  • Write a character to the current tape cell
  • Move Read/Write Head one cell to the left or
    right
  • Go into a new state

17
How does it decide what to do?
...
Tape
Read/Write Head
Current State
Control Device
Rules
  • Behavior is based on
  • Input the character in the current tape cell
  • State the current state

18
Lets see one in action
...

Tape
1
0
0
1
Read/Write Head
Current State
1
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
19
What are current state and input?
...

Tape
1
0
0
1
Read/Write Head
Current State
1
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
20
Which rule will the TM follow?
...

Tape
1
0
0
1
Read/Write Head
Current State
1
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
1 1 1 R 1
21
Write to the tape
...

Tape
1
0
0
1
Read/Write Head
Current State
1
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
1 1 1 R 1
22
Move right or left
...

Tape
1
0
0
1
Read/Write Head
Current State
1
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
1 1 1 R 1
23
Go to new state Done with rule
...

Tape
1
0
0
1
Read/Write Head
Current State
1
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
1 1 1 R 1
24
What are current state and input?
...

Tape
1
0
0
1
Read/Write Head
Current State
1
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
25
Which rule will the TM follow?
...

Tape
0
1
1
0
Read/Write Head
Current State
1
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
1 0 1 R 2
26
Write to the tape
...

Tape
0
1
1
1
Read/Write Head
Current State
1
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
1 0 1 R 2
27
Move right or left
...

Tape
0
1
1
1
Read/Write Head
Current State
1
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
1 0 1 R 2
28
Go to new state Done with rule
...

Tape
0
1
1
1
Read/Write Head
Current State
2
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
1 0 1 R 2
29
What are current state and input?
...

Tape
1
0
1
1
Read/Write Head
Current State
2
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
30
Which rule will the TM follow?
...

Tape
1
1
0
1
Read/Write Head
Current State
2
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
2 0 1 R 2
31
Write to the tape
...

Tape
1
1
1
1
Read/Write Head
Current State
2
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
2 0 1 R 2
32
Move right or left
...

Tape
1
1
1
1
Read/Write Head
Current State
2
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
2 0 1 R 2
33
Go to new state Done with rule
...

Tape
1
1
1
1
Read/Write Head
Current State
2
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
2 0 1 R 2
34
What are current state and input?
...

Tape
1
1
1
1
Read/Write Head
Current State
2
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
35
Which rule will the TM follow?
...

Tape
1
1
1
1
Read/Write Head
Current State
2
Control Device
Rules
State Symbol Write Move State 1
1 1 R 1 1
0 1 R 2 2
0 1 R 2
No Rule Done!
36
Is the Turing Machine The Right Model?
  • The Church Turing Thesis
  • Any reasonable model of computation is equivalent
    to the Turing machine.
  • Equivalence here refers to what can be
    computed, not how fast it can be done.
  • Not something that can be proved.

37
Why do we believe it?
  • Every TM extension to make it more powerful
    (e.g., multiple-tape TMs) has been shown to be
    equivalent to the basic Turing Machine.
  • 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?
  • Church-Turing Thesis
  • Anything you can do on any computer
  • you can do with a Turing Machine.
  • So, no computer is more powerful (can compute
    more) than a TM.

39
Is my computer LESS powerful than a Turing
Machine?
  • No.
  • Given an infinite input device (infinite tape,
    infinite number of floppies, infinite keyboard
    input), you can simulate a TM.
  • Therefore, anything that can be computed on a TM
    can be computed on your computer.

40
The Important Implication
  • If theres anything that we CANT do with a
    Turing Machine
  • then ...
  • we cant do it on any computer now or in the
    future.

41
Are there things we cant compute on a Turing
Machine?
YES

An Example The Halting Problem
42
Last Words.
  • Turing machines are
  • Hard to program.
  • Easy to prove things about.
  • If we can prove something about the capabilities
    of Turing machines, we can immediately apply it
    to all computers.

43
Regular Expressions
  • Another formalism for selecting strings to accept
    or reject.
  • Intimately related to FSAs
  • Practical applications in searching through
    strings.

44
Three Operators
  • Union (01)
  • accepts/matches either 0 or 1.
  • Concatenation 01
  • matches 0 followed by 1
  • Repetition 0
  • Matches any number of zeros (including 0)

45
Examples
  • These operators can be applied to regular
    expressions
  • (01)1 (matches any string that ends in a 1)
  • (01)(01)) (matches any even length string)
Write a Comment
User Comments (0)
About PowerShow.com