0% found this document useful (0 votes)
92 views42 pages

Ch2regular Expression

- Regular expressions allow algebraic representation of certain string sets using operations like concatenation, union, and Kleene closure - They describe languages accepted by finite state automata - There are rules and identities for regular expressions - We can convert regular expressions to equivalent finite automata and vice versa using techniques like the Arden's theorem and removing epsilon transitions - The pumping lemma gives a necessary condition to determine if a language is regular or not by "pumping" segments of strings in the language

Uploaded by

arpitbhainader
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views42 pages

Ch2regular Expression

- Regular expressions allow algebraic representation of certain string sets using operations like concatenation, union, and Kleene closure - They describe languages accepted by finite state automata - There are rules and identities for regular expressions - We can convert regular expressions to equivalent finite automata and vice versa using techniques like the Arden's theorem and removing epsilon transitions - The pumping lemma gives a necessary condition to determine if a language is regular or not by "pumping" segments of strings in the language

Uploaded by

arpitbhainader
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Regular Expression

• We shall build expressions from the symbols


using simple operations include
concatenation, union and kleen closure.
• Several intuitive examples of our notation are:
a) 01 means a zero followed by a one
(concatenation)
b) 0+1 means either a zero or a one (union)
c) 0* means ^ + 0 + 00 + 000 + ... (Kleene
closure)
Regular Expression
• Useful for representing certain sets of strings in an
algebraic fashion.(reunion of broken parts)
• Describes the languages accepted by finite state
automaton.
• Formal Recursive Definition of Regular Expression
over ∑ as follows:-
• Some Rules for Regular Expression:-

• Example:-
• Solution:-
Example:-

• Example:-
• Identities of Regular Expression:-
• We can write regular expression for a DFA using
Arden theorem
• Solution:- Assume that R = QP* satisfied 5.1
• Then Q + (QP*)P put the value of R in 5.1
• Q(Ʌ + P*P)
• Now apply I9
• QP* hence 5.1 is satisfied when R = QP*. This means R = QP* is a
solution of 5.1
• Example:-
• Finite Automata and Regular Expression:-
Transition System Containing Ʌ - Moves:-
• Transition Systems can be generalized by Ʌ - moves.
• occur when no input is applied.
• It is possible to convert a transition system with Ʌ -
moves into an equivalent transition system without
Ʌ - moves.

Suppose we want to replace a Ʌ- move from vertex v1 to


v2 . Then we proceed as follows:
Null Moves Removal
• Let R be a regular expression having n+1 characters.
Then :-

Also P and Q are regular expression having n characters or


less.
By :-
L(P) and L(Q) are recognized by M1 and M2 where M1
and M2 are NDFs with Ʌ - moves
such that L(P) = T(M1) and L(Q) = T(M2).
• M1 and M2 are represented by figure:-
•v
Construction of Finite Automata Equivalent to
Regular Expression:-
• Example:-

• Solution:-
• Example:-
• Equivalence of Two Finite Automata:-

Two finite automata over ∑ are equivalent if they accept


the same set of strings over ∑ .

Two finite automata are not equivalent if one automaton


reaches at final state and other doesn’t.
• Example:-
• Equivalence of Two Regular Expression:-
Two regular expression is equal if they represents same set.
Two regular expression is equal if their corresponding finite
automata is equal.

Example:-

Solution:-
• Pumping Lemma for Regular Sets:-
This lemma gives a necessary condition for an input string to belong to a
regular set. The result is called pumping lemma as it gives a method of
pumping (generating) many input strings from a given string. As pumping
lemma gives a necessary condition, it can be used to show that certain sets are
not regular.

Theorem 5.5 (Pumping Lemma) Let M be a finite automaton with n states. Let L be
the regular set accepted by M. Let wE L and w>= m. If m >=n, then there exists x,y, z
such that w =xyz, y != null and xyizE L for each i >=O.
Application of Pumping Lemma
• This theorem can be used to prove that certain sets
are not regular. The steps needed for proving that a
given set is not regular are
• Step 1 Assume that L is regular. Let n be the number
of states in the corresponding finite automaton.
• Step 2 Choose a string w such that w >= n. Use
pumping lemma to write w=xyz , xy<=n and Iy I > 0.
• Step 3 Find a suitable integer i such that xyiz does not
belongs to L. This contradicts our assumption, Hence L
is not regular.
• Show that L = {0i1i such that i>= I} is not regular.
Solution
• Step 1 Suppose L is regular. Let n be the number of states in the
finite automaton accepting L.
• Step 2 Let w =0n1n. Then w=2n > n. By pumping lemma, we write
• w = xyz with IX}'I ~ n and I y I ::t O.
• Step 3 We want to find i so that x.'/z EO L for getting a
contradiction. The
• string \' can be in any of the following fonns:
• Case 1 y has a's. i.e. y =Ok for some k e: l.
• Case 2 ,'has only l' s. i.e. y = 11 for some I 2: 1.
• Case 3 y has both O·sand l' s, i.e. y = Oklj for some k, j e: L

You might also like