Closure Properties of Regular Languages Union Intersection Difference





![Example: Product DFA for Intersection 0 0 A 1 B [A, C] 0, 1 Example: Product DFA for Intersection 0 0 A 1 B [A, C] 0, 1](https://slidetodoc.com/presentation_image_h/2ef736a4b6bd77591a1676d7a48e3e1b/image-6.jpg)

![Example: Product DFA for Difference 0 0 A 1 B [A, C] 0, 1 Example: Product DFA for Difference 0 0 A 1 B [A, C] 0, 1](https://slidetodoc.com/presentation_image_h/2ef736a4b6bd77591a1676d7a48e3e1b/image-8.jpg)
















- Slides: 24

Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism 1

Closure Properties u. Recall 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. u. For regular languages, we can use any of its representations to prove a closure property. 2

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

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

Closure Under Intersection u. If L and M are regular languages, then so is L M. u. Proof: Let A and B be DFA’s whose languages are L and M, respectively. u. Construct C, the product automaton of A and B. u. Make the final states of C be the pairs consisting of final states of both A and B. 5
![Example Product DFA for Intersection 0 0 A 1 B A C 0 1 Example: Product DFA for Intersection 0 0 A 1 B [A, C] 0, 1](https://slidetodoc.com/presentation_image_h/2ef736a4b6bd77591a1676d7a48e3e1b/image-6.jpg)
Example: Product DFA for Intersection 0 0 A 1 B [A, C] 0, 1 1 1 0 [A, D] 1 0 1 C 0 0 1 [B, C] 0 [B, D] D 1 6

Closure Under Difference u. If L and M are regular languages, then so is L – M = strings in L but not M. u. Proof: Let A and B be DFA’s whose languages are L and M, respectively. u. Construct C, the product automaton of A and B. u. Make the final states of C be the pairs where A-state is final but B-state is not. 7
![Example Product DFA for Difference 0 0 A 1 B A C 0 1 Example: Product DFA for Difference 0 0 A 1 B [A, C] 0, 1](https://slidetodoc.com/presentation_image_h/2ef736a4b6bd77591a1676d7a48e3e1b/image-8.jpg)
Example: Product DFA for Difference 0 0 A 1 B [A, C] 0, 1 1 1 0 [A, D] 1 0 1 C 0 1 [B, C] 0 [B, D] D Notice: difference is the empty language 8

Closure Under Complementation u. The complement of a language L (with respect to an alphabet Σ such that Σ* contains L) is Σ* – L. u. Since Σ* is surely regular, the complement of a regular language is always regular. 9

Closure Under Reversal u. Recall example of a DFA that accepted the binary strings that, as integers were divisible by 23. u. We said that the language of binary strings whose reversal was divisible by 23 was also regular, but the DFA construction was very tricky. u. Good application of reversal-closure. 10

Closure Under Reversal – (2) u. Given language L, LR is the set of strings whose reversal is in L. u. Example: L = {0, 01, 100}; LR = {0, 10, 001}. u. Proof: Let E be a regular expression for L. u. We show to reverse E, to provide a regular expression ER for LR. 11

Reversal of a Regular Expression u. Basis: If E is a symbol a, ε, or ER = E. u. Induction: If E is ∅, then w F+G, then ER = FR + GR. w FG, then ER = GRFR w F*, then ER = (FR)*. 12

Example: Reversal of a RE u. Let E = 01* + 10*. u. ER = (01* + 10*)R = (01*)R + (10*)R u= (1*)R 0 R + (0*)R 1 R u= (1 R)*0 + (0 R)*1 u= 1*0 + 0*1. 13

Homomorphisms u. A homomorphism on an alphabet is a function that gives a string for each symbol in that alphabet. u. Example: h(0) = ab; h(1) = ε. u. Extend to strings by h(a 1…an) = h(a 1)…h(an). u. Example: h(01010) = ababab. 14

Closure Under Homomorphism u. If L is a regular language, and h is a homomorphism on its alphabet, then h(L) = {h(w) | w is in L} is also a regular language. u. Proof: Let E be a regular expression for L. u. Apply h to each symbol in E. u. Language of resulting RE is h(L). 15

Example: Closure under Homomorphism u. Let h(0) = ab; h(1) = ε. u. Let L be the language of regular expression 01* + 10*. u. Then h(L) is the language of regular expression abε* + ε(ab)*. Note: use parentheses to enforce the proper grouping. 16

Example – Continued uabε* + ε(ab)* can be simplified. uε* = ε, so abε* = abε. uε is the identity under concatenation. w That is, εE = Eε = E for any RE E. u. Thus, abε* + ε(ab)* = abε + ε(ab)* = ab + (ab)*. u. Finally, L(ab) is contained in L((ab)*), so a RE for h(L) is (ab)*. 17

Inverse Homomorphisms u. Let h be a homomorphism and L a language whose alphabet is the output language of h. uh-1(L) = {w | h(w) is in L}. 18

Example: Inverse Homomorphism u. Let h(0) = ab; h(1) = ε. u. Let L = {abab, baba}. uh-1(L) = the language with two 0’s and any number of 1’s = L(1*01*01*). Notice: no string maps to baba; any string with exactly two 0’s maps to abab. 19

Closure Proof for Inverse Homomorphism u. Start with a DFA A for L. u. Construct a DFA B for h-1(L) with: w The same set of states. w The same start state. w The same final states. w Input alphabet = the symbols to which homomorphism h applies. 20

Proof – (2) u. The transitions for B are computed by applying h to an input symbol a and seeing where A would go on sequence of input symbols h(a). u. Formally, δB(q, a) = δA(q, h(a)). 21

Example: Inverse Homomorphism Construction 1 a B a A b 0 A 0 b a B 1 b Since h(1) = ε C h(0) = ab h(1) = ε Since h(0) = ab C 1, 0 22

Proof – (3) u. Induction on |w| shows that δB(q 0, w) = δA(q 0, h(w)). u. Basis: w = ε. uδB(q 0, ε) = q 0, and δA(q 0, h(ε)) = δA(q 0, ε) = q 0. 23

Proof – (4) u. Induction: Let w = xa; assume IH for x. uδB(q 0, w) = δB(δB(q 0, x), a). u= δB(δA(q 0, h(x)), a) by the IH. u= δA(δA(q 0, h(x)), h(a)) by definition of the DFA B. u= δA(q 0, h(x)h(a)) by definition of the extended delta. u= δA(q 0, h(w)) by def. of homomorphism. 24
Closure properties of regular expression
Closure properties of regular languages
Context free language closure properties
Closure and decision properties of context free languages
Every linear grammar generates a regular language
Decision properties of regular languages
Decision properties of regular languages
Decision properties of regular languages
Decision properties of regular languages
Properties of regular languages
Collectively exhaustive
Probability union and intersection
Simplify union and intersection
Union vs intersection
Union and intersection
Intensional definition
Intersection of sets
Intersection and union of events
Pumping lemma non regular languages examples
Regular and irregular languages
Proof by contradiction
Closure properties of integers and polynomials
Closure property of cfg
Closure properties of dfa
Np closure properties