1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen...
-
Upload
ellen-newton -
Category
Documents
-
view
214 -
download
0
description
Transcript of 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen...
![Page 1: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/1.jpg)
1
CD5560
FABER
Formal Languages, Automata and Models of Computation
Lecture 3
Mälardalen University2006
![Page 2: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/2.jpg)
2
Content
Finite Automata, FADeterministic Finite Automata, DFANondeterministic Automata NFANFA DFA EquivalenceGrammatikLinjär grammatikReguljär grammatik
![Page 3: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/3.jpg)
3
Finite Automata FA(Finite State Machines)
![Page 4: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/4.jpg)
4
There is no formal general definition for "automaton". Instead, there are various kinds of automata, each with it's own formal definition.
• has some form of input
• has some form of output
• has internal states,
• may or may not have some form of storage
• is hard-wired rather than programmable
Generally, an automaton
![Page 5: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/5.jpg)
5
Finite Automaton
Input
String
Output
String
FiniteAutomaton
![Page 6: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/6.jpg)
6
Finite Accepter
Input
“Accept” or“Reject”
String
FiniteAutomaton
Output
![Page 7: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/7.jpg)
7
Nodes = States Edges = Transitions
An edge with several symbols is a short-hand for several edges:
FA as Directed Graph
1qa
0q
1qba,0q1q
a
0qb
![Page 8: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/8.jpg)
8
Deterministic Finite Automata DFA
![Page 9: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/9.jpg)
9
• Deterministic there is no element of choice• Finite only a finite number of states and arcs • Acceptors produce only a yes/no answer
DFA
![Page 10: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/10.jpg)
10
Transition Graph
initialstate
final state“accept”state
transition
abba -Finite Acceptor
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
},{ baAlphabet =
![Page 11: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/11.jpg)
11
Formal definitionsDeterministic Finite Accepter (DFA)
FqQM ,,,, 0
Q
0q
F
: set of states: input alphabet: transition function: initial state: set of final states
![Page 12: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/12.jpg)
12
Input Aplhabet
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
ba,
![Page 13: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/13.jpg)
13
Set of States
Q
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
543210 ,,,,, qqqqqqQ
ba,
![Page 14: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/14.jpg)
14
Initial State
0q
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,0q
![Page 15: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/15.jpg)
15
Set of Final States
F
0q 1q 2q 3qa b b a
5q
a a bb
ba, 4qF
ba,
4q
![Page 16: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/16.jpg)
16
Transition Function
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
QQ :
ba,
![Page 17: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/17.jpg)
17
10 , qaq
2q 3q 4qa b b a
5q
a a bb
ba,
ba,0q 1q
![Page 18: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/18.jpg)
18
50 , qbq
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,0q
![Page 19: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/19.jpg)
19
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
32 , qbq
![Page 20: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/20.jpg)
20
Transition Function
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
a b0q
2q
5q
1q 5q
5q5q
3q
4q
1q 5q 2q5q 3q4q 5q5q 5q
![Page 21: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/21.jpg)
21
Extended Transition Function
*
QQ *:*
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
![Page 22: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/22.jpg)
22
20 ,* qabq
3q 4qa b b a
5q
a a bb
ba,
ba,0q 1q 2q
![Page 23: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/23.jpg)
23
40 ,* qabbaq
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
![Page 24: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/24.jpg)
24
Another Example
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
abbaabML ,, M
acceptacceptaccept
},{ baAlphabet =
![Page 25: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/25.jpg)
25
Formally
For a DFA
Language accepted by :
FqQM ,,,, 0
M
FwqwML ,*:* 0
alphabet transitionfunction
initialstate
finalstates
![Page 26: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/26.jpg)
26
Observation
Language accepted by
FwqwML ,*:* 0
M
FwqwML ,*:* 0
MLanguage rejected by
![Page 27: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/27.jpg)
27
Regular Languages
All regular languages form a language family
LM MLL
A language is regular if there is
a DFA such that
![Page 28: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/28.jpg)
28
Nondeterministic Automata NFA
![Page 29: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/29.jpg)
29
• Nondeterministic there is an element of choice: in a given state NFA
can act on a given string in different ways. Several start/final states are allowed. -transitions are allowed.
• Finite only a finite number of states and arcs • Acceptors produce only a yes/no answer
NFA
![Page 30: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/30.jpg)
30
1q 2q
3q
a
a
a
0q
Two choices
}{aAlphabet =
Nondeterministic Finite Accepter (NFA)
![Page 31: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/31.jpg)
31
a a
0q
1q 2q
3q
a
a
First Choice
a
![Page 32: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/32.jpg)
32
a a
0q
1q 2q
3q
a
a
a
First Choice
![Page 33: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/33.jpg)
33
a a
0q
1q 2q
3q
a
a
First Choice
a
![Page 34: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/34.jpg)
34
a a
0q
1q 2q
3q
a
a
a “accept”
First Choice
![Page 35: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/35.jpg)
35
a a
0q
1q 2q
3q
a
a
Second Choice
a
![Page 36: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/36.jpg)
36
a a
0q
1q 2qa
a
Second Choice
a
3q
![Page 37: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/37.jpg)
37
a a
0q
1q 2qa
a
a
3q
Second Choice
No transition:the automaton hangs
![Page 38: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/38.jpg)
38
a a
0q
1q 2qa
a
a
3q
Second Choice
“reject”
![Page 39: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/39.jpg)
39
Observation
An NFA accepts a string ifthere is a computation of the NFAthat accepts the string
![Page 40: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/40.jpg)
40
Exampleaa is accepted by the NFA:
0q
1q 2q
3q
a
a
a
![Page 41: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/41.jpg)
41
Lambda Transitions
1q 3qa0q 1q a
![Page 42: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/42.jpg)
42
a a
1q 3qa0q 2q a
![Page 43: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/43.jpg)
43
a a
1q 3qa0q 2q a
![Page 44: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/44.jpg)
44
a a
1q 3qa0q 2q a
(read head doesn’t move)
![Page 45: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/45.jpg)
45
a a
1q 3qa0q 2q a
![Page 46: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/46.jpg)
46
a a
1q 3qa0q 2q a
“accept”
String is acceptedaa
![Page 47: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/47.jpg)
47
Language accepted: }{aaL
1q 3qa0q 2q a
![Page 48: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/48.jpg)
48
Another NFA Example
0q 1q 2qa b
3q
},{ baAlphabet =
![Page 49: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/49.jpg)
49
a b
0q 1q 2qa b
3q
![Page 50: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/50.jpg)
50
a b
0q 2qa b
3q1q
![Page 51: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/51.jpg)
51
a b
0q 1qa b
3q2q
![Page 52: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/52.jpg)
52
a b
0q 1qa b
3q2q“accept”
![Page 53: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/53.jpg)
53
a b
Another String
a b
0q a b
1q 2q 3q
},{ baAlphabet =
![Page 54: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/54.jpg)
54
a b a b
0q a b
1q 2q 3q
![Page 55: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/55.jpg)
55
a b a b
0q a b
1q 2q 3q
![Page 56: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/56.jpg)
56
a b a b
0q a b
1q 2q 3q
![Page 57: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/57.jpg)
57
a b a b
0q a b
1q 2q 3q
![Page 58: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/58.jpg)
58
a b a b
0q a b
1q 2q 3q
![Page 59: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/59.jpg)
59
a b a b
0q a b
1q 2q 3q
![Page 60: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/60.jpg)
60
a b a b
0q a b
1q 2q 3q“accept”
![Page 61: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/61.jpg)
61
ab
ababababababL ...,,,
Language accepted
0q 1q 2qa b
3q
},{ baAlphabet =
![Page 62: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/62.jpg)
62
Another NFA Example
0q 1q 2q0
11,0
}1,0{Alphabet =
![Page 63: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/63.jpg)
63
*10
...,101010,1010,10, L
0q 1q 2q0
11,0
Language accepted
![Page 64: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/64.jpg)
64
Formal Definition of NFA FqQM ,,,, 0
:Q
::0q
:F
Set of states, i.e. 210 ,, qqq
: Input alphabet, i.e. ba,Transition function
Initial state
Final states
![Page 65: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/65.jpg)
65
10 1, qq
Transition Function
0
11,0
0q 1q 2q
![Page 66: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/66.jpg)
66
},{)0,( 201 qqq
0q0
11,0
1q 2q
![Page 67: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/67.jpg)
67
0q0
11,0
1q 2q
},{),( 200 qqq
![Page 68: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/68.jpg)
68
0q0
11,0
1q 2q
)1,( 2q
![Page 69: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/69.jpg)
69
Extended Transition Function
*
10 ,* qaq
0q
5q4q
3q2q1qaaa
b
(Utvidgad övergångsfunktion)
![Page 70: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/70.jpg)
70
540 ,,* qqaaq
0q
5q4q
3q2q1qaaa
b
![Page 71: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/71.jpg)
71
0320 ,,,* qqqabq
0q
5q4q
3q2q1qaaa
b
![Page 72: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/72.jpg)
72
Formally
wqq ij ,*
if and only if
there is a walk from towith label
iq jqw
![Page 73: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/73.jpg)
73
The Language of an NFA
540 ,,* qqaaq
0q
5q4q
3q2q1qaaa
b
M
)(MLaa
50 ,qqF
},{ baAlphabet =
![Page 74: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/74.jpg)
74
0320 ,,,* qqqabq
0q
5q4q
3q2q1qaaa
b
MLab
50 ,qqF
![Page 75: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/75.jpg)
75
50 ,qqF
540 ,,* qqabaaq )(MLabaa
0q
5q4q
3q2q1qaaa
b
![Page 76: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/76.jpg)
76
10 ,* qabaq MLaba
0q
5q4q
3q2q1qaaa
b
50 ,qqF
![Page 77: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/77.jpg)
77
0q
5q4q
3q2q1qaaa
b
aaababaaML *
![Page 78: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/78.jpg)
78
Formally
The language accepted by NFA M
,...,, 321 wwwML
,...},{),(* 0 jim qqwq
Fqk (final state)
where
and there is some (at least one)
is:
![Page 79: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/79.jpg)
79
MLw
0q kq
w
w
w
),(* 0 wq
Fqk
iq
jq
![Page 80: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/80.jpg)
80
NFA DFA Equivalence
![Page 81: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/81.jpg)
81
Equivalence of NFAs and DFAs
Accept the same languages?
YES!
NFAs DFAs ?
Same power?
![Page 82: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/82.jpg)
82
We will prove:
Languages acceptedby NFAs
Languages acceptedby DFAs
NFAs and DFAs have the same computation power!
![Page 83: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/83.jpg)
83
Languages acceptedby NFAs
Languages acceptedby DFAs
Step 1
Proof Every DFA is also an NFA
A language accepted by a DFAis also accepted by an NFA
![Page 84: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/84.jpg)
84
Languages acceptedby NFAs
Languages acceptedby DFAs
Step 2
Proof Any NFA can be converted to anequivalent DFA
A language accepted by an NFAis also accepted by a DFA
![Page 85: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/85.jpg)
85
Procedure NFA to DFA
1. Initial state of NFA:
Initial state of DFA:
0q
0q
![Page 86: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/86.jpg)
86
Example
a
b
a
0q 1q 2q
NFA
DFA 0q
Step 1
![Page 87: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/87.jpg)
87
Procedure NFA to DFA 2. For every DFA’s state
Compute in the NFA
},...,,{ mji qqq
...
,,*,,*
aqaq
j
i
},...,,{},,...,,{ mjimji qqqaqqq
},...,,{ mji qqq
Add transition
![Page 88: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/88.jpg)
88
Example NFA
DFA
a
b
a
0q 1q 2q
},{),(* 210 qqaq
0q 21,qqa
210 ,, qqaq
Step 2
![Page 89: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/89.jpg)
89
Procedure NFA to DFA
Repeat Step 2 for all letters in alphabet, until
no more transitions can be added.
![Page 90: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/90.jpg)
90
Example
a
b
a
0q 1q 2q
NFA
DFA 0q 21,qq
a
b
ab
ba,
Step 3
![Page 91: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/91.jpg)
91
Procedure NFA to DFA
3. For any DFA state
If some is a final state in the NFA
Then is a final state in the DFA
},...,,{ mji qqq
jq
},...,,{ mji qqq
![Page 92: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/92.jpg)
92
Example
a
b
a0q 1q 2q
NFA
DFA
0q 21,qqa
b
ab
ba,
Fq 1
Fqq 21,
Step 4
![Page 93: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/93.jpg)
93
Theorem
Take NFA M
Apply procedure to obtain DFA M
Then and are equivalent :M M
MLML
![Page 94: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/94.jpg)
94
Languages acceptedby NFAs
Languages acceptedby DFAs
We have proven (proof by construction):
Regular Languages
END OF PROOF
![Page 95: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/95.jpg)
95
Nondeterministic vs.
Deterministic Automata
![Page 96: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/96.jpg)
96
Formal Definition of NFA
FqQM ,,,, 0
:Q Set of states, i.e. 210 ,, qqq: Input alphabet, i.e. ba,: Transition function:0q Initial state
:F Final (accepting) states
NFA is a mathematical model defined as a quintuple:
![Page 97: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/97.jpg)
97
Deterministic Finite Automata
A deterministic finite automaton (DFA) is a special case of a nondeterministic finite automaton in which1. no state has an -transition, i.e. a transition
on input , and2. for each state q and input symbol a, there
is at most one edge labeled a leaving q.
![Page 98: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/98.jpg)
98
STATEINPUT SYMBOL
a b
012
{0, 1}--
{0}{2}{3}
Transition table for the finite automaton above
A nondeterministic finite automaton
b
0start 1a 2b b3
a
Example
![Page 99: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/99.jpg)
99
NFA accepting aa* + bb*
0start
1
a2
a
3
b 4
b
Example
![Page 100: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/100.jpg)
100
NFA accepting (a+b)*abb
0start 1a 2b b
b
a a
a
b
3
a
Example
![Page 101: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/101.jpg)
101
NFA recognizing three different patterns.
(a) NFA for a, abb, and a*b+.
(b) Combined NFA.
Example
4
1start a 2
3start a 65b b
7start b 8
ba
4
1
start
a 2
3 a 65b b
7 b 8
ba0
![Page 102: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/102.jpg)
102
Ways to think of nondeterminism
• always make the correct guess• “backtracking” (systematically try all possibilities)
For a particular string, imagine a tree of possiblestate transitions:
q0
q3
q0
q4
q2
q1a
a
aa
b
a
![Page 103: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/103.jpg)
103
Advantages of nondeterminism
• an NFA can be smaller, easier to construct and easier to understand than a DFA that accepts the same language
• useful for proving some theorems• good introduction to nondeterminism in more
powerful computational models, where nondeterminism plays an important role
![Page 104: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/104.jpg)
104
Space and time taken to recognize regular expressions:- NFA more compact but take time to backtrack all choices- DFA take place, but save time
AUTOMATON SPACE TIME
NFADFA
O(|r|)O(2|r|)
O(|r||x|)O(|x|)
Determinism vs. nondeterminism
(Where r is regular expression, and x is input string)
![Page 105: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/105.jpg)
105
Equivalent automata
Two finite automata M1 and M2 are equivalent if
L(M1) = L(M2)
that is, if they both accept the same language.
![Page 106: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/106.jpg)
106
Equivalence of NFAs and DFAs
To show that NFAs and DFAs accept the same class of languages, we show two things:
– Any language accepted by a DFA can also be accepted by some NFA (As DFA is a special case of NFA)
– Any language accepted by a NFA can also be accepted by some (corresponding, specially constructed) DFA
![Page 107: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/107.jpg)
107
Proof strategy
To show that any language accepted by a NFA is also accepted by some DFA, we describe an algorithm that takes any NFA and converts it into a DFA that accepts the same language.
The algorithm is called the “subset construction algorithm”.
We can use mathematical induction (on the length of a string accepted by the automaton) to prove the DFA that is constructed accepts the same language as the NFA.
![Page 108: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/108.jpg)
108
Converting NFA to DFA Subset Construction
![Page 109: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/109.jpg)
109
Subset construction
Given a NFA constructs a DFA that accepts the same language
The equivalent DFA simulates the NFA by keeping track of the possible states it could be in. Each state of the DFA is a subset of the set of states of the NFA -hence, the name of the algorithm.
If the NFA has n states, the DFA can have as many as 2n states, although it usually has many less.
![Page 110: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/110.jpg)
110
Steps of subset construction
The initial state of the DFA is the set of all states the NFA can be in without reading any input.
For any state {qi,qj,…,qk} of the DFA and any input a, the next state of the DFA is the set of all states of the NFA that can result as next states if the NFA is in any of the states qi,qj,…,qk when it reads a. This includes states that can be reached by reading a, followed by any number of -moves. Use this rule to keep adding new states and transitions until it is no longer possible to do so.
The accepting states of the DFA are those states that contain an accepting state of the NFA.
![Page 111: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/111.jpg)
111
Example
Here is a NFA that we want to convert to an equivalent DFA.
a
bb
01
2
b
a
a
b
![Page 112: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/112.jpg)
112
{0,1}
The start state of the DFA is the set of states the NFA can be in before reading any input. This includes the start state of the NFA and any states that can be reached by a -transition.
a
bb
b
a
a
01
2
b
NFA
DFA
![Page 113: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/113.jpg)
113
{0,1}
a
b
{2}
For start state {0,1}, make transitions for each possible input, here a and b. Reading b from start {0,1}, we reach state {2}. Means from either {0}, or {1} we reach {2}.
a
bb
b
a
a
01
2
b
NFADFA
![Page 114: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/114.jpg)
114
For state {2}, we create a transition for each possible input, a and b. From {2}, with b we are either back to {2} (loop) or we reach {1}- see the little framed original NFA. So from {2}, with b we end in state {1, 2}. Reading a leads us from {2} to {0} in the original NFA, which means state {0, 1} in the new DFA.
ba
a
b{0,1}{1,2}
{2}
a
bb
b
a
a
01
2
b
NFADFA
![Page 115: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/115.jpg)
115
For state {1, 2}, we make again transition for eachpossible input, a and b. From {2} a leads us to {0}. From {1} with a we are back to {1}. So, we reach {0, 1} with a from {1,2}. With b we are back to {1,2}.
At this point, a transition is defined for every state-input pair.
ba
a
b{0,1}
{1,2}
{2}
b
a
DFA a
bb
b
a
a
01
2
b
NFA
![Page 116: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/116.jpg)
116
The last step is to mark the final states of the DFA.As {1} was the accepting state in NFA, all states containing {1} in DFA will be accepting states: ({0, 1} and {1, 2}).
ba
a
b{0,1} {1,2}
{2}
b
a
DFA a
bb
b
a
a
01
2
b
NFA
![Page 117: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/117.jpg)
117
Subset Construction Algorithm
![Page 118: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/118.jpg)
118
Subset Construction
States of nondeterministic M´ will correspond to sets of states of deterministic M
Where q0 is start state of M, use {q0} as start state of M´.
Accepting states of M´ will be those state-sets containing at least one accepting state of M.
![Page 119: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/119.jpg)
119
Subset Construction (cont.)
For each state-set S and for each s in alphabet of M, we draw an arc labeled s from state S to that state-set consisting of all and only the s-successors of members of S.
Eliminate any state-set, as well as all arcs incident upon it, such that there is no path leading to it from {q0}.
![Page 120: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/120.jpg)
120
The power set of a finite set, Q, consists of 2|Q| elements
The DFA corresponding to a given NFA with Q states have a finite number of states, 2|Q|.
If |Q| = 0 then Q is the empty set, | P(Q)| = 1 = 20.
If |Q| = N and N 1, we construct subset of a given set so that for each element of the initial set there are two alternatives, either is the element member of a subset or not. So we have
2 · 2 · 2 · 2 · 2 · 2 · 2…. ·2 = 2N
N times
![Page 121: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/121.jpg)
121
From an NFA to a DFASubset ConstructionOperation Description
- closure(s)
- closure(T)
Move(T,a)
Set of NFA states reachable from an NFA state s on -transitions along
Set of NFA states reachable from some NFA state s in T on -transitions along
Set of NFA states reachable from some NFA state set with a transition on input symbol a
![Page 122: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/122.jpg)
122
From an NFA to a DFA
Subset Construction
Initially, -closure (s0) is the only states in D and it is unmarked
while there is an unmarked state T in D do mark T; for each input symbol a do U:= e-closure(move(T,a)); if U is not in D then add U as an unmarked state to D Dtran[T,a]:=U; end(for) end(while)
![Page 123: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/123.jpg)
123
Grammars
![Page 124: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/124.jpg)
124
GrammarsGrammars express languages
Example: the English language
verbpredicate
nounarticlephrasenoun
predicatephrasenounsentence
_
_
![Page 125: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/125.jpg)
125
barksverbsingsverb
dognounbirdnoun
thearticleaarticle
![Page 126: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/126.jpg)
126
A derivation of “the bird sings”:
birdtheverbbirdtheverbnounthe
verbnounarticlepredicatenounarticlepredicatephrasenounsentence
sings
_
![Page 127: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/127.jpg)
127
A derivation of “a dog barks”:
barksdogaverbdoga
verbnounaverbnounarticleverbphrasenounpredicatephrasenounsentence
__
![Page 128: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/128.jpg)
128
The language of the grammar:
"ingssogdhet","barksogdhet"
,"ingssogda","barksogda"
,"ingssbirdhet","barksbirdhet"
,"ingssbirda","barksbirda"{L
}
}
![Page 129: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/129.jpg)
129
Notation
dognoun
birdnoun
Non-terminal (Variable)
TerminalProduction rule
![Page 130: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/130.jpg)
130
Example
Derivation of sentence:
SaSbS
ab
abaSbS
aSbS S
Grammar:
![Page 131: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/131.jpg)
131
aabbaaSbbaSbS
aSbS S
aabb
SaSbSGrammar:
Derivation of sentence
![Page 132: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/132.jpg)
132
Other derivations
aaabbbaaaSbbbaaSbbaSbS
aaaabbbbaaaaSbbbbaaaSbbbaaSbbaSbS
![Page 133: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/133.jpg)
133
The language of the grammar
SaSbS
}0:{ nbaL nn
![Page 134: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/134.jpg)
134
Formal Definition
Grammar PSTVG ,,,
:V Set of variables
:T Set of terminal symbols
:S Start variable
:P Set of production rules
![Page 135: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/135.jpg)
135
ExampleGrammar
SaSbS
G
}{SV },{ baT
},{ SaSbSP
PSTVG ,,,
![Page 136: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/136.jpg)
136
Sentential Form A sentence that contains variables and terminals
Example
aaabbbaaaSbbbaaSbbaSbS
sentential forms Sentence(sats)
![Page 137: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/137.jpg)
137
We write:
Instead of:
aaabbbS*
aaabbbaaaSbbbaaSbbaSbS
![Page 138: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/138.jpg)
138
nww*
1
nwwww 321
In general we write
if
By default ww*( )
![Page 139: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/139.jpg)
139
Example
SaSbS
aaabbbS
aabbS
abS
S
*
*
*
*
Grammar Derivations
![Page 140: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/140.jpg)
140
baaaaaSbbbbaaSbb
aaSbbS
SaSbS
GrammarExample
Derivations
![Page 141: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/141.jpg)
141
Another Grammar Example
AaAbAAbS
Derivations
aabbbaaAbbbaAbbSabbaAbbAbS
bAbS
GGrammar
![Page 142: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/142.jpg)
142
More Derivations
aaaabbbbbaaaaAbbbbbaaaAbbbbaaAbbbaAbbAbS
bbaS
bbbaaaaaabbbbS
aaaabbbbbS
nn
![Page 143: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/143.jpg)
143
The Language of a Grammar
For a grammar with start variable G S
}:{)( wSwGL
String of terminals
![Page 144: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/144.jpg)
144
ExampleFor grammar
AaAbAAbS
}0:{)( nbbaGL nn
Since bbaS nn
G
![Page 145: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/145.jpg)
145
Notation
AaAbA
|aAbA
thearticleaarticle
theaarticle |
![Page 146: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/146.jpg)
146
Linear Grammars
![Page 147: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/147.jpg)
147
Linear Grammars
Grammars with at most one variable (non-terminal) at the right side of a production
AaAbAAbS
SaSbS
Examples:
![Page 148: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/148.jpg)
148
A Non-Linear Grammar
bSaSaSbS
SSSS
Grammar G
)}()(:{)( wnwnwGL ba
![Page 149: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/149.jpg)
149
Another Linear Grammar
Grammar
AbBaBAAS
|
}0:{)( nbaGL nn
G
![Page 150: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/150.jpg)
150
Right-Linear Grammars
All productions have form: xBA
xA or
aSabSS
Example
![Page 151: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/151.jpg)
151
Left-Linear Grammars
All productions have form BxA
aBBAabA
AabS
|
xA or
Example
![Page 152: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/152.jpg)
152
Regular Grammars
![Page 153: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/153.jpg)
153
Regular Grammars Generate
Regular Languages
![Page 154: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/154.jpg)
154
Theorem
LanguagesGenerated byRegular Grammars
RegularLanguages
![Page 155: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/155.jpg)
155
Theorem - Part 1
LanguagesGenerated byRegular Grammars
RegularLanguages
Any regular grammar generatesa regular language
![Page 156: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/156.jpg)
156
Theorem - Part 2
Any regular language is generated by a regular grammar
LanguagesGenerated byRegular Grammars
RegularLanguages
![Page 157: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/157.jpg)
157
Proof – Part 1
The language generated by any regular grammar is regular
)(GLG
LanguagesGenerated byRegular Grammars
RegularLanguages
![Page 158: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/158.jpg)
158
The case of Right-Linear Grammars
Let be a right-linear grammar
We will prove: is regular
Proof idea We will construct NFA with
G
)(GL
M)()( GLML
![Page 159: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/159.jpg)
159
Grammar is right-linearG
Example
aBbBBaaABaAS
|
|
![Page 160: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/160.jpg)
160
Construct NFA such that every state is a grammar variable:
M
aBbBBaaABaAS
|
|
A
B
S specialfinal stateFV
![Page 161: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/161.jpg)
161
Add edges for each production:
S FV
A
B
a
aBbBBaaABaAS
|
|
![Page 162: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/162.jpg)
162
S FV
A
B
a
aBbBBaaABaAS
|
|
![Page 163: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/163.jpg)
163
S FV
A
B
a
a
a
aBbBBaaABaAS
|
|
![Page 164: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/164.jpg)
164
S FV
A
B
a
a
a
baBbB
BaaABaAS
|
|
![Page 165: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/165.jpg)
165
S FV
A
B
a
a
a
b
a
aBbBBaaABaAS
|
|
![Page 166: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/166.jpg)
166
aaabaaaabBaaaBaAS
S FV
A
B
a
a
a
b
a
![Page 167: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/167.jpg)
167
S FV
A
B
a
a
a
b
a
abBBBaaABaAS
|
|
GM GrammarNFA
abaaaabGLML
**)()(
![Page 168: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/168.jpg)
168
In GeneralA right-linear grammar
has variables:
and productions:
G
,,, 210 VVV
jmi VaaaV 21
mi aaaV 21or
![Page 169: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/169.jpg)
169
We construct the NFA such that:
each variable corresponds to a node:
M
iV
0V 1V 2V FV
specialfinal state
….
![Page 170: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/170.jpg)
170
For each production:
we add transitions and intermediate nodes
jmi VaaaV 21
iV jV………
1a 2a ma
![Page 171: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/171.jpg)
171
Example
M
)()( MLGL
04
5193
452
48433421
23110
|
||
aVaVaV
VaVVaaaVaaV
VaVaV
0VFV
1V
2V
3V
4V
1a
3a3a
4a
8a
2a 4a5a
9a5a
9a
![Page 172: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/172.jpg)
172
The case of Left-Linear Grammars
Let be a left-linear grammar
We will prove: is regular
Proof idea We will construct a right-linear grammar with
G
)(GL
G RGLGL )()(
![Page 173: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/173.jpg)
173
Since is left-linear grammarthe productions look like:
G
kaaBaA 21
kaaaA 21
![Page 174: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/174.jpg)
174
Construct right-linear grammar G
In :G kaaBaA 21
In :G BaaaA k 12
vBA
BvA R
![Page 175: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/175.jpg)
175
Construct right-linear grammar G
In :G kaaaA 21
In :G 12aaaA k
vA
RvA
![Page 176: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/176.jpg)
176
It is easy to see that:
Since is right-linear, we have:
RGLGL )()(
)(GL RGL )(
G
)(GLRegularLanguage
RegularLanguage
RegularLanguage
![Page 177: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/177.jpg)
177
Proof - Part 2
Any regular language is generated by some regular grammar
LG
LanguagesGenerated byRegular Grammars
RegularLanguages
![Page 178: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/178.jpg)
178
Proof idea
Any regular language is generated by some regular grammar
LG
Construct from a regular grammar such that
M G)()( GLML
Since is regularthere is an NFA such that
LM )(MLL
![Page 179: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/179.jpg)
179
Example
*)*(* abbababL )(MLL
a
b
a
b
M1q 2q
3q
0q
![Page 180: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/180.jpg)
180
a
b
a
b
M0q 1q 2q
3q
3
13
32
21
11
10
qqqbqqaqqbqqaqq
G
LMLGL )()(
Convert to a right-linear grammarM
![Page 181: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/181.jpg)
181
In General
For any transition:aq p
Add production: apq
variable terminal variable
![Page 182: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/182.jpg)
182
For any final state: fq
Add production: fq
![Page 183: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/183.jpg)
183
Since is right-linear grammar
is also a regular grammar with
G
LMLGL )()(
G
![Page 184: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/184.jpg)
184
Regular GrammarsA regular grammar is any right-linear or left-linear grammar
aSabSS
aBBAabA
AabS
|
1G 2G
Examples
![Page 185: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/185.jpg)
185
ObservationRegular grammars generate regular languages
aSabSS
aabGL *)()( 1
aBBAabA
AabS
|
*)()( 2 abaabGL
1G 2GExamples
![Page 186: 1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University…](https://reader031.fdocuments.us/reader031/viewer/2022011808/5a4d1c127f8b9ab0599f75ea/html5/thumbnails/186.jpg)
186
Regular Languages
Chomsky’s Language Hierarchy
Non-regular languages