On this page:
1 Equivalent Machines
2 "Closed" Operation Practice
3 Formal Description of an NFA
4 Recursively Processing a String

Homework 3

Last updated: Thu, 29 Feb 2024 12:41:45 -0500

Out: Wed Feb 21, 12:00pm EST Due: Mon Mar 04, 12:00pm EST (noon)

This assignment continues to explore nondeterministic finite automata (NFAs) and regular languages.

Homework Problems

  1. Equivalent Machines (8 points)

  2. "Closed" Operation Practice (9 points)

  3. Formal Description of an NFA (9 points)

  4. Recursively Processing a String (8 points)

  5. README (1 point)

Total: 35 points

Submitting

Submit your solution to this assignment in Gradescope hw3. 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 Equivalent Machines

Two machines are considered equivalent if they recognize the same language (i.e., they accept the same strings).

Come up with a function \textrm{convert} : \textsf{DFA} \rightarrow \textsf{NFA} where, given some input DFA M = (Q,\Sigma,\delta,q_{start},F) that satisfies the formal definition of DFAs from class, \textrm{convert}(M)= some NFA N that satisfies the formal definition of NFAs, and is equivalent to the input DFA.

To prove "equivalence" of two machines, use a variation of our language-machine "Equivalence Table", except now the columns correspond to the two machines.

In addition, since we are not dealing with specific languages or machines here, each line of the table needs an additional "justification" (can be mix of formalism and English prose).

For example:

String

M accepts?

N accepts?

Justification for why N accepts/rejects?

Though your answer must work for any machine, you should use your answers for the specific machine qfrom Homework 1 DFA Formal Description and Homework 2 DFAs vs NFAs to help guide your thinking, and to double-check that your answer is correct.

2 "Closed" Operation Practice

Define:

\mathrm{NEG}(A) = \left\{w \mid w\textrm{ is not in the language }A\right\}

Prove that set of regular languages is closed under the \mathrm{NEG} operation by:

3 Formal Description of an NFA

Consider the following NFA:

  1. Come up with 3 strings that are accepted by the NFA.

  2. Come up with 3 strings that are not accepted (rejected) by the NFA. Your answer must include as least one string which, when run as input to the machine, makes the machine end in an empty set of states, and one which makes the machine end in a non-empty set of states.

  3. 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.

  4. Using your examples, create a table to show that this machine is equivalent to the DFA from Homework 1 DFA Formal Description and the NFA from Homework 2 DFAs vs NFAs.

  5. Give some additional intuition (in English prose) for:
    1. why all these machines are equivalent (hint: talk about what accepting computations look like in the machines), and

    2. why NFAs may be "easier to work with" than DFAs

4 Recursively Processing a String

Assume some alphabet \Sigma.

Write a recursive function \textrm{double} : \Sigma^* \rightarrow \Sigma^* that repeats each character in a string (remember a string is a sequence of zero or more characters from \Sigma).

Examples If \Sigma = \{\texttt{a},\texttt{b}\}
  • \textrm{double}(\texttt{a}) = \texttt{aa}

  • \textrm{double}(\texttt{ab}) = \texttt{aabb}

Your definition of \textrm{double} should resemble the structure of the \hat{\delta} definitions from class. That is to say, the definition of \textrm{double} should resemble the recursive definition of strings. More specifically, your answer should have two parts:

Note: The "function" in this problem is a mathematical function. In other words, it maps every element of some set (called the domain), to an element in another (possibly same) set (called the range). This problem does not involve any code.