\documentclass[11pt]{article}

% Define some commands for names to be used in this document
%-----------------------------------------------------------------
\newcommand{\myname}{Joe College}             % ADJUST THESE
\newcommand{\course}{MAT 4885}                % AS NECESSARY...
\newcommand{\assignment}{Homework 4}                  
\newcommand{\probs}{Page 123: 9ab}          
\newcommand{\duedate}{Sept.\ 23, 2011}              
%-----------------------------------------------------------------

% Declare some LaTeX packages for this document
%-----------------------------------------------------------------
\usepackage{amsmath}            % AMS enhancements for mathematical formulas
\usepackage{amsthm}             %     ... for theorem environments
\usepackage{amssymb,latexsym}   %     ... for additional mathematical symbols
\usepackage{graphicx}           % For graphics inclusion (e.g., PDF files)
\usepackage{verbatim}           % Useful for including code snippets
\usepackage{enumerate}          % Makes enumerated lists simpler to control
\usepackage[left=1in,right=1in,top=0.75in,bottom=0.5in]{geometry} % sets margins
\usepackage[dvipsnames,usenames]{color}    % Colors!  
\usepackage{ifthen} 
\usepackage{tikz} 
\usetikzlibrary{automata,positioning} 
%-----------------------------------------------------------------

% Define the desired format for the title to appear on the first page
%-----------------------------------------------------------------
\newcommand{\mytitle}{
\begin{flushleft}
\bfseries
\assignment       \hspace*{\fill} \course \hspace*{\fill} \myname\\
\probs    \hspace*{\fill}                                 \duedate\\
\rule[10pt]{\linewidth}{1pt}
\end{flushleft}
}
%-----------------------------------------------------------------

% Define the desired page headings for all pages except the first
%-----------------------------------------------------------------
\pagestyle{myheadings}
\markright{\course{} \assignment: \myname}
%-----------------------------------------------------------------
 
% Define an exercise environment, with two parameters:
%   -- how to refer to it: Exercise, Problem, etc. (optional) 
%   -- the exercise number
%-----------------------------------------------------------------
\newenvironment{exercise}[2][Exercise]
 {\begin{trivlist}\item[\hspace{0pt} \textbf{#1}~\textbf{#2.}]}
 {\end{trivlist}}
%-----------------------------------------------------------------

%-----------------------------------------------------------------
% Define a command to check for the existence of the student name
%-----------------------------------------------------------------
\newcommand{\checkname}
{
\ifthenelse{\equal{\myname}{Joe College}}
{
  \vspace*{\fill}
  \begin{center}
    {\LARGE \bf Your name is {\color{BrickRed} \myname}?\\[3pt]
    Please change \texttt{\color{BrickRed} \textbackslash myname} and re-process.}
  \end{center}
  \vspace*{\fill}
  \end{document}
  \newpage
}
{}
}


%
% Document body begins here...
%-----------------------------------------------------------------
\begin{document}
\checkname
\thispagestyle{empty}   % No page headings for page 1...
\mytitle                % Instead, put the customized title on this page

\renewcommand{\qedsymbol}{}  % Suppress "end-of-proof" symbol
                             % throughout proof environments

\begin{exercise}{9}
For each of the following NFAs, use the algorithm discussed in class
to construct an equivalent DFA.  As a first step, compute the value
of $\text{eps}(q)$ for each state $q$.

Provide a ``running commentary'' which shows how your solutions were
obtained.  Use JFLAP to assist and/or check your work --- however,
be sure you can perform this construction entirely on your own.
\begin{enumerate}[a)]
\item \ \\

\begin{center}
\begin{tikzpicture}[>=latex, shorten >=1pt, node distance=1.25in, on grid, auto]
 % Declare the nodes of the automaton 
  \node[state,initial,initial text=]      (q_0)                {$q_0$};
  \node[state]                            (q_1) [right=of q_0] {$q_1$};
  \node[state,accepting]                  (q_2) [right=of q_1] {$q_2$};
  \node[state]                            (q_3) [below=of q_0]{$q_3$};
  \node[state,accepting]                  (q_4) [below=of q_1]{$q_4$};
  \node[state,accepting]                  (q_5) [below=of q_2]{$q_5$};
  
  \path[->] (q_0) edge                      node {$\epsilon$} (q_1)
            (q_0) edge                      node {$1$} (q_3)
            (q_0) edge [loop above]         node {$1$} (q_0)
            (q_1) edge                      node {$0$} (q_2)
            (q_1) edge [swap]               node {$\epsilon$} (q_3)
            (q_3) edge                      node {$0$} (q_4)
            (q_2) edge                      node {$1$} (q_5) 
            (q_4) edge                      node {$1$} (q_1) 
            (q_4) edge                      node {$\epsilon$} (q_2) 
            (q_4) edge [bend right=20,swap] node {$\epsilon$} (q_5) 
            (q_5) edge [bend right=20,swap] node {$0$} (q_4) 
           ;
\end{tikzpicture} 
\end{center}

\item 
\begin{center}
\begin{tikzpicture}[>=latex, shorten >=1pt, node distance=1.25in, on grid, auto]
 % Declare the nodes of the automaton 
  \node[state,initial,initial text=]      (q_0)                {$q_0$};
  \node[state]                            (q_1) [right=of q_0] {$q_1$};
  \node[state]                            (q_2) [right=of q_1] {$q_2$};
  \node[state]                            (q_3) [right=of q_2] {$q_3$};
  \node[state,accepting]                  (q_4) [right=of q_3] {$q_4$};
   
  \path[->] (q_0) edge                node {$a$} (q_1)
            (q_0) edge [loop above]   node {$a,b$} (q_0)
            (q_1) edge                node {$a,b$} (q_2)
            (q_2) edge                node {$a,b$} (q_3) 
            (q_3) edge                node {$a,b$} (q_4) 
            ;
\end{tikzpicture} 
\end{center}
\end{enumerate}
\end{exercise}
\begin{proof}[Solution]
  % Your solution...
\end{proof}



\end{document}
                                    
                                    
                                   
                                  
                                
                                 
                                
                                  
                                 

