© 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:

Turing Machine

  • 1.
    © 2020 WaelBadawy 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 WaelBadawy 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.
  • 4.
    © 2020 WaelBadawy The Language Hierarchy 4 *a Regular Languages Context-Free Languages nn ba R ww nnn cba ww? **ba ?
  • 5.
    © 2020 WaelBadawy 5 *a Regular Languages Context-Free Languages nn ba R ww nnn cba ww **ba Languages accepted by Turing Machines
  • 6.
    © 2020 WaelBadawy A Turing Machine 6 ............ Tape Read-Write head Control Unit
  • 7.
    © 2020 WaelBadawy The Tape 7 ............ Read-Write head No boundaries -- infinite length The head moves Left or Right
  • 8.
    © 2020 WaelBadawy 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 WaelBadawy 9 ............ Example: Time 0 ............ Time 1 1. Reads 2. Writes a a cb a b k c a k 3. Moves Left
  • 10.
    © 2020 WaelBadawy 10 ............ Time 1 a b k c ............ Time 2 a k cf 1. Reads 2. Writes b f 3. Moves Right
  • 11.
    © 2020 WaelBadawy The Input String 11 ............ à à à à Blank symbol head àa b ca Head starts at the leftmost position of the input string Input string
  • 12.
    © 2020 WaelBadawy States & Transitions 12 1q 2qLba ,® Read Write Move Left 1q 2qRba ,® Move Right
  • 13.
    © 2020 WaelBadawy 13 Example: 1q 2qRba ,® ............ à à à ààa b ca Time 1 1q current state
  • 14.
    © 2020 WaelBadawy 14 ............ à à à ààa b ca Time 1 1q 2qRba ,® ............ à à à ààa b cb Time 2 1q 2q
  • 15.
    © 2020 WaelBadawy 15 ............ à à à ààa b ca Time 1 1q 2qLba ,® ............ à à à ààa b cb Time 2 1q 2q Example:
  • 16.
    © 2020 WaelBadawy 16 ............ à à à ààa b ca Time 1 1q 2qRg,®à ............ à à à àga b cb Time 2 1q 2q Example:
  • 17.
    © 2020 WaelBadawy Determinism 17 1q 2qRba ,® Allowed Not Allowed 3qLdb ,® 1q 2qRba ,® 3qLda ,® Turing Machines are deterministic
  • 18.
    © 2020 WaelBadawy Partial Transition Function 18 1q 2qRba ,® 3qLdb ,® ............ à à à ààa b ca 1q Example: No transition for input symbol c Allowed:
  • 19.
    © 2020 WaelBadawy Halting 19 The machine halts in a state if there is no transition to follow
  • 20.
    © 2020 WaelBadawy 20 Halting Example 1: ............ à à à ààa b ca 1q 1q No transition from HALT!!! 1q
  • 21.
    © 2020 WaelBadawy 21 Halting Example 2: ............ à à à ààa b ca 1q 1q 2qRba ,® 3qLdb ,® No possible transition from and symbol HALT!!! 1q c
  • 22.
    © 2020 WaelBadawy Accepting States 22 1q 2q Allowed 1q 2q Not Allowed •Accepting states have no outgoing transitions •The machine halts and accepts
  • 23.
    © 2020 WaelBadawy 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 WaelBadawy 24 Observation: In order to accept an input string, it is not necessary to scan all the symbols of the input string
  • 25.
    © 2020 WaelBadawy Turing Machine Example 25 Accepts the language: *a 0q Raa ,® L,à®à 1q Input alphabet },{ ba=S
  • 26.
    © 2020 WaelBadawy 26 à à à àaaTime 0 0q a 0q Raa ,® L,à®à 1q
  • 27.
    © 2020 WaelBadawy 27 à à à àaaTime 1 0q a 0q Raa ,® L,à®à 1q
  • 28.
    © 2020 WaelBadawy 28 à à à àaaTime 2 0q a 0q Raa ,® L,à®à 1q
  • 29.
    © 2020 WaelBadawy 29 à à à àaaTime 3 0q a 0q Raa ,® L,à®à 1q
  • 30.
    © 2020 WaelBadawy 30 à à à àaaTime 4 1q a 0q Raa ,® L,à®à 1q Halt & Accept
  • 31.
    © 2020 WaelBadawy 31 Rejection Example 0q Raa ,® L,à®à 1q à à à àbaTime 0 0q a
  • 32.
    © 2020 WaelBadawy 32 0q Raa ,® L,à®à 1q à à à àbaTime 1 0q a No possible Transition Halt & Reject
  • 33.
    © 2020 WaelBadawy 33 Accepts the language: *a 0q but for input alphabet }{a=S A simpler machine for same language
  • 34.
    © 2020 WaelBadawy 34 à à à àaaTime 0 0q a 0q Halt & Accept Not necessary to scan input
  • 35.
    © 2020 WaelBadawy Infinite Loop Example 35 0q Raa ,® L,à®à 1q Lbb ,® A Turing machine for language *)(* baba ++
  • 36.
    © 2020 WaelBadawy 36 à à à àbaTime 0 0q a 0q Raa ,® L,à®à 1q Lbb ,®
  • 37.
    © 2020 WaelBadawy 37 à à à àbaTime 1 0q a 0q Raa ,® L,à®à 1q Lbb ,®
  • 38.
    © 2020 WaelBadawy 38 à à à àbaTime 2 0q a 0q Raa ,® L,à®à 1q Lbb ,®
  • 39.
    © 2020 WaelBadawy 39 à à à àbaTime 2 0q a à à à àbaTime 3 0q a à à à àbaTime 4 0q a à à à àbaTime 5 0q a Infiniteloop
  • 40.
    © 2020 WaelBadawy 40 Because of the infinite loop: •The accepting state cannot be reached •The machine never halts •The input string is rejected
  • 41.
    © 2020 WaelBadawy 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 WaelBadawy 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 WaelBadawy 43 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àba 0q a bTime 0 à
  • 44.
    © 2020 WaelBadawy 44 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àbx 1q a b àTime 1
  • 45.
    © 2020 WaelBadawy 45 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àbx 1q a b àTime 2
  • 46.
    © 2020 WaelBadawy 46 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 2q a b àTime 3
  • 47.
    © 2020 WaelBadawy 47 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 2q a b àTime 4
  • 48.
    © 2020 WaelBadawy 48 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 0q a b àTime 5
  • 49.
    © 2020 WaelBadawy 49 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 1q x b àTime 6
  • 50.
    © 2020 WaelBadawy 50 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 1q x b àTime 7
  • 51.
    © 2020 WaelBadawy 51 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx x y 2q àTime 8
  • 52.
    © 2020 WaelBadawy 52 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx x y 2q àTime 9
  • 53.
    © 2020 WaelBadawy 53 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 0q x y àTime 10
  • 54.
    © 2020 WaelBadawy 54 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 3q x y àTime 11
  • 55.
    © 2020 WaelBadawy 55 0q 1q 2q3q Rxa ,® Raa ,® Ryy ,® Lyb ,® Laa ,® Lyy ,® Rxx ,® Ryy ,® Ryy ,® 4q L,à®à à àyx 3q x y àTime 12
  • 56.
    © 2020 WaelBadawy 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 WaelBadawy 57 If we modify the machine for the language }{ nn ba we can easily construct a machine for the language }{ nnn cba Observation:
  • 58.
  • 59.
    © 2020 WaelBadawy 59 Transition Function 1q 2qRba ,® ),,(),( 21 Rbqaq =d
  • 60.
    © 2020 WaelBadawy 60 1q 2qLdc ,® ),,(),( 21 Ldqcq =d Transition Function
  • 61.
    © 2020 WaelBadawy 61 Turing Machine: ),,,,,,( 0 FqQM àGS= d States Input alphabet Tape alphabet Transition function Initial state blank Accept states
  • 62.
    © 2020 WaelBadawy Configuration 62 à à àba 1q a Instantaneous description: cà baqca 1
  • 63.
    © 2020 WaelBadawy 63 à àyx 2q a b Time 4 à àyx 0q a b Time 5 à à A Move: aybqxxaybq 02 ! (yields in one move)
  • 64.
    © 2020 WaelBadawy 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 WaelBadawy 65 bqxxyybqxxaybqxxaybq 1102 !!! bqxxyxaybq 12 * !Equivalent notation:
  • 66.
    © 2020 WaelBadawy 66 Initial configuration: wq0 à àba 0q a b à w Input string
  • 67.
    © 2020 WaelBadawy The Accepted Language 67 For any Turing Machine M }:{)( 210 xqxwqwML f * = ! Initial state Accept state
  • 68.
    © 2020 WaelBadawy 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: