Minor edits
This commit is contained in:
parent
d50a6ca6d9
commit
770bd2c2c4
@ -121,9 +121,33 @@ Describe the strings accepted by $B$.
|
|||||||
\vfill
|
\vfill
|
||||||
\pagebreak
|
\pagebreak
|
||||||
|
|
||||||
|
Before we continue, let's properly define all the words we've been using in the problems above.
|
||||||
|
|
||||||
|
\definition{}
|
||||||
|
An \textit{alphabet} is a finite set of symbols. \par
|
||||||
|
|
||||||
|
\definition{}
|
||||||
|
A \textit{string} over an alphabet $Q$ is a finite sequence of symbols from $Q$. \par
|
||||||
|
We'll denote the empty string $\varepsilon$. \par
|
||||||
|
|
||||||
|
|
||||||
|
\definition{}
|
||||||
|
$Q^*$ is the set of all possible strings over $Q$. \par
|
||||||
|
For example, $\{\texttt{0}, \texttt{1}\}^*$ is the set $\{\varepsilon, \texttt{0}, \texttt{1}, \texttt{00}, \texttt{01}, \texttt{10}, \texttt{11}, \texttt{000},... \}$ \par
|
||||||
|
Note that this set contains the empty string.
|
||||||
|
|
||||||
|
\definition{}
|
||||||
|
A \textit{language} over an alphabet $Q$ is a subset of $Q^*$. \par
|
||||||
|
For example, the language \say{strings of length 2} over $\{\texttt{0}, \texttt{1}\}$ is $\{\texttt{00}, \texttt{01}, \texttt{10}, \texttt{11}\}$
|
||||||
|
|
||||||
|
\definition{}
|
||||||
|
The language \textit{recognized} by a DFA is the set of strings that the DFA accepts.
|
||||||
|
|
||||||
|
\vspace{5mm}
|
||||||
|
|
||||||
\problem{}<fibonacci>
|
\problem{}<fibonacci>
|
||||||
How many strings of length $n$ are accepted by the automaton $C$?
|
How many strings of length $n$ are accepted by the automaton below? \par
|
||||||
|
\hint{Induction.}
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\begin{tikzpicture}
|
\begin{tikzpicture}
|
||||||
@ -150,33 +174,9 @@ How many strings of length $n$ are accepted by the automaton $C$?
|
|||||||
Computing initial conditions, we see that $A_n$ is an $n+2$-th Fibonacci number.
|
Computing initial conditions, we see that $A_n$ is an $n+2$-th Fibonacci number.
|
||||||
\end{solution}
|
\end{solution}
|
||||||
|
|
||||||
%\begin{remark}
|
|
||||||
%Note that all the states in our DFAs $A$, $B$ and $C$ from figures 1, 2, 3 have outgoing symbols for each letter of the alphabet. %Do the same for your DFAs.
|
|
||||||
%\end{remark}
|
|
||||||
|
|
||||||
\vfill
|
\vfill
|
||||||
|
|
||||||
\definition{}
|
\vfill
|
||||||
An \textit{alphabet} is a finite set of symbols. \par
|
|
||||||
|
|
||||||
\definition{}
|
|
||||||
A \textit{string} over an alphabet $Q$ is a finite sequence of symbols from $Q$. \par
|
|
||||||
We denote the empty string $\varepsilon$. \par
|
|
||||||
|
|
||||||
|
|
||||||
\vspace{2mm}
|
|
||||||
|
|
||||||
$Q^*$ is the set of all possible strings over $Q$. \par
|
|
||||||
For example, $\{\texttt{0}, \texttt{1}\}^*$ is the set $\{\varepsilon, \texttt{0}, \texttt{1}, \texttt{00}, \texttt{01}, \texttt{10}, \texttt{11}, \texttt{000},... \}$ \par
|
|
||||||
Note that this set contains the empty string.
|
|
||||||
|
|
||||||
\definition{}
|
|
||||||
A \textit{language} over an alphabet $Q$ is a subset of $Q^*$. \par
|
|
||||||
For example, the language \say{strings of length 2} over $\{\texttt{0}, \texttt{1}\}$ is $\{\texttt{00}, \texttt{01}, \texttt{10}, \texttt{11}\}$
|
|
||||||
|
|
||||||
\definition{}
|
|
||||||
We say a language $L$ is \textit{recognized} by a DFA if that DFA accepts a string $w$ if and only if $w \in L$.
|
|
||||||
|
|
||||||
\pagebreak
|
\pagebreak
|
||||||
|
|
||||||
\problem{}
|
\problem{}
|
||||||
@ -193,7 +193,6 @@ Draw DFAs that recognize the following languages. In all parts, the alphabet is
|
|||||||
\begin{solution}
|
\begin{solution}
|
||||||
$\{w~ | ~w~ \text{begins with a \texttt{1} and ends with a \texttt{0}}\}$
|
$\{w~ | ~w~ \text{begins with a \texttt{1} and ends with a \texttt{0}}\}$
|
||||||
|
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\begin{tikzpicture}
|
\begin{tikzpicture}
|
||||||
\begin{scope}[layer = nodes]
|
\begin{scope}[layer = nodes]
|
||||||
@ -428,6 +427,13 @@ Draw a DFA over an alphabet $\{\texttt{a}, \texttt{b}, \texttt{@}, \texttt{.}\}$
|
|||||||
|
|
||||||
\end{solution}
|
\end{solution}
|
||||||
|
|
||||||
|
\vfill
|
||||||
|
|
||||||
|
%\problem{}
|
||||||
|
%Construct a DFA that accepts a binary integer iff it is divisible by two.
|
||||||
|
%\vfill
|
||||||
|
|
||||||
|
|
||||||
\vfill
|
\vfill
|
||||||
\pagebreak
|
\pagebreak
|
||||||
|
|
||||||
@ -441,7 +447,7 @@ Draw a state diagram for a DFA over an alphabet of your choice that accepts exac
|
|||||||
\item $f(n)$ is a Tribonacci number. \par
|
\item $f(n)$ is a Tribonacci number. \par
|
||||||
Tribonacci numbers are defined by the sequence $f(0) = 0$, $f(1) = 1$, $f(2) = 1$,
|
Tribonacci numbers are defined by the sequence $f(0) = 0$, $f(1) = 1$, $f(2) = 1$,
|
||||||
and $f(n) = f(n-1)+f(n-2)+f(n-3)$ for $n \ge 3$ \par
|
and $f(n) = f(n-1)+f(n-2)+f(n-3)$ for $n \ge 3$ \par
|
||||||
\hint{Fibonacci numbers are given by the automaton prohibiting two \texttt{`a'}s in a row.}
|
\hint{Fibonacci numbers are given by the automaton prohibiting two letters \say{\texttt{a}} in a row.}
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
|
|
||||||
@ -485,7 +491,7 @@ Draw a state diagram for a DFA over an alphabet of your choice that accepts exac
|
|||||||
|
|
||||||
\textbf{Part 5:} Tribonacci numbers \par
|
\textbf{Part 5:} Tribonacci numbers \par
|
||||||
Using the hint, we get the following automaton. \par
|
Using the hint, we get the following automaton. \par
|
||||||
It rejects all strings with three \texttt{'a'}s in a row.
|
It rejects all strings with three \texttt{a}s in a row.
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\begin{tikzpicture}
|
\begin{tikzpicture}
|
||||||
@ -510,7 +516,7 @@ Draw a state diagram for a DFA over an alphabet of your choice that accepts exac
|
|||||||
\end{tikzpicture}
|
\end{tikzpicture}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
This automaton rejects all strings with three \texttt{'a'}s in a row. If we count accepted strings, we get the Tribonacci numbers with an offset: $f(0) = 1$, $f(1) = 2$, $f(2)=4$, ... \par
|
This automaton rejects all strings with three \texttt{a}s in a row. If we count accepted strings, we get the Tribonacci numbers with an offset: $f(0) = 1$, $f(1) = 2$, $f(2)=4$, ... \par
|
||||||
|
|
||||||
\pagebreak
|
\pagebreak
|
||||||
|
|
||||||
@ -626,5 +632,18 @@ Draw a state diagram for a DFA over an alphabet of your choice that accepts exac
|
|||||||
|
|
||||||
\end{solution}
|
\end{solution}
|
||||||
|
|
||||||
|
\vfill
|
||||||
|
\pagebreak
|
||||||
|
|
||||||
|
\problem{}<divsix>
|
||||||
|
Construct a DFA that accepts an binary integer if and only if it is divisible by six. \par
|
||||||
|
Strings are read from most to least significant digit.
|
||||||
|
(that is, 18 will be read as 1,0,0,1,0)
|
||||||
|
|
||||||
|
\vfill
|
||||||
|
|
||||||
|
\problem{}
|
||||||
|
Construct a DFA that satisfies \ref{divsix}, but reads digits in the opposite order.
|
||||||
|
|
||||||
\vfill
|
\vfill
|
||||||
\pagebreak
|
\pagebreak
|
Loading…
x
Reference in New Issue
Block a user