Announcements Midterm is Wednesday June 23 in class. There will be no tutorial next week (Tuesday June 29). A midterm study aid lists the material you are responsible for on the midterm. Many old midterms are posted. Look at old finals for questions on CFG’s and PDA’s (these are also posted).
The next slides are examples of incorrect solutions to the assignment questions. Why are these not correct solutions? Critique these responses.
DFA from Question 1(c) :
Question 1(c) The number of strings accepted by the DFA of length n=2k+1 is f(0)= 2, f(k)= 2*f(k-1) and hence f(k) = 2k+1. Proof: [Basis] The base case is k=0 and 20+1 =2 as required. Assume that f(k)= 2k+1. We need to show that f(k+1)= 2k+2. But f(k+1)= 2 * f(k). By induction, f(k)= 2k+1. Therefore, f(k+1)= 2 * 2k+1= 2k+2 as required.
Question 2:L = {ar bsct : s ³ r, t ³ 2s}. One case: Recall w= arbrc2r. x= a bi, y= bj, z= br-i-j c2r Pump twice to get ar br+j c2r which is not in L since it is not of the form arbrc2r. Find some number n > 0 so that you can pump n times to fix this case (n=0 also works),
x= ar-i, y= ai bj , z= br-j c2r Another case: x= ar-i, y= ai bj , z= br-j c2r Pump twice to get ar+i br+j c2r which is not in L.
Question 6 (c): L1 = {uuRv : u, v Î {a, b}+}, For the strings of length 6 we have: two choices for u of length one then for each of these 24 choices for v. four choices for u of length two then for each of these 22 choices for v. So the number of length 6 is 2* 16 + 4 * 4 = 48.
Question 6 (c): L1 = {uuRv : u, v Î {a, b}+}, If |u| 2, then choose x= e, y= uuR , z=v. Pumping n times gives: (uuR)n v which is in L. Give a string w that provides a counterexample to this argument.
L= { ap : p is a prime number} is not regular. Theorem: L= { ap : p is a prime number} is not regular. Assume L is regular and is accepted by a DFA M with k states. Choose w= ap for some prime number p ≥ k. Factor ap in all ways as x y z: w = ar as at where p= r + s + t, and s ≥ 1. Pumping n+1 times yields: ap+ ns .
Case 1: If r+t = 0 then pump 2 times to get a2p L since 2p is not prime. Case 2: If r + t = 1 then pump p+1 times: a1+ (p-1)(p+1) = ap*p L since p2 is not prime. Case 3: If r+t ≥ 2 then pump r + t times to get ar+t + (r+t)s L since (s+1)(r+t) is not prime (both factors are at least two).
What would be a more judicious choice for w for this proof and which cases would remain?
Theorem: L= { an2 : n ≥ 0} is not regular. Note: if L is a language defined over a one symbol alphabet and you can prove L is not regular using the pumping lemma, then it also means that L is not context-free.
Factor ap in all ways as u v x y z: w = ai aj ar as at where p= i + j + r + s + t, j + s ≥ 1, v=aj and y= as. Pumping n times yields: ai (aj )n ar (as)n at = ai ar at (aj )n (as)n = ap-j-s + (j+s)n Let x= j+s. Pumping n+1 times yields: ap+xn
w = ai aj ar as at, let x= j + s. Case 1: If p-x=0 then pump 2 times to get a2p L since 2p is not prime. Case 2: If p-x= 1 then pump p+1 times: a1+ (p-1)(p+1) = ap*p L since p2 is not prime. Case 3: If p-x ≥ 2 then pump p-x times to get ap-x+x(p-x) L since (x+1)(p-x) is not prime (x ≥ 1 since x= |v| + |y|).