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
107,5 KB
Nội dung
Chapter 4: Properties of Regular Languages 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 of regular languages 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 = {abn | n ≥ 0} L 2 = {anb | n ≥ 0} L 1 ∩L 2 = {ab} Example 4.2 Find intersection dfa of L 1 ={ a 2 nbm : n , m ≥ 0} and L 2 ={ a 3 nb 2 m : 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 of regular languages is closed under reversal: If L is regular, then so is LR. Proof ? Suppose Σ and Γ are alphabets. h: Σ → Γ* is called a homomorphism Homomorphism [...]... L(M3) ∩ L2 = ∅ Standard representation Standard 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,... δ*(q0, x) = qi δ*(qi, y) ∈ F and 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 of regular languages is closed under right quotient: If L and L are regular, then so is L /L 1 2 1 2 Proof • M = (Q, Σ, δ, q , F) accepts L 0 1 M^ = (P, Σ, δ, q , F^) accepts L /L 0 1 2 If y ∈ L and δ*(q , y) ∈ F ⇒ add... (dbcc + (bdc)*)(dbccdbcc)* Theorem 4.3 The family of regular 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 L and L be languages on the same alphabet 1 2 Then the right quotient of L with L is defined as: 1 2 L /L = {x | xy ∈ L and y ∈ L } 1 2 1 2 Example 4.5 L = {anbm | n ≥ 1, m ≥ 0}∪{ba}... finite, or infinite? Yes Questions about RL 3 Given two regular languages L and L , is there an algorithm to 1 2 determine whether or not L = L ? 1 2 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...Homomorphism (cont’d) Extended definition: w = a a a 1 2 n h(w) = h(a )h(a ) h(a ) 1 2 n Homomorphism (cont’d) If L is a language on Σ, then its homomorphic image is defined as: h(L) = {h(w): w ∈ L} Example 4.3 Σ = {a, b} Γ = {a, b, c} h(a) = ab h(b) = bbc h(aba) = abbbcab L = {aa, aba} ⇒ h(L) = {abab, abbbcab} Homomorphism . Regular Languages 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 of regular languages. regular 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 L 1 and L 2 be languages. L 2 q 1 q 0 q 2 aa b L 1 b Theorem 2 The family of regular languages is closed under reversal: If L is regular, then so is LR. Proof ? Suppose Σ and Γ are alphabets. h: Σ → Γ* is called a homomorphism Homomorphism Homomorphism