SlideShare a Scribd company logo
1 of 82
Turing Machines
Invented by Alan Turing in 1936.
A simple mathematical model of a general
purpose computer.
It is capable of performing any calculation
which can be performed by any computing
machine.
The Language Hierarchy
*a
Regular Languages
Context-Free Languages
nn
ba R
ww
nnn
cba ww?
**ba
?
*a
Regular Languages
Context-Free Languages
nn
ba R
ww
nnn
cba ww
**ba
Languages accepted by
Turing Machines
Finite
Automata
NDPA
A Turing Machine
............
Tape
Read-Write head
Control Unit
The Tape
............
Read-Write head
No boundaries -- infinite length
The head moves Left or Right
............
Read-Write head
The head at each time step:
1. Reads a symbol
2. Writes a symbol
3. Moves Left or Right
............
Example:
Time 0
............
Time 1
1. Reads
2. Writes
a a cb
a b k c
a
k
3. Moves Left
............
Time 1
a b k c
............
Time 2
a k cf
1. Reads
2. Writes
b
f
3. Moves Right
The Input String
............
Blank symbol
head
a b ca
Head starts at the leftmost position
of the input string
Input string
Are treated as left and right brackets for the
input written on the tape.
States & Transitions
1q 2qLba ,
Read Write
Move Left
1q 2qRba ,
Move Right
Example:
1q 2qRba ,
............ a b ca
Time 1
1q
current state
............ a b ca
Time 1
1q 2qRba ,
............ a b cb
Time 2
1q
2q
............ a b ca
Time 1
1q 2qLba ,
............ a b cb
Time 2
1q
2q
Example:
............ a b ca
Time 1
1q 2qRg,
............ ga b cb
Time 2
1q
2q
Example:
Determinism
1q
2qRba ,
Allowed Not Allowed
3qLdb ,
1q
2qRba ,
3qLda ,
No lambda transitions allowed
Turing Machines are deterministic
Partial Transition Function
1q
2qRba ,
3qLdb ,
............ a b ca
1q
Example:
No transition
for input symbol c
Allowed:
Halting
The machine halts if there are
no possible transitions to follow
Example:
............ a b ca
1q
1q
2qRba ,
3qLdb ,
No possible transition
HALT!!!
Final States
1q 2q Allowed
1q 2q Not Allowed
• Final states have no outgoing transitions
• In a final state the machine halts
Acceptance
Accept Input
If machine halts
in a final state
Reject Input
If machine halts
in a non-final state
or
If machine enters
an infinite loop
Turing Machine Example
A Turing machine that accepts the language:
*aa
0q
Raa ,
L,
1q
aaTime 0
0q
a
0q
Raa ,
L,
1q
aaTime 1
0q
a
0q
Raa ,
L,
1q
aaTime 2
0q
a
0q
Raa ,
L,
1q
aaTime 3
0q
a
0q
Raa ,
L,
1q
aaTime 4
1q
a
0q
Raa ,
L,
1q
Halt & Accept
Rejection Example
0q
Raa ,
L,
1q
baTime 0
0q
a
0q
Raa ,
L,
1q
baTime 1
0q
a
No possible Transition
Halt & Reject
Infinite Loop Example
0q
Raa ,
L,
1q
Lbb ,
baTime 0
0q
a
0q
Raa ,
L,
1q
Lbb ,
baTime 1
0q
a
0q
Raa ,
L,
1q
Lbb ,
baTime 2
0q
a
0q
Raa ,
L,
1q
Lbb ,
baTime 2
0q
a
baTime 3
0q
a
baTime 4
0q
a
baTime 5
0q
a
... Infinite Loop
Because of the infinite loop:
•The final state cannot be reached
•The machine never halts
•The input is not accepted
Another Turing Machine
Example
Turing machine for the language }{ nn
ba
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
ba
0q
a bTime 0
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
bx
1q
a bTime 1
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
bx
1q
a bTime 2
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
yx
2q
a bTime 3
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
yx
2q
a bTime 4
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
yx
0q
a bTime 5
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
yx
1q
x bTime 6
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
yx
1q
x bTime 7
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
yx x y
2q
Time 8
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
yx x y
2q
Time 9
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
yx
0q
x yTime 10
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
yx
3q
x yTime 11
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
yx
3q
x yTime 12
0q 1q 2q3q
Rxa ,
Raa ,
Ryy ,
Lyb ,
Laa ,
Lyy ,
Rxx ,
Ryy ,
Ryy ,
4q
L,
yx
4q
x y
Halt & Accept
Time 13
If we modify the
machine for the language }{ nn
ba
we can easily construct
a machine for the language }{ nnn
cba
Observation:
Formal Definitions
for
Turing Machines
1q 2qLdc ,
),,(),( 21 Ldqcq
Transition Function
Turing Machine:
),,,,,,( 0 FqQM
States
Input
alphabet
Tape
alphabet
A partial
Transition
function Initial
state
Blank : a special symbol
Of
Final
states
Configuration
ba
1q
a
Instantaneous description:
c
baqca 1
yx
2q
a b
Time 4
yx
0q
a b
Time 5
A Move: aybqxxaybq 02 
yx
2q
a b
Time 4
yx
0q
a b
Time 5
bqxxyybqxxaybqxxaybq 1102 
yx
1q
x b
Time 6
yx
1q
x b
Time 7
bqxxyybqxxaybqxxaybq 1102 
bqxxyxaybq 12 Equivalent notation:
Initial configuration: wq0
ba
0q
a b
w
Input string
The Accepted Language
For any Turing Machine M
}:{)( 210 xqxwqwML f
Initial state Final state
Standard Turing Machine
• Deterministic
• Infinite tape in both directions
•Tape is the input/output file
The machine we described is the standard:
Design a Turing machine to recognize all
strings in which 010 is present as a
substring.
q0 q1 q2 H
0,0,R 1,1,R 0,0,R
0,0,R
1,1, R
1,1,R
DFA for the previous language
q0 q1 q2
0 1 0
0
1
1
0 , 1
Turing machine for odd no of 1’s
1, 1 , R
1, b , R
1, b , R
Recursively Enumerable
and
Recursive
Languages
Definition:
A language is recursively enumerable
if some Turing machine accepts it
For string :
Let be a recursively enumerable languageL
and the Turing Machine that accepts itM
Lw
w
if then halts in a final stateM
Lwif then halts in a non-final stateM
or loops forever
Definition:
A language is recursive
if some Turing machine accepts it
and halts on any input string
In other words:
A language is recursive if there is
a membership algorithm for it
For string :
Let be a recursive languageL
and the Turing Machine that accepts itM
Lw
w
if then halts in a final stateM
Lwif then halts in a non-final stateM
We will prove:
1. There is a specific language
which is not recursively enumerable
(not accepted by any Turing Machine)
2. There is a specific language
which is recursively enumerable
but not recursive
Recursive
Recursively Enumerable
Non Recursively Enumerable
We will first prove:
• If a language is recursive then
there is an enumeration procedure for it
• A language is recursively enumerable
if and only if
there is an enumeration procedure for it
The Chomsky Hierarchy
Unrestricted Grammars:
Productions
vu
String of variables
and terminals
String of variables
and terminals
Example unrestricted grammar:
dAc
cAaB
aBcS
A language is recursively enumerable
if and only if is generated by an
unrestricted grammar
L
L
Theorem:
Context-Sensitive Grammars:
and: |||| vu
Productions
vu
String of variables
and terminals
String of variables
and terminals
The language }{ nnn
cba
is context-sensitive:
aaAaaaB
BbbB
BbccAc
bAAb
aAbcabcS
|
|
The language }{ nnn
cba
is context-sensitive:
aaAaaaB
BbbB
BbccAc
bAAb
aAbcabcS
|
|
A language is context sensistive
if and only if
is accepted by a Linear-Bounded automatonL
L
Theorem:
There is a language which is context-sensitive
but not recursive
Observation:
Non-recursively enumerable
Recursively-enumerable
Recursive
Context-sensitive
Context-free
Regular
The Chomsky Hierarchy

More Related Content

More from Melaku Bayih Demessie (6)

Reed solomon code
Reed solomon codeReed solomon code
Reed solomon code
 
C2.0 propositional logic
C2.0 propositional logicC2.0 propositional logic
C2.0 propositional logic
 
Chapter 5 of 1
Chapter 5 of 1Chapter 5 of 1
Chapter 5 of 1
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
minimum spanning tree
minimum spanning tree minimum spanning tree
minimum spanning tree
 
Divide and Conquer
Divide and ConquerDivide and Conquer
Divide and Conquer
 

Recently uploaded

Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 

Recently uploaded (20)

Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 

Turingmachines