Homework 1
Last updated: Sun, 2 Apr 2023 09:58:04 -0400
Out: Wed Feb 1, 00:00 EST Due: Tue Feb 7, 23:59 EST
This assignment explores deterministic finite automata (DFAs) and regular languages.
Homework Problems
HW 0 Second Chance! (up to 4 points extra)
DFA Formal Description (12 points)
Is It A Regular Language? (8 points)
DFAs Can Do "Real" Computation (5 points)
README (1 point)
Maximum: 30 (out of 26) points
Submitting
Submit your solution to this assignment in Gradescope hw1. 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.
HW 0 Second Chance!
what your misunderstanding was, and
what the right answer should be.
You will receive 1 bonus pt on this assignment for each HW 0 question where you provide the above information.
Alternatively, if you got less than four questions wrong, you may come up with a possible discrete math quiz question that you think would help future CS 420 students prepare for this course.
You will receive 1 bonus pt on this assignment for each quiz question you come up with.
The maximum bonus that may be earned on this assignment is 4 points.
1 DFA Formal Description
Imagine you have been given the task of checking whether a given password contains a "special character".
The following FSM (DFA) represents computation that could do this. More specifically, it accepts all strings containing at least one \texttt{\$} character.
Come up with 2 strings that are accepted by the DFA. These strings are said to be in the language recognized by the DFA.
Come up with 2 strings that are not accepted (rejected) by the DFA. These strings are not in the language recognized by the DFA.
Is the empty string, \varepsilon, in the language of the DFA?
Come up with a formal description for this DFA.
Recall that a DFA’s formal description is a tuple of five components, e.g. M = (Q,\Sigma,\delta,q_{start},F).
You may assume that the alphabet contains only the symbols from the diagram.
- Then for each of the following, say whether the computation represents an accepting computation or not (make sure to review the definition of an accepting computation). If the answer is no, explain why not.:
\hat{\delta}(q0,\texttt{a\$b})
\hat{\delta}(q1,\texttt{a\$b})
\hat{\delta}(q0,\texttt{abc})
\hat{\delta}(q0,\texttt{cd\$})
2 Is It A Regular Language?
Prove that the following language is a regular language:
L_{01} = \{w\mid w\textrm{ is a string where any two consecutive characters are different}\}
You may assume that strings in the language are drawn from alphabet \{\texttt{0},\texttt{1}\}.
Important: Before attempting the proof, make sure to understand what this problem is asking. In other words, make sure to understand what strings are in the language and are not in the language. Post examples to Piazza for clarification if you are unsure.
Your proof must be in the form of a Statements and Justifications table, as presented in class.
If your answer includes designing a DFA, you may submit a state diagram instead of a formal description of the machine.
To "prove" that a DFA recognizes a language, you must give three strings that are both accepted by the DFA and in the language, and three strings that the DFA rejects that are not in the language.
3 DFAs Can Do "Real" Computation
Here is an example showing that DFAs can perform "real" computation.
Assume that the following is an alphabet of "domino" symbols (one could easily use unicode characters to represent such an alphabet):
Now let L_< be a language consisting of sequences of these dominos where the top and bottom rows are interpreted as binary numbers. Specifically:
L_< = \{w\mid w \textrm{ is a sequence of dominoes where top row} < \textrm{bottom row}\}
Prove that L_< is a regular language.
Your proof must be in the form of a Statements and Justifications table, as presented in class.
If your answer includes designing a DFA, you may submit a state diagram instead of a formal description of the machine.
To "prove" that a DFA recognizes a language, you must give three strings that are both accepted by the DFA and in the language, and three strings that the DFA rejects that are not in the language.