proving non regularity
play

Proving Non-regularity Question: Is every language a regular - PowerPoint PPT Presentation

Algorithms & Models of Computation Regular Languages, DFA s, NFA s CS/ECE 374, Fall 2017 Theorem Languages accepted by DFA s, NFA s, and regular expressions are the same. Proving Non-regularity Question: Is every language a regular language?


  1. Algorithms & Models of Computation Regular Languages, DFA s, NFA s CS/ECE 374, Fall 2017 Theorem Languages accepted by DFA s, NFA s, and regular expressions are the same. Proving Non-regularity Question: Is every language a regular language? No. Each DFA M can be represented as a string over a finite Lecture 6 alphabet Σ by appropriate encoding Thursday, September 14, 2017 Hence number of regular languages is countably infinite Number of languages is uncountably infinite Hence there must be a non-regular language! Sariel Har-Peled (UIUC) CS374 1 Fall 2017 1 / 22 Sariel Har-Peled (UIUC) CS374 2 Fall 2017 2 / 22 How to prove non-regularity? Proof by figures Possible Not possible Claim: Language L is not regular. Idea: Show # states in any DFA M for language L has infinite number of states. w δ * (s,xw) x δ * (s,x) Lemma δ * (s,xw) w s y Consider three strings x , y , w ∈ Σ ∗ . x s δ * (s,x) = δ * (s,y) y M = ( Q , Σ , δ, s , A ) : DFA for language L ⊆ Σ ∗ . w w δ * (s,y) δ * (s,yw) δ * (s,yw) If δ ∗ ( s , xw ) ∈ A and δ ∗ ( s , yw ) / ∈ A then δ ∗ ( s , x ) � = δ ∗ ( s , y ) . Proof. Assume for the sake of contradiction that δ ∗ ( s , x ) = δ ∗ ( s , y ) . = ⇒ A ∋ δ ∗ ( s , xw ) = δ ∗ ( δ ∗ ( s , x ) , w ) = δ ∗ ( δ ∗ ( s , y ) , w ) = δ ∗ ( s , yw ) / ∈ A = ⇒ A ∋ δ ∗ ( s , xw ) / ∈ A . Impossible! Sariel Har-Peled (UIUC) CS374 3 Fall 2017 3 / 22 Sariel Har-Peled (UIUC) CS374 4 Fall 2017 4 / 22

  2. A Simple and Canonical Non-regular Language Proof by Contradiction L = { 0 k 1 k | i ≥ 0 } = { ǫ, 01 , 0011 , 000111 , · · · , } Suppose L is regular. Then there is a DFA M such that L ( M ) = L . Theorem Let M = ( Q , { 0 , 1 } , δ, s , A ) where | Q | = n . L is not regular. Consider strings ǫ, 0 , 00 , 000 , · · · , 0 n total of n + 1 strings. Question: Proof? What states does M reach on the above strings? Let q i = δ ∗ ( s , 0 i ) . Intuition: Any program to recognize L seems to require counting number of zeros in input which cannot be done with fixed memory. By pigeon hole principle q i = q j for some 0 ≤ i < j ≤ n . That is, M is in the same state after reading 0 i and 0 j where i � = j . How do we formalize intuition and come up with a formal proof? M should accept 0 i 1 i but then it will also accept 0 j 1 i where i � = j . This contradicts the fact that M accepts L . Thus, there is no DFA for L . Sariel Har-Peled (UIUC) CS374 5 Fall 2017 5 / 22 Sariel Har-Peled (UIUC) CS374 6 Fall 2017 6 / 22 Generalizing the argument Wee Lemma Definition Lemma For a language L over Σ and two strings x , y ∈ Σ ∗ , x and y are Suppose L = L ( M ) for some DFA M = ( Q , Σ , δ, s , A ) and distinguishable with respect to L if there is a string w ∈ Σ ∗ such suppose x , y are distinguishable with respect to L . Then that exactly one of xw , yw is in L . δ ∗ ( s , x ) � = δ ∗ ( s , y ) . x , y are indistinguishable with respect to L if there is no such w . Proof. Example: If i � = j , 0 i and 0 j are distinguishable with respect to Since x , y are distinguishable let w be the distinguishing suffix. If L = { 0 k 1 k | k ≥ 0 } δ ∗ ( s , x ) = δ ∗ ( s , y ) then M will either accept both the strings xw , yw , or reject both. But exactly one of them is in L , a Example: 000 and 0000 are indistinguishable with respect to the contradiction. language L = { w | w has 00 as a substring } Sariel Har-Peled (UIUC) CS374 7 Fall 2017 7 / 22 Sariel Har-Peled (UIUC) CS374 8 Fall 2017 8 / 22

  3. Fooling Sets Proof of Theorem Definition Theorem Suppose F is a fooling set for L . If F is finite then there is no DFA For a language L over Σ a set of strings F (could be infinite) is a M that accepts L with less than | F | states. fooling set or distinguishing set for L if every two distinct strings x , y ∈ F are distinguishable. Proof. Example: F = { 0 i | i ≥ 0 } is a fooling set for the language Suppose there is a DFA M = ( Q , Σ , δ, s , A ) that accepts L . Let L = { 0 k 1 k | k ≥ 0 } . | Q | = n . If n < | F | then by pigeon hole principle there are two strings Theorem x , y ∈ F , x � = y such that δ ∗ ( s , x ) = δ ∗ ( s , y ) but x , y are Suppose F is a fooling set for L . If F is finite then there is no DFA distinguishable. M that accepts L with less than | F | states. Implies that there is w such that exactly one of xw , yw is in L . However, M ’s behavior on xw and yw is exactly the same and hence M will accept both xw , yw or reject both. A contradiction. Sariel Har-Peled (UIUC) CS374 9 Fall 2017 9 / 22 Sariel Har-Peled (UIUC) CS374 10 Fall 2017 10 / 22 Infinite Fooling Sets Examples { 0 k 1 k | k ≥ 0 } Theorem Suppose F is a fooling set for L . If F is finite then there is no DFA { bitstrings with equal number of 0s and 1s } { 0 k 1 ℓ | k � = ℓ } M that accepts L with less than | F | states. { 0 k 2 | k ≥ 0 } Corollary If L has an infinite fooling set F then L is not regular. Proof. Suppose for contradiction that L = L ( M ) for some DFA M with n states. Any subset F ′ of F is a fooling set. (Why?) Pick F ′ ⊆ F arbitrarily such that | F ′ | > n . By preceding theorem, we obtain a contradiction. Sariel Har-Peled (UIUC) CS374 11 Fall 2017 11 / 22 Sariel Har-Peled (UIUC) CS374 12 Fall 2017 12 / 22

  4. Exponential gap between NFA and DFA size How do pick a fooling set L k = { w ∈ { 0 , 1 } ∗ | w has a 1 k positions from the end } How do we pick a fooling set F ? Recall that L k is accepted by a NFA N with k + 1 states. If x , y are in F and x � = y they should be distinguishable! Of course. Theorem Every DFA that accepts L k has at least 2 k states. All strings in F except maybe one should be prefixes of strings in the language L . For example if L = { 0 k 1 k | k ≥ 0 } do not pick 1 and 10 Claim (say). Why? F = { w ∈ { 0 , 1 } ∗ : | w | = k } is a fooling set of size 2 k for L k . Why? Suppose a 1 a 2 . . . a k and b 1 b 2 . . . b k are two distinct bitstrings of length k Let i be first index where a i � = b i y = 0 k − i − 1 is a distinguishing suffix for the two strings Sariel Har-Peled (UIUC) CS374 13 Fall 2017 13 / 22 Sariel Har-Peled (UIUC) CS374 14 Fall 2017 14 / 22 Non-regularity via closure properties L = { bitstrings with equal number of 0s and 1s } L ′ = { 0 k 1 k | k ≥ 0 } Part I Suppose we have already shown that L ′ is non-regular. Can we show that L is non-regular without using the fooling set argument from Non-regularity via closure properties scratch? L ′ = L ∩ L (0 ∗ 1 ∗ ) Claim: The above and the fact that L ′ is non-regular implies L is non-regular. Why? Suppose L is regular. Then since L (0 ∗ 1 ∗ ) is regular, and regular languages are closed under intersection, L ′ also would be regular. But we know L ′ is not regular, a contradiction. Sariel Har-Peled (UIUC) CS374 15 Fall 2017 15 / 22 Sariel Har-Peled (UIUC) CS374 16 Fall 2017 16 / 22

  5. Non-regularity via closure properties Proving non-regularity: Summary General recipe: Method of distinguishing suffixes. To prove that L is non-regular find an infinite fooling set. L 1 Closure properties. Use existing non-regular languages and regular languages to prove that some new language is L 2 non-regular. Apply KNOWN L non-regular closure REGULAR Pumping lemma. We did not cover it but it is sometimes an properties easier proof technique to apply, but not as general as the fooling L n set technique. L ? UNKNOWN Sariel Har-Peled (UIUC) CS374 17 Fall 2017 17 / 22 Sariel Har-Peled (UIUC) CS374 18 Fall 2017 18 / 22 Indistinguishability Recall: Definition For a language L over Σ and two strings x , y ∈ Σ ∗ we say that x Part II and y are distinguishable with respect to L if there is a string w ∈ Σ ∗ such that exactly one of xw , yw is in L . x , y are Myhill-Nerode Theorem indistinguishable with respect to L if there is no such w . Given language L over Σ define a relation ≡ L over strings in Σ ∗ as follows: x ≡ L y iff x and y are indistinguishable with respect to L . Claim ≡ L is an equivalence relation over Σ ∗ . Therefore, ≡ L partitions Σ ∗ into a collection of equivalence classes X 1 , X 2 , . . . , Sariel Har-Peled (UIUC) CS374 19 Fall 2017 19 / 22 Sariel Har-Peled (UIUC) CS374 20 Fall 2017 20 / 22

  6. Myhill-Nerode Theorem Claim ≡ L is an equivalence relation over Σ ∗ . Theorem (Myhill-Nerode) Therefore, ≡ L partitions Σ ∗ into a collection of equivalence classes. L is regular ⇐ ⇒ ≡ L has a finite number of equivalence classes. If ≡ L is finite with n equivalence classes then there is a DFA M Claim accepting L with exactly n states and this is the minimum possible. Let x , y be two distinct strings. If x , y belong to the same equivalence class of ≡ L then x , y are indistinguishable. Otherwise Corollary they are distinguishable. A language L is non-regular if and only if there is an infinite fooling set F for L . Corollary If ≡ L is finite with n equivalence classes then there is a fooling set F Algorithmic implication: For every DFA M one can find in polynomial time a DFA M ′ such that L ( M ) = L ( M ′ ) and M ′ has of size n for L . If ≡ L is infinite then there is an infinite fooling set for L . the fewest possible states among all such DFA s. Sariel Har-Peled (UIUC) CS374 21 Fall 2017 21 / 22 Sariel Har-Peled (UIUC) CS374 22 Fall 2017 22 / 22

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend