Download presentation
Presentation is loading. Please wait.
Published byBeverley Young Modified over 9 years ago
1
1 Closure Properties of Regular Languages L 1 and L 2 are regular. How about L 1 L 2, L 1 L 2, L 1 L 2, L 1, L 1 * ?
2
2 Theorem 1 If L 1 and L 2 are regular, then so are L 1 L 2, L 1 L 2, L 1 L 2, L 1, L 1 *. (The family of regular languages is closed under intersection, union, concatenation, complement, and star-closure.)
3
3 Proof L 1 = L(r 1 ) L 2 = L(r 2 ) L(r 1 + r 2 ) = L(r 1 ) L(r 2 ) L(r 1. r 2 ) = L(r 1 )L(r 2 ) L(r 1 * ) = (L(r 1 )) *
4
4 Proof M = (Q, , , q 0, F) accepts L 1. M = (Q, , , q 0, Q – F) accepts L 1.
5
5 Proof M 1 = (Q, , 1, q 0, F 1 ) accepts L 1. M 2 = (P, , 2, p 0, F 2 ) accepts L 2. q0q0 qfqf a1a1 anan p0p0 pfpf a1a1 anan 2 (p j, a) = p l 1 (q i, a) = q k 1 ((q i, p j ), a) = (q k, p l )
6
6 Proof Example: L 1 = {ab n | n 0} L 2 = {a n b | n 0} L 1 L 2 = {ab}
7
7 Theorem 2 The family of regular languages is closed under reversal: If L is regular, then so is L R.
8
8 Proof ?
9
9 Homomorphism Suppose and are alphabets. h: * is called a homomorphism
10
10 Homomorphism Extended definition: w = a 1 a 2... a n h(w) = h(a 1 )h(a 2 )... h(a n )
11
11 Homomorphism If L is a language on , then its homomorphic image is defined as: h(L) = {h(w): w L}
12
12 Example = {a, b} = {a, b, c} h(a) = abh(b) = bbc h(aba) = abbbcab L = {aa, aba} h(L) = {abab, abbbcab}
13
13 Homomorphism If L is the language on of a regular expression r, then the regular expression for h(L) is obtained by applying the homomorphism to each symbol of r.
14
14 Example = {a, b} = {b, c, d} h(a) = dbcch(b) = bdc r = (a + b * )(aa) * L = L(r) h(r) = (dbcc + (bdc) * )(dbccdbcc) *
15
15 Theorem 3 The family of regular languages is closed under homomorphism: If L is regular, then so is h(L).
16
16 Proof Let L(r) = L for some regular expression r. Prove: h(L(r)) = L(h(r)).
17
17 Homework Exercises: 2, 4, 6, 8, 9, 11, 18, 22 of Section 4.1 - Linz’s book. Presentation: Section 4.3 - Linz’s book (pigeonhole principle & pumping lemma and examples).
18
18 Right Quotient Let L 1 and L 2 be languages on the same alphabet. Then the right quotient of L 1 with L 2 is defined as: L 1 /L 2 = {x | xy L 1 and y L 2 }
19
19 Example L 1 = {a n b m | n 1, m 0} {ba} L 2 = {b m | m 1} L 1 /L 2 = ?
20
20 Example L 1 = {a n b m | n 1, m 0} {ba} L 2 = {b m | m 1} L 1 /L 2 = {a n b m | n 1, m 0}
21
21 Example q0q0 q1q1 q2q2 b b b a q3q3 a a, b a q4q4 q5q5 a L 1 = {a n b m | n 1, m 0} {ba}
22
22 Example q0q0 q1q1 q2q2 b b b a q3q3 a a, b a q4q4 q5q5 a L 1 = {a n b m | n 1, m 0} {ba}L 2 = {b m | m 1} * (q 0, x) = q i * (q i, y) F and y L 2
23
23 Example q0q0 q1q1 q2q2 b b b a q3q3 a a, b a q4q4 q5q5 a L 1 = {a n b m | n 1, m 0} {ba}L 2 = {b m | m 1} * (q 0, x) = q i * (q i, y) F and y L 2
24
24 Theorem The family of regular languages is closed under right quotient: If L 1 and L 2 are regular, then so is L 1 /L 2.
25
25 Proof M = (Q, , , q 0, F) accepts L 1. M ^ = (P, , , q 0, F ^ ) accepts L 1 /L 2. If y L 2 and * (q i, y) F add q i to F ^
26
26 Proof M = (Q, , , q 0, F) accepts L 1. M ^ = (P, , , q 0, F ^ ) accepts L 1 /L 2. If y L 2 and * (q i, y) F add q i to F ^ M i = (P, , , q i, F) and L(M i ) L 2 .
27
27 Example L 1 = L(a * baa * ) L 2 = L(ab * ) L 1 /L 2 = ?
28
28 Example q0q0 q1q1 q2q2 a a b b b a, b q3q3 a L 1 = L(a * baa * ) L(M 0 ) L 2 = L(M 1 ) L 2 = {a} L(M 2 ) L 2 = {a} L(M 3 ) L 2 = L 1 = L(ab * )
29
29 Example q0q0 q1q1 q2q2 a a b b b a, b q3q3 a L 1 = L(a * baa * ) L(M 0 ) L 2 = L(M 1 ) L 2 = {a} L(M 2 ) L 2 = {a} L(M 3 ) L 2 = L 1 = L(ab * )
30
30 Questions about RLs 1.Given a regular language L on and any w *, is there an algorithm to determine whether or not w L?.
31
31 Questions about RLs 1.Given a regular language L on and any w *, is there an algorithm to determine whether or not w L?. Yes.
32
32 Questions about RLs 1.Is there an algorithm to determine whether or not a regular language is empty, finite, or infinite?.
33
33 Questions about RLs 1.Is there an algorithm to determine whether or not a regular language is empty, finite, or infinite?. Yes.
34
34 Questions about RLs 1.Given two regular languages L 1 and L 2, is there an algorithm to determine whether or not L 1 = L 2 ?.
35
35 Questions about RLs 1.Given two regular languages L 1 and L 2, is there an algorithm to determine whether or not L 1 = L 2 ?. Yes.
36
36 Homework Exercises: 1, 2, 3, 5, 9 of Section 4.2 - Linz’s book. Exercises: 3, 4, 5, 6, 8, 10, 12 of Section 4.3 - Linz’s book.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.