1
Turing Machines
Reading: Chapter 8
2
Turing Machines are…
 Very powerful (abstract) machines that
could simulate any modern day
computer (although very, very slowly!)
 Why design such a machine?
 If a problem cannot be “solved” even using
a TM, then it implies that the problem is
undecidable
 Computability vs. Decidability
For every input,
answer YES or NO
3
A Turing Machine (TM)
 M = (Q, ∑, , , q0,B,F)
B B B X1 X2 X3 … Xi … Xn B B
… …
Finite
control
Infinite tape with tape symbols
B: blank symbol (special symbol reserved to indicate data boundary)
Input & output tape symbols
Tape head
This is like
the CPU &
program
counter
Tape is the
memory
4
Transition function
 One move (denoted by |---)
in a TM does the following:
 (q,X) = (p,Y,D)

q is the current state

X is the current tape symbol pointed by
tape head

State changes from q to p

After the move:
 X is replaced with symbol Y
 If D=“L”, the tape head moves “left” by
one position.
Alternatively, if D=“R” the tape head
moves “right” by one position.
q p
X / Y,D
You can also use:
 for R
 for L
5
ID of a TM
 Instantaneous Description or ID :

X1X2…Xi-1qXiXi+1…Xn
means:

q is the current state

Tape head is pointing to Xi

X1X2…Xi-1XiXi+1…Xn are the current tape symbols
 (q,Xi) = (p,Y,R) is same as:
X1…Xi-1qXi…Xn |---- X1…Xi-1YpXi+1…Xn
 (q,Xi) = (p,Y,L) is same as:
X1…Xi-1qXi…Xn |---- X1…pXi-1YXi+1…Xn
6
Way to check for Membership
 Is a string w accepted by a TM?
 Initial condition:
 The (whole) input string w is present in TM,
preceded and followed by infinite blank symbols
 Final acceptance:
 Accept w if TM enters final state and halts
 If TM halts and not final state, then reject
7
Example: L = {0n
1n
| n≥1}
 Strategy: w = 000111
0 1 1 1
0
0 B B
B
B
… …
0 1 1 1
0
X B B
B
B
… …
… 0 Y 1 1
0
X B B
B
B …
0 Y 1 1
X
X B B
B
B
… …
0 Y Y 1
X
X B B
B
B
… …
X Y Y 1
X
X B B
B
B …
X Y Y Y
X
X B B
B
B …
Accept
X Y Y Y
X
X B B
B
B …
…
…
…
…
…
8
TM for {0n
1n
| n≥1}
q0 q1
0 / X,R
0 / 0,R
q2
1 / Y,L
Y / Y,L
0 / 0,L
X / X,R
q3
Y / Y,R
Y / Y,R
q4
B / B,R
1. Mark next unread 0 with X
and move right
2. Move to the right all the way
to the first unread 1, and mark
it with Y
3. Move back (to the left) all the
way to the last marked X, and
then move one position to the
right
4. If the next position is 0, then
goto step 1.
Else move all the way to the
right to ensure there are no
excess 1s. If not move right to
the next blank symbol and
stop & accept.
Y / Y,R
9
TM for {0n
1n
| n≥1}
Next Tape Symbol
Curr.
State
0 1 X Y B
q0 (q1,X,R) - - (q3,Y,R) -
q1 (q1,0,R) (q2,Y,L) - (q1,Y,R) -
q2 (q2,0,L) - (q0,X,R) (q2,Y,L) -
q3 - - - (q3,Y,R) (q4,B,R)
*q4 - -- - - -
Table representation of the state diagram
*state diagram representation preferred
10
TMs for calculations
 TMs can also be used for calculating
values
 Like arithmetic computations
 Eg., addition, subtraction, multiplication,
etc.
11
Example 2: monus subtraction
“m -- n” = max{m-n,0}
0m
10n
 ...B 0m-n
B.. (if m>n)
...BB…B.. (otherwise)
1. For every 0 on the left (mark X), mark off a 0 on the right
(mark Y)
2. Repeat process, until one of the following happens:
1. // No more 0s remaining on the left of 1
Answer is 0, so flip all excess 0s on the right of 1 to Bs
(and the 1 itself) and halt
2. //No more 0s remaining on the right of 1
Answer is m-n, so simply halt after making 1 to B
Give
state
diagram
12
Example 3: Multiplication
 0m
10n
1 (input), 0mn
1 (output)
 Pseudocode:
1. Move tape head back & forth such that for every
0 seen in 0m
, write n 0s to the right of the last
delimiting 1
2. Once written, that zero is changed to B to get
marked as finished
3. After completing on all m 0s, make the
remaining n 0s and 1s also as Bs
Give
state
diagram
Calculations vs. Languages
13
A “calculation” is one
that takes an input
and outputs a value
(or values)
A “language” is a set
of strings that meet
certain criteria
The “language” for a certain
calculation is the set of strings of
the form “<input, output>”, where
the output corresponds to a valid
calculated value for the input
“<0#0,0>”
“<0#1,1>”
…
“<2#4,6>”
…
E.g., The language Ladd for the addition operation
Membership question == verifying a solution
e.g., is “<15#12,27>” a member of Ladd ?
14
Language of the Turing
Machines
 Recursive Enumerable (RE) language
Regular
(DFA)
Context-
free
(PDA)
Context
sensitive
Recursively
Enumerable
Variations of Turing Machines
15
16
TMs with storage
 E.g., TM for 01* + 10*
q
storage
Tape head
1 1 1 1
1
0 B B
B
B …
Transition function :
• ([q0,B],a) = ([q1,a], a, R)
• ([q1,a],a) = ([q1,a], a, R)
• ([q1,a],B) = ([q2,B], B, R)
[q,a]: where q is current state,
a is the symbol in storage
Are the standard TMs
equivalent to TMs with storage?
Yes
Generic description
Will work for both a=0 and a=1
Current
state
Current
Storage
symbol
Tape
symbol
Next
state
New
Storage
symbol
18
Multi-track Turing Machines
 TM with multiple tracks,
but just one unified tape head
control
… …
… …
… …
Track 1
Track 2
Track k
…
One tape head to read
k symbols from the k tracks
at one step.
…
19
Multi-Track TMs
 TM with multiple “tracks” but just one
head E.g., TM for {wcw | w {0,1}* }
but w/o modifying original input string
control
Tape head
0 c 0 1
1
0 0 B
B
B …
… Track 1
X c Y Y
X
X Y B
B
B …
… Track 2
AFTER
control
Tape head
0 c 0 1
1
0 0 B
B
B …
… Track 1
B B B B
B
B B B
B
B …
… Track 2
BEFORE
Second track mainly used as a scratch space for marking
22
Multi-tape Turing Machines
 TM with multiple tapes, each tape with a
separate head
 Each head can move independently of the
others
control
… …
… …
… …
Tape 1
Tape 2
Tape k
…
k separate heads
26
Non-deterministic TMs
 A TM can have non-deterministic moves:

(q,X) = { (q1,Y1,D1), (q2,Y2,D2), … }
 Simulation using a multitape deterministic
TM:
Control
ID1 ID2 ID3 ID4
* * * *
Scratch tape
Input tape
Marker tape
Non-deterministic TMs  Deterministic TMs
27
Summary
 TMs == Recursively Enumerable languages
 TMs can be used as both:
 Language recognizers
 Calculators/computers
 Basic TM is equivalent to all the below:
1. TM + storage
2. Multi-track TM
3. Multi-tape TM
4. Non-deterministic TM
 TMs are like universal computing machines
with unbounded storage

More Related Content

PPTX
TuringMachines-myppt.pptx
PDF
Theory of computation complete 5th module
PPT
1LECTURE 9TuringMachines.ppt
PDF
Turing machines
PDF
TuringMachines.pdf
PDF
L1_TMs_Primitive_Godel.pdf Theory of com
PPT
Turing Machine
PPT
TuringMachineS FOUNDATION OF DATA SCIENCE
TuringMachines-myppt.pptx
Theory of computation complete 5th module
1LECTURE 9TuringMachines.ppt
Turing machines
TuringMachines.pdf
L1_TMs_Primitive_Godel.pdf Theory of com
Turing Machine
TuringMachineS FOUNDATION OF DATA SCIENCE

Similar to AUTOMATA AUTOMATA AUTOMATAAutomata9Chapter8.pptx (20)

PPT
THEORY OF COMPUTATION PROCESS AND MECHANISUMS
PPTX
Automata Theory - Turing machine
PPTX
Winter 8 Tutorial TM.pptx
PPTX
Turing machine by_deep
PPT
Unit-3_TOC theory of computation subj.ppt
PPT
5 decidability theory of computation
PPT
TuringMachines and its introduction for computer science studetns
PPT
TuringMachines.ppt
PPTX
Turing machine
PPTX
souraj Toc.pptx
PPT
Turing machine power point presentations
PPTX
symbolic_automata or Advanced Programming Practice.pptx
PPTX
Chapter 3: Simplification of Boolean Function
PPT
Matrix 2 d
PDF
PDF
smtlecture.5
PPTX
Succinct Data Structure for Analyzing Document Collection
PPTX
Online Signals and Systems Assignment Help
PPTX
CS 5th.pptx
PDF
Some New Exercises on Computability Theory Associated with Turing Machine
THEORY OF COMPUTATION PROCESS AND MECHANISUMS
Automata Theory - Turing machine
Winter 8 Tutorial TM.pptx
Turing machine by_deep
Unit-3_TOC theory of computation subj.ppt
5 decidability theory of computation
TuringMachines and its introduction for computer science studetns
TuringMachines.ppt
Turing machine
souraj Toc.pptx
Turing machine power point presentations
symbolic_automata or Advanced Programming Practice.pptx
Chapter 3: Simplification of Boolean Function
Matrix 2 d
smtlecture.5
Succinct Data Structure for Analyzing Document Collection
Online Signals and Systems Assignment Help
CS 5th.pptx
Some New Exercises on Computability Theory Associated with Turing Machine
Ad

More from ArjayBalberan1 (20)

PDF
PPE-Module-1.2 PPE-Module-1.2 PPE-Module-1.2.pdf
PDF
PPE-Module-1.1 PPE-Module-1.1 PPE-Module-1.1.pdf
PPTX
LESSON 5 LESSON 5 LESSON 5 LESSON 5.pptx
PPTX
LESSON 1 AUTOMATA LESSON 1 AUTOMATA.pptx
PPTX
AUTOMATA AUTOMATA Automata10Chapter-8-and-9.pptx
PPTX
AUTOMATA AUTOMATA Automata8Chapter7.pptx
PPTX
AUTOMATA AUTOMATA AUTOMATAAutomata7Chapter6.pptx
PPTX
AUTOMATA AUTOMATA AUTOMATA Automata6Chapter5.pptx
PPTX
AUTOMATA AUTOMATA Automata5Chapter4.pptx
PPTX
AUTOMATA AUTOMATA Automata4Chapter3.pptx
PPTX
AUTOMATA THEORY AUTOMATA THEORYAutomata3Chapter2.pptx
PPTX
automata theory and formal languages Automata2Chapter1.pptx
PPTX
Group-1 (1) Group-1 (1) Group-1 (1)Group-1 (1).pptx
PPTX
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASECSS.pptx
PPTX
Introduction to Algorithms Introduction to Algorithms.pptx
PPTX
MYSQL DATABASE MYSQL DATABASEGroup-1.pptx
PPTX
Appdev appdev appdev app devAPPDEV 1.2.pptx
PPTX
Rizals-Family-Childhood-Early-Education.pptx
PPTX
MYSQL DATABASE Operating System Part2 (1).pptx
PPTX
MYSQL DATABASE APP DEV POWERPOINT 1.pptx
PPE-Module-1.2 PPE-Module-1.2 PPE-Module-1.2.pdf
PPE-Module-1.1 PPE-Module-1.1 PPE-Module-1.1.pdf
LESSON 5 LESSON 5 LESSON 5 LESSON 5.pptx
LESSON 1 AUTOMATA LESSON 1 AUTOMATA.pptx
AUTOMATA AUTOMATA Automata10Chapter-8-and-9.pptx
AUTOMATA AUTOMATA Automata8Chapter7.pptx
AUTOMATA AUTOMATA AUTOMATAAutomata7Chapter6.pptx
AUTOMATA AUTOMATA AUTOMATA Automata6Chapter5.pptx
AUTOMATA AUTOMATA Automata5Chapter4.pptx
AUTOMATA AUTOMATA Automata4Chapter3.pptx
AUTOMATA THEORY AUTOMATA THEORYAutomata3Chapter2.pptx
automata theory and formal languages Automata2Chapter1.pptx
Group-1 (1) Group-1 (1) Group-1 (1)Group-1 (1).pptx
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASECSS.pptx
Introduction to Algorithms Introduction to Algorithms.pptx
MYSQL DATABASE MYSQL DATABASEGroup-1.pptx
Appdev appdev appdev app devAPPDEV 1.2.pptx
Rizals-Family-Childhood-Early-Education.pptx
MYSQL DATABASE Operating System Part2 (1).pptx
MYSQL DATABASE APP DEV POWERPOINT 1.pptx
Ad

Recently uploaded (20)

PDF
Flame analysis and combustion estimation using large language and vision assi...
PPTX
Microsoft Excel 365/2024 Beginner's training
PDF
STKI Israel Market Study 2025 version august
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PDF
UiPath Agentic Automation session 1: RPA to Agents
PDF
CloudStack 4.21: First Look Webinar slides
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PPTX
The various Industrial Revolutions .pptx
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Flame analysis and combustion estimation using large language and vision assi...
Microsoft Excel 365/2024 Beginner's training
STKI Israel Market Study 2025 version august
Module 1.ppt Iot fundamentals and Architecture
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Improvisation in detection of pomegranate leaf disease using transfer learni...
The influence of sentiment analysis in enhancing early warning system model f...
UiPath Agentic Automation session 1: RPA to Agents
CloudStack 4.21: First Look Webinar slides
NewMind AI Weekly Chronicles – August ’25 Week III
Developing a website for English-speaking practice to English as a foreign la...
A review of recent deep learning applications in wood surface defect identifi...
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
Enhancing plagiarism detection using data pre-processing and machine learning...
The various Industrial Revolutions .pptx
Credit Without Borders: AI and Financial Inclusion in Bangladesh
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Chapter 5: Probability Theory and Statistics
Getting started with AI Agents and Multi-Agent Systems
How ambidextrous entrepreneurial leaders react to the artificial intelligence...

AUTOMATA AUTOMATA AUTOMATAAutomata9Chapter8.pptx

  • 2. 2 Turing Machines are…  Very powerful (abstract) machines that could simulate any modern day computer (although very, very slowly!)  Why design such a machine?  If a problem cannot be “solved” even using a TM, then it implies that the problem is undecidable  Computability vs. Decidability For every input, answer YES or NO
  • 3. 3 A Turing Machine (TM)  M = (Q, ∑, , , q0,B,F) B B B X1 X2 X3 … Xi … Xn B B … … Finite control Infinite tape with tape symbols B: blank symbol (special symbol reserved to indicate data boundary) Input & output tape symbols Tape head This is like the CPU & program counter Tape is the memory
  • 4. 4 Transition function  One move (denoted by |---) in a TM does the following:  (q,X) = (p,Y,D)  q is the current state  X is the current tape symbol pointed by tape head  State changes from q to p  After the move:  X is replaced with symbol Y  If D=“L”, the tape head moves “left” by one position. Alternatively, if D=“R” the tape head moves “right” by one position. q p X / Y,D You can also use:  for R  for L
  • 5. 5 ID of a TM  Instantaneous Description or ID :  X1X2…Xi-1qXiXi+1…Xn means:  q is the current state  Tape head is pointing to Xi  X1X2…Xi-1XiXi+1…Xn are the current tape symbols  (q,Xi) = (p,Y,R) is same as: X1…Xi-1qXi…Xn |---- X1…Xi-1YpXi+1…Xn  (q,Xi) = (p,Y,L) is same as: X1…Xi-1qXi…Xn |---- X1…pXi-1YXi+1…Xn
  • 6. 6 Way to check for Membership  Is a string w accepted by a TM?  Initial condition:  The (whole) input string w is present in TM, preceded and followed by infinite blank symbols  Final acceptance:  Accept w if TM enters final state and halts  If TM halts and not final state, then reject
  • 7. 7 Example: L = {0n 1n | n≥1}  Strategy: w = 000111 0 1 1 1 0 0 B B B B … … 0 1 1 1 0 X B B B B … … … 0 Y 1 1 0 X B B B B … 0 Y 1 1 X X B B B B … … 0 Y Y 1 X X B B B B … … X Y Y 1 X X B B B B … X Y Y Y X X B B B B … Accept X Y Y Y X X B B B B … … … … … …
  • 8. 8 TM for {0n 1n | n≥1} q0 q1 0 / X,R 0 / 0,R q2 1 / Y,L Y / Y,L 0 / 0,L X / X,R q3 Y / Y,R Y / Y,R q4 B / B,R 1. Mark next unread 0 with X and move right 2. Move to the right all the way to the first unread 1, and mark it with Y 3. Move back (to the left) all the way to the last marked X, and then move one position to the right 4. If the next position is 0, then goto step 1. Else move all the way to the right to ensure there are no excess 1s. If not move right to the next blank symbol and stop & accept. Y / Y,R
  • 9. 9 TM for {0n 1n | n≥1} Next Tape Symbol Curr. State 0 1 X Y B q0 (q1,X,R) - - (q3,Y,R) - q1 (q1,0,R) (q2,Y,L) - (q1,Y,R) - q2 (q2,0,L) - (q0,X,R) (q2,Y,L) - q3 - - - (q3,Y,R) (q4,B,R) *q4 - -- - - - Table representation of the state diagram *state diagram representation preferred
  • 10. 10 TMs for calculations  TMs can also be used for calculating values  Like arithmetic computations  Eg., addition, subtraction, multiplication, etc.
  • 11. 11 Example 2: monus subtraction “m -- n” = max{m-n,0} 0m 10n  ...B 0m-n B.. (if m>n) ...BB…B.. (otherwise) 1. For every 0 on the left (mark X), mark off a 0 on the right (mark Y) 2. Repeat process, until one of the following happens: 1. // No more 0s remaining on the left of 1 Answer is 0, so flip all excess 0s on the right of 1 to Bs (and the 1 itself) and halt 2. //No more 0s remaining on the right of 1 Answer is m-n, so simply halt after making 1 to B Give state diagram
  • 12. 12 Example 3: Multiplication  0m 10n 1 (input), 0mn 1 (output)  Pseudocode: 1. Move tape head back & forth such that for every 0 seen in 0m , write n 0s to the right of the last delimiting 1 2. Once written, that zero is changed to B to get marked as finished 3. After completing on all m 0s, make the remaining n 0s and 1s also as Bs Give state diagram
  • 13. Calculations vs. Languages 13 A “calculation” is one that takes an input and outputs a value (or values) A “language” is a set of strings that meet certain criteria The “language” for a certain calculation is the set of strings of the form “<input, output>”, where the output corresponds to a valid calculated value for the input “<0#0,0>” “<0#1,1>” … “<2#4,6>” … E.g., The language Ladd for the addition operation Membership question == verifying a solution e.g., is “<15#12,27>” a member of Ladd ?
  • 14. 14 Language of the Turing Machines  Recursive Enumerable (RE) language Regular (DFA) Context- free (PDA) Context sensitive Recursively Enumerable
  • 15. Variations of Turing Machines 15
  • 16. 16 TMs with storage  E.g., TM for 01* + 10* q storage Tape head 1 1 1 1 1 0 B B B B … Transition function : • ([q0,B],a) = ([q1,a], a, R) • ([q1,a],a) = ([q1,a], a, R) • ([q1,a],B) = ([q2,B], B, R) [q,a]: where q is current state, a is the symbol in storage Are the standard TMs equivalent to TMs with storage? Yes Generic description Will work for both a=0 and a=1 Current state Current Storage symbol Tape symbol Next state New Storage symbol
  • 17. 18 Multi-track Turing Machines  TM with multiple tracks, but just one unified tape head control … … … … … … Track 1 Track 2 Track k … One tape head to read k symbols from the k tracks at one step. …
  • 18. 19 Multi-Track TMs  TM with multiple “tracks” but just one head E.g., TM for {wcw | w {0,1}* } but w/o modifying original input string control Tape head 0 c 0 1 1 0 0 B B B … … Track 1 X c Y Y X X Y B B B … … Track 2 AFTER control Tape head 0 c 0 1 1 0 0 B B B … … Track 1 B B B B B B B B B B … … Track 2 BEFORE Second track mainly used as a scratch space for marking
  • 19. 22 Multi-tape Turing Machines  TM with multiple tapes, each tape with a separate head  Each head can move independently of the others control … … … … … … Tape 1 Tape 2 Tape k … k separate heads
  • 20. 26 Non-deterministic TMs  A TM can have non-deterministic moves:  (q,X) = { (q1,Y1,D1), (q2,Y2,D2), … }  Simulation using a multitape deterministic TM: Control ID1 ID2 ID3 ID4 * * * * Scratch tape Input tape Marker tape Non-deterministic TMs  Deterministic TMs
  • 21. 27 Summary  TMs == Recursively Enumerable languages  TMs can be used as both:  Language recognizers  Calculators/computers  Basic TM is equivalent to all the below: 1. TM + storage 2. Multi-track TM 3. Multi-tape TM 4. Non-deterministic TM  TMs are like universal computing machines with unbounded storage