Class Discussion: Can You Draw A DFA That Accepts The Language (A B - K 0,1,2, ) Over The Alphabet (A, B) ?
Class Discussion: Can You Draw A DFA That Accepts The Language (A B - K 0,1,2, ) Over The Alphabet (A, B) ?
Can you draw a DFA that accepts the language {akbk | k = 0,1,2,} over the alphabet ={a,b}?
Limitations of FA
Many languages are non-regular: {anbn | n = 0,1,2,} {0i2 | i 0,1,2,} p {0 | p is a prime number } the set of all well-formed parentheses over the alphabet ={(, )} the set of all palindromes over the alphabet ={a, b} ...
Why Impossible?
We want to prove that L = {aibi | i = 0,1,2,} is non-regular. Prove by contradiction: Assume that there is a DFA M that recognizes L. Let n be the total number of states in M. Consider the path followed by the input string anbn in M:
q(0) a q(1) a a q(n) b q(n+1) b ... b q (2n) ...
Why Impossible?
Since M has only n states, there must be at least one state visited twice in the first n transitions. Let this state be visited at the ith and the jth steps, where j > i.
q(i) = q(j)
q(2n) F q(0)
By skipping the loop, an-(j-i)bn should also be accepted, but this is contradictory since an-(j-i)bnL
Another Example
We want to prove that L = {1k2 | k > 0} is nonregular. Prove by contradiction: Assume that there is a DFA M that recognizes L. Let n be the total number of states in M. M should also accept the string 1n2
q(0) 1 q(1) 1 q(2) 1
1 q( 2) n ...
Another Example
Since n2 n and M has only n states, there must be at least two equal states from q(0) to q (n2). Let q(i) = q(j) be the first repeated state where j-i = m n.
q(i) = q(j) q(n2 ) F The path in M n2 when reading 1
By repeating the loop one more time, 1(n2+m) is also accepted by M, which is a contradiction, since (n2+m) cannot be a square (the next square after n2 is (n+1)2 but n2+m < (n+1)2).
where z(i) is the ith symbol of the string z. Since k n and M has only n states, there must be at least one repeated states from q(0) to q(k). Let q(i) be the first such repeated state.
q(0)
a path in M
q(k) F
Let u be the string obtained by traversing from q(0) to q(i), and v be the string obtained by traversing the loop once (|v|1). In the traversal from q(0) to q(i) and then through the loop once back to q(i), nothing except q(i) repeats, so |uv| n. By traversing the loop 0 or more times, we obtain uviw where i 0. These strings should all be accepted by M since they can all reach q(k) which is a final state in M.
Class Discussion
Prove that the set of all strings over {0,1} such that the number of 1s is one more than the number of 0s is non-regular.