Download presentation

Published bySophia Kane Modified over 4 years ago

1
**CS2303-THEORY OF COMPUTATION Closure Properties of Regular Languages**

&& Department of nskinfo-i education CS2303-THEORY OF COMPUTATION Chapter: Closure Properties of Regular Languages

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 Kleene’s 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
**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
**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
**Closure of regular languages under Intersection ……**

If L and M are regular languages, then so is L M. Proof: Let A and B be DFA’s 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
**Example: Product DFA for Intersection**

1 [A,C] [A,D] A B 1 0, 1 1 1 1 [B,C] [B,D] 1 C D 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 L1 – L2 is also regular

12
**Closure under Difference …..**

Proof: Let A and B be DFA’s 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
**Example: Product DFA for Difference**

1 [A,C] [A,D] A B 1 0, 1 1 1 1 [B,C] [B,D] 1 C D Notice: difference is the empty language 1

14
Reversal of a language Reversal of a string w with symbols a1 a2….an is a string represented as WR with symbols ana n-1….a1 For example if W = then WR =

15
**Closure under Reversal of a language**

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

16
**Reversal of a Regular Expression**

Basis: If E is a symbol a, ε, or ∅, then ER = E. Induction: If E is F+G, then ER = FR + GR. FG, then ER = GRFR F*, then ER = (FR)*.

17
**Set of states in M2 are same as that of M1**

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

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.

Similar presentations

OK

1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.

1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google