Problem 1
- T - regular languages are closed under concatenation
- F - context-free languages are not closed under intersection
- F - language is not regular
- F - context-free languages not closed under complement
- T - if all words in L have length < 1000 then L is finite, thus regular
- T - e.g. with dynamic programming
- T - see def'n of Chomsky Normal Form
- T - any finite language is regular
- F - every regular language is context free
- T
- F - for some NFA's with n states, there are no equivalent DFA's with less than 2n states
Problem 2
states: (each state's name is what we need to see to have seen 0010)
- 0010 - accept
- 010 - accept
- 10 - accept
- 0 - accept
- reject
transitions:
| state | symbol | new state |
| 0010 | 0 | 010 |
| 0010 | 1 | 0010 |
| 010 | 0 | 10 |
| 010 | 1 | 0010 |
| 10 | 0 | 10 |
| 10 | 1 | 0 |
| 0 | 0 | reject |
| 0 | 1 | 0010 |
| reject | 0 | reject |
| reject | 1 | reject |
Problem 3
- S -> a S d | B | C
- B -> b B d | T
- C -> a C c | T
- T -> b T c | epsilon
explanation:
- T -> { bi ci }
- B -> { bj T dj } = {bj bi ci dj } = { bk ci dj : i+j = k }
- C -> { aj T cj } = { aj bi ci cj } = { aj bi ck : i+j = k }
- S -> { an B dn } ∪ { an B dn } = { an bk ci dj dn : i+j=k } ∪ {an aj bi ck dn : i+j = k}
Problem 4
The language is regular. Here is a DFA:
states:
- 00 -- accept
- 01
- 02
- 10
- 11
- 12
transition function:
- δ(ij, 0) = i'j where i' = i+1 mod 2
- δ(ij, 1) = ij' where j' = j+1 mod 3