CSE 105
THEORY OF COMPUTATION
Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/
CSE 105 THEORY OF COMPUTATION Fall 2016 - - PowerPoint PPT Presentation
CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ T oday's learning goals Sipser Ch 1.11.4 Are there non-regular languages? Pumping Lemma for Regular Languages Identify some nonregular sets
Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/
–
L1 = {0n1n | n < 10}
–
L2 = {0n1n | n > 10} A) L1 B) L2 C) Both L1 and L2 D) Neither L1 nor L2 E) I don’t know
–
L1 = {0n1n | n < 10}
–
L2 = {0n1n | n > 10}
–
Easy: because it is a fjnite language (of size 10)
similar!
–
L1 = {0n1n | n < 10}
A) 10 (or fewer) B) 20 (or fewer) C) 100 (or fewer) D) Exaclty 2048 E) I don’t know
–
L1 = {0n1n | n >= 0 }
–
L2 = {0n1n | (5<n) and (n<10)}
–
L3 = Complement of L2
–
L4 = {0n1n | not(5<n) or not(n<10)} A) All four B) L2, L3 C) L2, L3, L4 D) None E) I don’t know
k, given enough states.
–
Given a long enough string 0000000000...0, they will loose count when they “run out” of states
the fjrst time and future times it visited that state.
– L=L(M) is the language of a DFA = (Q,…) with
a fjnite number of states p=|Q|
– Consider computation on input 0p1p – Computation has length 2p+1>|Q| – Must visit the same state twice – This gives many other accepting computations
–
Accepts not only 000000111111
–
But also 00111111, 000000000111111
–
00(000)k01111111
00 01111 11 000
reasoning to prove that a language is not regular
all regular languages
–
Assume (for contradition) that L is regular
–
Therefore it satisfjes pumping property
–
Derive a contradiction.
a DFA can be pumped
x y z Idea: if one long string xyz is accepted, then many other strings have to be accepted too: xz, xyz, xyyz, xyyyz, ...
Sipser p. 78 Theorem 1.70
Sipser p. 78 Theorem 1.70
# states in DFA recognizing A # states in DFA recognizing A T ransition labels along loop Transition labels along loop
the pumping lemma:
A) It is a property of every regular language B) It is a property of every non-regular language C) It is a closure property of regular languages D) It is a closure property of non-regular languages E) I don’t know
by every regular language
–
Assume L is regular (for contradiction)
–
Apply pumping property
–
Get a contradiction
–
Therefore L is not regular
Claim: The set L = {0n1n | n ≥ 0} is not regular.
Claim: The set L = {0n1n | n ≥ 0} is not regular. Proof: Assume, towards a contradiction, that L is regular.
Pumping Lemma gives property of all regular sets. Can we get a contradiction by assuming that the Pumping Lemma applies to this set? Pumping Lemma gives property of all regular sets. Can we get a contradiction by assuming that the Pumping Lemma applies to this set?
Claim: The set L = {0n1n | n ≥ 0} is not regular. Proof: Assume, towards a contradiction, that L is regular. Therefore, the Pumping Lemma applies to L and gives us some number p, the pumping length of L. In particular, this means that every string in L that is
…Idea: can we fjnd some long string in L that can't be?
Claim: The set L = {0n1n | n ≥ 0} is not regular. Proof: …In particular, this means that every string in L that is of length p or more can be "pumped". Goal: pick a string s in L of length greater than or equal to p such that any division of s as s =xyz with |y|>0 and |xy|≤ p gives some value i≥0 with xyiz not in L So we have a contradiction, and L is not regular.
Claim: The set L = {0n1n | n ≥ 0} is not regular. Proof: … Goal: pick a string s in L of length greater than or equal to p such that any division of s as s =xyz with |y|>0 and |xy|≤ p gives some value i≥0 with xyiz not in L Choose s = 0p1p. Consider any s=xyz with |y|>0, |xy|≤p.
Claim: The set L = {0n1n | n ≥ 0} is not regular. Proof: … Goal: pick a string s in L of length greater than or equal to p such that any division of s as s =xyz with |y|>0 and |xy|≤ p gives some value i≥0 with xyiz not in L Choose s = 0p1p. Consider any s = xyz with |y|>0, |xy|≤p. Since |xy|≤p, x=0m , y = 0n , z = 0r1p with m+n+r =p, j>0.
Claim: The set L = {0n1n | n ≥ 0} is not regular. Proof: … Goal: pick a string s in L of length greater than or equal to p such that any division of s as s =xyz with |y|>0 and |xy|≤ p gives some value i≥0 with xyiz not in L Choose s = 0p1p. Consider any s = xyz with |y|>0, |xy|≤p. Since |xy|≤p, x=0m , y = 0n , z = 0r1p with m+n+r =p, j>0. Picking i=0: xyiz = xz = 0m0r1p = 0m+r1p , not in L!
Claim: The set L = {0n1n | n ≥ 0} is not regular. Proof: … Goal: pick a string s in L of length greater than or equal to p such that any division of s as s =xyz with |y|>0 and |xy|≤ p gives some value i≥0 with xyiz not in L Choose s = 0p1p. Consider any s = xyz with |y|>0, |xy|≤p. Since |xy|≤p, x=0m , y = 0n , z = 0r1p with m+n+r =p, j>0. Picking i=0: xyiz = xz = 0m0r1p = 0m+r1p , not in L! This is a contradiction with the Pumping Lemma applied to L, so L must not be regular.
Claim: Language L is not regular. Proof: Assume, towards a contradiction, that L is regular. By the Pumping Lemma, there is a pumping length p for L. Consider the string s = …… You must pick s carefully: we want |s|≥p and s in L.
*Confjrm these facts as part of your proof* Now we will prove a contradiction with the statement "s can be pumped"
Consider an arbitrary choice of x,y,z such that s = xyz, |y|>0, | xy|≤p. This means that...What properties are guaranteed about x,y,z? Consider i=… In this case, xyiz = …, which is not in L, a contradiction with the Pumping Lemma applying to L and so L is not regular.
Claim: The set L = {0n1n | n ≥ 0} is not regular. In proof, we used s = 0p1p and i=0 Claim: The set {anbman | m,n≥ 0} is not regular. In proof, we used s = apbap and i=3
Claim: The set {w wR | w is a string over {0,1} } is not regular. Proof: …Consider the string s = …… You must pick s carefully: we want |s|≥p and s in L. Now we will
prove a contradiction with the statement "s can be pumped" Consider i=…
Which s and i let us complete the proof?
i=3