\documentclass[11pt]{article}
\usepackage{latexsym}
\usepackage{amssymb,amsmath, amsthm}
\usepackage{bussproofs}
\newtheorem{conjecture}{Conjecture}
\newtheorem{lemma}{Lemma}
\newtheorem*{claim}{Claim}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\theoremstyle{definition}
\newtheorem{example}{Example}
\newtheorem{definition}{Definition}
\def\sequent{\,\mbox{\Large$\boldsymbol\rightarrow$}\,}
\def\limplies{{\rightarrow}}
\newcommand{\inftype}[2]{{\it #1:#2}}
\def\phi{\varphi}
\def\fCenter{\sequent}
\newcommand{\dm}{\buildrel\textstyle.\over{\hbox{\vrule height3pt depth0pt width0pt}{\smash-}}}


\def\Bit{{\mathrm{Bit}}}
\def\Len{{\mathrm{Len}}}
\def\LenBit{{\mathrm{LenBit}}}
\def\Numones{{\mathrm{Numones}}}
\def\IsEntryAt{{\mathrm{IsEntryAt}}}
\def\Entry{{\mathrm{Entry}}}
\def\Dominant{{\mathrm{Dominant}}}
\def\CountsTo{{\mathrm{CountsTo}}}
\def\IsCorrect{{\mathrm{IsCorrect}}}


\def\studentName{Sam Buss}
\def\lectureDate{May 11, 2012 --- Part II}

\begin{document}

\begin{center}
\bf Math 260A --- Mathematical Logic --- Scribe Notes \\
\bf UCSD --- Spring Quarter 2012 \\
\bf Instructor: Sam Buss \\[1ex]
\bf Notes by: \studentName{} \\
\bf \lectureDate \\[1em]
\bf The Graph of Exponentiation --- Simplifed $\Delta_0$ Definition
\end{center}

These notes present a new, simplified $\Delta_0$ definition
of the graph of the base~2 exponentiation function
$y=2^x$.  This definition is a key part of the bootstrapping
process for the theory $I\Delta_0$, and is a key part of
the approach we use for giving $\Delta_0$ definitions for
sequence coding functions.

The goal is to present $\Delta_0$ definitions of
graph of $x = 2^y$ along with the following
functions:
\begin{eqnarray*}
|x| &=& \lceil \log_2(x+1)\rceil,~~ \hbox{the length of $x$'s binary represenation.}
\\[1ex]
2^x=y &:& \hbox{the graph of the base 2 exponentiation function.}
\\[1ex]
\Bit(i,x) &=& x/2^i \bmod 2, ~~ \hbox{the $i$-th bit of~$x$.}
\\[1ex]
\Numones(x) &=& \hbox{the number of 1's in the binary representation of~$x$.}
\\[1ex]
\beta(i,w) &=& \hbox{the $i$-th member of the sequence coded by~$w$.}
\\[1ex]
\Len(w) &=& \hbox{the number of member in the sequence coded by~$w$.}
\end{eqnarray*}

The material replaces the material on pages 91-94 of
Chapter~II of the
{\em Handbook of Proof Theory}~\cite{Buss:prooftheoryarithmetic}.
We use the notation and material developed in the earlier
part of that chapter (and in the Math 260 class lectures),
and presume this notation is familiar to the reader.

The original $\Delta_0$ definition of the graph
of exponentiation, formalized in the theory~$I\Delta_0$
is due to Gaifman and Dimitracopoulos~\cite{GaifmanDimitracopoulos:MRDP}.
Proofs are
also given in H\'ajek-Pudl\a'k~\cite{HajekPudlak:book}.

\paragraph{Compressed representation for consecutive counting.}
The first step in
our bootstrapping of $\Delta_0$ definitions
is to define a {\em compressed} representation of consecutive
counting is to encode the sequence of integers $1,2,3,4,\ldots,k$
with a single value~$w\in{\mathbb N}$ such $|w| = O(k)$.
We wish to do this in such a way that we can pick out the
location of each value $i$ in the sequence in a natural way.\footnote{Later
on we will define the ``$\Numones(x)$ function that could
accomplish the same kind of thing, but this requires some bootstrapping
first.}

Let $\ell\in{\mathbb N}$.
Define $\ell^*$ to be the maximum power of~2 that divides~$\ell$.
That is
\[
y = \ell^*
  ~\Leftrightarrow~
  \hbox{$i^*$ is the largest power of~2 $<\ell$ s.t. $\ell^*|\ell$}.
\]
For example, the first eleven values have the binary representation
as given in the table:
\begin{center}
\begin{tabular}{rr}
$\ell$~ & $\ell^*~$\kern-2pt
\\ \hline
$1$ & $1$ \\
$10$ & $10$ \\
$11$ & $1$ \\
$100$ & $100$ \\
$101$ & $1$ \\
$110$ & $10$ \\
$111$ & $1$ \\
$1000$ & $1000$ \\
$1001$ & $1$ \\
$1010$ & $10$ \\
$1011$ & $1$ \\
\end{tabular}
\end{center}
The intuition is that $\ell^*$ is giving just the bits of~$\ell$ which
are changed from $\ell-1$.

The sequence $1,2,\ldots, k$ is then represented by the
number~$w$ whose binary representation is formed as the
concatenation of the binary representations of
the values $1^*, 2^*, \ldots, k^*$.  For example, for
$k=11$ (eleven), the compressed encoding~$w$ will have binary representation
\[
1\, 10\, 1\, 100\, 1\, 10\, 1\, 1000\, 1\, 10 \, 1.
\]
(The spaces are included only for readability.)

The intuition is that we can recover $k$ from $w$ by finding
the entries~$\ell^*$ in~$w$ which give bits of~$k$: namely, the
entries $\ell*$ such that no later entries has longer length.
In the example, these entries are the ``1000'', the ``10'',
and the ``1'' which are the values for $\ell^*$ with
$\ell =8, 10, 11$.
These will be called ``dominant'' entries.

\begin{lemma}\label{lm:Length}
Let $w$ be the number defined from~$k$ as above.
Then,
\[
|w| ~=~ k + \lfloor k/2\rfloor + \lfloor k/2^2\rfloor + \lfloor k/2^3\rfloor + \cdots.
\]
This sum has $|k|$ many non-zero terms.
\end{lemma}
\begin{proof}
Note that there are $k$ bits in~$w$ that are in the 1's
place of some $\ell^*$, for $1\le \ell \le k$.  There are $\lfloor k/2 \rfloor$
many such bits in the 2's place.  More generally, there are $\lfloor k/2^i \rfloor$
many such bits from the $2^i$'s place.
\end{proof}

We can do even better than Lemma~\ref{lm:Length}, by giving an exact
formula for the length of~$w$:
\begin{lemma}\label{lm:LengthExact}
Let $w$ be the number defined from~$k$ as above.
Then,
\[
|w| ~=~ 2k - \Numones(k).
\]
\end{lemma}
\begin{proof}
If $k$ is a power of two,
Lemma~\ref{lm:Length} implies $|w| = 2k-1$, so Lemma~\ref{lm:LengthExact}
follows in this case.
Otherwise, express $k$ as a sum of distinct
powers of~2, $k=k_1+k_2+\cdots+k_i$,
where $i=\Numones(k)$.
Clearly,
\[
\lfloor k/2^j \rfloor ~=~
   \lfloor k_1/2^j \rfloor + \lfloor k_2/2^j \rfloor + \cdots
   \lfloor k_i/2^j \rfloor.
\]
Thus, we have $|w| = \sum_j (2k_i - 1)$, and Lemma~\ref{lm:LengthExact}
follows.
\end{proof}

This suggests to add $\Numones(k)$ many bits back into~$w$ to get the length of
$w$ exactly equal to $2k$.  For this, we define $\overline w$ to be like~$w$, but
with an extra bit "1" inserted just before every dominant entry.
For example, for k=11 again, $\overline w$ is equal to
\[
1\, 10\, 1\, 100\, 1\, 10\, 1\, \underline 1\, 1000\, 1\, \underline 1\, 10 \, \underline 1\, 1.
\]
The intuition for our $\Delta_0$ definition of $x=2^k$ that we define
$\overline w$ in this way, and then note that $x=2^k$ iff $x$ is a power of~2 and
$x^2$ has the same length as $2 \overline w$.  (That is, $x^2/2 \le 2w < x^2$.)
Once the graph of exponentiation is defined, it is trivial to define
the length function~$|x|=y$ by $2^y\le 2x < 2\cdot 2^y$.
We can then define $\Numones(k)$ as $|\overline w| - |w|$.

We now give more formal details.
Informally, a binary string `$100\cdots00$' is an ``entry'' in~$w$ if it
is one of the maximal length such strings in the binary
representation of~$w$.  More formally, we
define $\IsEntryAt(2^i, 2^{i^\prime},w)$ and
$\Entry(2^i, 2^{i^\prime},w)=x$ as follows.
Recall that $\LenBit(2^i,x)$ is the bit at
position~$i$ in~$x$;
it was $\Delta_0$-defined as $x/2^i \bmod 2$.
\begin{eqnarray*}
\IsEntryAt(2^i, 2^{i^\prime},w) &\Leftrightarrow&
      2^i<2^{i^\prime} \land
      \LenBit(2^i/2,w)=1 \land \LenBit(2^{i^\prime}/2,w)=1 \land
\\
&& \quad\quad
      (\forall 2^j\le w) ( 2^i<2^k<2^{i^\prime}/2 \limplies
         \LenBit(2^k/2,w)=0).
\\[1em]
\Entry(2^i, 2^{i^\prime},w)=v & \Leftrightarrow &
      v = (w/2^i) \bmod (2^{i^\prime}/2^i).
\end{eqnarray*}
Here, we write $(\forall 2^j\le x)\phi(2^j)$ as a shorthand
notation for
\[
(\forall z\le x)(\hbox{``$z$ is a power of~2''}\limplies \phi(z)).
\]
Similar conventions hold for $(\exists 2^j\le x)\phi(2^j)$.

Note that if $\IsEntryAt(2^i, 2^{i^\prime},w)$ holds,
then $\Entry(2^i, 2^{i^\prime},w)$ is a power of~2.
The $\Entry()$ function picks out a power of two
encoded a substring of the binary represenation of~$w$,
that is an $\ell^*$ value for $1\le \ell\le k$.

A ``dominant'' entry in~$w$ is a entry which is longer than
all later entries. In the example with $k=11$ (eleven), there
are three dominant entries: namely the
binary representations ``$1000$'', ``$10$'' and ``$1$''.
Formally,
\begin{eqnarray*}
\Dominant(2^i,2^{i^\prime},w)
  &\Leftrightarrow&
     \IsEntryAt(2^i,2^{i^\prime},w) \land \\
&& \quad (\forall 2^j<2^{j^\prime}\le 2^i)(\IsEntryAt(2^j,2^{j^\prime},w)\rightarrow
      2^{j^\prime}/2^j<2^{i^\prime}/2^i).
\end{eqnarray*}
The number~$k$
for which $w$ encodes the compressed sequential counting
can be extracted by the following $\Delta_0$-defined function.
\begin{eqnarray*}
\CountsTo(w)=k
&\Leftrightarrow&
(\forall 2^i\le k)[ \LenBit(2^i,k)=1 \leftrightarrow
\\
& & \quad\quad\quad\quad
     (\exists 2^{j^\prime}\le w)
        (\Dominant(2^j,2^{j^\prime},w)\land 2^i\cdot2^j = 2^{j^\prime}].
\end{eqnarray*}
The intuition is that we are determining $k$ from~$w$ by looking at the
last place where a bit of~$k$ was specified.

It is also important to be able to verify when $w$ correctly encodes
a compressed sequential counting.  This is done by
\begin{eqnarray*}
\IsCorrect(w) &\Leftrightarrow& (\forall 2^i<2^{i^\prime}<2^{i^{\prime\prime}}\le w)
[ \IsEntryAt(2^i,2^{i^\prime},w) \land \IsEntryAt(2^{i^\prime},2^{i^{\prime\prime}},w)
\\
&& \quad \rightarrow \CountsTo(w/2^i) = \CountsTo(w/2^{i^\prime})+1].
\end{eqnarray*}
A similar definition is used to define the correctness of
$\overline w$, but it needs extra cases to handle the extra
inserted bits after dominant entries.  First, define
\begin{eqnarray*}
\overline\IsEntryAt(2^i,2^{i^\prime},\overline w) & \Leftrightarrow &
 \IsEntryAt(2^i,2^{i^\prime},\overline w) \land \\
&& \quad \lnot (\exists 2^j<2^i)[\Dominant(2^j,2^i,w)].
\end{eqnarray*}
\begin{eqnarray*}
\overline\IsCorrect(w) &\Leftrightarrow&
(\forall 2^i<2^{i^\prime}<2^{i^{\prime\prime}}<2^{i^{\prime\prime\prime}}\le w)
\\
&& [ (\overline\IsEntryAt(2^i,2^{i^\prime},w)
     \land \overline \IsEntryAt(2^{i^{\prime\prime}},2^{i^{\prime\prime\prime}},w) \\
&& \quad\quad\quad \land 2^{i^{\prime\prime}}=2^{i^\prime}
\lor ((\Dominant(2^i,2^{i^\prime},w)\land
      2^{i^{\prime\prime}}=2\cdot2^{i^\prime}))
\\
&& \quad \rightarrow \CountsTo(w/2^i) = \CountsTo(w/2^{i^{\prime\prime}})+1]
\\
&& \land (\forall 2^i<2^{i^\prime}\le w)[Dominant(2^i,2^{i^\prime},w) \rightarrow LenBit(2^{i^\prime},\overline w)=1].
\end{eqnarray*}
The last clause of $\overline\IsCorrect$ is to ensure that exactly one
bit is inserted before every dominant entry.

This completes the $\Delta_0$ definition of $w$ and $\overline w$ as
functions of~$k$.  Namely, there are they unique values
such that $\IsCorrect(w)$ and $\overline\IsCorrect(\overline w)$,
with $\CountsTo(w)=k$ and $\CountsTo(\overline w)=k$.

By the discussion after Lemma~\ref{lm:LengthExact}, it is now easy
to $\Delta_0$-define the graph of base 2 exponentiation, the $\Bit$
function, the $\Numones$ function, and the function~$|x|$.

Finally, we claim that all the standard ``straightforward'' properties of
these $\Delta_0$ relation and functions can be proved in~$I\Delta_0$.

\paragraph*{Sequence coding}

Sequence coding can be done using base~4 representations.
We call a base four digit a {\em qit}\footnote{The only standard terms for digits in
various bases seem
to be: {\em bit}, {\em trit}, and {\em digit} for bases 2, 3, and 10; and as well as either
{\em ban} or {\em hartley} for base~10, or {\em nat} for base~$e$.
The term ``ban'' was coined be A.~Turing.
The term {\em hartley} is for Ralph Hartley (1928).
However, these last three terms are used for measuring information
content rather than as names for digits.
For names of digits in bases 2-10, I suggest:
bit, trit, qit, qint, sit, sipt, ict, nint, and digit.};
namely, a qit can be a ``0'', ``1'', ``2'', or ``3''.

A sequence $\langle a_0,\ldots, a_{k-1}\rangle$ can
be defined by the base 4 representation
\[
3 ~ 1^* ~ 2 ~ a_0~ 3 ~ 2^* ~ 2 ~ a_1~ 3 ~ 3^* ~ 2 ~ a_2~ 3
\cdots ~ k^* ~ 2 ~ a_{k-1}~ 3
\]
The 2's and 3's mean the indicated qit 2 or~3.
The values $1^*$, $a_0$, $2^*$, $a_1$, etc, are
to be replaced by the 0/1 qits that correspond to the bits
of their binary representations.

An alternate version of sequence definitions (see the handbook
article) uses
\[
2 ~ a_0~ 2 ~ a_1~ 2 ~ a_2~ 2
\cdots 2 ~ a_{k-1}~ 2,
\]
and uses a reduction to the $\Numones$ function to count the number of qits ``2''
to determine the index of any entry~$a_i$ in the sequence.
The qits ``2'' serve a commas.



\bibliographystyle{siam}
\bibliography{logic}
\end{document}
