Download presentation
Presentation is loading. Please wait.
Published byἙνώχ Αλεξάνδρου Modified over 6 years ago
2
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 ^ (Kleene closure)
3
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:-
5
Some Rules for Regular Expression:-
Example:-
6
Solution:-
7
Example:- Example:-
8
Identities of Regular Expression:-
10
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
11
Example:-
12
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:
13
Null Moves Removal
16
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).
17
M1 and M2 are represented by figure:-
19
v
25
Construction of Finite Automata Equivalent to Regular Expression:-
26
Example:- Solution:-
29
Example:-
33
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.
34
Example:-
38
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:-
39
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.
40
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.
41
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.