## Recall that a deterministic finite automaton (DFA) is defined as (Q, Σ, δ, q0, F) where Q is the set of states, Σ is the input alphabet, δ is the transition function, q0 is the start state, and F is the set of final (accepting) states. Design a DFA that accepts the language in question 1.

Theory of Computation (CS 320)

Homework #1

Due: Sept. 14, 2016

Instructions:

• You are allowed – and even encouraged – to work with other students, as well as to use textbooks and resources from the Internet, to solve these problems. However, your write-up must be your own and you must understand your answers. Inability to explain what you have written may result in losing credit for the homework assignment, and is likely to also result in poor performance on the exam.

Maximum score: 50 points

1. Recall that a grammar is defined as G = (V, T, S, P) where V is the set of variables, T is the set of terminal (alphabet) symbols, S is the start symbol (one of the variables), and P is the set of production rules. Suppose that a password for a website is comprised of only letters from {a, b, c} and digits from {1, 2, 3} and must contain at least one such letter and one such digit (but in no particular order). Devise a grammar that generates the language of passwords accepted by this website.

1. Recall that a deterministic finite automaton (DFA) is defined as (Q, Σ, δ, q0, F) where Q is the set of states, Σ is the input alphabet, δ is the transition function, q0 is the start state, and F is the set of final (accepting) states. Design a DFA that accepts the language in question 1. (Hint: perhaps use a case-based state design similar to the example discussed in class for a DFA that accepts strings with an even number of 0’s and odd number of 1’s.)

1. Last week, we proved that if w1 and w2 are words, then (w1 w2)R = w2R w1R. Prove a similar result for languages, namely that if L1 and L2 are languages, then (L1 L2)R = L2R L1R. (Hint: to prove that two languages are equal, you must show that every element of the first language is an elements of the second language, and every element of the second language is an element of the first language.)

1. Find grammars for these languages:
1. L = {an where n is even and n ≥ 0}
2. L = {an where n is odd and n ≥ 1}
3. L = {an where n is even and n ≥ 3}

1. Find the respective languages accepted by the following two machines: