Unformatted text preview: 2 +n+1) Algebraic Equality (n+1) 3 + 2(n+1) = 3(k+n 2 +n+1) Regrouping Works for n+1, QED 3) Give a CFG to accept an even or odd PALINDROME, where Σ = {a,b} S → aSa  bSb  a  b  ε 4) Give a CFG to accept the language {a n b m  n≠m} S → aSb  A  B A → aA  a B → bB  b 5) A homework problem: Find a context free grammar for L {a n b m : 0 ≤ n ≤ m+3}, ∑ = {a, b}. n a = n could be larger than n b = m by an amount of 1, 2, or 3. Otherwise it is smaller or equal to n b = m. S → aSb  A  B // n a = n b in L A → aaa  aa  a  λ // 0 ≤ n a – n b ≤ 3 in L B → bB  b // n a < n b in L...
View
Full
Document
 Spring '10
 Icamarra
 Contextfree grammar, inductive step, Inductive assumption n3+2n, Algebraic Equality Regrouping

Click to edit the document details