
\documentclass{article}

\usepackage{xspace,graphicx,hyperref,paralist}

\newtheorem{illustration}{Illustration}[section]


\newcounter{exer}
\renewcommand{\theexer}{\thechapter:\arabic{exer}}

\newcommand{\FIXIT}[1]{\typeout #1 -- {\LARGE\sf #1}}

%---
\newcommand{\TM}{{Turing machine}\xspace}
\newcommand{\TMs}{{Turing machines}\xspace}
\newcommand{\NPCness}{{NP-completeness}\xspace}
\newcommand{\NPC}{{NP-complete}\xspace}
\newcommand{\NPH}{{NP-hard}\xspace}
\newcommand{\sfP}{{\sf P}\xspace}
\newcommand{\sfNP}{{\sf NP}\xspace}
\newcommand{\sfNPC}{{\sf NPC}\xspace}
\newcommand{\sfNPH}{{\sf NPH}\xspace}
\newcommand{\sfCoNP}{{\sf CoNP}\xspace}
\newcommand{\sfCoNPC}{{\sf CoNPC}\xspace}
\newcommand{\BA}{{B\"{u}chi automata}\xspace}
\newcommand{\BAon}{{B\"{u}chi automaton}\xspace}
\newcommand{\TL}{{Temporal Logic}\xspace}
\newcommand{\LTL}{{linear-time temporal logic}\xspace}
\newcommand{\CTL}{{Computational Tree Logic}\xspace}
\newcommand{\KS}{{Kripke structure}\xspace}
\newcommand{\KSs}{{Kripke structures}\xspace}
\newcommand{\OR}{{$\omega$-regular}\xspace}
%---


\oddsidemargin 0cm
\textwidth 17cm

\begin{document}


\title{\large\bf CS 3100 -- Models of Computation -- Fall 2011 --  Notes for L11}

\maketitle

\section{Why Reversal Preserves Mod-3-equals-0}

I prove by example, and leave a general proof for you.

\subsection{Consider odd-length strings}

{\tt abcde} vs {\tt edcba} in binary. The values are, respectively

\begin{itemize}
\item $2^4 a + 2^3 b + 2^2 c + 2^1 d + 2^0 e$, versus
\item $2^4 e + 2^3 d + 2^2 c + 2^1 b + 2^0 a$
\end{itemize}

\noindent After taking mod-3 (i.e. \verb|%3|), and asking the question of interest (i.e.
is the modulus equal to 0),  we have

\begin{itemize}
\item $(2^4\%3 a + 2^3\%3 b + 2^2\%3 c + 2^1\%3 d + 2^0\%3 e)\%3 = 0$, versus
\item $(2^4\%3 e + 2^3\%3 d + 2^2\%3 c + 2^1\%3 b + 2^0\%3 a)\%3 = 0$
\end{itemize}

\noindent This reduces to

\begin{itemize}
\item $(a + 2 b + c + 2 d + e)\%3 = 0$, versus
\item $(e + 2 d + c + 2 b + a)\%3 = 0$
\end{itemize}

For odd-length strings, the situation is the same! So reversal preserves mod-3-equal-0.

(Generalize this to N bits.)

\subsection{Consider even-length strings}

{\tt abcd} vs {\tt dcba} in binary. The values are, respectively

\begin{itemize}
\item $2^3 a + 2^2 b + 2^1 c + 2^0 d$, versus
\item $2^3 d + 2^2 c + 2^1 b + 2^0 a$
\end{itemize}

\noindent After taking mod-3 (i.e. \verb|%3|), and asking the question of interest (i.e.
is the modulus equal to 0),  we have

\begin{itemize}
\item $(2 a + b + 2 c + d)\%3 = 0$, versus
\item $(2 d + c + 2 b + a)\%3 = 0$
\end{itemize}

\noindent Not quite the same. However, take {\tt abcd} vs {\tt dcba0} (double the second number)
because doubling preserves mod-3-equals-0. (If n is  divisible by 3 without remainder then so is 2n.)

Then we have

\begin{itemize}
\item $(2 a + b + 2 c + d)\%3 = 0$, versus
\item $(d + 2 c + b + 2 a + 0)\%3 = 0$
\end{itemize}

\noindent Now the situation is the same.

\section{Half Language}

\noindent Define the convention of starting an NFA in a set of states.
This is a simple idea: if an NFA is required to start at states $\{a,b,c\}$, 
it can be easily achieved in our style of NFAs (so far required to begin operation
in a single state) as follows: Introduce a new initial state; introduce
$\epsilon$ jumps to each state in $\{a,b,c\}$. Here after, we will assume
this ability, and often employ $q_0$ to be a set of states.

Given a DFA $D$


\begin{itemize}
\item $(Q,\; \Sigma,\; \delta,\; q_0,\; F)$
\end{itemize}

\noindent build an NFA with its own ``$(Q,\; \Sigma,\; \delta,\; q_0,\; F)$'' tuple
as follows (there was a typo in the earlier version; now fixed):

\begin{itemize}

\item $(Q\times Q\times Q,\;  \Sigma,\;  \delta_N,\;  \{(q_0, q, q)\;\mid\; q\in Q\},\; 
   \{(q,q,q1)\;\mid\;q1\in F\})$
\item $\delta_N((p,q,r),q) = \{ (\delta(p,a),q,\delta(r,x) \;\mid\; x\in \Sigma) \}$
\end{itemize}

\noindent Let's use the analogy of frogs with synchronized jumps. Then, the above $\delta_N$
is saying:
%
\begin{itemize}
\item Start a frog at $q_0$
\item Put a sign-post at every possible $q$ (in the NFA initial state)
\item Start another frog at every sign post $q$ also
\end{itemize}

\noindent You can see how the first position and the third position of the tuple are
moving forward. 
%
{\em The first position moves according to the input.
%
The third position moves chaotically in all directions---all it needs to do is describe the same
length, regardless of the string processed.}
%
The final states are those where the first and second positions are the
same and the third position is at a final state. This means that the first position
has traced out a path of the same length as the third position has while going to
a final state.

\section{Middle-third Language}

The ideas are similar and you should try and build this $\delta_N$ yourself, claiming
extra credits from me! Hint: use a four-tuple and two frogs.

\end{document}
