Download presentation

Presentation is loading. Please wait.

Published bySophia Kane Modified over 3 years ago

1
&& Department of nskinfo-i educationwww.nsksofttch.com CS2303-THEORY OF COMPUTATION Chapter: Closure Properties of Regular Languages 1

2
2 Closure Properties A closure property is a statement that a certain operation on languages, when applied to languages in a class (e.g., the regular languages), produces a result that is also in that class. For regular languages, we can use any of its representations to prove a closure property.

3
Closure Property …. Resultant languages obtained by performing some operations on regular languages are also regular Union Intersection Complement Difference Kleenes star Concatenation Reversal Homomorphism Inverse Homomorphism

4
Closure of Regular languages under boolean operations Or : Let L and M be languages over alphabet. Then L M is the language that contains all strings that are are in either or both of L and M. And: Let L and M be languages over alphabet. Then L M is the language that contains all strings that are both in L and M. * : Let L be a language over alphabet. Then L, the complement of L, is the set of strings in * that are not in L.

5
5 Closure Under Union If L and M are regular languages, so is L M. Proof: Let L and M be the languages of regular expressions R and S, respectively. Then R+S is a regular expression whose language is L M.

6
6 Closure Under Concatenation and Kleene Closure Same idea: – RS is a regular expression whose language is LM. – R* is a regular expression whose language is L*.

7
Closure under Complement Operator Represented by L or L. Denoted by L = * - L Introduce a new state called Dead state and transitions are added from the states to the dead state on left out input symbols Accepting states are made as non accepting and vice versa

8
Closure of regular languages under Intersection operator The intersection of two sets is the set of elements that are not in the complement of either set. Using Demorgans Law

9
9 Closure of regular languages under Intersection …… If L and M are regular languages, then so is L M. Proof: Let A and B be DFAs whose languages are L and M, respectively. Construct C, the product automaton of A and B. Make the final states of C be the pairs consisting of final states of both A and B.

10
10 Example: Product DFA for Intersection A C B D 0 1 0, [A,C][A,D] 0 [B,C] [B,D] 0 1

11
Closure under Difference Operator L-M is the difference of L and M, is the set of strings that are in language L but not in language M. L – M = L M Property of the language and set theory Since regular languages are closed under complement and intersection operators it may be concluded that L 1 – L 2 is also regular

12
12 Closure under Difference ….. Proof: Let A and B be DFAs whose languages are L and M, respectively. Construct C, the product automaton of A and B. Make the final states of C be the pairs where A-state is final but B-state is not.

13
13 Example: Product DFA for Difference A C B D 0 1 0, [A,C][A,D] 0 [B,C] [B,D] 0 1 Notice: difference is the empty language

14
Reversal of a language Reversal of a string w with symbols a 1 a 2 ….a n is a string represented as W R with symbols a n a n-1 ….a 1 For example if W = then W R =

15
15 Closure under Reversal of a language Given language L, L R is the set of strings whose reversal is in L. Example: L = {0, 01, 100}; L R = {0, 10, 001}. Proof: Let E be a regular expression for L. We show how to reverse E, to provide a regular expression E R for L R.

16
16 Reversal of a Regular Expression Basis: If E is a symbol a, ε, or, then E R = E. Induction: If E is – F+G, then E R = F R + G R. – FG, then E R = G R F R – F*, then E R = (F R )*.

17
Set of states in M 2 are same as that of M 1 Initial state is a new state with transitions to all accepting states of M 1 Final state is only one state and that is the initial state of M 1 Reverse all transitions (i.e.) (p, a) = q, are rewritten as (q, a) = p

18

19
All the transitions are reversed

20
Homomorphism Substitute a particular string for each symbol. Denoted by h(L) Ex: h(0) =ab h(1)=Є if the string w=0011 then h(w)=h(0)h(0)h(1)h(1) =abab Theorem: If L is a regular language over alphabet and h is a homomorphism on, then h(L) is also regular language.

21
Inverse Homomorphism Let L be the language over alphabet T. Then h -1 (L) is the set of string w in * such that h(w) is in L. h -1 (L) = {w | h(w) is in L}. Ex: r=(010)* h(0) =a h(1)=bb h -1 (L) =(abba)* Theorem: If h is a homomorphism from alphabet to alphabet T, and L is a regular language over T, then h -1 (L) the inverse homomorphism of the language L is also a regular language.

22

23

24

25

26

27

28

29

30

31

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google