0% found this document useful (0 votes)
41 views

Chapter 5 Turing Machines

Uploaded by

abdumulate16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Chapter 5 Turing Machines

Uploaded by

abdumulate16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 49

Chapter Five

Turing Machines

1
Turing Machines:

 A simple mathematical model of a general purpose

computer.

 It is capable of performing any calculation which can be

performed by any computing machine.

 Invented by Alan Turing in 1936.

2
A Turing Machine
Tape
...... ......

Read-Write head
Control Unit

3
The Tape
No boundaries -- infinite length
...... ......

Read-Write head

The head moves Left or Right


4
...... ......

Read-Write head
The head at each time step:

1. Reads a symbol
2. Writes a symbol
3. Moves Left or Right

5
Example:
Time 0
...... a b a c ......

Time 1
...... a b k c ......

1. Reads a
2. Writes k
3. Moves Left
6
Time 1
...... a b k c ......

Time 2
...... a f k c ......

1. Reads b
2. Writes f
3. Moves Right
7
The Input String

Input string Blank symbol

......   a b a c    ......

head
Head starts at the leftmost position
of the input string
 Are treated as left and right brackets for the
input written on the tape.
8
9
States & Transitions

Read Write
Move Left

q1 a  b, L q2

Move Right

q1 a  b, R q2
10
Determinism
Turing Machines are deterministic

Allowed Not Allowed


a  b, R q2 a  b, R q2

q1 q1
q3 a  d, L q3
b  d, L

No lambda transitions allowed


11
Example:
......   a b a c    ......

a  b, R q2 q1

q1 No possible transition

b  d, L q3 HALT!!!

Halting
- the machine halts if there are no possible transitions to follow.

12
Final States
q1 q2 Allowed

q1 q2 Not Allowed

 Final states have no outgoing transitions


 In a final state the machine halts
13
Acceptance
If machine halts
Accept Input
in a final state

If machine halts
in a non-final state
Reject Input or
If machine enters
an infinite loop
14
Turing Machine Example
A Turing machine that accepts the
language: aa *

a  a, R

  , L
q0 q1

15
Time 0   a a a  

q0

a  a, R

  , L
q0 q1

16
Time 1   a a a  

q0

a  a, R

  , L
q0 q1

17
Time 2   a a a  

q0

a  a, R

  , L
q0 q1

18
Time 3   a a a  

q0

a  a, R

  , L
q0 q1

19
Time 4   a a a  

q1

a  a, R Halt & Accept

  , L
q0 q1

20
Rejection Example

Time 0   a b a  

q0

a  a, R

  , L
q0 q1
21
Time 1   a b a  

q0
No possible Transition
a  a, R Halt & Reject

  , L
q0 q1
22
Infinite Loop Example

b  b, L
a  a, R

  , L
q0 q1

23
Time 0   a b a  

q0

b  b, L
a  a, R

  , L
q0 q1

24
Time 1   a b a  

q0

b  b, L
a  a, R

  , L
q0 q1

25
Time 2   a b a  

b  b, L q0
a  a, R

  , L
q0 q1

26
Another Turing Machine Example

Turing machine for the language n n


{a b }

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
27 x  x, R
Time 0  a a b b  

q0

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
28 x  x, R
Time 1  x a b b  

q1

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
29 x  x, R
Time 2  x a b b  

q1

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
30 x  x, R
Time 3  x a y b  

q2

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
31 x  x, R
Time 4  x a y b  

q2

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
32 x  x, R
Time 5  x a y b  

q0

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
33 x  x, R
Time 6  x x y b  

q1

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
34 x  x, R
Time 7  x x y b  

q1

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
35 x  x, R
Time 8  x x y y  

q2

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
36 x  x, R
Time 9  x x y y  

q2

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
37 x  x, R
Time 10  x x y y  

q0

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
38 x  x, R
Time 11  x x y y  

q3

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
39 x  x, R
Time 12  x x y y  

q3

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
40 x  x, R
Time 13  x x y y  

q4
Halt & Accept

q4 y  y, R y  y, L
y  y, R a  a, R a  a, L
  , L
y  y, R a  x, R b  y, L
q3 q0 q1 q2
41 x  x, R
Undecidability

 Turing Decidable
 Turing Acceptable
 Undecidable Problems

42
Recognizability and Decidability
A language is recognizable if there is a Turing Machine that
recognizes it.
A language is decidable if there is a Turing Machine that
decides it.

43
44
Cont….

45
Cont….

46
Language Accepted by Turing Machine/ Turing Acceptable

 The T.M accepts all the language even though they are recursive
enumerable.
 Recursive means repeating same set of rules for any number of
times.
 Enumerable means a list of elements.
 TM also accepts the computable functions, such as addition,
multiplication, subtraction, division and many more.

47
Undecidable Problems

 In computability theory and computational complexity theory, an undecidable


problem is a decision problem for which it is proved to be impossible to construct
an algorithm that always leads to a correct yes-or-no answer.
 Its Undecidable Language:- there is no Turing Machine which accepts the
language and makes a decision for every input.
 Examples
 Halting Problem
 Mortality Problem
 Boolean Satisfiability Problem
 Are an example: they are proven that there is no algorithm that correctly
determines
48 whether arbitrary programs eventually halt when run.
49

You might also like