Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 30 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
30
Dung lượng
105,89 KB
Nội dung
Chapter 4: Properties of Regular Languages October 11, 2009 Chapter 4: Properties of Regular Languages Objectives Determine whether or not a language is regular? Chapter 4: Properties of Regular Languages Theorem 4.1 - Linz ’s book Theorem The family of regular languages is closed under intersection, union, concatenation, complement, and star-closure 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 Chapter 4: Properties of Regular Languages Proof of Theorem 4.1 - Linz ’s book By theorem 3.2 - Linz ’s book: L 1 = L(r 1 ) and 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 )) ∗ Chapter 4: Properties of Regular Languages Proof of Theorem 4.1 - Linz ’s book M = (Q, , δ, q 0 , F) accepts L 1 . M = (Q, , δ, q 0 , Q − F) accepts L 1 . Chapter 4: Properties of Regular Languages Proof of Theorem 4.1 - Linz ’s book M 1 = (Q, , δ 1 , q 0 , F 1 ) accepts L 1 . M 2 = (P, , δ 2 , p 0 , F 2 ) accepts L 2 . q 0 q f p 0 p f a 1 a n a 1 a n δ 1 (q i , a) = q k and δ 2 (p j , a) = p l δ((q i , p j ), a) = (q k , p l ) Chapter 4: Properties of Regular Languages Example 4.1 L 1 = {ab n | n ≥ 0} L 2 = {a n b | n ≥ 0} L 1 ∩ L 2 = {ab} Chapter 4: Properties of Regular Languages Example 4.2 L 1 = {a 2n b m | m, n ≥ 0} and L 2 = {a 3n b 2m | m, n ≥ 0} q 0 q 1 q 2 a a b b p 0 p 1 p 2 p 3 p 4 a a a b b b Chapter 4: Properties of Regular Languages Example 4.2 L 1 ∩ L 2 q 0 p 0 q 1 p 2 q 1 p 1 q 0 p 1 q 0 p 2 q 1 p 0 q 2 p 3 q 2 p 4 a a aa a a b b b Chapter 4: Properties of Regular Languages Theorem 4.2 - Linz ’s book Theorem The family of regular languages is closed under reversal If L is regular, then so is L R Proof: ??? Chapter 4: Properties of Regular Languages [...]... Example 4. 5 a q0 a q1 a b q2 a b q3 b b q5 a,b a,b q4 L1 /L2 = {an b m | n ≥ 1, m ≥ 0} Chapter 4: Properties of Regular Languages Theorem 4. 4 - Linz ’s book Theorem The family of regular languages is closed under right quotient If L1 and L2 are regular, then so is L1 /L2 Chapter 4: Properties of Regular Languages Example 4. 6 L1 = L(a∗ baa∗ ) L2 = L(ab ∗ ) L1 /L2 =? Chapter 4: Properties of Regular Languages. .. Example 4. 6 L1 = L(a∗ baa∗ ) and L2 = L(ab ∗ ) a a q0 b q1 b a q2 b q3 a,b Chapter 4: Properties of Regular Languages Example 4. 6 a a q0 b q1 b a q2 b q3 a,b L1 /L2 = a∗ ba∗ Chapter 4: Properties of Regular Languages Standard representation Standard representation of a regular language is one of the followings: Finite automaton Regular expression Regular grammar Chapter 4: Properties of Regular Languages. .. Chapter 4: Properties of Regular Languages Homomorphism Definition If r is a regular expression on , then the regular expression h(r) is obtained by applying the homomorphism to each symbol of r Chapter 4: Properties of Regular Languages Example 4. 4 = {a, b} Γ = {b, c, d} h(a) = dbcc and h(b) = bdc r = (a + b ∗ )(aa)∗ h(r) = (dbcc + (bdc)∗ )(dbccdbcc)∗ Chapter 4: Properties of Regular Languages Theorem 4. 3... Theorem The family of regular languages is closed under homomorphism If L is regular, then so is h(L) Chapter 4: Properties of Regular Languages Proof of Theorem 4. 3 - Linz ’s book Let L(r) = L for some regular expression r h(L(r)) = L(h(r)) Chapter 4: Properties of Regular Languages Right Quotient Definition Let L1 and L2 be languages on the same alphabet Then the right quotient of L1 with L2 is defined... Chapter 4: Properties of Regular Languages Example 4. 5 L1 = {an b m | n ≥ 1, m ≥ 0} ∪ {ba} L2 = {b m | m ≥ 1} L1 /L2 = {an b m | n ≥ 1, m ≥ 0} Chapter 4: Properties of Regular Languages Example 4. 5 L1 = {an b m | n ≥ 1, m ≥ 0} ∪ {ba} and L2 = {b m | m ≥ 1} a b q0 a q1 a q2 a b q3 b b q5 a,b a,b q4 δ ∗ (q0 , x) = qi and δ ∗ (qi , y ) ∈ F and y ∈ L2 qi ∈ FL1 /L2 Chapter 4: Properties of Regular Languages. .. |y | ≥ 1 such that wi = xy i z is also in L for all i = 0,1,2, Chapter 4: Properties of Regular Languages Exerises Exercises: 2, 4, 6, 8, 9, 11, 18, 22 of Section 4. 1 - Linzs book Exercises: 1, 2, 3, 5, 9 of Section 4. 2 - Linzs book Exercises: 3, 4, 5, 6, 8, 10, 12 of Section 4. 3 - Linzs book Chapter 4: Properties of Regular Languages ... alphabets h: → Γ∗ is called a homomorphism Chapter 4: Properties of Regular Languages Homomorphism Extended definition: w = a1 a2 an h(w) = h(a1 )h(a2 ) h(an ) Chapter 4: Properties of Regular Languages Homomorphism Definition If L is a language on , then its homomorphic image is defined as: h(L) = {h(w ) : w ∈ L} Chapter 4: Properties of Regular Languages Example 4. 3 = {a, b} Γ = {a, b, c} h(a) = ab and h(b)... languages L1 and L2 , is there an algorithm to determine whether or not L1 = L2 ? Problem (Theorem 4. 8 - Linz ’s book) Is there an algorithm to determine whether or not a language is regular? Chapter 4: Properties of Regular Languages Theorem 4. 8 - Linz ’s book Theorem (Pumping Lemma) Let L be an infinite regular language Then there exists some positive integer m such that any w ∈ L with |w | ≥ m can... Languages Questions about RL Problem (Theorem 4. 5 - Linz ’s book) Given a regular language L on and any w ∈ algorithm to determine whether or not w ∈ L? ∗ , is there an Problem (Theorem 4. 6 - Linz ’s book) Is there an algorithm to determine whether or not a regular language is empty, finite, or infinite? Problem (Theorem 4. 7 - Linz ’s book) Given two regular languages L1 and L2 , is there an algorithm . Chapter 4: Properties of Regular Languages October 11, 2009 Chapter 4: Properties of Regular Languages Objectives Determine whether or not a language is regular? Chapter 4: Properties of Regular Languages Theorem. (L(r 1 )) ∗ Chapter 4: Properties of Regular Languages Proof of Theorem 4. 1 - Linz ’s book M = (Q, , δ, q 0 , F) accepts L 1 . M = (Q, , δ, q 0 , Q − F) accepts L 1 . Chapter 4: Properties of Regular Languages Proof. (bdc) ∗ )(dbccdbcc) ∗ Chapter 4: Properties of Regular Languages Theorem 4. 3 - Linz ’s book Theorem The family of regular languages is closed under homomorphism. If L is regular, then so is h(L). Chapter 4: Properties of