1 language recognition (12.4) and turing machines (12.5)
TRANSCRIPT
![Page 1: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/1.jpg)
1
Language Recognition (12.4)and Turing Machines (12.5)
![Page 2: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/2.jpg)
2
Three Equivalent Representations
Finite automata
Regularexpressions
Regular languages
Each can
describethe others
Kleene’s Theorem:
For every regular expression, there is a deterministic finite-state automaton that defines the same language, and vice versa.
![Page 3: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/3.jpg)
3
NFAs Regular grammarsThus, the language recognized by FSA
is a regular language
Every NFA (=FSA) can be converted into a corresponding regular grammar and vice versa.
Each symbol A of the grammar is associated with a non-terminal node of the NFA sA, in particular, start symbol
S is associated with the start state sS.
Every transition is associated with a grammar production:
T(sA,a) = sB A aB.
Every production B is associated with final state sB.See p. 823.
![Page 4: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/4.jpg)
4
Kleene’s Theorem
LanguagesGenerated byRegular Expressions
LanguagesRecognizedby FSA
![Page 5: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/5.jpg)
5
LanguagesGenerated byRegular Expressions
LanguagesRecognizedby FSA
LanguagesGenerated byRegular Expressions
LanguagesRecognizedby FSA
We will show:
![Page 6: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/6.jpg)
6
Proof - Part 1
r)(rL
For any regular expression
the language is recognized by FSA (= is a regular language)
LanguagesGenerated byRegular Expressions
LanguagesRecognizedby FSA
Proof by induction on the size of r
![Page 7: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/7.jpg)
7
Induction BasisPrimitive Regular Expressions: , , a
NFAs
)()( 1 LML
)(}{)( 2 LML
)(}{)( 3 aLaML
regularlanguages
a
![Page 8: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/8.jpg)
8
Inductive Hypothesis
Assume for regular expressions andthat and are regular languages (i.e., L(FSA))
1r 2r
)( 1rL )( 2rL
![Page 9: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/9.jpg)
9
Inductive StepWe will prove:
1
1
21
21
*
rL
rL
rrL
rrL
Are regular Languages
![Page 10: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/10.jpg)
10
By definition of regular expressions:
11
11
2121
2121
**
rLrL
rLrL
rLrLrrL
rLrLrrL
p. 818
![Page 11: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/11.jpg)
11
)( 1rL )( 2rLBy inductive hypothesis we know: and are regular languages
Regular languages are closed under:
*1
21
21
rL
rLrL
rLrL Union
Concatenation
Star
We need to show:
Can be shown via defn. of regular grammar.,
Note: alt. Proof Thm. 1 p 819, directly constructs FSA. See Fig. 2 and Fig. 3.
![Page 12: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/12.jpg)
12
Therefore:
** 11
2121
2121
rLrL
rLrLrrL
rLrLrrL
Are regularlanguages
And trivially: ))(( 1rL is a regular language
![Page 13: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/13.jpg)
13
Proof - Part 2
LanguagesGenerated byRegular Expressions
LanguagesRecognizedby FSA
Lr LrL )(
For any regular language there is a regular expression with
Proof by construction of regular expression
![Page 14: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/14.jpg)
14
Since is regular take the NFA that accepts it
LM
LML )(
Single final state
![Page 15: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/15.jpg)
15
From construct the equivalentGeneralized Transition Graph in which transition labels are regular
expressions
M
Example:
a
ba,
cM
a
ba
c
![Page 16: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/16.jpg)
16
Another Example:
ba a
b
b
0q 1q 2q
ba,a
b
b
0q 1q 2q
b
b
![Page 17: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/17.jpg)
17
Reducing the states:
ba a
b
b
0q 1q 2q
b
0q 2q
babb*
)(* babb
![Page 18: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/18.jpg)
18
Resulting Regular Expression:
0q 2q
babb*
)(* babb
*)(**)*( bbabbabbr
LMLrL )()(
![Page 19: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/19.jpg)
19
In GeneralRemoving states:
iq q jqa b
cde
iq jq
dae* bce*dce*
bae*
![Page 20: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/20.jpg)
20
The final transition graph:
0q fq
1r
2r
3r4r
*)*(* 213421 rrrrrrr
LMLrL )()(
The resulting regular expression:
![Page 21: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/21.jpg)
21
DFA - regular languages
Push down automata - Context-free
Bounded Turing M’s - Context sensitive
Turing machines - Phrase-structure
Models of computing
![Page 22: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/22.jpg)
22
Foundations
The theory of computation and the practical application it made possible — the computer — was developed by an Englishman called Alan Turing.
![Page 23: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/23.jpg)
24
The Decision ProblemIn 1928 the German mathematician, David Hilbert (1862-1943), asked whether there could be a mechanical way (i.e. by means of a fully specifiable set of instructions) of determining whether some statement in a formal system like arithmetic was provable or not.In 1936 Turing published a paper the aim of which was to show that there was no such method. “On computable numbers, with an application to the Entscheidungs problem.” Proceedings of the London Mathematical Society, 2(42):230-265).
![Page 24: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/24.jpg)
29
FunctionsIt is essential to the idea of a Turing machine that it is not a physical machine, but an abstract one — a set of procedures.
It makes no difference whether the machine is embodied by a person in a boxcar on a track, or a person with a paper and pencil, or a smart and well-trained flamingo.
![Page 25: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/25.jpg)
31
First computers: custom computing machines
1950 -- Eniac: the control is hardwired manually foreach problem.
Control
Input tape (read only)
Output tape (write only)
Work tape (memory)
1940: VON NEUMANN: DISTINCTION BETWEEN DATA AND INSTRUCTIONS
![Page 26: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/26.jpg)
32
Can Machines Think?In “Computing machinery and intelligence,” written in 1950, Turing asks whether machines can think.He claims that this question is too vague, and proposes, instead, to replace it with a different one.That question is: Can machines pass the “imitation game” (now called the Turing test)? If they can, they are intelligent. Turing is thus the first to have offered a rigorous test for the determination of intelligence quite generally.
![Page 27: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/27.jpg)
33
The Turing TestThe game runs as follows. You sit at a computer terminal and have an electronic conversation. You don’t know who is on the other end; it could be a person or a computer responding as it has been programmed to do.
If you can’t distinguish between a human being and a computer from your interactions, then the computer is intelligent.
Note that this is meant to be a sufficient condition of intelligence only. There may be other ways to be intelligent.
![Page 28: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/28.jpg)
35
The Church-Turning Thesis
Turing, and a logician called Alonzo Church (1903-1995), independently developed the idea (not yet proven by widely accepted) that whatever can be computed by a mechanical procedure can be computed by a Turing machine.This is known as the Church-Turing thesis.
![Page 29: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/29.jpg)
37
Turing Machines
![Page 30: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/30.jpg)
38
The Language Hierarchy
*aRegular Languages
Context-Free Languagesnnba Rww
nnn cba ww?
**ba
?
![Page 31: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/31.jpg)
39
*aRegular Languages
Context-Free Languagesnnba Rww
nnn cba ww
**ba
Languages accepted byTuring Machines
![Page 32: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/32.jpg)
40
A Turing Machine
............Tape
Read-Write head
Control Unit
![Page 33: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/33.jpg)
41
The Tape
............
Read-Write head
No boundaries -- infinite length
The head moves Left or Right
![Page 34: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/34.jpg)
42
............
Read-Write head
The head at each time step:
1. Reads a symbol 2. Writes a symbol 3. Moves Left or Right
![Page 35: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/35.jpg)
43
............
Example:Time 0
............Time 1
1. Reads
2. Writes
a a cb
a b k c
a
k3. Moves Left
![Page 36: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/36.jpg)
44
............Time 1
a b k c
............Time 2
a k cf
1. Reads
2. Writes
bf
3. Moves Right
![Page 37: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/37.jpg)
45
The Input String
............
Blank symbol
head
a b ca
Head starts at the leftmost positionof the input string
Input string
![Page 38: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/38.jpg)
46
............
Blank symbol
head
a b ca
Input string
Remark: the input string is never empty
![Page 39: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/39.jpg)
47
States & Transitions
1q 2qLba ,
Read Write Move Left
1q 2qRba ,
Move Right
![Page 40: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/40.jpg)
48
Example:
1q 2qRba ,
............ a b ca
Time 1
1qcurrent state
![Page 41: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/41.jpg)
49
............ a b caTime 1
1q 2qRba ,
............ a b cbTime 2
1q
2q
![Page 42: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/42.jpg)
50
............ a b caTime 1
1q 2qLba ,
............ a b cbTime 2
1q
2q
Example:
![Page 43: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/43.jpg)
51
............ a b caTime 1
1q 2qRg,
............ ga b cbTime 2
1q
2q
Example:
![Page 44: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/44.jpg)
52
Determinism
1q
2qRba ,
Allowed Not Allowed
3qLdb ,
1q
2qRba ,
3qLda ,
Turing Machines are deterministic
![Page 45: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/45.jpg)
53
Partial Transition Function
1q
2qRba ,
3qLdb ,
............ a b ca
1q
Example:
No transitionfor input symbol c
Allowed:
![Page 46: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/46.jpg)
54
Halting
The machine halts if there areno possible transitions to follow
![Page 47: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/47.jpg)
55
Example:
............ a b ca
1q
1q
2qRba ,
3qLdb ,
No possible transition
HALT!!!
![Page 48: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/48.jpg)
56
Final States
1q 2q Allowed
1q 2q Not Allowed
• Final states have no outgoing transitions
• In a final state the machine halts
![Page 49: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/49.jpg)
57
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
![Page 50: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/50.jpg)
58
Turing Machine Example
A Turing machine that accepts the language:
*aa
0q
Raa ,
L,1q
![Page 51: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/51.jpg)
59
aaTime 0
0q
a
0q
Raa ,
L,1q
![Page 52: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/52.jpg)
60
aaTime 1
0q
a
0q
Raa ,
L,1q
![Page 53: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/53.jpg)
61
aaTime 2
0q
a
0q
Raa ,
L,1q
![Page 54: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/54.jpg)
62
aaTime 3
0q
a
0q
Raa ,
L,1q
![Page 55: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/55.jpg)
63
aaTime 4
1q
a
0q
Raa ,
L,1q
Halt & Accept
![Page 56: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/56.jpg)
64
Rejection Example
0q
Raa ,
L,1q
baTime 0
0q
a
![Page 57: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/57.jpg)
65
0q
Raa ,
L,1q
baTime 1
0q
a
No possible Transition
Halt & Reject
![Page 58: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/58.jpg)
66
Infinite Loop Example
0q
Raa ,
L,1q
Lbb ,
A Turing machine for language *)(* babaa
![Page 59: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/59.jpg)
67
baTime 0
0q
a
0q
Raa ,
L,1q
Lbb ,
![Page 60: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/60.jpg)
68
baTime 1
0q
a
0q
Raa ,
L,1q
Lbb ,
![Page 61: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/61.jpg)
69
baTime 2
0q
a
0q
Raa ,
L,1q
Lbb ,
![Page 62: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/62.jpg)
70
baTime 2
0q
a
baTime 3
0q
a
baTime 4
0q
a
baTime 5
0q
a
Infinite
loop
![Page 63: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/63.jpg)
71
Because of the infinite loop:
•The final state cannot be reached
•The machine never halts
•The input is not accepted
![Page 64: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/64.jpg)
72
Another Turing Machine Example
Turing machine for the language }{ nnba
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
![Page 65: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/65.jpg)
73
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
ba
0q
a bTime 0
![Page 66: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/66.jpg)
74
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
bx
1q
a b Time 1
![Page 67: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/67.jpg)
75
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
bx
1q
a b Time 2
![Page 68: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/68.jpg)
76
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
yx
2q
a b Time 3
![Page 69: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/69.jpg)
77
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
yx
2q
a b Time 4
![Page 70: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/70.jpg)
78
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
yx
0q
a b Time 5
![Page 71: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/71.jpg)
79
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
yx
1q
x b Time 6
![Page 72: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/72.jpg)
80
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
yx
1q
x b Time 7
![Page 73: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/73.jpg)
81
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
yx x y
2q
Time 8
![Page 74: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/74.jpg)
82
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
yx x y
2q
Time 9
![Page 75: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/75.jpg)
83
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
yx
0q
x y Time 10
![Page 76: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/76.jpg)
84
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
yx
3q
x y Time 11
![Page 77: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/77.jpg)
85
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
yx
3q
x y Time 12
![Page 78: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/78.jpg)
86
0q 1q 2q3qRxa ,
Raa ,Ryy ,
Lyb ,
Laa ,Lyy ,
Rxx ,
Ryy ,
Ryy ,4q
L,
yx
4q
x y
Halt & Accept
Time 13
![Page 79: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/79.jpg)
87
If we modify the machine for the language }{ nnba
we can easily construct a machine for the language }{ nnn cba
Observation:
![Page 80: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/80.jpg)
88
*aRegular Languages
Context-Free Languagesnnba Rww
nnn cba ww
**ba
Languages accepted byTuring Machines
![Page 81: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/81.jpg)
89
More details in Chapter 12 of Rosen.
End of intro to Languages (sets of strings), Grammars, Automata, andTuring Machines (= computation).
![Page 82: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/82.jpg)
90
![Page 83: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/83.jpg)
91
Formal Definitionsfor
Turing Machines
![Page 84: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/84.jpg)
92
Transition Function
1q 2qRba ,
),,(),( 21 Rbqaq
![Page 85: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/85.jpg)
93
1q 2qLdc ,
),,(),( 21 Ldqcq
Transition Function
![Page 86: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/86.jpg)
94
Turing Machine:
),,,,,,( 0 FqQM
States
Inputalphabet
Tapealphabet
Transitionfunction
Initialstate
blank
Finalstates
![Page 87: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/87.jpg)
95
Configuration
ba
1q
a
Instantaneous description:
c
baqca 1
![Page 88: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/88.jpg)
96
yx
2q
a b
Time 4
yx
0q
a b
Time 5
A Move: aybqxxaybq 02
![Page 89: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/89.jpg)
97
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
![Page 90: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/90.jpg)
98
bqxxyybqxxaybqxxaybq 1102
bqxxyxaybq 12
Equivalent notation:
![Page 91: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/91.jpg)
99
Initial configuration: wq0
ba
0q
a b
w
Input string
![Page 92: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/92.jpg)
100
The Accepted Language
For any Turing Machine M
}:{)( 210 xqxwqwML f
Initial state Final state
![Page 93: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/93.jpg)
101
Standard Turing Machine
• Deterministic
• Infinite tape in both directions
•Tape is the input/output file
The machine we described is the standard:
![Page 94: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/94.jpg)
102
Computing Functionswith
Turing Machines
![Page 95: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/95.jpg)
103
A function )(wf
Domain: Result Region:
has:
D
Dw
S
Swf )()(wf
![Page 96: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/96.jpg)
104
A function may have many parameters:
yxyxf ),(
Example: Addition function
![Page 97: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/97.jpg)
105
Integer Domain
Unary:
Binary:
Decimal:
11111
101
5
We prefer unary representation:
easier to manipulate with Turing machines
![Page 98: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/98.jpg)
106
Definition:
A function is computable ifthere is a Turing Machine such that:
fM
Initial configuration Final configuration
Dw Domain
0q
w
fq
)(wf
final stateinitial state
For all
![Page 99: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/99.jpg)
107
)(0 wfqwq f
Initial Configuration
FinalConfiguration
A function is computable ifthere is a Turing Machine such that:
fM
In other words:
Dw DomainFor all
![Page 100: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/100.jpg)
108
Example
The function yxyxf ),( is computable
Turing Machine:
Input string: yx0 unary
Output string: 0xy unary
yx, are integers
![Page 101: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/101.jpg)
109
0
0q
1 1 1 1
x y
1 Start
initial state
The 0 is the delimiter that separates the two numbers
![Page 102: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/102.jpg)
110
0
0q
1 1 1 1
x y
1
0
fq
1 1
yx
11
Start
Finish
final state
initial state
![Page 103: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/103.jpg)
111
0
fq
1 1
yx
11Finish
final state
The 0 helps when we usethe result for other operations
![Page 104: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/104.jpg)
112
0q
Turing machine for function
1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
yxyxf ),(
![Page 105: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/105.jpg)
113
Execution Example:
11x
11y 0
0q
1 1 1 1
Time 0
x y
Final Result
0
4q
1 1 1 1
yx
(2)
(2)
![Page 106: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/106.jpg)
114
0
0q
1 1Time 0
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
1 1
![Page 107: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/107.jpg)
115
0q
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
01 11 1Time 1
![Page 108: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/108.jpg)
116
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
0
0q
1 1 1 1Time 2
![Page 109: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/109.jpg)
117
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
1q
1 11 11Time 3
![Page 110: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/110.jpg)
118
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
1q
1 1 1 11Time 4
![Page 111: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/111.jpg)
119
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
1q
1 11 11Time 5
![Page 112: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/112.jpg)
120
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
2q
1 1 1 11Time 6
![Page 113: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/113.jpg)
121
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
3q
1 11 01Time 7
![Page 114: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/114.jpg)
122
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
3q
1 1 1 01Time 8
![Page 115: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/115.jpg)
123
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
3q
1 11 01Time 9
![Page 116: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/116.jpg)
124
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
3q
1 1 1 01Time 10
![Page 117: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/117.jpg)
125
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
3q
1 11 01Time 11
![Page 118: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/118.jpg)
126
0q 1q 2q 3qL, L,01
L,11
R,
R,10
R,11
4q
R,11
4q
1 1 1 01
HALT & accept
Time 12
![Page 119: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/119.jpg)
127
Another Example
The function xxf 2)( is computable
Turing Machine:
Input string: x unary
Output string: xx unary
x is integer
![Page 120: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/120.jpg)
128
0q
1 1
x
1
1
fq
1 1
x2
11
Start
Finish
final state
initial state
![Page 121: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/121.jpg)
129
Turing Machine Pseudocode for xxf 2)(
• Replace every 1 with $
• Repeat:
• Find rightmost $, replace it with 1
• Go to right end, insert 1
Until no more $ remain
![Page 122: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/122.jpg)
130
0q 1q 2q
3q
R,1$
L,1
L,
R$,1 L,11 R,11
R,
Turing Machine for xxf 2)(
![Page 123: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/123.jpg)
131
0q 1q 2q
3q
R,1$
L,1
L,
R$,1 L,11 R,11
R,
Example
0q
1 1
3q
1 11 1
Start Finish
![Page 124: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/124.jpg)
132
Another Example
The function ),( yxf
is computable0
1 yx
yx
if
if
![Page 125: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/125.jpg)
133
Turing Machine for
Input: yx0
Output: 1 0or
),( yxf0
1 yx
yx
if
if
![Page 126: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/126.jpg)
134
Turing Machine Pseudocode:
Match a 1 from with a 1 from x y
• Repeat
Until all of or is matchedx y
• If a 1 from is not matched erase tape, write 1 else erase tape, write 0
x)( yx
)( yx
![Page 127: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/127.jpg)
135
Combining Turing Machines
![Page 128: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/128.jpg)
136
Block Diagram
TuringMachine
input output
![Page 129: 1 Language Recognition (12.4) and Turing Machines (12.5)](https://reader033.vdocument.in/reader033/viewer/2022042703/56649f305503460f94c4a46a/html5/thumbnails/129.jpg)
137
Example:
),( yxf0
yx yx
yx
if
if
Comparer
Adder
Eraser
yx,
yx,
yx
yx
yx
0