\section{peano.h File Reference}
\label{peano_8h}\index{peano.h@{peano.h}}
An interface (header file) for Peano Arithmetic. 




This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=80pt]{peano_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Compounds}
\begin{CompactItemize}
\item 
struct {\bf Natnum}
\begin{CompactList}\small\item\em A structure for representing Natural Numbers from the Peano Arithmetic.\item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef {\bf Natnum} $\ast$ {\bf Natnum\_\-t}
\begin{CompactList}\small\item\em Natnum\_\-t : the object that will be operated on.\item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
{\bf Natnum\_\-t} {\bf Z} ()
\item 
{\bf Natnum\_\-t} {\bf S} (const {\bf Natnum\_\-t} n)
\item 
{\bf Natnum\_\-t} {\bf itsum} (const {\bf Natnum\_\-t}, const {\bf Natnum\_\-t})
\item 
{\bf Natnum\_\-t} {\bf recsum} (const {\bf Natnum\_\-t}, const {\bf Natnum\_\-t})
\item 
{\bf Natnum\_\-t} {\bf loopsum} (const {\bf Natnum\_\-t}, const {\bf Natnum\_\-t})
\item 
const {\bf Natnum\_\-t} {\bf pred} (const {\bf Natnum\_\-t})
\item 
int {\bf Zeq} ({\bf Natnum\_\-t})
\item 
int {\bf eq} ({\bf Natnum\_\-t}, {\bf Natnum\_\-t})
\item 
unsigned {\bf nn2uns} ({\bf Natnum\_\-t})
\item 
{\bf Natnum\_\-t} {\bf uns2nn} (unsigned)
\end{CompactItemize}


\subsection{Detailed Description}
An interface (header file) for Peano Arithmetic.

 

It defines the representation for Peano numbers and the interface to operations on them.



\subsection{Typedef Documentation}
\index{peano.h@{peano.h}!Natnum_t@{Natnum\_\-t}}
\index{Natnum_t@{Natnum\_\-t}!peano.h@{peano.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Natnum\_\-t}\label{peano_8h_a0}


Natnum\_\-t : the object that will be operated on.

A Peano number will always be a pointer to a {\bf Natnum} {\rm (p.\,\pageref{structNatnum})}, i.e., a Natnum\_\-t 

\subsection{Function Documentation}
\index{peano.h@{peano.h}!eq@{eq}}
\index{eq@{eq}!peano.h@{peano.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int eq ({\bf Natnum\_\-t} {\em n0}, {\bf Natnum\_\-t} {\em n1})}\label{peano_8h_a8}


equlity test

Notice that equality is defined with respect to the intended representation \index{peano.h@{peano.h}!itsum@{itsum}}
\index{itsum@{itsum}!peano.h@{peano.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Natnum\_\-t} itsum (const {\bf Natnum\_\-t} {\em s0}, const {\bf Natnum\_\-t} {\em s1})}\label{peano_8h_a3}


tail recursive function for computing sum over {\bf Natnum} {\rm (p.\,\pageref{structNatnum})} \index{peano.h@{peano.h}!loopsum@{loopsum}}
\index{loopsum@{loopsum}!peano.h@{peano.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Natnum\_\-t} loopsum ({\bf Natnum\_\-t} {\em s0}, {\bf Natnum\_\-t} {\em s1})}\label{peano_8h_a5}


The sum of two {\bf Natnum} {\rm (p.\,\pageref{structNatnum})} object, using iteration

It implements invariant assertion. \index{peano.h@{peano.h}!nn2uns@{nn2uns}}
\index{nn2uns@{nn2uns}!peano.h@{peano.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned nn2uns ({\bf Natnum\_\-t})}\label{peano_8h_a9}


Converting a Natnum\_\-t to binary representation \index{peano.h@{peano.h}!pred@{pred}}
\index{pred@{pred}!peano.h@{peano.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf Natnum\_\-t} pred (const {\em Natnum\_\-t})}\label{peano_8h_a6}


the predecessor of a given number \index{peano.h@{peano.h}!recsum@{recsum}}
\index{recsum@{recsum}!peano.h@{peano.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Natnum\_\-t} recsum (const {\bf Natnum\_\-t} {\em s0}, const {\bf Natnum\_\-t} {\em s1})}\label{peano_8h_a4}


recursive function for computing sum over {\bf Natnum} {\rm (p.\,\pageref{structNatnum})}

it computes sum of two {\bf Natnum} {\rm (p.\,\pageref{structNatnum})} objects, using recursion with suspended computation (computation with draft on stack) \index{peano.h@{peano.h}!S@{S}}
\index{S@{S}!peano.h@{peano.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Natnum\_\-t} S (const {\bf Natnum\_\-t} {\em n})}\label{peano_8h_a2}


A constructor for an object representing the successor of a given number \begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
n}]a number \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
the successor of n \end{Desc}
\index{peano.h@{peano.h}!uns2nn@{uns2nn}}
\index{uns2nn@{uns2nn}!peano.h@{peano.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Natnum\_\-t} uns2nn (unsigned)}\label{peano_8h_a10}


From binary to Natnum\_\-t \index{peano.h@{peano.h}!Z@{Z}}
\index{Z@{Z}!peano.h@{peano.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Z ()}\label{peano_8h_a1}


A constructor for an object representing the number zero \index{peano.h@{peano.h}!Zeq@{Zeq}}
\index{Zeq@{Zeq}!peano.h@{peano.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Zeq ({\bf Natnum\_\-t})}\label{peano_8h_a7}


whether a number is zero 