Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 33 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
33
Dung lượng
105,5 KB
Nội dung
Chapter4:PropertiesofRegularLanguages Quan Thanh Tho qttho@cse.hcmut.edu.vn Theorem 4.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 ofregularlanguages is closed under intersection, union, concatenation, complement, and star-closure.) 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 )) * Proof (cont’d) • M = (Q, Σ, δ, q 0 , F) accepts L 1 . M = (Q, Σ, δ, q 0 , Q – F) accepts L 1 . Proof (cont’d) M1 = (Q, Σ, δ1, q0, F1) accepts L1. M2 = (P, Σ, δ2, p0, F2) accepts L2. q 0 q f a 1 a n p 0 p f a 1 a n δ 2 (p j , a) = p l δ 1 (q i , a) = q k δ 1 ((q i , p j ), a) = (q k , p l ) Example 4.1 L 1 = {ab n | n ≥ 0} L 2 = {a n b | n ≥ 0} L 1 ∩L 2 = {ab} Example 4.2 Find intersection dfa of L 1 ={a 2n b m : n, m ≥ 0} and L 2 ={a 3n b 2m : n, m ≥ 0} p 1 p 0 p 2 p 3 a a a b b b L 2 p 4 q 1 p 1 q 0 p 0 q 2 p 4 q 1 p 2 q 2 p 3 q 0 p 2 q 0 p 1 q 1 p 0 a a a a a a b b b L 1 ∩ L 2 q 1 q 0 q 2 aa b L 1 b Theorem 2 The family ofregularlanguages is closed under reversal: If L is regular, then so is L R . Proof ? Suppose Σ and Γ are alphabets. h: Σ → Γ* is called a homomorphism Homomorphism [...]... (cont’d) If r is a regular expression on Σ, then the regular expression h(r) is obtained by applying the homomorphism to each Σ symbol of r Example 4.4 Σ = {a, b} Γ = {b, c, d} h(a) = dbcc h(b) = bdc r = (a + b*)(aa)* h(r) = (dbcc + (bdc)*)(dbccdbcc)* Theorem 4.3 The family ofregularlanguages is closed under homomorphism: If L is regular, then so is h(L) Proof Let L(r) = L for some regular expression... representation of a regular language is one of the followings: – – – Finite automaton Regular expression Regular grammar Questions about RL 1 Given a regular language L on Σ and any w ∈ Σ*, is there an algorithm to determine whether or not w ∈ L? Yes Questions about RL 2 Is there an algorithm to determine whether or not a regular language is empty, finite, or infinite? Yes Questions about RL 3 Given two regular. .. y ∈ L2 Example 4.5 (cont’d) L1 = {anbm | n ≥ 1, m ≥ 0}∪{ba} L2 = {bm | m ≥ 1} b q1 b q2 δ*(q0, x) = qi δ*(qi, y) ∈ F and y ∈ L2 Theorem 4.4 The family ofregularlanguages is closed under right quotient: If L1 and L2 are regular, then so is L1/L2 Proof • M = (Q, Σ, δ, q0, F) accepts L1 M^ = (P, Σ, δ, q0, F^) accepts L1/L2 If y ∈ L2 and δ*(qi, y) ∈ F ⇒ add qi to F^ Example 4.6 L1 = L(a*baa*) L2 = L(ab*)... language or not? Further Reading Pumping lemma L = {anbn : n ≥ 0} revisited with pumping lemma Homework • Exercises: 2, 4, 6, 8, 9, 11, 18, 22 of Section 4.1 - Linz’s book • 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 ... empty, finite, or infinite? Yes Questions about RL 3 Given two regularlanguages L1 and L2, is there an algorithm to determine whether or not L1 = L2? Yes Pigeonhole principle When n objects are placed in m boxes, provided n > m, there is at least one box storing more than one objects Example: L = {anbn : n ≥ 0} ; L is a regular language or not? Further Reading Pumping lemma L = {anbn : n... languages is closed under homomorphism: If L is regular, then so is h(L) Proof Let L(r) = L for some regular expression r Prove: h(L(r)) = L(h(r)) Right Quotient Let L1 and L2 be languages on the same alphabet Then the right quotient of L1 with L2 is defined as: L1/L2 = {x | xy ∈ L1 and y ∈ L2} Example 4.5 L1 = {anbm | n ≥ 1, m ≥ 0}∪{ba} L2 = {bm | m ≥ 1} L1/L2 = {anbm | n ≥ 1, m ≥ 0} Example 4.5 (cont’d)