SlideShare a Scribd company logo
1 of 60
Dete rministic Finite
Autom ata (DFA)
โ€ข DFA can be defined by quintuples
( ๐‘„ , ฮฃ , ๐›ฟ , ๐‘ž 0 , ๐น )
โ€“ ๐‘„ is finite set of states
โ€“ ฮฃ is finite set of alphabets
โ€“ ๐›ฟ is transition function
โ€“ ๐‘ž 0 is initial state
โ€“ ๐น finite set of final states
1
Example of DFA
๐‘„ = ๐ด, ๐ต, ๐ถ
ฮฃ = ๐‘Ž, ๐‘
๐›ฟ: ๐‘„ ฮง ฮฃ โ†’ ๐‘„
๐‘ž0 = ๐ด
๐น = {๐ต}
2
Transition Function
๐›ฟ: ๐‘„ ฮง ฮฃ โ†’ ๐‘„
{A, B, C} X {a, b} ๏ƒ {A, B, C}
(A, a)
(A, b)
(B, a)
(B, b)
(C, a)
(C, b)
A
B
C
For every input on a
state there is
exactly one
transition.
3
A
B
C
Question
โ€ข Why this FA is called Deterministic Finite
Automata?
โ€“ Every state on seeing any input it is always going
to go to only one state.
4
DFA
โ€ข Construct a DFA, that accepts set of all strings
over {a, b} of length 2.
โ€ข Ans:
โ€“ ฮฃ = ๐‘Ž, ๐‘
โ€“ ๐ฟ = {๐‘Ž๐‘Ž, ๐‘Ž๐‘, ๐‘๐‘Ž, ๐‘๐‘}
B C
A
a a
5
DFA
โ€ข Is this a complete DFA?
โ€ข No
โ€ข Now is this a complete DFA?
โ€ข No
โ€ข After reaching sate โ€˜Dโ€™ we canโ€™t go back to the final state, that is
why this state is called dead state/trap state.
B C
A
a a
B C
A
B C
A
a, b a, b
a, b a, b
D
a, b
a, b
6
Acceptance
โ€ข Acceptance of a string by a FA:
โ€“ Scan the entire string and if we reach a final state
from initial state.
โ€ข Acceptance of a language by a FA:
โ€“ If all the strings in the language are accepted by
the FA and all the strings those are not in the
language must reject by the FA.
7
DFA
โ€ข Construct a DFA that accept all strings over the
alphabets {a, b} where the string length is at least 2.
โ€“ ๐Ž โˆˆ ๐’‚, ๐’ƒ and ๐Ž โ‰ฅ ๐Ÿ
โ€“ ๐œฎ = ๐’‚, ๐’ƒ
โ€“ ๐‘ณ = {๐’‚๐’‚, ๐’‚๐’ƒ, ๐’ƒ๐’‚, ๐’ƒ๐’ƒ, ๐’‚๐’‚๐’‚, โ€ฆ โ€ฆ ๐’ƒ๐’ƒ๐’ƒ, โ€ฆ โ€ฆ โ€ฆ }
โ€“ Up to this is a DFA of string length 2. This is not the
required DFA.
โ€“ Now this is required DFA.
A B
a,b
C
a,b
a, b
8
DFA
โ€ข Construct a DFA that accept all strings over the
alphabets {a, b} where the string length is at most
two.
โ€“ ๐Ž โˆˆ ๐’‚, ๐’ƒ and ๐Ž โ‰ค ๐Ÿ
โ€“ ๐œฎ = ๐’‚, ๐’ƒ
โ€“ ๐‘ณ = {๐, ๐’‚, ๐’ƒ, ๐’‚๐’‚, ๐’‚๐’ƒ, ๐’ƒ๐’‚, ๐’ƒ๐’ƒ}
โ€“ To accept null string (๐) the only way to make initial
state to both initial state and final state.
A B
a,b
C
a,b
D
a, b
a, b
9
Minimum numbe r of state s
๐Ž = ๐Ÿ ๐Ž โ‰ฅ ๐Ÿ ๐Ž โ‰ค ๐Ÿ
๐Ž = ๐’
n + 2
๐Ž โ‰ฅ ๐’
n + 1
๐Ž โ‰ค ๐’
n + 2
10
DFA
โ€ข Construct a DFA that accept all strings over
the alphabets {a, b} where the string length is
divisible by two.
โ€ข ๐‘ณ = {๐œ–, ๐‘Ž๐‘Ž, ๐‘Ž๐‘, ๐‘๐‘Ž, ๐‘๐‘, ๐‘Ž๐‘Ž๐‘Ž๐‘Ž โ€ฆ ๐‘๐‘๐‘๐‘ โ€ฆ โ€ฆ โ€ฆ }
โ€ข This is not a finite automata
A B
a, b
C
a, b
D
a, b
E
a, b
Length 0 Length 1 Length 2 Length 3 Length 4
11
DFA
โ€ข Construct a DFA that accept all strings over
the alphabets {a, b} where the string length is
divisible by two.
โ€ข This is not minimal
A B
a, b
C
a, b
Length 0 Length 1 Length 2
A B
a, b
Length
Even
Length
Odd
a, b
a, b
12
DFA
โ€ข Construct a DFA that accept all strings over the
alphabets {a, b} where the string length is not
divisible by two.
โ€ข We will get 0 or 1 after diving the length of a string
by two. That is why we need two state.
โ€ข If string length is 3 then we will get 0 or 1 or 2 as
remainder after dividing any length by 3. So we will
be requiring three state in that case.
A B
a, b
Length
Even
Length
Odd
a, b
13
DFA
โ€ข Construct a DFA that accept all strings over
the alphabets {a, b} where the string length is
divisible by three.
โ€“ ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 0
โ€“ ๐ฟ = {๐œ–, ๐‘Ž๐‘Ž๐‘Ž, โ€ฆ โ€ฆ โ€ฆ , ๐‘๐‘๐‘, ๐‘Ž๐‘Ž๐‘Ž๐‘Ž๐‘Ž๐‘Ž, โ€ฆ โ€ฆ โ€ฆ , ๐‘๐‘๐‘๐‘๐‘๐‘, โ€ฆ โ€ฆ โ€ฆ โ€ฆ โ€ฆ โ€ฆ }
A B
a, b
C
a, b
Length
0,3,6,โ€ฆ
Length
1,4,7,โ€ฆ
Length
2,5,8,โ€ฆ
a, b
14
DFA
โ€ข Construct a DFA where ๐œ” โ‰… 1 ๐‘š๐‘œ๐‘‘ 3
โ€ข ๐œ” โ‰… 1 ๐‘š๐‘œ๐‘‘ 3 means ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 1
โ€ข For ๐œ” ๐‘š๐‘œ๐‘‘ ๐‘› = 0 ๐‘œ๐‘Ÿ ๐œ” โ‰… ๐‘š ๐‘š๐‘œ๐‘‘ n (m is any number)
in general for minimal DFA we need ๐‘› number of states.
A
a, b
C
a, b
Length
0,3,6,โ€ฆ
Length
1,4,7,โ€ฆ
Length
2,5,8,โ€ฆ
a, b
B
15
DFA
โ€ข Construct a DFA that accept all strings over
the alphabets {a, b} where number of โ€˜aโ€™ in
the string is two.
โ€“ ๐‘›๐‘Ž ๐œ” = 2
โ€“ ๐ฟ = ๐‘Ž๐‘Ž, ๐‘๐‘Ž๐‘Ž, ๐‘Ž๐‘๐‘Ž, ๐‘Ž๐‘Ž๐‘, ๐‘๐‘๐‘Ž๐‘Ž, โ€ฆ โ€ฆ โ€ฆ
B
a
C
a
0 โ€˜aโ€™s 1 โ€˜aโ€™s 2 โ€˜aโ€™s
A D
b b b
a
3 โ€˜aโ€™s
a,b
16
DFA
โ€ข Construct a DFA that accept all strings over
the alphabets {a, b} where number of โ€˜aโ€™ in
the string at least two.
โ€“ ๐‘›๐‘Ž ๐œ” โ‰ฅ 2
B
a
C
a
0 โ€˜aโ€™s 1 โ€˜aโ€™s 2 โ€˜aโ€™s
A
b b a, b
17
DFA
โ€ข Construct a DFA that accept all strings over
the alphabets {a, b} where number of โ€˜aโ€™ in
the string at most two.
โ€“ ๐‘›๐‘Ž ๐œ” โ‰ค 2
b
B
a
C
a
0 โ€˜aโ€™s 1 โ€˜aโ€™s 2 โ€˜aโ€™s
A
b b
D
3 โ€˜aโ€™s
a,b
a
18
DFA
โ€ข Construct a DFA that accept all strings over
the alphabets {a, b} where number of โ€˜aโ€™ in
the string is even.
โ€“ ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 0
โ€“ ๐‘›๐‘Ž ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 2
A B
a
Length
Even
Length
Odd
a
b
b
19
DFA
โ€ข Construct a DFA that accept all strings over
the alphabets {a, b} where number of โ€˜aโ€™ in
the string is odd.
โ€“ ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 1
โ€“ ๐‘›๐‘Ž ๐œ” โ‰… 1 ๐‘š๐‘œ๐‘‘ 2
b
A B
a
Length
Even
Length
Odd
a
b
20
DFA
โ€ข Construct a DFA that accept all strings over
the alphabets {a, b} where number of โ€˜aโ€™ in
the string is divisible by 3.
โ€“ ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 0
โ€“ ๐‘›๐‘Ž ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 3
A B
a
a
b
b
C
a
b
21
DFA
โ€ข ๐‘–๐‘“๐‘›๐‘Ž ๐œ” โ‰… ๐‘˜ ๐‘š๐‘œ๐‘‘ n , how to draw DFA??
โ€“ ๐‘› number of states will be there
โ€ข If k=0 ๐‘ž0 will be final state
โ€ข If k=1 ๐‘ž1 will be final state
โ€ข If k=2 ๐‘ž2 will be final state
โ€ข If k=3 ๐‘ž3 will be final state
โ€ข So on
22
Assignment
1. Construct a DFA that accept all strings over the
alphabets {a, b} where number of โ€˜bโ€™ in the string is
divisible by 5.
2. Construct a DFA that accept all strings over the
alphabets {a, b} such that ๐‘›๐‘Ž ๐œ” โ‰… 2 ๐‘š๐‘œ๐‘‘ 5
3. Construct a DFA that accept all strings over the
alphabets {a, b} such that ๐‘›๐‘ ๐œ” โ‰… 1 ๐‘š๐‘œ๐‘‘ 3
23
DFA
โ€ข Construct a DFA that accept all strings over
the alphabets {a, b} where number of โ€˜aโ€™ and
number of โ€˜bโ€™ in the string is even.
โ€“ ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 0 & ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 0
โ€“ ๐‘›๐‘Ž ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 2 & ๐‘›๐‘ ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 2
๐‘›๐‘Ž ๐œ” ๐‘›๐‘ ๐œ”
E E
O E
E O
O O
Four possible
states
representing this
situation
24
DFA
ee eo
oe oo
1. String ๐œ– state ee
2. String โ€˜aโ€™ state oe
3. String โ€˜bโ€™ state eo
4. String โ€˜aaโ€™ state ee
5. String โ€˜abโ€™ state oo
6. String โ€˜baโ€™ state oo
7. String โ€˜bbโ€™ state ee
8. String โ€˜abaโ€™ or โ€˜baaโ€™ state eo
9. String โ€˜babโ€™ or โ€˜abbโ€™ state oe
a
b
a
b
a
b
a
b
25
Cross Product Method
โ€ข ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 0 & ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 0
๐ด, ๐ต ร— ๐ถ, ๐ท = ๐ด๐ถ, ๐ด๐ท, ๐ต๐ถ, ๐ต๐ท
A B
a
a
b
b
C D
b
b
a
a
b
a
b
a
b
a
b
a
A B
C C
a
a
b
b
A A
C D
AC BC
AD BD
ee oe
oo
eo
Observation: โ€˜aโ€™s are counting
in horizontal way and โ€˜bโ€™s are
counting in vertical way. 26
Cross Product Method
โ€ข Construct a DFA that accept all strings over the
alphabets {a, b} where number of โ€˜aโ€™ is divisible by 3
and number of โ€˜bโ€™ in the string is divisible by 2.
b
a
a
b
00 10
01 11
20
b
21
a
a
a
a
b
b
b
27
Cross Product Method
โ€ข Construct a DFA that accept all strings over the alphabets {a,
b} where number of โ€˜aโ€™ and number of โ€˜bโ€™ in the string is
divisible by 3.
โ€“ ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 0 & ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 0
โ€“ ๐‘›๐‘Ž ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 3 & ๐‘›๐‘ ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 3
b
a
a
b
A B
D E
C
b
F
a
a
a
a
b
a
b
G H
b
I
a
a
b
b
b
28
DFA
โ€ข Construct a DFA that accept all strings over the alphabets {a,
b} such that ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 โ‰ฅ ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 2
b
a
a
b
00 10
01 11
20
b
21
a
a
a
a
b
b
b
No. of โ€˜aโ€™s mod 3 >
no. of โ€˜bโ€™s mod 2
this will be a final
state
No. of โ€˜aโ€™s mod 3 >
no. of โ€˜bโ€™s mod 2
this will be a final
state
No. of โ€˜aโ€™s mod 3 =
no. of โ€˜bโ€™s mod 2
this will be a final
state
No. of โ€˜aโ€™s mod 3 >
no. of โ€˜bโ€™s mod 2
this will be a final
state
No. of โ€˜aโ€™s mod 3 =
no. of โ€˜bโ€™s mod 2
So this will be a
final state
No. of โ€˜aโ€™s mod 3 <
no. of โ€˜bโ€™s mod 2
this will not be a
final state
29
DFA
โ€ข Construct a minimal DFA which accepts all
strings over {0,1}, which when interpreted as
binary number is divisible by 2.
โ€“ Two remainders are possible, so two states
๐’’๐ŸŽ ๐’’๐Ÿ
1
0
1
0
30
DFA
โ€ข Construct a minimal DFA which accepts all
strings over {0,1}, which when interpreted as
binary number is divisible by 3.
โ€“ Three remainders are possible, so three states
๐’’๐ŸŽ ๐’’๐Ÿ
1
1
0
0
๐’’๐Ÿ
0
1
If the question is divisible by โ€˜nโ€™ then number of state is n.
31
Transition Table
0 1
๐‘ž0 ๐‘ž0 ๐‘ž1
๐‘ž1 ๐‘ž2 ๐‘ž0
๐‘ž2 ๐‘ž1 ๐‘ž2
q0 q1
q2 q0
q1 q2
32
Transition Table
โ€ข Construct a minimal DFA which accepts all
strings over {0,1}, which when interpreted as
binary number is divisible by 4
0 1
๐‘ž0 ๐‘ž0 ๐‘ž1
๐‘ž1 ๐‘ž2 ๐‘ž3
๐‘ž2 ๐‘ž0 ๐‘ž1
๐‘ž3 ๐‘ž2 ๐‘ž3
33
DFA
โ€ข Construct a minimal DFA which accepts all
strings over {0,1}, which when interpreted as
binary number is โ‰… 1 ๐‘š๐‘œ๐‘‘ 3.
๐’’๐ŸŽ ๐’’๐Ÿ
1
1
0
0
๐’’๐Ÿ
0
1
34
DFA
โ€ข Construct a minimal DFA which accepts all
strings over {0,1}, which when interpreted as
binary number is โ‰… 2 ๐‘š๐‘œ๐‘‘ 3.
๐’’๐ŸŽ ๐’’๐Ÿ
1
1
0
0
๐’’๐Ÿ
0
1
35
Transition Table
โ€ข Construct a minimal DFA which accepts all
strings over {0,1,2}, which when interpreted as
ternary number is divisible by 4
0 1 2
๐‘ž0 ๐‘ž0 ๐‘ž1 ๐‘ž2
๐‘ž1 ๐‘ž3 ๐‘ž0 ๐‘ž1
๐‘ž2 ๐‘ž2 ๐‘ž3 ๐‘ž0
๐‘ž3 ๐‘ž1 ๐‘ž2 ๐‘ž3
36
DFA
โ€ข Construct a minimal DFA which accepts set of
all strings over {a, b} where each string starts
with an โ€˜aโ€™.
โ€ข Construct a minimal DFA which accepts set of
all strings over {a, b} where each string
contains an โ€˜aโ€™.
โ€ข Construct a minimal DFA which accepts set of
all strings over {a, b} where each string ends
with an โ€˜aโ€™.
37
Assignment
1. Construct a DFA that accept all strings over the alphabets {a, b} where number of
โ€˜aโ€™ and number of โ€˜bโ€™ is odd in the string.
2. Construct a DFA that accept all strings over the alphabets {a, b} where number of
โ€˜aโ€™ is even and number of โ€˜bโ€™ is odd in the string .
3. Construct a DFA that accept all strings over the alphabets {a, b} where number of
โ€˜aโ€™ is odd and number of โ€˜bโ€™ is even in the string .
4. Construct a DFA that accept all strings over the alphabets {a, b} where number of
โ€˜aโ€™ is multiple of three and number of โ€˜bโ€™ is multiple of two in the string.
5. Construct a DFA that accept all strings over the alphabets {a, b} such that
๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 = ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 2
6. Construct a DFA that accept all strings over the alphabets {a, b} such that
๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 โ‰ค ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 2
7. Construct a DFA that accept all strings over the alphabets {a, b} such that
๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 1 and ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 2
8. Construct a DFA that accept all strings over the alphabets {a, b} such that
๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 > ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 3
9. Construct a minimal DFA which accepts all strings over Octal number system,
which when interpreted as binary number โ‰… 1 ๐‘š๐‘œ๐‘‘ 5
38
DFA
โ€ข Construct a minimal DFA which accepts set of
all strings over {a, b} where each string start
with โ€œabโ€
โ€“ L= {ab, aba, abb, โ€ฆโ€ฆโ€ฆ}
B C
A
a b
D
a, b
a
a, b
39
b
DFA
โ€ข Construct a minimal DFA which accepts set of
all strings over {a, b} where each string
contains โ€œabโ€ as a sub string.
โ€“ L= {ab, aab, aba, bab, abb โ€ฆโ€ฆโ€ฆ}
B C
A
a b
b a a,b
40
DFA
โ€ข Construct a minimal DFA which accepts set of
all strings over {a, b} where each string end
with โ€œabโ€
โ€“ L= {ab, aab, bab, abab โ€ฆโ€ฆโ€ฆ}
B C
A
a b
b a
a
b
41
DFA
โ€ข Construct a minimal DFA which accepts set of all
strings over {a, b} where each string starts with โ€˜aโ€™
and ends with โ€˜bโ€™ or vice versa.
โ€“ L ={ab, ba, aab, abb, baa, bba. โ€ฆโ€ฆ}
B C
A
a b
b
a b
a
D
a
E
b
b
42
a
DFA
โ€ข Construct a minimal DFA which accepts set of all
strings over {a, b} where each string starts and ends
with same symbol.
โ€“ L={๐œ–, a, b, aa, bb, aba, bab,โ€ฆโ€ฆโ€ฆโ€ฆ}
C
B
A
a b
b
a
b
a
E
a
D b
b
a
This DFA is complement of
previous DFA and language also.
We will get complement of a
language by removing one
language from ๐šบโˆ—. ๐‘ณ๐Ÿ = ๐šบโˆ— โˆ’ ๐‘ณ๐Ÿ
L2 is complement of L1
43
Complement of DFA
A B
a
Length
Even
Length
Odd
a
b
b
A B
a
Length
Even
Length
Odd
a
b
L1 = Even number of โ€˜aโ€™ L2 = Odd number of โ€˜aโ€™
L3 = Starts with โ€˜aโ€™ L4 = Not starts with โ€˜aโ€™
A B
C
a
b
a,b
a,b
A B
C
a
b
a,b
a,b
44
Complement of DFA
โ€ข DFA can be defined by quintuples
โ€“ ( ๐‘„ , ฮฃ , ๐›ฟ , ๐‘ž 0 , ๐น )
โ€ข Complement of DFA can be defined by
quintuples
โ€“ ( ๐‘„ , ฮฃ , ๐›ฟ , ๐‘ž 0 , ๐‘„ โˆ’ ๐น )
45
DFA
โ€ข Construct a minimal DFA which accepts set of
all strings over {a, b} which accepts strings in
which every 'a' is followed by 'b'.
โ€“ L={๐œ–, b, ab, bb, aba, bab, โ€ฆโ€ฆโ€ฆโ€ฆ}
46
C
B
A a b
a
b
a
b
D
a,b
DFA
โ€ข Construct a minimal DFA which accepts set of
all strings over {a, b} which accepts strings in
which every 'a' never followed by 'b'.
โ€“ This is not complement of previous
โ€“ L={๐œ–, a, aa,โ€ฆ..,b, bb,โ€ฆโ€ฆ, ba, bbaโ€ฆโ€ฆโ€ฆโ€ฆ}
47
C
B
A
a b
a
a,b
b
DFA
โ€ข Construct a minimal DFA which accepts set of
all strings over {a, b} which accepts strings in
which every 'a' is followed by โ€˜bb'.
48
D
B
A a b
a
b
a
b
E
a,b
C
b
a
DFA
โ€ข Construct a minimal DFA which accepts set of
all strings over {a, b} which accepts strings in
which every 'a' never followed by โ€˜bb'.
49
D
B
A a b
a, b
a
b
C
b
a
DFA
โ€ข ๐ฟ = ๐‘Ž๐‘›
๐‘๐‘š
|๐‘›, ๐‘š โ‰ฅ 1
โ€“ ๐ฟ = {๐‘Ž๐‘, ๐‘Ž๐‘Ž๐‘๐‘, ๐‘Ž๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘๐‘๐‘, โ€ฆ โ€ฆ โ€ฆ }
50
C
B
A a
b
b
a
D
a, b
b
a
DFA
โ€ข ๐ฟ = ๐‘Ž๐‘›
๐‘๐‘š
|๐‘›, ๐‘š โ‰ฅ 0
โ€“ ๐ฟ = {๐œ–, ๐‘Ž, ๐‘Ž๐‘Ž, โ€ฆ , ๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘๐‘, โ€ฆ ๐‘, ๐‘๐‘, ๐‘๐‘๐‘ โ€ฆ โ€ฆ โ€ฆ }
51
C
B
A
b a
b a,b
a
DFA
โ€ข ๐ฟ = ๐‘Ž๐‘›
๐‘๐‘š
๐‘๐‘™
|๐‘›, ๐‘š, ๐‘™ โ‰ฅ 1
โ€“ ๐ฟ = {๐‘Ž๐‘๐‘, ๐‘Ž๐‘Ž๐‘๐‘, ๐‘Ž๐‘๐‘๐‘, ๐‘Ž๐‘๐‘๐‘, โ€ฆ โ€ฆ โ€ฆ }
52
D
B
A a
b, c
c
c
D
a, b, c
b
a
C
c
a
b
a, b
DFA
โ€ข ๐ฟ = ๐‘Ž๐‘›
๐‘๐‘š
๐‘๐‘™
|๐‘›, ๐‘š, ๐‘™ โ‰ฅ 0
โ€“ ๐ฟ = {๐œ–, ๐‘Ž, ๐‘, ๐‘, ๐‘Ž๐‘, ๐‘Ž๐‘, ๐‘๐‘, ๐‘Ž๐‘๐‘, ๐‘Ž๐‘Ž, ๐‘๐‘, ๐‘๐‘, โ€ฆ }
53
B
A b c
c
b
a
C
c
a
D
a, b, c
a, b
DFA
โ€ข ๐ฟ = {๐‘Ž3
๐‘๐‘ค๐‘Ž3
|๐‘ค โˆˆ {๐‘Ž, ๐‘}โˆ—
}
โ€“ ๐ฟ = {๐‘Ž3๐‘๐œ–๐‘Ž3, ๐‘Ž3๐‘๐‘Ž๐‘Ž3, ๐‘Ž3๐‘๐‘๐‘Ž3, ๐‘Ž3๐‘๐‘Ž๐‘Ž๐‘Ž3, โ€ฆ โ€ฆ }
54
H
B
A a a
C D E F G
a b a a a
I
b
a, b
b b a
b
b
b
b
a
Operations of DFA
Different operations that we can apply on DFAs
are -
1. Union
2. Concatenation
3. Cross Product
4. Complement
5. Reversal
55
Union
โ€ข Union of two Regular language is also Regular
โ€“ L1 = starts with โ€˜aโ€™ and ends with โ€˜bโ€™
โ€“ L2 = starts with โ€˜bโ€™ and ends with โ€˜aโ€™
โ€“ ๐ฟ = ๐ฟ1 โˆช ๐ฟ2 = starts with different symbol
โ€ข Let,
๐‘ด๐Ÿ = ๐‘„1, ฮฃ1, ๐›ฟ1, ๐‘ž0
1, ๐น1 DFA for L1 , ๐‘ด๐Ÿ = ๐‘„2, ฮฃ2, ๐›ฟ2, ๐‘ž0
2, ๐น2 DFA for L2
We want to construct M for ๐‘ณ = ๐ฟ1 โˆช ๐ฟ2
๐‘ด = ๐‘„, ฮฃ, ๐›ฟ, ๐‘ž0, ๐น DFA for L
Where,
๐‘ธ = ๐‘„1 ร— ๐‘„2
๐œฎ = ฮฃ1 โˆช ฮฃ2
๐œน ๐‘Ÿ1, ๐‘Ÿ2 , ๐‘Ž = ๐›ฟ1 ๐‘Ÿ1, ๐‘Ž , ๐›ฟ2 ๐‘Ÿ2, ๐‘Ž
๐’’๐ŸŽ= ๐‘ž0
1, ๐‘ž0
2
๐‘ญ = ๐‘Ÿ1, ๐‘Ÿ2 | ๐‘Ÿ1 โˆˆ ๐น1 ๐‘œ๐‘Ÿ ๐‘Ÿ2 โˆˆ ๐น2
56
๐‘Ÿ1 โˆˆ ๐‘„1 ๐‘Ž๐‘›๐‘‘ ๐‘Ÿ2 โˆˆ ๐‘„2
Union
57
B
A a b
b
a
C
b
D
a, b
a
B
A b a
a
b
C
a
D
a, b
b
b
B
A a b
b
a
C
a
B
b
a
a
b
C
Concatenation
โ€ข Concatenation of two Regular language is also Regular
โ€“ L1 = starts with โ€˜aโ€™
โ€“ L2 = ends with โ€˜bโ€™
โ€“ ๐ฟ = ๐ฟ1 โˆ˜ ๐ฟ2 = starts with โ€˜aโ€™ and ends with โ€˜bโ€™
๐ฟ1 = ๐‘Ž, ๐‘Ž๐‘Ž, ๐‘Ž๐‘, ๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘Ž๐‘Ž, ๐‘Ž๐‘๐‘, โ€ฆ โ€ฆ
๐ฟ2 = {๐‘, ๐‘Ž๐‘, ๐‘๐‘, ๐‘๐‘๐‘, ๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘๐‘, โ€ฆ โ€ฆ }
๐ฟ = {๐‘Ž๐‘, ๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘๐‘, ๐‘Ž๐‘๐‘๐‘, โ€ฆ โ€ฆ โ€ฆ }
โ€ข Let,
๐‘ด๐Ÿ = ๐‘„1, ฮฃ1, ๐›ฟ1, ๐‘ž0
1
, ๐น1 DFA for L1 , ๐‘ด๐Ÿ = ๐‘„2, ฮฃ2, ๐›ฟ2, ๐‘ž0
2
, ๐น2 DFA for L2
We want to construct M for ๐‘ณ = ๐ฟ1 โˆ˜ ๐ฟ2
๐‘ด = ๐‘„, ฮฃ, ๐›ฟ, ๐‘ž0, ๐น DFA for L
58
Concatenation
59
A a
a, b
B
b
C
a, b
A b
b
B
a
a
B
A a b
b
a
C
b
D
a, b
a
Reversal
โ€ข L1= starts with โ€˜aโ€™
โ€“ ๐ฟ1 = {a, aa, ab, aaa, aab, aba,โ€ฆโ€ฆ}
โ€“ ๐ฟ1๐‘… = {a, aa, ba, aaa, baa, aba,โ€ฆโ€ฆ}
โ€ข Steps:
โ€“ States are same as original
โ€“ Convert initial state to final state
โ€“ Convert final state to initial state
60
A a
a, b
B
b
C
a, b
A
a
a, b
B
b
C
a, b
This is not DFA it is NFA
If we reverse a DFA of a
language we will get a
reverse language, but we
may or may not get
reverse DFA. Reverse FA is
either DFA or NFA.

More Related Content

Similar to 15159222.ppt

RegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptx
RaviAr5
ย 
Theory of computing
Theory of computingTheory of computing
Theory of computing
Ranjan Kumar
ย 
Chapter 2 limits of DFA NDFA.ppt
Chapter 2  limits of DFA  NDFA.pptChapter 2  limits of DFA  NDFA.ppt
Chapter 2 limits of DFA NDFA.ppt
ArwaKhallouf
ย 

Similar to 15159222.ppt (20)

Lec 3 ---- dfa
Lec 3  ---- dfaLec 3  ---- dfa
Lec 3 ---- dfa
ย 
Lecture12_16717_Lecture1.ppt
Lecture12_16717_Lecture1.pptLecture12_16717_Lecture1.ppt
Lecture12_16717_Lecture1.ppt
ย 
Context free grammar
Context free grammarContext free grammar
Context free grammar
ย 
To lec 03
To lec 03To lec 03
To lec 03
ย 
RegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptx
ย 
Automata theory - CFG and normal forms
Automata theory - CFG and normal formsAutomata theory - CFG and normal forms
Automata theory - CFG and normal forms
ย 
Lecture 03 lexical analysis
Lecture 03 lexical analysisLecture 03 lexical analysis
Lecture 03 lexical analysis
ย 
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
ย 
Periodic pattern mining
Periodic pattern miningPeriodic pattern mining
Periodic pattern mining
ย 
Periodic pattern mining
Periodic pattern miningPeriodic pattern mining
Periodic pattern mining
ย 
Theory of computing
Theory of computingTheory of computing
Theory of computing
ย 
Lesson 04
Lesson 04Lesson 04
Lesson 04
ย 
NFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramNFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition Diagram
ย 
Lesson 02
Lesson 02Lesson 02
Lesson 02
ย 
Lesson 02
Lesson 02Lesson 02
Lesson 02
ย 
10 Regular VS Non Regular Language.pptx
10 Regular VS Non Regular Language.pptx10 Regular VS Non Regular Language.pptx
10 Regular VS Non Regular Language.pptx
ย 
Theory of Automata Lesson 02
Theory of Automata Lesson 02Theory of Automata Lesson 02
Theory of Automata Lesson 02
ย 
finite_automata.ppt
finite_automata.pptfinite_automata.ppt
finite_automata.ppt
ย 
Chapter 2 limits of DFA NDFA.ppt
Chapter 2  limits of DFA  NDFA.pptChapter 2  limits of DFA  NDFA.ppt
Chapter 2 limits of DFA NDFA.ppt
ย 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
ย 

More from ssuser47f7f2 (10)

rs1.ppt
rs1.pptrs1.ppt
rs1.ppt
ย 
Lecture7x.ppt
Lecture7x.pptLecture7x.ppt
Lecture7x.ppt
ย 
NORMAL-FORMS.ppt
NORMAL-FORMS.pptNORMAL-FORMS.ppt
NORMAL-FORMS.ppt
ย 
functions (1).pptx
functions (1).pptxfunctions (1).pptx
functions (1).pptx
ย 
09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf
ย 
Module 2_Conditional Statements.pptx
Module 2_Conditional Statements.pptxModule 2_Conditional Statements.pptx
Module 2_Conditional Statements.pptx
ย 
03-FiniteAutomata.pptx
03-FiniteAutomata.pptx03-FiniteAutomata.pptx
03-FiniteAutomata.pptx
ย 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
ย 
Module 1-System Software PROGRAMS.pptx
Module 1-System Software PROGRAMS.pptxModule 1-System Software PROGRAMS.pptx
Module 1-System Software PROGRAMS.pptx
ย 
module1 network security.pdf
module1 network security.pdfmodule1 network security.pdf
module1 network security.pdf
ย 

Recently uploaded

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
ย 
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
KreezheaRecto
ย 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
ย 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
ย 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
ย 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
ย 
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night StandCall Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
amitlee9823
ย 
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 

Recently uploaded (20)

Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
ย 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
ย 
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
ย 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
ย 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
ย 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
ย 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
ย 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
ย 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
ย 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
ย 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
ย 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
ย 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
ย 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ย 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
ย 
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night StandCall Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
ย 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
ย 
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...
ย 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
ย 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
ย 

15159222.ppt

  • 1. Dete rministic Finite Autom ata (DFA) โ€ข DFA can be defined by quintuples ( ๐‘„ , ฮฃ , ๐›ฟ , ๐‘ž 0 , ๐น ) โ€“ ๐‘„ is finite set of states โ€“ ฮฃ is finite set of alphabets โ€“ ๐›ฟ is transition function โ€“ ๐‘ž 0 is initial state โ€“ ๐น finite set of final states 1
  • 2. Example of DFA ๐‘„ = ๐ด, ๐ต, ๐ถ ฮฃ = ๐‘Ž, ๐‘ ๐›ฟ: ๐‘„ ฮง ฮฃ โ†’ ๐‘„ ๐‘ž0 = ๐ด ๐น = {๐ต} 2
  • 3. Transition Function ๐›ฟ: ๐‘„ ฮง ฮฃ โ†’ ๐‘„ {A, B, C} X {a, b} ๏ƒ {A, B, C} (A, a) (A, b) (B, a) (B, b) (C, a) (C, b) A B C For every input on a state there is exactly one transition. 3 A B C
  • 4. Question โ€ข Why this FA is called Deterministic Finite Automata? โ€“ Every state on seeing any input it is always going to go to only one state. 4
  • 5. DFA โ€ข Construct a DFA, that accepts set of all strings over {a, b} of length 2. โ€ข Ans: โ€“ ฮฃ = ๐‘Ž, ๐‘ โ€“ ๐ฟ = {๐‘Ž๐‘Ž, ๐‘Ž๐‘, ๐‘๐‘Ž, ๐‘๐‘} B C A a a 5
  • 6. DFA โ€ข Is this a complete DFA? โ€ข No โ€ข Now is this a complete DFA? โ€ข No โ€ข After reaching sate โ€˜Dโ€™ we canโ€™t go back to the final state, that is why this state is called dead state/trap state. B C A a a B C A B C A a, b a, b a, b a, b D a, b a, b 6
  • 7. Acceptance โ€ข Acceptance of a string by a FA: โ€“ Scan the entire string and if we reach a final state from initial state. โ€ข Acceptance of a language by a FA: โ€“ If all the strings in the language are accepted by the FA and all the strings those are not in the language must reject by the FA. 7
  • 8. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where the string length is at least 2. โ€“ ๐Ž โˆˆ ๐’‚, ๐’ƒ and ๐Ž โ‰ฅ ๐Ÿ โ€“ ๐œฎ = ๐’‚, ๐’ƒ โ€“ ๐‘ณ = {๐’‚๐’‚, ๐’‚๐’ƒ, ๐’ƒ๐’‚, ๐’ƒ๐’ƒ, ๐’‚๐’‚๐’‚, โ€ฆ โ€ฆ ๐’ƒ๐’ƒ๐’ƒ, โ€ฆ โ€ฆ โ€ฆ } โ€“ Up to this is a DFA of string length 2. This is not the required DFA. โ€“ Now this is required DFA. A B a,b C a,b a, b 8
  • 9. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where the string length is at most two. โ€“ ๐Ž โˆˆ ๐’‚, ๐’ƒ and ๐Ž โ‰ค ๐Ÿ โ€“ ๐œฎ = ๐’‚, ๐’ƒ โ€“ ๐‘ณ = {๐, ๐’‚, ๐’ƒ, ๐’‚๐’‚, ๐’‚๐’ƒ, ๐’ƒ๐’‚, ๐’ƒ๐’ƒ} โ€“ To accept null string (๐) the only way to make initial state to both initial state and final state. A B a,b C a,b D a, b a, b 9
  • 10. Minimum numbe r of state s ๐Ž = ๐Ÿ ๐Ž โ‰ฅ ๐Ÿ ๐Ž โ‰ค ๐Ÿ ๐Ž = ๐’ n + 2 ๐Ž โ‰ฅ ๐’ n + 1 ๐Ž โ‰ค ๐’ n + 2 10
  • 11. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where the string length is divisible by two. โ€ข ๐‘ณ = {๐œ–, ๐‘Ž๐‘Ž, ๐‘Ž๐‘, ๐‘๐‘Ž, ๐‘๐‘, ๐‘Ž๐‘Ž๐‘Ž๐‘Ž โ€ฆ ๐‘๐‘๐‘๐‘ โ€ฆ โ€ฆ โ€ฆ } โ€ข This is not a finite automata A B a, b C a, b D a, b E a, b Length 0 Length 1 Length 2 Length 3 Length 4 11
  • 12. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where the string length is divisible by two. โ€ข This is not minimal A B a, b C a, b Length 0 Length 1 Length 2 A B a, b Length Even Length Odd a, b a, b 12
  • 13. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where the string length is not divisible by two. โ€ข We will get 0 or 1 after diving the length of a string by two. That is why we need two state. โ€ข If string length is 3 then we will get 0 or 1 or 2 as remainder after dividing any length by 3. So we will be requiring three state in that case. A B a, b Length Even Length Odd a, b 13
  • 14. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where the string length is divisible by three. โ€“ ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 0 โ€“ ๐ฟ = {๐œ–, ๐‘Ž๐‘Ž๐‘Ž, โ€ฆ โ€ฆ โ€ฆ , ๐‘๐‘๐‘, ๐‘Ž๐‘Ž๐‘Ž๐‘Ž๐‘Ž๐‘Ž, โ€ฆ โ€ฆ โ€ฆ , ๐‘๐‘๐‘๐‘๐‘๐‘, โ€ฆ โ€ฆ โ€ฆ โ€ฆ โ€ฆ โ€ฆ } A B a, b C a, b Length 0,3,6,โ€ฆ Length 1,4,7,โ€ฆ Length 2,5,8,โ€ฆ a, b 14
  • 15. DFA โ€ข Construct a DFA where ๐œ” โ‰… 1 ๐‘š๐‘œ๐‘‘ 3 โ€ข ๐œ” โ‰… 1 ๐‘š๐‘œ๐‘‘ 3 means ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 1 โ€ข For ๐œ” ๐‘š๐‘œ๐‘‘ ๐‘› = 0 ๐‘œ๐‘Ÿ ๐œ” โ‰… ๐‘š ๐‘š๐‘œ๐‘‘ n (m is any number) in general for minimal DFA we need ๐‘› number of states. A a, b C a, b Length 0,3,6,โ€ฆ Length 1,4,7,โ€ฆ Length 2,5,8,โ€ฆ a, b B 15
  • 16. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ in the string is two. โ€“ ๐‘›๐‘Ž ๐œ” = 2 โ€“ ๐ฟ = ๐‘Ž๐‘Ž, ๐‘๐‘Ž๐‘Ž, ๐‘Ž๐‘๐‘Ž, ๐‘Ž๐‘Ž๐‘, ๐‘๐‘๐‘Ž๐‘Ž, โ€ฆ โ€ฆ โ€ฆ B a C a 0 โ€˜aโ€™s 1 โ€˜aโ€™s 2 โ€˜aโ€™s A D b b b a 3 โ€˜aโ€™s a,b 16
  • 17. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ in the string at least two. โ€“ ๐‘›๐‘Ž ๐œ” โ‰ฅ 2 B a C a 0 โ€˜aโ€™s 1 โ€˜aโ€™s 2 โ€˜aโ€™s A b b a, b 17
  • 18. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ in the string at most two. โ€“ ๐‘›๐‘Ž ๐œ” โ‰ค 2 b B a C a 0 โ€˜aโ€™s 1 โ€˜aโ€™s 2 โ€˜aโ€™s A b b D 3 โ€˜aโ€™s a,b a 18
  • 19. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ in the string is even. โ€“ ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 0 โ€“ ๐‘›๐‘Ž ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 2 A B a Length Even Length Odd a b b 19
  • 20. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ in the string is odd. โ€“ ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 1 โ€“ ๐‘›๐‘Ž ๐œ” โ‰… 1 ๐‘š๐‘œ๐‘‘ 2 b A B a Length Even Length Odd a b 20
  • 21. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ in the string is divisible by 3. โ€“ ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 0 โ€“ ๐‘›๐‘Ž ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 3 A B a a b b C a b 21
  • 22. DFA โ€ข ๐‘–๐‘“๐‘›๐‘Ž ๐œ” โ‰… ๐‘˜ ๐‘š๐‘œ๐‘‘ n , how to draw DFA?? โ€“ ๐‘› number of states will be there โ€ข If k=0 ๐‘ž0 will be final state โ€ข If k=1 ๐‘ž1 will be final state โ€ข If k=2 ๐‘ž2 will be final state โ€ข If k=3 ๐‘ž3 will be final state โ€ข So on 22
  • 23. Assignment 1. Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜bโ€™ in the string is divisible by 5. 2. Construct a DFA that accept all strings over the alphabets {a, b} such that ๐‘›๐‘Ž ๐œ” โ‰… 2 ๐‘š๐‘œ๐‘‘ 5 3. Construct a DFA that accept all strings over the alphabets {a, b} such that ๐‘›๐‘ ๐œ” โ‰… 1 ๐‘š๐‘œ๐‘‘ 3 23
  • 24. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ and number of โ€˜bโ€™ in the string is even. โ€“ ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 0 & ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 0 โ€“ ๐‘›๐‘Ž ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 2 & ๐‘›๐‘ ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 2 ๐‘›๐‘Ž ๐œ” ๐‘›๐‘ ๐œ” E E O E E O O O Four possible states representing this situation 24
  • 25. DFA ee eo oe oo 1. String ๐œ– state ee 2. String โ€˜aโ€™ state oe 3. String โ€˜bโ€™ state eo 4. String โ€˜aaโ€™ state ee 5. String โ€˜abโ€™ state oo 6. String โ€˜baโ€™ state oo 7. String โ€˜bbโ€™ state ee 8. String โ€˜abaโ€™ or โ€˜baaโ€™ state eo 9. String โ€˜babโ€™ or โ€˜abbโ€™ state oe a b a b a b a b 25
  • 26. Cross Product Method โ€ข ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 0 & ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 2 = 0 ๐ด, ๐ต ร— ๐ถ, ๐ท = ๐ด๐ถ, ๐ด๐ท, ๐ต๐ถ, ๐ต๐ท A B a a b b C D b b a a b a b a b a b a A B C C a a b b A A C D AC BC AD BD ee oe oo eo Observation: โ€˜aโ€™s are counting in horizontal way and โ€˜bโ€™s are counting in vertical way. 26
  • 27. Cross Product Method โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ is divisible by 3 and number of โ€˜bโ€™ in the string is divisible by 2. b a a b 00 10 01 11 20 b 21 a a a a b b b 27
  • 28. Cross Product Method โ€ข Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ and number of โ€˜bโ€™ in the string is divisible by 3. โ€“ ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 0 & ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 0 โ€“ ๐‘›๐‘Ž ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 3 & ๐‘›๐‘ ๐œ” โ‰… 0 ๐‘š๐‘œ๐‘‘ 3 b a a b A B D E C b F a a a a b a b G H b I a a b b b 28
  • 29. DFA โ€ข Construct a DFA that accept all strings over the alphabets {a, b} such that ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 โ‰ฅ ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 2 b a a b 00 10 01 11 20 b 21 a a a a b b b No. of โ€˜aโ€™s mod 3 > no. of โ€˜bโ€™s mod 2 this will be a final state No. of โ€˜aโ€™s mod 3 > no. of โ€˜bโ€™s mod 2 this will be a final state No. of โ€˜aโ€™s mod 3 = no. of โ€˜bโ€™s mod 2 this will be a final state No. of โ€˜aโ€™s mod 3 > no. of โ€˜bโ€™s mod 2 this will be a final state No. of โ€˜aโ€™s mod 3 = no. of โ€˜bโ€™s mod 2 So this will be a final state No. of โ€˜aโ€™s mod 3 < no. of โ€˜bโ€™s mod 2 this will not be a final state 29
  • 30. DFA โ€ข Construct a minimal DFA which accepts all strings over {0,1}, which when interpreted as binary number is divisible by 2. โ€“ Two remainders are possible, so two states ๐’’๐ŸŽ ๐’’๐Ÿ 1 0 1 0 30
  • 31. DFA โ€ข Construct a minimal DFA which accepts all strings over {0,1}, which when interpreted as binary number is divisible by 3. โ€“ Three remainders are possible, so three states ๐’’๐ŸŽ ๐’’๐Ÿ 1 1 0 0 ๐’’๐Ÿ 0 1 If the question is divisible by โ€˜nโ€™ then number of state is n. 31
  • 32. Transition Table 0 1 ๐‘ž0 ๐‘ž0 ๐‘ž1 ๐‘ž1 ๐‘ž2 ๐‘ž0 ๐‘ž2 ๐‘ž1 ๐‘ž2 q0 q1 q2 q0 q1 q2 32
  • 33. Transition Table โ€ข Construct a minimal DFA which accepts all strings over {0,1}, which when interpreted as binary number is divisible by 4 0 1 ๐‘ž0 ๐‘ž0 ๐‘ž1 ๐‘ž1 ๐‘ž2 ๐‘ž3 ๐‘ž2 ๐‘ž0 ๐‘ž1 ๐‘ž3 ๐‘ž2 ๐‘ž3 33
  • 34. DFA โ€ข Construct a minimal DFA which accepts all strings over {0,1}, which when interpreted as binary number is โ‰… 1 ๐‘š๐‘œ๐‘‘ 3. ๐’’๐ŸŽ ๐’’๐Ÿ 1 1 0 0 ๐’’๐Ÿ 0 1 34
  • 35. DFA โ€ข Construct a minimal DFA which accepts all strings over {0,1}, which when interpreted as binary number is โ‰… 2 ๐‘š๐‘œ๐‘‘ 3. ๐’’๐ŸŽ ๐’’๐Ÿ 1 1 0 0 ๐’’๐Ÿ 0 1 35
  • 36. Transition Table โ€ข Construct a minimal DFA which accepts all strings over {0,1,2}, which when interpreted as ternary number is divisible by 4 0 1 2 ๐‘ž0 ๐‘ž0 ๐‘ž1 ๐‘ž2 ๐‘ž1 ๐‘ž3 ๐‘ž0 ๐‘ž1 ๐‘ž2 ๐‘ž2 ๐‘ž3 ๐‘ž0 ๐‘ž3 ๐‘ž1 ๐‘ž2 ๐‘ž3 36
  • 37. DFA โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} where each string starts with an โ€˜aโ€™. โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} where each string contains an โ€˜aโ€™. โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} where each string ends with an โ€˜aโ€™. 37
  • 38. Assignment 1. Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ and number of โ€˜bโ€™ is odd in the string. 2. Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ is even and number of โ€˜bโ€™ is odd in the string . 3. Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ is odd and number of โ€˜bโ€™ is even in the string . 4. Construct a DFA that accept all strings over the alphabets {a, b} where number of โ€˜aโ€™ is multiple of three and number of โ€˜bโ€™ is multiple of two in the string. 5. Construct a DFA that accept all strings over the alphabets {a, b} such that ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 = ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 2 6. Construct a DFA that accept all strings over the alphabets {a, b} such that ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 โ‰ค ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 2 7. Construct a DFA that accept all strings over the alphabets {a, b} such that ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 1 and ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 3 = 2 8. Construct a DFA that accept all strings over the alphabets {a, b} such that ๐‘›๐‘Ž ๐œ” ๐‘š๐‘œ๐‘‘ 3 > ๐‘›๐‘ ๐œ” ๐‘š๐‘œ๐‘‘ 3 9. Construct a minimal DFA which accepts all strings over Octal number system, which when interpreted as binary number โ‰… 1 ๐‘š๐‘œ๐‘‘ 5 38
  • 39. DFA โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} where each string start with โ€œabโ€ โ€“ L= {ab, aba, abb, โ€ฆโ€ฆโ€ฆ} B C A a b D a, b a a, b 39 b
  • 40. DFA โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} where each string contains โ€œabโ€ as a sub string. โ€“ L= {ab, aab, aba, bab, abb โ€ฆโ€ฆโ€ฆ} B C A a b b a a,b 40
  • 41. DFA โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} where each string end with โ€œabโ€ โ€“ L= {ab, aab, bab, abab โ€ฆโ€ฆโ€ฆ} B C A a b b a a b 41
  • 42. DFA โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} where each string starts with โ€˜aโ€™ and ends with โ€˜bโ€™ or vice versa. โ€“ L ={ab, ba, aab, abb, baa, bba. โ€ฆโ€ฆ} B C A a b b a b a D a E b b 42 a
  • 43. DFA โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} where each string starts and ends with same symbol. โ€“ L={๐œ–, a, b, aa, bb, aba, bab,โ€ฆโ€ฆโ€ฆโ€ฆ} C B A a b b a b a E a D b b a This DFA is complement of previous DFA and language also. We will get complement of a language by removing one language from ๐šบโˆ—. ๐‘ณ๐Ÿ = ๐šบโˆ— โˆ’ ๐‘ณ๐Ÿ L2 is complement of L1 43
  • 44. Complement of DFA A B a Length Even Length Odd a b b A B a Length Even Length Odd a b L1 = Even number of โ€˜aโ€™ L2 = Odd number of โ€˜aโ€™ L3 = Starts with โ€˜aโ€™ L4 = Not starts with โ€˜aโ€™ A B C a b a,b a,b A B C a b a,b a,b 44
  • 45. Complement of DFA โ€ข DFA can be defined by quintuples โ€“ ( ๐‘„ , ฮฃ , ๐›ฟ , ๐‘ž 0 , ๐น ) โ€ข Complement of DFA can be defined by quintuples โ€“ ( ๐‘„ , ฮฃ , ๐›ฟ , ๐‘ž 0 , ๐‘„ โˆ’ ๐น ) 45
  • 46. DFA โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} which accepts strings in which every 'a' is followed by 'b'. โ€“ L={๐œ–, b, ab, bb, aba, bab, โ€ฆโ€ฆโ€ฆโ€ฆ} 46 C B A a b a b a b D a,b
  • 47. DFA โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} which accepts strings in which every 'a' never followed by 'b'. โ€“ This is not complement of previous โ€“ L={๐œ–, a, aa,โ€ฆ..,b, bb,โ€ฆโ€ฆ, ba, bbaโ€ฆโ€ฆโ€ฆโ€ฆ} 47 C B A a b a a,b b
  • 48. DFA โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} which accepts strings in which every 'a' is followed by โ€˜bb'. 48 D B A a b a b a b E a,b C b a
  • 49. DFA โ€ข Construct a minimal DFA which accepts set of all strings over {a, b} which accepts strings in which every 'a' never followed by โ€˜bb'. 49 D B A a b a, b a b C b a
  • 50. DFA โ€ข ๐ฟ = ๐‘Ž๐‘› ๐‘๐‘š |๐‘›, ๐‘š โ‰ฅ 1 โ€“ ๐ฟ = {๐‘Ž๐‘, ๐‘Ž๐‘Ž๐‘๐‘, ๐‘Ž๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘๐‘๐‘, โ€ฆ โ€ฆ โ€ฆ } 50 C B A a b b a D a, b b a
  • 51. DFA โ€ข ๐ฟ = ๐‘Ž๐‘› ๐‘๐‘š |๐‘›, ๐‘š โ‰ฅ 0 โ€“ ๐ฟ = {๐œ–, ๐‘Ž, ๐‘Ž๐‘Ž, โ€ฆ , ๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘๐‘, โ€ฆ ๐‘, ๐‘๐‘, ๐‘๐‘๐‘ โ€ฆ โ€ฆ โ€ฆ } 51 C B A b a b a,b a
  • 52. DFA โ€ข ๐ฟ = ๐‘Ž๐‘› ๐‘๐‘š ๐‘๐‘™ |๐‘›, ๐‘š, ๐‘™ โ‰ฅ 1 โ€“ ๐ฟ = {๐‘Ž๐‘๐‘, ๐‘Ž๐‘Ž๐‘๐‘, ๐‘Ž๐‘๐‘๐‘, ๐‘Ž๐‘๐‘๐‘, โ€ฆ โ€ฆ โ€ฆ } 52 D B A a b, c c c D a, b, c b a C c a b a, b
  • 53. DFA โ€ข ๐ฟ = ๐‘Ž๐‘› ๐‘๐‘š ๐‘๐‘™ |๐‘›, ๐‘š, ๐‘™ โ‰ฅ 0 โ€“ ๐ฟ = {๐œ–, ๐‘Ž, ๐‘, ๐‘, ๐‘Ž๐‘, ๐‘Ž๐‘, ๐‘๐‘, ๐‘Ž๐‘๐‘, ๐‘Ž๐‘Ž, ๐‘๐‘, ๐‘๐‘, โ€ฆ } 53 B A b c c b a C c a D a, b, c a, b
  • 54. DFA โ€ข ๐ฟ = {๐‘Ž3 ๐‘๐‘ค๐‘Ž3 |๐‘ค โˆˆ {๐‘Ž, ๐‘}โˆ— } โ€“ ๐ฟ = {๐‘Ž3๐‘๐œ–๐‘Ž3, ๐‘Ž3๐‘๐‘Ž๐‘Ž3, ๐‘Ž3๐‘๐‘๐‘Ž3, ๐‘Ž3๐‘๐‘Ž๐‘Ž๐‘Ž3, โ€ฆ โ€ฆ } 54 H B A a a C D E F G a b a a a I b a, b b b a b b b b a
  • 55. Operations of DFA Different operations that we can apply on DFAs are - 1. Union 2. Concatenation 3. Cross Product 4. Complement 5. Reversal 55
  • 56. Union โ€ข Union of two Regular language is also Regular โ€“ L1 = starts with โ€˜aโ€™ and ends with โ€˜bโ€™ โ€“ L2 = starts with โ€˜bโ€™ and ends with โ€˜aโ€™ โ€“ ๐ฟ = ๐ฟ1 โˆช ๐ฟ2 = starts with different symbol โ€ข Let, ๐‘ด๐Ÿ = ๐‘„1, ฮฃ1, ๐›ฟ1, ๐‘ž0 1, ๐น1 DFA for L1 , ๐‘ด๐Ÿ = ๐‘„2, ฮฃ2, ๐›ฟ2, ๐‘ž0 2, ๐น2 DFA for L2 We want to construct M for ๐‘ณ = ๐ฟ1 โˆช ๐ฟ2 ๐‘ด = ๐‘„, ฮฃ, ๐›ฟ, ๐‘ž0, ๐น DFA for L Where, ๐‘ธ = ๐‘„1 ร— ๐‘„2 ๐œฎ = ฮฃ1 โˆช ฮฃ2 ๐œน ๐‘Ÿ1, ๐‘Ÿ2 , ๐‘Ž = ๐›ฟ1 ๐‘Ÿ1, ๐‘Ž , ๐›ฟ2 ๐‘Ÿ2, ๐‘Ž ๐’’๐ŸŽ= ๐‘ž0 1, ๐‘ž0 2 ๐‘ญ = ๐‘Ÿ1, ๐‘Ÿ2 | ๐‘Ÿ1 โˆˆ ๐น1 ๐‘œ๐‘Ÿ ๐‘Ÿ2 โˆˆ ๐น2 56 ๐‘Ÿ1 โˆˆ ๐‘„1 ๐‘Ž๐‘›๐‘‘ ๐‘Ÿ2 โˆˆ ๐‘„2
  • 57. Union 57 B A a b b a C b D a, b a B A b a a b C a D a, b b b B A a b b a C a B b a a b C
  • 58. Concatenation โ€ข Concatenation of two Regular language is also Regular โ€“ L1 = starts with โ€˜aโ€™ โ€“ L2 = ends with โ€˜bโ€™ โ€“ ๐ฟ = ๐ฟ1 โˆ˜ ๐ฟ2 = starts with โ€˜aโ€™ and ends with โ€˜bโ€™ ๐ฟ1 = ๐‘Ž, ๐‘Ž๐‘Ž, ๐‘Ž๐‘, ๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘Ž๐‘Ž, ๐‘Ž๐‘๐‘, โ€ฆ โ€ฆ ๐ฟ2 = {๐‘, ๐‘Ž๐‘, ๐‘๐‘, ๐‘๐‘๐‘, ๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘๐‘, โ€ฆ โ€ฆ } ๐ฟ = {๐‘Ž๐‘, ๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘๐‘, ๐‘Ž๐‘๐‘๐‘, โ€ฆ โ€ฆ โ€ฆ } โ€ข Let, ๐‘ด๐Ÿ = ๐‘„1, ฮฃ1, ๐›ฟ1, ๐‘ž0 1 , ๐น1 DFA for L1 , ๐‘ด๐Ÿ = ๐‘„2, ฮฃ2, ๐›ฟ2, ๐‘ž0 2 , ๐น2 DFA for L2 We want to construct M for ๐‘ณ = ๐ฟ1 โˆ˜ ๐ฟ2 ๐‘ด = ๐‘„, ฮฃ, ๐›ฟ, ๐‘ž0, ๐น DFA for L 58
  • 59. Concatenation 59 A a a, b B b C a, b A b b B a a B A a b b a C b D a, b a
  • 60. Reversal โ€ข L1= starts with โ€˜aโ€™ โ€“ ๐ฟ1 = {a, aa, ab, aaa, aab, aba,โ€ฆโ€ฆ} โ€“ ๐ฟ1๐‘… = {a, aa, ba, aaa, baa, aba,โ€ฆโ€ฆ} โ€ข Steps: โ€“ States are same as original โ€“ Convert initial state to final state โ€“ Convert final state to initial state 60 A a a, b B b C a, b A a a, b B b C a, b This is not DFA it is NFA If we reverse a DFA of a language we will get a reverse language, but we may or may not get reverse DFA. Reverse FA is either DFA or NFA.

Editor's Notes

  1. โ‰… congruent to
  2. E = Even, O = Odd
  3. Lecture 8: {0,1,2} ternary number where base is 3.
  4. This rule is only for DFAโ€™s not for NFAโ€™s
  5. Final state of 1st DFA is initial state of 2nd DFA
  6. If we reverse a DFA of a language we will get a reverse language, but we may or may not get reverse DFA. Reverse FA is either DFA or NFA.