Homework 2
Last updated: Tue, 14 Feb 2023 18:19:13 -0500
Out: Wed Feb 08, 00:00 EST Due: Tue Feb 14, 23:59 EST
This assignment explores nondeterministic finite automata (NFAs) and closed operations for regular languages.
Homework Problems
Formal Description of an NFA (11 points)
DFAs vs NFAs (9 points)
Are Regular Languages Closed Under OP1? (11 points)
README (1 point)
Total: 32 points
Submitting
Submit your solution to this assignment in Gradescope hw2. Please assign each page to the correct problem and make sure your solutions are legible.
A submission must also include a README containing the required information.
1 Formal Description of an NFA
Consider the following NFA:
Come up with 3 strings that are accepted by the NFA. Together, your answers must traverse all transitions and reach all accept states.
Come up with 3 strings that are not accepted (rejected) by the NFA. Together, your answers must reach all non-accept states of the NFA.
In class we learned that an NFA’s formal description has five components, e.g. N = (Q,\Sigma,\delta,q_{start},F), where \delta:Q\times\Sigma_\varepsilon\rightarrow\mathcal{P}(Q) is the transition function mapping a state and input symbol (or no symbol, in the case of an empty transition) to a set of states.
Come up with the formal description of the NFA above.
2 DFAs vs NFAs
Explain two possible differences between the formal description of a DFA and the formal description of an NFA.
Explain a difference between computation with a DFA and computation with an NFA.
Two machines are considered equivalent if they recognize the same language (i.e., they accept the same strings).
Come up with a function \texttt{d2n} : \texttt{DFA} \rightarrow \texttt{NFA} where, given an input DFA M = (Q,\Sigma,\delta,q_{start},F) that satisfies the formal definition of DFAs from class, \texttt{d2n}(M) produces an NFA N = (Q^\prime,\Sigma,\delta^\prime,q^\prime_{start},F^\prime) that satisfies the formal definition of NFAs and is equivalent to the input DFA.
3 Are Regular Languages Closed Under OP1?
Define the following operation, called \mathrm{OP}_1, on two languages:
\mathrm{OP}_1(A,B)=\{w\mid w=ab, \textrm{ where }w\textrm{ is a string},a\notin A,\textrm{ and }b \in B\}
Prove that class of regular languages is closed under the \mathrm{OP}_1 operation:
Give the equivalent IF-THEN statement that must be proved.
Give a proof of this IF-THEN statement.
Make sure your answer is in the form of a "Statements and Justifications" table, as explained in lecture (and also Hopcroft Chapter 1).
If you need to give examples in your proof, express them in terms of the input languages. You should have at least 3 examples, which must include at least one that is in the output language and one that is not in the output language.
Also, in this proof, you may use the following facts as given:"If an NFA recognizes a language, then that language is a regular language."
"If a language is regular, then there is an NFA that recognizes it."