Acd Unit1
Acd Unit1
Engineering &Technology
Department of Computer Science & Engineering
▪ 𝐿1 ∪ 𝐿2 = 𝑤 𝑤 𝑖𝑛 𝐿1 𝑜𝑟 𝑤 𝑖𝑛 𝐿2 }
𝐿1 ∪ 𝐿2 = { 0, 01,10,11,001}
▪ 𝐿1 𝐿2 = 𝑢𝑣 𝑢 ∈ 𝐿1 𝑎𝑛𝑑 𝑣 ∈ 𝐿2 }
AB = { 0001,1101,0010,1110}
▪ An automaton with finite number of states is called Finite Automaton (FA) or Finite
State Machines (FSM).
𝑞2
Figure 1.2
a b
𝑞0 𝑞1 𝑞2
𝑞1 𝑞1
𝑞2 𝑞2
L = { 0,01,001,00,001,0111….}
0 0
𝑞0 𝑞1 𝑞2
𝑞3
1
0,1
𝑞4
ε-closure:
ε-closure (q) is a set of all states p
reachable from q to p on ε-moves
including the state q itself.
We get
δ([q0, q1, q3], a) = δ(q0, a) ∪ δ(q1, a) ∪ δ(q3, a)
= [q0, q1] ∪ q2 ∪ φ
= [q0, q1, q2]
We get
δ([q0, q1, q3], b) = δ(q0, b) ∪ δ(q1, b) ∪ δ(q3, b)
= q0 ∪ q1 ∪ q2
= [q0, q1, q2]
Problem 2
The start state of the new NFA will be [q0, q1, q2].
The final states of the new NFA are {q0, q1, q2}, {q1, q2}, {q2}, since
they contain the final state q2 of the old NFA.
▪ Applications:
▪ In web page design, the user name validation, password validation, date
validation, phone number validation are some of the operations
performed by Regular expressions.
▪ In Compiler construction, source code recognition is one of the major
application of Regular expressions.
Prepared by Dr.M.Gangappa, CSE dept,, VNRVJIET, Hyderabad September 16, 2024 68
▪ A regular expressions over input alphabet Σ can be defined recursively as
follows:
▪ Rule 2 : if R1 and R2 are two regular expressions, then the union of R1 and
R2 denoted by R1 + R2 or R1 | R2 is also regular expression.
▪ The language associate with R1 and R2 is L(R1) and L(R2). The union of L(R1)
and L(R2) is L(R1) + L(R2) or L(R1)|L(R2).
Prepared by Dr.M.Gangappa, CSE dept,, VNRVJIET, Hyderabad September 16, 2024 69
▪ Rule 3: if R1 and R2 are two regular expressions, then the concatenation of
R1 and R2 denoted by R1.R2 or R1R2 is also regular expression.
▪ The language associate with R1 and R2 is L(R1) and L(R2). The concatenation
of L(R1) and L(R2) is L(R1).L(R2) .
▪ Rule 4: if R1 is regular expression, then the iteration (Kleene closure or
positive closure) of R1 denoted by 𝑅1 ∗ is also regular expression.
▪ The language associate with R1 is L(R1). The iteration of L(R1) is L(R1)*.
▪ R = Q ( ε + P + P2 + …. )
▪ R = QP*
b
q0 qq01
1 0
q0 q1 q2
0 1
1
q0 q1
2. Find the regular expression for
0 0 0 1
1
q3 q2
2 R=φ
q0 q1
3 R=a
a
q0 q1
q0 q5
ε
ε
b
q3 q4
5 R = a.b
a ε b
q0 q1 q2 q3
ε ε a ε ε
q0 q1 q3 q4 q5 q6