SlideShare a Scribd company logo
1 of 68
Download to read offline
© 2020 Wael Badawy
1
Turing Machines
1
DISCLAIMER:
This video is optimized for HD large display using
patented and patent-pending “Nile Codec”, the first
Egyptian Video Codec for more information,
PLEASE check https://NileCodec.com
Also available as a PodCast
© 2020 Wael Badawy
Copyright © 2020 Wael Badawy. All rights reserved
n This video is subject to copyright owned by Wael Badawy “WB”. Any
reproduction or republication of all or part of this video is expressly prohibited
unless WB has explicitly granted its prior written consent. All other rights
reserved.
n This video is intended for education and information only and is offered AS IS,
without any warranty of the accuracy or the quality of the content. Any other
use is strictly prohibited. The viewer is fully responsible to verify the accuracy
of the contents received without any claims of costs or liability arising .
n The names, trademarks service marked as logos of WB or the sponsors
appearing in this video may not be used in any any product or service,
without prior express written permission from WB and the video sponsors
n Neither WB nor any party involved in creating, producing or delivering
information and material via this video shall be liable for any direction,
incidental, consequential, indirect of punitive damages arising out of access
to, use or inability to use this content or any errors or omissions in the
content thereof.
n If you will continue to watch this video, you agree to the terms above and
other terms that may be available on http://nu.edu.eg & https://caiwave.net
2
© 2020 Wael Badawy
© 2020 Wael Badawy
The Language Hierarchy
4
*a
Regular Languages
Context-Free Languages
nn
ba R
ww
nnn
cba ww?
**ba
?
© 2020 Wael Badawy
5
*a
Regular Languages
Context-Free Languages
nn
ba R
ww
nnn
cba ww
**ba
Languages accepted by
Turing Machines
© 2020 Wael Badawy
A Turing Machine
6
............
Tape
Read-Write head
Control Unit
© 2020 Wael Badawy
The Tape
7
............
Read-Write head
No boundaries -- infinite length
The head moves Left or Right
© 2020 Wael Badawy
8
............
Read-Write head
The head at each transition (time step):
1. Reads a symbol
2. Writes a symbol
3. Moves Left or Right
© 2020 Wael Badawy
9
............
Example:
Time 0
............
Time 1
1. Reads
2. Writes
a a cb
a b k c
a
k
3. Moves Left
© 2020 Wael Badawy
10
............
Time 1
a b k c
............
Time 2
a k cf
1. Reads
2. Writes
b
f
3. Moves Right
© 2020 Wael Badawy
The Input String
11
............ à à à à
Blank symbol
head
àa b ca
Head starts at the leftmost position
of the input string
Input string
© 2020 Wael Badawy
States & Transitions
12
1q 2qLba ,®
Read Write
Move Left
1q 2qRba ,®
Move Right
© 2020 Wael Badawy
13
Example:
1q 2qRba ,®
............ à à à ààa b ca
Time 1
1q
current state
© 2020 Wael Badawy
14
............ à à à ààa b ca
Time 1
1q 2qRba ,®
............ à à à ààa b cb
Time 2
1q
2q
© 2020 Wael Badawy
15
............ à à à ààa b ca
Time 1
1q 2qLba ,®
............ à à à ààa b cb
Time 2
1q
2q
Example:
© 2020 Wael Badawy
16
............ à à à ààa b ca
Time 1
1q 2qRg,®à
............ à à à àga b cb
Time 2
1q
2q
Example:
© 2020 Wael Badawy
Determinism
17
1q
2qRba ,®
Allowed Not Allowed
3qLdb ,®
1q
2qRba ,®
3qLda ,®
Turing Machines are deterministic
© 2020 Wael Badawy
Partial Transition Function
18
1q
2qRba ,®
3qLdb ,®
............ à à à ààa b ca
1q
Example:
No transition
for input symbol c
Allowed:
© 2020 Wael Badawy
Halting
19
The machine halts in a state if there is
no transition to follow
© 2020 Wael Badawy
20
Halting Example 1:
............ à à à ààa b ca
1q
1q No transition from
HALT!!!
1q
© 2020 Wael Badawy
21
Halting Example 2:
............ à à à ààa b ca
1q
1q
2qRba ,®
3qLdb ,®
No possible transition
from and symbol
HALT!!!
1q c
© 2020 Wael Badawy
Accepting States
22
1q 2q Allowed
1q 2q Not Allowed
•Accepting states have no outgoing transitions
•The machine halts and accepts
© 2020 Wael Badawy
Acceptance
23
Accept Input
If machine halts
in an accept state
Reject Input
If machine halts
in a non-accept state
or
If machine enters
an infinite loop
string
string
© 2020 Wael Badawy
24
Observation:
In order to accept an input string,
it is not necessary to scan all the
symbols of the input string
© 2020 Wael Badawy
Turing Machine Example
25
Accepts the language: *a
0q
Raa ,®
L,à®à
1q
Input alphabet },{ ba=S
© 2020 Wael Badawy
26
à à à àaaTime 0
0q
a
0q
Raa ,®
L,à®à
1q
© 2020 Wael Badawy
27
à à à àaaTime 1
0q
a
0q
Raa ,®
L,à®à
1q
© 2020 Wael Badawy
28
à à à àaaTime 2
0q
a
0q
Raa ,®
L,à®à
1q
© 2020 Wael Badawy
29
à à à àaaTime 3
0q
a
0q
Raa ,®
L,à®à
1q
© 2020 Wael Badawy
30
à à à àaaTime 4
1q
a
0q
Raa ,®
L,à®à
1q
Halt & Accept
© 2020 Wael Badawy
31
Rejection Example
0q
Raa ,®
L,à®à
1q
à à à àbaTime 0
0q
a
© 2020 Wael Badawy
32
0q
Raa ,®
L,à®à
1q
à à à àbaTime 1
0q
a
No possible Transition
Halt & Reject
© 2020 Wael Badawy
33
Accepts the language: *a
0q
but for input alphabet }{a=S
A simpler machine for same language
© 2020 Wael Badawy
34
à à à àaaTime 0
0q
a
0q
Halt & Accept
Not necessary to scan input
© 2020 Wael Badawy
Infinite Loop Example
35
0q
Raa ,®
L,à®à
1q
Lbb ,®
A Turing machine
for language *)(* baba ++
© 2020 Wael Badawy
36
à à à àbaTime 0
0q
a
0q
Raa ,®
L,à®à
1q
Lbb ,®
© 2020 Wael Badawy
37
à à à àbaTime 1
0q
a
0q
Raa ,®
L,à®à
1q
Lbb ,®
© 2020 Wael Badawy
38
à à à àbaTime 2
0q
a
0q
Raa ,®
L,à®à
1q
Lbb ,®
© 2020 Wael Badawy
39
à à à àbaTime 2
0q
a
à à à àbaTime 3
0q
a
à à à àbaTime 4
0q
a
à à à àbaTime 5
0q
a
Infiniteloop
© 2020 Wael Badawy
40
Because of the infinite loop:
•The accepting state cannot be reached
•The machine never halts
•The input string is rejected
© 2020 Wael Badawy
Another Turing Machine
Example
41
Turing machine for the language }{ nn
ba
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
1³n
© 2020 Wael Badawy
42
Match a’s with b’s:
Repeat:
replace leftmost a with x
find leftmost b and replace it with y
Until there are no more a’s or b’s
If there is a remaining a or b reject
Basic Idea:
© 2020 Wael Badawy
43
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àba
0q
a bTime 0 à
© 2020 Wael Badawy
44
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àbx
1q
a b àTime 1
© 2020 Wael Badawy
45
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àbx
1q
a b àTime 2
© 2020 Wael Badawy
46
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àyx
2q
a b àTime 3
© 2020 Wael Badawy
47
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àyx
2q
a b àTime 4
© 2020 Wael Badawy
48
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àyx
0q
a b àTime 5
© 2020 Wael Badawy
49
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àyx
1q
x b àTime 6
© 2020 Wael Badawy
50
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àyx
1q
x b àTime 7
© 2020 Wael Badawy
51
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àyx x y
2q
àTime 8
© 2020 Wael Badawy
52
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àyx x y
2q
àTime 9
© 2020 Wael Badawy
53
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àyx
0q
x y àTime 10
© 2020 Wael Badawy
54
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àyx
3q
x y àTime 11
© 2020 Wael Badawy
55
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àyx
3q
x y àTime 12
© 2020 Wael Badawy
56
0q 1q 2q3q
Rxa ,®
Raa ,®
Ryy ,®
Lyb ,®
Laa ,®
Lyy ,®
Rxx ,®
Ryy ,®
Ryy ,®
4q
L,à®à
à àyx
4q
x y à
Halt & Accept
Time 13
© 2020 Wael Badawy
57
If we modify the
machine for the language }{ nn
ba
we can easily construct
a machine for the language }{ nnn
cba
Observation:
58
Formal Definitions
for
Turing Machines
58
© 2020 Wael Badawy
59
Transition Function
1q 2qRba ,®
),,(),( 21 Rbqaq =d
© 2020 Wael Badawy
60
1q 2qLdc ,®
),,(),( 21 Ldqcq =d
Transition Function
© 2020 Wael Badawy
61
Turing Machine:
),,,,,,( 0 FqQM àGS= d
States
Input
alphabet
Tape
alphabet
Transition
function
Initial
state
blank
Accept
states
© 2020 Wael Badawy
Configuration
62
à à àba
1q
a
Instantaneous description:
cà
baqca 1
© 2020 Wael Badawy
63
à àyx
2q
a b
Time 4
à àyx
0q
a b
Time 5
à à
A Move: aybqxxaybq 02 !
(yields in one move)
© 2020 Wael Badawy
64
à à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
à à
A computation
© 2020 Wael Badawy
65
bqxxyybqxxaybqxxaybq 1102 !!!
bqxxyxaybq 12
*
!Equivalent notation:
© 2020 Wael Badawy
66
Initial configuration: wq0
à àba
0q
a b à
w
Input string
© 2020 Wael Badawy
The Accepted Language
67
For any Turing Machine M
}:{)( 210 xqxwqwML f
*
= !
Initial state Accept state
© 2020 Wael Badawy
68
If a language is accepted
by a Turing machine
then we say that is:
•Turing Acceptable
•Recursively Enumerable
M
L
L
•Turing Recognizable
Other names used:

More Related Content

Similar to Turing Machine

Regular pumping examples
Regular pumping examples Regular pumping examples
Regular pumping examples Wael Badawy
 
Regular expressions
Regular expressions Regular expressions
Regular expressions Wael Badawy
 
Computer Vision Cameras
Computer Vision CamerasComputer Vision Cameras
Computer Vision CamerasWael Badawy
 
Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015Monica Beckwith
 
Datavideo TLM-700HD
Datavideo TLM-700HDDatavideo TLM-700HD
Datavideo TLM-700HDAV ProfShop
 
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]David Buck
 
Don't Cross the Streams! (or do, we got you)
Don't Cross the Streams! (or do, we got you)Don't Cross the Streams! (or do, we got you)
Don't Cross the Streams! (or do, we got you)Caito Scherr
 
MAXIMIZING PROFITABILITY WITH TRUE, CLOSED-LOOP AUTONOMOUS LIFT OPTIMIZATION
MAXIMIZING PROFITABILITY WITH TRUE, CLOSED-LOOP AUTONOMOUS LIFT OPTIMIZATIONMAXIMIZING PROFITABILITY WITH TRUE, CLOSED-LOOP AUTONOMOUS LIFT OPTIMIZATION
MAXIMIZING PROFITABILITY WITH TRUE, CLOSED-LOOP AUTONOMOUS LIFT OPTIMIZATIONiQHub
 
Introducing Teleport cloud
Introducing Teleport cloudIntroducing Teleport cloud
Introducing Teleport cloudTeleport
 

Similar to Turing Machine (9)

Regular pumping examples
Regular pumping examples Regular pumping examples
Regular pumping examples
 
Regular expressions
Regular expressions Regular expressions
Regular expressions
 
Computer Vision Cameras
Computer Vision CamerasComputer Vision Cameras
Computer Vision Cameras
 
Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015
 
Datavideo TLM-700HD
Datavideo TLM-700HDDatavideo TLM-700HD
Datavideo TLM-700HD
 
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]
 
Don't Cross the Streams! (or do, we got you)
Don't Cross the Streams! (or do, we got you)Don't Cross the Streams! (or do, we got you)
Don't Cross the Streams! (or do, we got you)
 
MAXIMIZING PROFITABILITY WITH TRUE, CLOSED-LOOP AUTONOMOUS LIFT OPTIMIZATION
MAXIMIZING PROFITABILITY WITH TRUE, CLOSED-LOOP AUTONOMOUS LIFT OPTIMIZATIONMAXIMIZING PROFITABILITY WITH TRUE, CLOSED-LOOP AUTONOMOUS LIFT OPTIMIZATION
MAXIMIZING PROFITABILITY WITH TRUE, CLOSED-LOOP AUTONOMOUS LIFT OPTIMIZATION
 
Introducing Teleport cloud
Introducing Teleport cloudIntroducing Teleport cloud
Introducing Teleport cloud
 

More from Wael Badawy

HTML introduction
HTML introduction HTML introduction
HTML introduction Wael Badawy
 
Np complete reductions
Np complete reductionsNp complete reductions
Np complete reductionsWael Badawy
 
Computer Vision Gans
Computer Vision GansComputer Vision Gans
Computer Vision GansWael Badawy
 
Computer Vision image classification
Computer Vision image classificationComputer Vision image classification
Computer Vision image classificationWael Badawy
 
Computer Vision Structure from motion
Computer Vision Structure from motionComputer Vision Structure from motion
Computer Vision Structure from motionWael Badawy
 
Pushdown Automota
Pushdown Automota Pushdown Automota
Pushdown Automota Wael Badawy
 
Computer Vision sfm
Computer Vision sfmComputer Vision sfm
Computer Vision sfmWael Badawy
 
Computer vision - photometric
Computer vision - photometricComputer vision - photometric
Computer vision - photometricWael Badawy
 
Computer vision - light
Computer vision - lightComputer vision - light
Computer vision - lightWael Badawy
 
Computer vision - two view geometry
Computer vision -  two view geometryComputer vision -  two view geometry
Computer vision - two view geometryWael Badawy
 
Computer Vision - Stereo Vision
Computer Vision - Stereo VisionComputer Vision - Stereo Vision
Computer Vision - Stereo VisionWael Badawy
 
Computer Vision - Single View
Computer Vision - Single ViewComputer Vision - Single View
Computer Vision - Single ViewWael Badawy
 
Computer Vision single view Modelling
Computer Vision single view ModellingComputer Vision single view Modelling
Computer Vision single view ModellingWael Badawy
 
Computer Vision panoramas
Computer Vision  panoramasComputer Vision  panoramas
Computer Vision panoramasWael Badawy
 
Computer Vision panoramas
Computer Vision panoramas Computer Vision panoramas
Computer Vision panoramas Wael Badawy
 
Computer Vision - cameras
Computer Vision - camerasComputer Vision - cameras
Computer Vision - camerasWael Badawy
 
Computer Vision - RANSAC
Computer Vision - RANSACComputer Vision - RANSAC
Computer Vision - RANSACWael Badawy
 
Computer Vision alignment
Computer Vision alignmentComputer Vision alignment
Computer Vision alignmentWael Badawy
 

More from Wael Badawy (19)

HTML introduction
HTML introduction HTML introduction
HTML introduction
 
Np complete reductions
Np complete reductionsNp complete reductions
Np complete reductions
 
Parsers -
Parsers -Parsers -
Parsers -
 
Computer Vision Gans
Computer Vision GansComputer Vision Gans
Computer Vision Gans
 
Computer Vision image classification
Computer Vision image classificationComputer Vision image classification
Computer Vision image classification
 
Computer Vision Structure from motion
Computer Vision Structure from motionComputer Vision Structure from motion
Computer Vision Structure from motion
 
Pushdown Automota
Pushdown Automota Pushdown Automota
Pushdown Automota
 
Computer Vision sfm
Computer Vision sfmComputer Vision sfm
Computer Vision sfm
 
Computer vision - photometric
Computer vision - photometricComputer vision - photometric
Computer vision - photometric
 
Computer vision - light
Computer vision - lightComputer vision - light
Computer vision - light
 
Computer vision - two view geometry
Computer vision -  two view geometryComputer vision -  two view geometry
Computer vision - two view geometry
 
Computer Vision - Stereo Vision
Computer Vision - Stereo VisionComputer Vision - Stereo Vision
Computer Vision - Stereo Vision
 
Computer Vision - Single View
Computer Vision - Single ViewComputer Vision - Single View
Computer Vision - Single View
 
Computer Vision single view Modelling
Computer Vision single view ModellingComputer Vision single view Modelling
Computer Vision single view Modelling
 
Computer Vision panoramas
Computer Vision  panoramasComputer Vision  panoramas
Computer Vision panoramas
 
Computer Vision panoramas
Computer Vision panoramas Computer Vision panoramas
Computer Vision panoramas
 
Computer Vision - cameras
Computer Vision - camerasComputer Vision - cameras
Computer Vision - cameras
 
Computer Vision - RANSAC
Computer Vision - RANSACComputer Vision - RANSAC
Computer Vision - RANSAC
 
Computer Vision alignment
Computer Vision alignmentComputer Vision alignment
Computer Vision alignment
 

Recently uploaded

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
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
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 

Recently uploaded (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
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
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
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
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

Turing Machine

  • 1. © 2020 Wael Badawy 1 Turing Machines 1 DISCLAIMER: This video is optimized for HD large display using patented and patent-pending “Nile Codec”, the first Egyptian Video Codec for more information, PLEASE check https://NileCodec.com Also available as a PodCast
  • 2. © 2020 Wael Badawy Copyright © 2020 Wael Badawy. All rights reserved n This video is subject to copyright owned by Wael Badawy “WB”. Any reproduction or republication of all or part of this video is expressly prohibited unless WB has explicitly granted its prior written consent. All other rights reserved. n This video is intended for education and information only and is offered AS IS, without any warranty of the accuracy or the quality of the content. Any other use is strictly prohibited. The viewer is fully responsible to verify the accuracy of the contents received without any claims of costs or liability arising . n The names, trademarks service marked as logos of WB or the sponsors appearing in this video may not be used in any any product or service, without prior express written permission from WB and the video sponsors n Neither WB nor any party involved in creating, producing or delivering information and material via this video shall be liable for any direction, incidental, consequential, indirect of punitive damages arising out of access to, use or inability to use this content or any errors or omissions in the content thereof. n If you will continue to watch this video, you agree to the terms above and other terms that may be available on http://nu.edu.eg & https://caiwave.net 2
  • 3. © 2020 Wael Badawy
  • 4. © 2020 Wael Badawy The Language Hierarchy 4 *a Regular Languages Context-Free Languages nn ba R ww nnn cba ww? **ba ?
  • 5. © 2020 Wael Badawy 5 *a Regular Languages Context-Free Languages nn ba R ww nnn cba ww **ba Languages accepted by Turing Machines
  • 6. © 2020 Wael Badawy A Turing Machine 6 ............ Tape Read-Write head Control Unit
  • 7. © 2020 Wael Badawy The Tape 7 ............ Read-Write head No boundaries -- infinite length The head moves Left or Right
  • 8. © 2020 Wael Badawy 8 ............ Read-Write head The head at each transition (time step): 1. Reads a symbol 2. Writes a symbol 3. Moves Left or Right
  • 9. © 2020 Wael Badawy 9 ............ Example: Time 0 ............ Time 1 1. Reads 2. Writes a a cb a b k c a k 3. Moves Left
  • 10. © 2020 Wael Badawy 10 ............ Time 1 a b k c ............ Time 2 a k cf 1. Reads 2. Writes b f 3. Moves Right
  • 11. © 2020 Wael Badawy The Input String 11 ............ à à à à Blank symbol head àa b ca Head starts at the leftmost position of the input string Input string
  • 12. © 2020 Wael Badawy States & Transitions 12 1q 2qLba ,® Read Write Move Left 1q 2qRba ,® Move Right
  • 13. © 2020 Wael Badawy 13 Example: 1q 2qRba ,® ............ à à à ààa b ca Time 1 1q current state
  • 14. © 2020 Wael Badawy 14 ............ à à à ààa b ca Time 1 1q 2qRba ,® ............ à à à ààa b cb Time 2 1q 2q
  • 15. © 2020 Wael Badawy 15 ............ à à à ààa b ca Time 1 1q 2qLba ,® ............ à à à ààa b cb Time 2 1q 2q Example:
  • 16. © 2020 Wael Badawy 16 ............ à à à ààa b ca Time 1 1q 2qRg,®à ............ à à à àga b cb Time 2 1q 2q Example:
  • 17. © 2020 Wael Badawy Determinism 17 1q 2qRba ,® Allowed Not Allowed 3qLdb ,® 1q 2qRba ,® 3qLda ,® Turing Machines are deterministic
  • 18. © 2020 Wael Badawy Partial Transition Function 18 1q 2qRba ,® 3qLdb ,® ............ à à à ààa b ca 1q Example: No transition for input symbol c Allowed:
  • 19. © 2020 Wael Badawy Halting 19 The machine halts in a state if there is no transition to follow
  • 20. © 2020 Wael Badawy 20 Halting Example 1: ............ à à à ààa b ca 1q 1q No transition from HALT!!! 1q
  • 21. © 2020 Wael Badawy 21 Halting Example 2: ............ à à à ààa b ca 1q 1q 2qRba ,® 3qLdb ,® No possible transition from and symbol HALT!!! 1q c
  • 22. © 2020 Wael Badawy Accepting States 22 1q 2q Allowed 1q 2q Not Allowed •Accepting states have no outgoing transitions •The machine halts and accepts
  • 23. © 2020 Wael Badawy Acceptance 23 Accept Input If machine halts in an accept state Reject Input If machine halts in a non-accept state or If machine enters an infinite loop string string
  • 24. © 2020 Wael Badawy 24 Observation: In order to accept an input string, it is not necessary to scan all the symbols of the input string
  • 25. © 2020 Wael Badawy Turing Machine Example 25 Accepts the language: *a 0q Raa ,® L,à®à 1q Input alphabet },{ ba=S
  • 26. © 2020 Wael Badawy 26 à à à àaaTime 0 0q a 0q Raa ,® L,à®à 1q
  • 27. © 2020 Wael Badawy 27 à à à àaaTime 1 0q a 0q Raa ,® L,à®à 1q
  • 28. © 2020 Wael Badawy 28 à à à àaaTime 2 0q a 0q Raa ,® L,à®à 1q
  • 29. © 2020 Wael Badawy 29 à à à àaaTime 3 0q a 0q Raa ,® L,à®à 1q
  • 30. © 2020 Wael Badawy 30 à à à àaaTime 4 1q a 0q Raa ,® L,à®à 1q Halt & Accept
  • 31. © 2020 Wael Badawy 31 Rejection Example 0q Raa ,® L,à®à 1q à à à àbaTime 0 0q a
  • 32. © 2020 Wael Badawy 32 0q Raa ,® L,à®à 1q à à à àbaTime 1 0q a No possible Transition Halt & Reject
  • 33. © 2020 Wael Badawy 33 Accepts the language: *a 0q but for input alphabet }{a=S A simpler machine for same language
  • 34. © 2020 Wael Badawy 34 à à à àaaTime 0 0q a 0q Halt & Accept Not necessary to scan input
  • 35. © 2020 Wael Badawy Infinite Loop Example 35 0q Raa ,® L,à®à 1q Lbb ,® A Turing machine for language *)(* baba ++
  • 36. © 2020 Wael Badawy 36 à à à àbaTime 0 0q a 0q Raa ,® L,à®à 1q Lbb ,®
  • 37. © 2020 Wael Badawy 37 à à à àbaTime 1 0q a 0q Raa ,® L,à®à 1q Lbb ,®
  • 38. © 2020 Wael Badawy 38 à à à àbaTime 2 0q a 0q Raa ,® L,à®à 1q Lbb ,®
  • 39. © 2020 Wael Badawy 39 à à à àbaTime 2 0q a à à à àbaTime 3 0q a à à à àbaTime 4 0q a à à à àbaTime 5 0q a Infiniteloop
  • 40. © 2020 Wael Badawy 40 Because of the infinite loop: •The accepting state cannot be reached •The machine never halts •The input string is rejected
  • 41. © 2020 Wael Badawy Another Turing Machine Example 41 Turing machine for the language }{ nn ba 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à 1³n
  • 42. © 2020 Wael Badawy 42 Match a’s with b’s: Repeat: replace leftmost a with x find leftmost b and replace it with y Until there are no more a’s or b’s If there is a remaining a or b reject Basic Idea:
  • 43. © 2020 Wael Badawy 43 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àba 0q a bTime 0 à
  • 44. © 2020 Wael Badawy 44 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àbx 1q a b àTime 1
  • 45. © 2020 Wael Badawy 45 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àbx 1q a b àTime 2
  • 46. © 2020 Wael Badawy 46 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 2q a b àTime 3
  • 47. © 2020 Wael Badawy 47 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 2q a b àTime 4
  • 48. © 2020 Wael Badawy 48 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 0q a b àTime 5
  • 49. © 2020 Wael Badawy 49 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 1q x b àTime 6
  • 50. © 2020 Wael Badawy 50 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 1q x b àTime 7
  • 51. © 2020 Wael Badawy 51 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx x y 2q àTime 8
  • 52. © 2020 Wael Badawy 52 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx x y 2q àTime 9
  • 53. © 2020 Wael Badawy 53 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 0q x y àTime 10
  • 54. © 2020 Wael Badawy 54 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 3q x y àTime 11
  • 55. © 2020 Wael Badawy 55 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 3q x y àTime 12
  • 56. © 2020 Wael Badawy 56 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 4q x y à Halt & Accept Time 13
  • 57. © 2020 Wael Badawy 57 If we modify the machine for the language }{ nn ba we can easily construct a machine for the language }{ nnn cba Observation:
  • 59. © 2020 Wael Badawy 59 Transition Function 1q 2qRba ,® ),,(),( 21 Rbqaq =d
  • 60. © 2020 Wael Badawy 60 1q 2qLdc ,® ),,(),( 21 Ldqcq =d Transition Function
  • 61. © 2020 Wael Badawy 61 Turing Machine: ),,,,,,( 0 FqQM àGS= d States Input alphabet Tape alphabet Transition function Initial state blank Accept states
  • 62. © 2020 Wael Badawy Configuration 62 à à àba 1q a Instantaneous description: cà baqca 1
  • 63. © 2020 Wael Badawy 63 à àyx 2q a b Time 4 à àyx 0q a b Time 5 à à A Move: aybqxxaybq 02 ! (yields in one move)
  • 64. © 2020 Wael Badawy 64 à à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 à à A computation
  • 65. © 2020 Wael Badawy 65 bqxxyybqxxaybqxxaybq 1102 !!! bqxxyxaybq 12 * !Equivalent notation:
  • 66. © 2020 Wael Badawy 66 Initial configuration: wq0 à àba 0q a b à w Input string
  • 67. © 2020 Wael Badawy The Accepted Language 67 For any Turing Machine M }:{)( 210 xqxwqwML f * = ! Initial state Accept state
  • 68. © 2020 Wael Badawy 68 If a language is accepted by a Turing machine then we say that is: •Turing Acceptable •Recursively Enumerable M L L •Turing Recognizable Other names used: