\documentstyle[makeidx]{article}
\makeindex
%\setlength{\oddsidemargin}{.5in}
%\setlength{\evensidemargin}{.5in}
%\setlength{\textwidth}{5.8in}
\begin{document}
%\setlength{\parindent}{0pt}
%\newcounter{bean}
%\begin{list}{\arabic{bean}.}{\usecounter{bean}\setlength{\leftmargin}{0pt}\setlength{\rightmargin}{0pt}\setlength{\listparindent}{20pt}\setlength{\parsep}{5pt}}
%\item[]

\begin{verbatim}#|
 Copyright (C) 1993 by Matt Wilding.

 This script is hereby placed in the public domain, and therefore unlimited
 editing and redistribution is permitted.

 NO WARRANTY

 Matt Wilding PROVIDES ABSOLUTELY NO WARRANTY.  THE EVENT SCRIPT IS
 PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
 INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND
 FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND
 PERFORMANCE OF THE SCRIPT IS WITH YOU.  SHOULD THE SCRIPT PROVE DEFECTIVE, YOU
 ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

 IN NO EVENT WILL Matt Wilding BE LIABLE TO YOU FOR ANY DAMAGES,
 ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL
 DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THIS SCRIPT (INCLUDING BUT
 NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES
 SUSTAINED BY THIRD PARTIES), EVEN IF YOU HAVE ADVISED US OF THE POSSIBILITY OF
 SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
|#
\end{verbatim}
\noindent{\sc Event}:   Start with the library {\tt{"piton"}} using the compiled version.

\addvspace{18pt}
\begin{verbatim};; NIM Piton proof
;; Matt Wilding 4-15-92

;; modified 7-92 to work on Piton library

;; This script takes 10 hours to run on a 64 meg Sparc2

;; This work is described in Technical Report #78.  A presentation
;; about this work was made at the CLI research review in April 92.

#|
Nim is a game played with piles of matches.  Two opponents alternate
taking at least one match from exactly one pile until there are no
matches left.  The player who takes the last match loses.

Piton is an assembly-level language with a formal semantics and a
verified compiler.  Piton is described in CLI tech report #22.  One of
the machines to which Piton is targeted is FM9001, a microprocessor
that has a formal semantics and that has been fabricated.

This proof script leads NQTHM to a proof that a Piton program that
"plays" Nim does so optimally.  Informally, this means

  a) A Piton program (see function CM-PROG) when run on the Piton
  interpreter and given as input a reasonable Nim state yields a new
  Nim state equal to what is calculated by function COMPUTER-MOVE.  
  (See event COMPUTER-MOVE-IMPLEMENTED.)

  b) COMPUTER-MOVE generates valid moves.  That is, it removes at
  least one match from exactly one pile.  (VALID-MOVEP-COMPUTER-MOVE)

  c) Depth-first search of the state space of all possible moves is
  used to define what is meant by optimal Nim play.  Exhaustive search
  is used to find if there is a strategy for a Nim player to ensures
  eventual victory from the current Nim state.  An optimal strategy
  transforms any state for which there exists such a winning strategy
  into a state from which exhaustive search can find no winning
  strategy.  
     Exhaustive search of all possible moves from a NIM state is 
  formalized in the function WSP.  The optimalilty of the strategy
  COMPUTER-MOVE is proved in the event COMPUTER-MOVE-WORKS.

  d) The FM9001 Piton compiler correctness theorem assumes that the 
  Piton state that is to be run contains valid Piton code, fit into 
  an FM9001's memory, and use constants of word size 32.  A Piton 
  state (used in the Indiana test described below) was constructed
  that contains the Nim program, and is proved to meet the compiler
  correctness constraints (CM-PROG-FM9001-LOADABLE)

The algorithm used by the program is non-obvious and very efficient,
avoiding the need to search.  (I invented the programming trick only
to subsequently discover that it has been known since the beginning
of the century.)  See tech report #78 for a description.

(Constant bounds on the number of Piton instructions executed while
running this program have been proved using PC-NQTHM.  These events
are not included in this NQTHM-processable script, but the theorem is
included in comments later in this file for completeness.)

This script was developed using only those events from the Piton
library necessary to define the interpreter and the naturals library.
In July 92 it was modified somewhat to "fit" onto the Piton library
that sits on top of the FM9001 library.  The immediate motivation was
to make it easier to include in the upcoming NQTHM-1992 proveall
release being put together by Boyer.  The Piton library contains the
events of the FM9001 library.  The FM9001 library contains an older
version of the naturals library (though not explicitly with a
note-lib).  Thus, this script requires only the Piton library.

In May 92, in consultation with researchers at Indiana University, I
compiled the Nim Piton program for the FM9001 and sent the image to
Indiana.  They ran the image and generated an optimal NIM move on a
fabricated FM9001 they had wired up.  The intial image and part of the
resulting image is included in a comment at the end of this script.  A
non-trivial program compiled using a reasonably-complex compiler for a
small microprocessor worked without any conventional testing done on
any of the components, and everyone was pleased but not surprised.

|#



\end{verbatim}
\noindent{\sc Event}:   Set the status of the events in the theory addition.  The status of each event is to be set as follows.  Anything not otherwise mentioned is to be enabled.   Name this event `addition-on'.\index{addition-on}

\addvspace{18pt}

\noindent{\sc Event}:   Set the status of the events in the theory multiplication.  The status of each event is to be set as follows.  Anything not otherwise mentioned is to be enabled.   Name this event `multiplication-on'.\index{multiplication-on}

\addvspace{18pt}

\noindent{\sc Event}:   Set the status of the events in the theory remainders.  The status of each event is to be set as follows.  Anything not otherwise mentioned is to be enabled.   Name this event `remainders-on'.\index{remainders-on}

\addvspace{18pt}

\noindent{\sc Event}:   Set the status of the events in the theory quotients.  The status of each event is to be set as follows.  Anything not otherwise mentioned is to be enabled.   Name this event `quotients-on'.\index{quotients-on}

\addvspace{18pt}

\noindent{\sc Event}:   Set the status of the events in the theory exponentiation.  The status of each event is to be set as follows.  Anything not otherwise mentioned is to be enabled.   Name this event `exponentiation-on'.\index{exponentiation-on}

\addvspace{18pt}

\noindent{\sc Event}:   Set the status of the events in the theory logs.  The status of each event is to be set as follows.  Anything not otherwise mentioned is to be enabled.   Name this event `logs-on'.\index{logs-on}

\addvspace{18pt}

\noindent{\sc Event}:   Set the status of the events in the theory gcds.  The status of each event is to be set as follows.  Anything not otherwise mentioned is to be enabled.   Name this event `gcds-on'.\index{gcds-on}

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{clock-plus}$\;\;$
{\rm{clock-plus}}\,({\it{x\/}}, {\it{y\/}})\index{clock-plus} $=$ ({\it{x\/}} $+$ {\it{y\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  p-add1 \\ \index{p-add1}
{\rm{p}}\,({\it{p0\/}}, $1\;+$ {\it{n\/}})\index{p} $=$ {\rm{p}}\,({\rm{p-step}}\,({\it{p0\/}})\index{p-step}, {\it{n\/}})\index{p}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  p-0 \\ \index{p-0}
({\it{n\/}} $\simeq {\tt{0}}$) $\rightarrow$ ({\rm{p}}\,({\it{p0\/}}, {\it{n\/}})\index{p} $=$ {\it{p0\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  clock-plus-function \\ \index{clock-plus-function}
{\rm{p}}\,({\it{p0\/}}, {\rm{clock-plus}}\,({\it{x\/}}, {\it{y\/}})\index{clock-plus})\index{p} $=$ {\rm{p}}\,({\rm{p}}\,({\it{p0\/}}, {\it{x\/}})\index{p}, {\it{y\/}})\index{p}
\end{tabbing}


\noindent{\sc Event}:   Disable p-add1.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  clock-plus-add1 \\ \index{clock-plus-add1}
{\rm{p}}\,({\it{p0\/}}, {\rm{clock-plus}}\,($1\;+$ {\it{x\/}}, {\it{y\/}})\index{clock-plus})\index{p} $=$ {\rm{p}}\,({\it{p0\/}}, $1\;+$ {\rm{clock-plus}}\,({\it{x\/}}, {\it{y\/}})\index{clock-plus})\index{p}
\end{tabbing}


\noindent{\sc Event}:   Disable clock-plus.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  clock-plus-0 \\ \index{clock-plus-0}
({\it{x\/}} $\simeq {\tt{0}}$) $\rightarrow$ ({\rm{clock-plus}}\,({\it{x\/}}, {\it{y\/}})\index{clock-plus} $=$ {\rm{fix}}\,({\it{y\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-clock-plus \\ \index{fix-clock-plus}
{\rm{fix}}\,({\rm{clock-plus}}\,({\it{x\/}}, {\it{y\/}})\index{clock-plus}) $=$ {\rm{clock-plus}}\,({\it{x\/}}, {\it{y\/}})\index{clock-plus}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  p-step1-opener \\ \index{p-step1-opener}
\=\+{\rm{p-step1}}\,({\rm{cons}}\,({\it{opcode\/}}, {\it{operands\/}}), {\it{p\/}})\index{p-step1} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{p-ins-okp}}\,({\rm{cons}}\,({\it{opcode\/}}, {\it{operands\/}}), {\it{p\/}})\index{p-ins-okp} \\ 
{\bf then }{\rm{p-ins-step}}\,({\rm{cons}}\,({\it{opcode\/}}, {\it{operands\/}}), {\it{p\/}})\index{p-ins-step} \\ 
{\bf else }{\rm{p-halt}}\,({\it{p\/}}, {\rm{x-y-error-msg}}\,({\tt{'}}{\tt{p}}, {\it{opcode\/}})\index{x-y-error-msg})\index{p-halt}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable p-step1.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  p-opener \\ \index{p-opener}
\=\+({\rm{p}}\,({\it{s\/}}, {\tt{0}})\index{p} $=$ {\it{s\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,({\it{pc\/}}, {\it{ctrl\/}}, {\it{temp\/}}, {\it{prog\/}}, {\it{data\/}}, {\it{max-ctrl\/}}, {\it{max-temp\/}}, {\it{word-size\/}}, {\it{psw\/}})\index{p-state}, \\ 
$1\;+$ {\it{n\/}})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p}}\,(\=\+{\rm{p-step}}\,({\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl\/}}, \\ 
{\it{temp\/}}, \\ 
{\it{prog\/}}, \\ 
{\it{data\/}}, \\ 
{\it{max-ctrl\/}}, \\ 
{\it{max-temp\/}}, \\ 
{\it{word-size\/}}, \\ 
{\it{psw\/}})\-\index{p-state})\index{p-step}, \\ 
{\it{n\/}})\-\index{p})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable p.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{at-least-morep} \\  
{\rm{at-least-morep}}\,({\it{base\/}}, {\it{delta\/}}, {\it{value\/}})\index{at-least-morep} $=$ ({\it{value\/}} $\not<$ ({\it{base\/}} $+$ {\it{delta\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  at-least-morep-normalize \\ \index{at-least-morep-normalize}
\=\+(\=\+{\rm{at-least-morep}}\,($1\;+$ {\it{base\/}}, {\it{delta\/}}, {\it{value\/}})\index{at-least-morep} \\ 
$=$$\;\;\;\;${\rm{at-least-morep}}\,({\it{base\/}}, $1\;+$ {\it{delta\/}}, {\it{value\/}})\index{at-least-morep})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{at-least-morep}}\,({\it{base\/}}, $1\;+$ {\it{delta\/}}, $1\;+$ {\it{value\/}})\index{at-least-morep} \\ 
$=$$\;\;\;\;${\rm{at-least-morep}}\,({\it{base\/}}, {\it{delta\/}}, {\it{value\/}})\index{at-least-morep})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  at-least-morep-linear \\ \index{at-least-morep-linear}
\=\+({\rm{at-least-morep}}\,({\it{base\/}}, {\it{d1\/}}, {\it{value\/}})\index{at-least-morep} $\wedge$ ({\it{d1\/}} $\not<$ {\it{d2\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{at-least-morep}}\,({\it{base\/}}, {\it{d2\/}}, {\it{value\/}})\index{at-least-morep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-as-at-least-morep \\ \index{lessp-as-at-least-morep}
\=\+{\rm{at-least-morep}}\,({\it{base\/}}, {\it{delta\/}}, {\it{value\/}})\index{at-least-morep} \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\it{value\/}} $<$ {\it{x\/}}) $=$ ($\neg$ {\rm{at-least-morep}}\,({\it{x\/}}, {\tt{0}}, {\it{value\/}})\index{at-least-morep})) \\ 
$\wedge$$\;\;\;\;$(({\it{x\/}} $<$ {\it{value\/}}) $=$ {\rm{at-least-morep}}\,({\it{x\/}}, {\tt{1}}, {\it{value\/}})\index{at-least-morep}))\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable at-least-morep.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv} \\  
\=\+{\rm{nat-to-bv}}\,({\it{nat\/}}, {\it{size\/}})\index{nat-to-bv} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{size\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }{\it{nat\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}} $-\;1$)\index{exp}$\;\;${\bf then }{\rm{cons}}\,({\tt{0}}, {\rm{nat-to-bv}}\,({\it{nat\/}}, {\it{size\/}} $-\;1$)\index{nat-to-bv}) \\ 
{\bf else }{\rm{cons}}\,({\tt{1}}, {\rm{nat-to-bv}}\,({\it{nat\/}} $-$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}} $-\;1$)\index{exp}, {\it{size\/}} $-\;1$)\index{nat-to-bv})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv-state} \\  
\=\+{\rm{nat-to-bv-state}}\,({\it{state\/}}, {\it{size\/}})\index{nat-to-bv-state} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{state\/}}) \\ 
{\bf then }{\rm{cons}}\,({\rm{nat-to-bv}}\,({\rm{car}}\,({\it{state\/}}), {\it{size\/}})\index{nat-to-bv}, {\rm{nat-to-bv-state}}\,({\rm{cdr}}\,({\it{state\/}}), {\it{size\/}})\index{nat-to-bv-state}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; a more elegant way to write this program would be to use the
;; bit-vector of all 0's initially, then xor all the elements of
;; the array.  But we don't want a pointer to memory to
;; ever have an improper value, so we write things this way

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{xor-bvs-program} \\  
\=\+{\sc{xor-bvs-program}}\index{xor-bvs-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{xor-bvs}} \\ 
{\tt{(}}{\tt{vecs-addr}}{\tt{ }}{\tt{numvecs}}{\tt{)}} \\ 
{\tt{nil}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{vecs-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{fetch}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numvecs}}{\tt{)}} \\ 
{\tt{(}}{\tt{sub1-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{numvecs}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{loop}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numvecs}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-nat-and-jump}}{\tt{ }}{\tt{zero}}{\tt{ }}{\tt{done}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numvecs}}{\tt{)}} \\ 
{\tt{(}}{\tt{sub1-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{numvecs}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{vecs-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{add-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{vecs-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{fetch}}{\tt{)}} \\ 
{\tt{(}}{\tt{xor-bitv}}{\tt{)}} \\ 
{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{loop}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{done}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bit-vectors-piton} \\  
\=\+{\rm{bit-vectors-piton}}\,({\it{array\/}}, {\it{size\/}})\index{bit-vectors-piton} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{array\/}}) \\ 
{\bf then }\=\+{\rm{listp}}\,({\rm{car}}\,({\it{array\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{caar}}\,({\it{array\/}}) $=$ {\tt{'}}{\tt{bitv}}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\rm{cadar}}\,({\it{array\/}}), {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\rm{cddar}}\,({\it{array\/}}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectors-piton}}\,({\rm{cdr}}\,({\it{array\/}}), {\it{size\/}})\index{bit-vectors-piton}\- \\ 
{\bf else }{\it{array\/}} $=$ {\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{array}$\;\;$
{\rm{array}}\,({\it{name\/}}, {\it{segment\/}})\index{array} $=$ {\rm{cdr}}\,({\rm{assoc}}\,({\it{name\/}}, {\it{segment\/}}))
\end{tabbing}

\begin{verbatim};; vecs is name of state
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{xor-bvs-input-conditionp} \\  
\=\+{\rm{xor-bvs-input-conditionp}}\,({\it{p0\/}})\index{xor-bvs-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\rm{caadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), {\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\index{definedp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectors-piton}}\,(\=\+{\rm{array}}\,(\=\+{\rm{caadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\-\index{bit-vectors-piton} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) \\ 
$=$$\;\;\;\;${\rm{length}}\,({\rm{array}}\,(\=\+{\rm{caadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{length})\- \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{4}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{2}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag} $<$ {\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}))\-\-
\end{tabbing}

\begin{verbatim}; time to run loop
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{xor-bvs-clock-loop} \\  
\=\+{\rm{xor-bvs-clock-loop}}\,({\it{numvecs\/}})\index{xor-bvs-clock-loop} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{numvecs\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\tt{3}} \\ 
{\bf else }{\tt{12}} $+$ {\rm{xor-bvs-clock-loop}}\,({\it{numvecs\/}} $-\;1$)\index{xor-bvs-clock-loop}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; time to run xor-bvs, including call and ret

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{xor-bvs-clock} \\  
{\rm{xor-bvs-clock}}\,({\it{numvecs\/}})\index{xor-bvs-clock} $=$ ({\tt{6}} $+$ {\rm{xor-bvs-clock-loop}}\,({\it{numvecs\/}} $-\;1$)\index{xor-bvs-clock-loop})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{xor-bvs-array} \\  
\=\+{\rm{xor-bvs-array}}\,({\it{current\/}}, {\it{array\/}}, {\it{n\/}}, {\it{array-size\/}})\index{xor-bvs-array} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\it{current\/}} \\ 
{\bf else }{\rm{xor-bvs-array}}\,(\=\+{\rm{xor-bitv}}\,(\=\+{\it{current\/}}, \\ 
{\rm{untag}}\,({\rm{get}}\,({\it{array-size\/}} $-$ {\it{n\/}}, {\it{array\/}})\index{get})\index{untag})\-\index{xor-bitv}, \\ 
{\it{array\/}}, \\ 
{\it{n\/}} $-\;1$, \\ 
{\it{array-size\/}})\-\index{xor-bvs-array}$\;${\bf  endif}\-\-
\end{tabbing}
     
\begin{tabbing}{\sc Theorem}:  lessp-1-exp \\ \index{lessp-1-exp}
({\tt{1}} $<$ {\rm{exp}}\,({\it{a\/}}, {\it{b\/}})\index{exp}) $=$ (({\tt{1}} $<$ {\it{a\/}}) $\wedge$ ({\it{b\/}} $\not\simeq {\tt{0}}$))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectors-piton-means \\ \index{bit-vectors-piton-means}
\=\+({\rm{bit-vectors-piton}}\,({\it{state\/}}, {\it{size\/}})\index{bit-vectors-piton} $\wedge$ ({\it{p\/}} $<$ {\rm{length}}\,({\it{state\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{car}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) $=$ {\tt{'}}{\tt{bitv}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\rm{cadr}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}), {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) $=$ {\bf{nil}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{xor-bvs-loop-correctness-genera!l-induct} \\  
\=\+{\rm{xor-bvs-loop-correctness-general-induct}}\,({\it{i\/}}, {\it{current\/}}, {\it{n\/}}, {\it{s\/}}, {\it{data-segment\/}})\index{xor-bvs-loop-correctness-genera!l-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{xor-bvs-loop-correctness-general-induct}}\,(\=\+{\it{i\/}} $-\;1$, \\ 
{\rm{xor-bitv}}\,(\=\+{\it{current\/}}, \\ 
{\rm{cadr}}\,({\rm{get}}\,(\=\+{\it{n\/}} $-$ {\it{i\/}}, \\ 
{\rm{array}}\,(\=\+{\it{s\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\-\index{get}))\-\index{xor-bitv}, \\ 
{\it{n\/}}, \\ 
{\it{s\/}}, \\ 
{\it{data-segment\/}})\-\index{xor-bvs-loop-correctness-genera!l-induct}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{verbatim};; in Piton library
;(prove-lemma bit-vectorp-xor-bitv (rewrite)
;	     (implies
;	      (and
;	       (bit-vectorp x size)
;	       (bit-vectorp y size))
;	      (bit-vectorp (xor-bitv x y) size)))

\end{verbatim}
\noindent{\sc Event}:   Enable bit-vectorp-xor-bitv.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  xor-bvs-loop-correctness-general \\ \index{xor-bvs-loop-correctness-genera!l}
\=\+(\=\+({\rm{length}}\,({\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array})\index{length} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{word-size\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectors-piton}}\,({\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array}, {\it{word-size\/}})\index{bit-vectors-piton} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{3}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{xor-bvs}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{xor-bvs-program}}\index{xor-bvs-program}) \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\it{s\/}}, {\it{data-segment\/}})\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $<$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{current\/}}, {\it{word-size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $=$ {\rm{length}}\,({\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array})\index{length}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{xor-bvs}}{\tt{ .\ }}{\tt{5}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{list}}\,(\=\+{\rm{cons}}\,(\=\+{\tt{'}}{\tt{vecs-addr}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{addr}}, {\rm{cons}}\,({\it{s\/}}, ({\it{n\/}} $-$ {\it{i\/}}) $-\;1$)))\-, \\ 
{\rm{cons}}\,({\tt{'}}{\tt{numvecs}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{i\/}})))\-, \\ 
{\it{ret-pc\/}})\-, \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{current\/}}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{xor-bvs-clock-loop}}\,({\it{i\/}})\index{xor-bvs-clock-loop})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{xor-bvs-array}}\,(\=\+{\it{current\/}}, \\ 
{\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array}, \\ 
{\it{i\/}}, \\ 
{\it{n\/}})\-\index{xor-bvs-array})\-, \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  difference-x-sub1-x-better \\ \index{difference-x-sub1-x-better}
\=\+({\it{x\/}} $-$ ({\it{x\/}} $-\;1$)) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\tt{0}} $<$ {\it{x\/}}$\;\;${\bf then }{\tt{1}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bvs-loop-correctness \\ \index{xor-bvs-loop-correctness}
\=\+(\=\+({\rm{length}}\,({\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array})\index{length} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{word-size\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectors-piton}}\,({\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array}, {\it{word-size\/}})\index{bit-vectors-piton} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{3}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{xor-bvs}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{xor-bvs-program}}\index{xor-bvs-program}) \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\it{s\/}}, {\it{data-segment\/}})\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{current\/}}, {\it{word-size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $=$ {\rm{length}}\,({\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array})\index{length}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{xor-bvs}}{\tt{ .\ }}{\tt{5}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{list}}\,(\=\+{\rm{cons}}\,({\tt{'}}{\tt{vecs-addr}}, {\rm{list}}\,({\tt{'}}{\tt{addr}}, {\rm{cons}}\,({\it{s\/}}, {\tt{0}}))), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{numvecs}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{n\/}} $-\;1$)))\-, \\ 
{\it{ret-pc\/}})\-, \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{current\/}}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{xor-bvs-clock-loop}}\,({\it{n\/}} $-\;1$)\index{xor-bvs-clock-loop})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{xor-bvs-array}}\,(\=\+{\it{current\/}}, \\ 
{\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array}, \\ 
{\it{n\/}} $-\;1$, \\ 
{\it{n\/}})\-\index{xor-bvs-array})\-, \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  exp-0 \\ \index{exp-0}
\=\+({\it{x\/}} $\simeq {\tt{0}}$) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+{\rm{exp}}\,({\it{x\/}}, {\it{y\/}})\index{exp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{y\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\tt{1}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\- \\ 
$\wedge$$\;\;\;\;$({\rm{exp}}\,({\it{y\/}}, {\it{x\/}})\index{exp} $=$ {\tt{1}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectors-piton-means-more \\ \index{bit-vectors-piton-means-more}
\=\+({\rm{listp}}\,({\it{x\/}}) $\wedge$ {\rm{bit-vectors-piton}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectors-piton}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\rm{cadar}}\,({\it{x\/}})) $=$ {\rm{car}}\,({\it{x\/}}))\-
\end{tabbing}

\begin{verbatim};; xor-bvs of an array of at least one bit vector
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{xor-bvs} \\  
\=\+{\rm{xor-bvs}}\,({\it{array\/}})\index{xor-bvs} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{array\/}})$\;\;${\bf then }{\rm{xor-bitv}}\,({\rm{car}}\,({\it{array\/}}), {\rm{xor-bvs}}\,({\rm{cdr}}\,({\it{array\/}}))\index{xor-bvs})\index{xor-bitv} \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{untag-array} \\  
\=\+{\rm{untag-array}}\,({\it{array\/}})\index{untag-array} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{array\/}})$\;\;${\bf then }{\rm{cons}}\,({\rm{untag}}\,({\rm{car}}\,({\it{array\/}}))\index{untag}, {\rm{untag-array}}\,({\rm{cdr}}\,({\it{array\/}}))\index{untag-array}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-get \\ \index{bit-vectorp-get}
\=\+{\rm{bit-vectors-piton}}\,({\it{array\/}}, {\it{size\/}})\index{bit-vectors-piton} \\ 
$\rightarrow$$\;\;\;\;$({\rm{bit-vectorp}}\,({\rm{untag}}\,({\rm{get}}\,({\it{n\/}}, {\it{array\/}})\index{get})\index{untag}, {\it{size\/}})\index{bit-vectorp} $=$ ({\it{n\/}} $<$ {\rm{length}}\,({\it{array\/}})\index{length}))\-
\end{tabbing}

\begin{verbatim};(prove-lemma difference-sub1-arg2 (rewrite)
;	     (equal
;	      (difference a (sub1 n))
;	      (if (zerop n) (fix a)
;		(if (lessp a n) 0 (add1 (difference a n))))))
\end{verbatim}
\noindent{\sc Event}:   Enable difference-sub1-arg2.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  xor-bitv-commutative \\ \index{xor-bitv-commutative}
({\rm{length}}\,({\it{a\/}})\index{length} $=$ {\rm{length}}\,({\it{b\/}})\index{length}) $\rightarrow$ ({\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv} $=$ {\rm{xor-bitv}}\,({\it{b\/}}, {\it{a\/}})\index{xor-bitv})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bitv-commutative2 \\ \index{xor-bitv-commutative2}
\=\+({\rm{length}}\,({\it{a\/}})\index{length} $=$ {\rm{length}}\,({\it{b\/}})\index{length}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{xor-bitv}}\,({\it{a\/}}, {\rm{xor-bitv}}\,({\it{b\/}}, {\it{c\/}})\index{xor-bitv})\index{xor-bitv} $=$ {\rm{xor-bitv}}\,({\it{b\/}}, {\rm{xor-bitv}}\,({\it{a\/}}, {\it{c\/}})\index{xor-bitv})\index{xor-bitv})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bitv-associative \\ \index{xor-bitv-associative}
\=\+({\rm{length}}\,({\it{a\/}})\index{length} $=$ {\rm{length}}\,({\it{b\/}})\index{length}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{xor-bitv}}\,({\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv}, {\it{c\/}})\index{xor-bitv} $=$ {\rm{xor-bitv}}\,({\it{a\/}}, {\rm{xor-bitv}}\,({\it{b\/}}, {\it{c\/}})\index{xor-bitv})\index{xor-bitv})\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  length-from-bit-vectorp \\ \index{length-from-bit-vectorp}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectorp} $\rightarrow$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{fix}}\,({\it{s\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-xor-bitv \\ \index{length-xor-bitv}
{\rm{length}}\,({\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv})\index{length} $=$ {\rm{length}}\,({\it{a\/}})\index{length}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-cadr-get-bit-vectors-piton \\ \index{length-cadr-get-bit-vectors-pit!on}
\=\+({\rm{bit-vectors-piton}}\,({\it{x\/}}, {\it{l\/}})\index{bit-vectors-piton} $\wedge$ ({\it{i\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{length}}\,({\rm{cadr}}\,({\rm{get}}\,({\it{i\/}}, {\it{x\/}})\index{get}))\index{length} $=$ {\rm{fix}}\,({\it{l\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-xor-bitv-x-x \\ \index{equal-xor-bitv-x-x}
\=\+({\rm{bit-vectorp}}\,({\it{b\/}}, {\rm{length}}\,({\it{a\/}})\index{length})\index{bit-vectorp} $\wedge$ {\rm{bit-vectorp}}\,({\it{c\/}}, {\rm{length}}\,({\it{a\/}})\index{length})\index{bit-vectorp}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv} $=$ {\rm{xor-bitv}}\,({\it{a\/}}, {\it{c\/}})\index{xor-bitv}) $=$ ({\it{b\/}} $=$ {\it{c\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bit-vectorp-induct} \\  
\=\+{\rm{bit-vectorp-induct}}\,({\it{size\/}}, {\it{a\/}}, {\it{b\/}})\index{bit-vectorp-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{size\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{bit-vectorp-induct}}\,({\it{size\/}} $-\;1$, {\rm{cdr}}\,({\it{a\/}}), {\rm{cdr}}\,({\it{b\/}}))\index{bit-vectorp-induct}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-xor-bitv2 \\ \index{bit-vectorp-xor-bitv2}
{\rm{bit-vectorp}}\,({\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv}, {\it{size\/}})\index{bit-vectorp} $=$ ({\rm{length}}\,({\it{a\/}})\index{length} $=$ {\rm{fix}}\,({\it{size\/}}))
\end{tabbing}

	      
\begin{tabbing}{\sc Definition}:\index{bit-vectorsp} \\  
\=\+{\rm{bit-vectorsp}}\,({\it{bvs\/}}, {\it{size\/}})\index{bit-vectorsp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{bvs\/}}) \\ 
{\bf then }{\rm{bit-vectorp}}\,({\rm{car}}\,({\it{bvs\/}}), {\it{size\/}})\index{bit-vectorp} $\wedge$ {\rm{bit-vectorsp}}\,({\rm{cdr}}\,({\it{bvs\/}}), {\it{size\/}})\index{bit-vectorsp} \\ 
{\bf else }{\it{bvs\/}} $=$ {\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-xor-bvs \\ \index{length-xor-bvs}
\=\+{\rm{bit-vectorsp}}\,({\it{bvs\/}}, {\rm{length}}\,({\rm{car}}\,({\it{bvs\/}}))\index{length})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$({\rm{length}}\,({\rm{xor-bvs}}\,({\it{bvs\/}})\index{xor-bvs})\index{length} $=$ {\rm{length}}\,({\rm{car}}\,({\it{bvs\/}}))\index{length})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorsp-untag \\ \index{bit-vectorsp-untag}
{\rm{bit-vectors-piton}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectors-piton} $\rightarrow$ {\rm{bit-vectorsp}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array}, {\it{s\/}})\index{bit-vectorsp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorsp-cdr-untag \\ \index{bit-vectorsp-cdr-untag}
{\rm{bit-vectors-piton}}\,({\rm{cdr}}\,({\it{x\/}}), {\it{s\/}})\index{bit-vectors-piton} $\rightarrow$ {\rm{bit-vectorsp}}\,({\rm{cdr}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array}), {\it{s\/}})\index{bit-vectorsp}
\end{tabbing}

\begin{verbatim};; actually part of npiton-defs, but not supporter of p
;;
;(DEFN NTHCDR
;      (N L)
;      (IF (ZEROP N)
;          L
;          (NTHCDR (SUB1 N) (CDR L))))
\end{verbatim}
\noindent{\sc Event}:   Enable nthcdr.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  bit-vectorsp-nthcdr \\ \index{bit-vectorsp-nthcdr}
({\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectorsp} $\wedge$ ({\it{n\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length})) $\rightarrow$ {\rm{bit-vectorsp}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{x\/}})\index{nthcdr}, {\it{s\/}})\index{bit-vectorsp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-xor-bvs \\ \index{bit-vectorp-xor-bvs}
({\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorsp} $\wedge$ {\rm{listp}}\,({\it{x\/}})) $\rightarrow$ {\rm{bit-vectorp}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs}, {\it{size\/}})\index{bit-vectorp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-untag-array \\ \index{length-untag-array}
{\rm{length}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{length} $=$ {\rm{length}}\,({\it{x\/}})\index{length}
\end{tabbing}

\begin{verbatim};(prove-lemma listp-nthcdr (rewrite)
;	     (equal
;	      (listp (nthcdr n x))
;	      (lessp n (length x)))
;	     ((enable nthcdr)))
\end{verbatim}
\noindent{\sc Event}:   Enable listp-nthcdr.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  nthcdr-open \\ \index{nthcdr-open}
({\it{n\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length}) $\rightarrow$ ({\rm{nthcdr}}\,({\it{n\/}}, {\it{x\/}})\index{nthcdr} $=$ {\rm{cons}}\,({\rm{get}}\,({\it{n\/}}, {\it{x\/}})\index{get}, {\rm{nthcdr}}\,($1\;+$ {\it{n\/}}, {\it{x\/}})\index{nthcdr}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  get-untag-array \\ \index{get-untag-array}
({\it{n\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length}) $\rightarrow$ ({\rm{get}}\,({\it{n\/}}, {\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{get} $=$ {\rm{cadr}}\,({\rm{get}}\,({\it{n\/}}, {\it{x\/}})\index{get}))
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  equal-xor-bitv-x-x-special \\ \index{equal-xor-bitv-x-x-special}
\=\+({\rm{bit-vectorp}}\,({\it{b\/}}, {\rm{length}}\,({\it{a\/}})\index{length})\index{bit-vectorp} $\wedge$ {\rm{bit-vectorp}}\,({\rm{xor-bitv}}\,({\it{z\/}}, {\it{c\/}})\index{xor-bitv}, {\rm{length}}\,({\it{a\/}})\index{length})\index{bit-vectorp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv} $=$ {\rm{xor-bitv}}\,({\it{z\/}}, {\rm{xor-bitv}}\,({\it{a\/}}, {\it{c\/}})\index{xor-bitv})\index{xor-bitv}) \\ 
$=$$\;\;\;\;$({\it{b\/}} $=$ {\rm{xor-bitv}}\,({\it{z\/}}, {\it{c\/}})\index{xor-bitv}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{fix-bit} \\  
\=\+{\rm{fix-bit}}\,({\it{b\/}})\index{fix-bit} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{b\/}} $=$ {\tt{0}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bitv-0 \\ \index{xor-bitv-0}
({\rm{xor-bit}}\,({\it{x\/}}, {\tt{0}})\index{xor-bit} $=$ {\rm{fix-bit}}\,({\it{x\/}})\index{fix-bit}) $\wedge$ ({\rm{xor-bit}}\,({\tt{0}}, {\it{x\/}})\index{xor-bit} $=$ {\rm{fix-bit}}\,({\it{x\/}})\index{fix-bit})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bitv-nlistp \\ \index{xor-bitv-nlistp}
($\neg$ {\rm{listp}}\,({\it{c\/}})) $\rightarrow$ ({\rm{xor-bitv}}\,({\it{a\/}}, {\rm{xor-bitv}}\,({\it{b\/}}, {\it{c\/}})\index{xor-bitv})\index{xor-bitv} $=$ {\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bitv-nlistp2 \\ \index{xor-bitv-nlistp2}
({\rm{bit-vectorp}}\,({\it{a\/}}, {\it{b\/}})\index{bit-vectorp} $\wedge$ ($\neg$ {\rm{listp}}\,({\it{c\/}}))) $\rightarrow$ ({\rm{xor-bitv}}\,({\it{a\/}}, {\it{c\/}})\index{xor-bitv} $=$ {\it{a\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bvs-array-rewrite \\ \index{xor-bvs-array-rewrite}
\=\+(\=\+{\rm{bit-vectors-piton}}\,({\it{array\/}}, {\rm{length}}\,({\it{current\/}})\index{length})\index{bit-vectors-piton} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{current\/}}, {\rm{length}}\,({\it{current\/}})\index{length})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $<$ {\rm{length}}\,({\it{array\/}})\index{length}) \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{array\/}})\index{length} $=$ {\it{as\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{xor-bvs-array}}\,({\it{current\/}}, {\it{array\/}}, {\it{n\/}}, {\it{as\/}})\index{xor-bvs-array} \\ 
$=$$\;\;\;\;${\rm{xor-bitv}}\,({\it{current\/}}, {\rm{xor-bvs}}\,({\rm{nthcdr}}\,({\it{as\/}} $-$ {\it{n\/}}, {\rm{untag-array}}\,({\it{array\/}})\index{untag-array})\index{nthcdr})\index{xor-bvs})\index{xor-bitv})\-\-
\end{tabbing}

\begin{verbatim};; in npiton-defs but not a supporter of p
;(PROVE-LEMMA EQUAL-LENGTH-0
;             (REWRITE)
;             (EQUAL (EQUAL (LENGTH X) '0)
;                    (NLISTP X)))
\end{verbatim}
\noindent{\sc Event}:   Enable equal-length-0.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-xor-bvs-helper \\ \index{correctness-of-xor-bvs-helper}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{append}}\,(\=\+{\rm{list}}\,({\rm{tag}}\,({\tt{'}}{\tt{nat}}, {\it{numvecs\/}})\index{tag}, {\rm{tag}}\,({\tt{'}}{\tt{addr}}, {\rm{cons}}\,({\it{state\/}}, {\tt{0}}))\index{tag}), \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{xor-bvs}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{xor-bvs}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{xor-bvs-program}}\index{xor-bvs-program}) \\ 
$\wedge$$\;\;\;\;${\rm{xor-bvs-input-conditionp}}\,({\it{p0\/}})\index{xor-bvs-input-conditionp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,({\it{p0\/}}, {\rm{xor-bvs-clock}}\,({\it{numvecs\/}})\index{xor-bvs-clock})\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{xor-bvs-array}}\,(\=\+{\rm{untag}}\,({\rm{car}}\,({\rm{array}}\,(\=\+{\it{state\/}}, \\ 
{\it{data-segment\/}})\-\index{array}))\index{untag}, \\ 
{\rm{array}}\,({\it{state\/}}, {\it{data-segment\/}})\index{array}, \\ 
{\it{numvecs\/}} $-\;1$, \\ 
{\it{numvecs\/}})\-\index{xor-bvs-array})\-, \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-cadar-bvs \\ \index{length-cadar-bvs}
({\rm{bit-vectors-piton}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectors-piton} $\wedge$ {\rm{listp}}\,({\it{x\/}})) $\rightarrow$ ({\rm{length}}\,({\rm{cadar}}\,({\it{x\/}}))\index{length} $=$ {\rm{fix}}\,({\it{s\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-from-bit-vectors-piton \\ \index{bit-vectorp-from-bit-vectors-pit!on}
\=\+{\rm{bit-vectors-piton}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectors-piton} \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{bit-vectorp}}\,({\rm{cadar}}\,({\it{x\/}}), {\it{s\/}})\index{bit-vectorp} $=$ {\rm{listp}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{bit-vectorp}}\,({\rm{cadr}}\,({\rm{get}}\,({\it{n\/}}, {\it{x\/}})\index{get}), {\it{s\/}})\index{bit-vectorp} $=$ ({\it{n\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-1 \\ \index{nthcdr-1}
{\rm{nthcdr}}\,({\tt{1}}, {\it{a\/}})\index{nthcdr} $=$ {\rm{cdr}}\,({\it{a\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-untag-array \\ \index{listp-untag-array}
{\rm{listp}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array}) $=$ {\rm{listp}}\,({\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bvs-input-conditionp-means-xor-bvs-hack \\ \index{xor-bvs-input-conditionp-means-!xor-bvs-hack}
\=\+(\=\+{\rm{xor-bvs-input-conditionp}}\,({\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{numvecs\/}}), \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,({\tt{'}}{\tt{addr}}, {\rm{cons}}\,({\it{state\/}}, {\tt{0}})), \\ 
{\it{temp-stk\/}})\-)\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\index{xor-bvs-input-conditionp} \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\it{word-size\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{xor-bvs-array}}\,(\=\+{\rm{untag}}\,({\rm{car}}\,({\rm{array}}\,({\it{state\/}}, {\it{data-segment\/}})\index{array}))\index{untag}, \\ 
{\rm{array}}\,({\it{state\/}}, {\it{data-segment\/}})\index{array}, \\ 
{\it{numvecs\/}} $-\;1$, \\ 
{\it{numvecs\/}})\-\index{xor-bvs-array} \\ 
$=$$\;\;\;\;${\rm{xor-bvs}}\,({\rm{untag-array}}\,({\rm{array}}\,({\it{state\/}}, {\it{data-segment\/}})\index{array})\index{untag-array})\index{xor-bvs})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-xor-bvs \\ \index{correctness-of-xor-bvs}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{n\/}}, {\rm{cons}}\,({\it{s\/}}, {\it{temp-stk\/}})), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\it{word-size\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{xor-bvs}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{xor-bvs}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{xor-bvs-program}}\index{xor-bvs-program}) \\ 
$\wedge$$\;\;\;\;${\rm{xor-bvs-input-conditionp}}\,({\it{p0\/}})\index{xor-bvs-input-conditionp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{n\/}}, {\rm{cons}}\,({\it{s\/}}, {\it{temp-stk\/}})), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{xor-bvs-clock}}\,({\rm{cadr}}\,({\it{n\/}}))\index{xor-bvs-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{xor-bvs}}\,({\rm{untag-array}}\,({\rm{array}}\,(\=\+{\rm{caadr}}\,({\it{s\/}}), \\ 
{\it{data-segment\/}})\-\index{array})\index{untag-array})\index{xor-bvs})\-, \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{example-xor-bvs-p-state} \\  
\=\+{\sc{example-xor-bvs-p-state}}\index{example-xor-bvs-p-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{xor-bvs}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\sc{xor-bvs-program}}\index{xor-bvs-program})\-, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{(}}\=\+{\tt{arr}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}}{\tt{)}}\-{\tt{)}}\-, \\ 
{\tt{10}}, \\ 
{\tt{8}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{verbatim};;;; push-1-vector 
;; Piton currently does not provide any mechanism for creating a
;; bit vector except as an operation on other bit vectors.  Until
;; this apparent flaw is fixed, we'll write our program as a
;; function of the word size.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{one-bit-vector} \\  
\=\+{\rm{one-bit-vector}}\,({\it{wordsize\/}})\index{one-bit-vector} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{wordsize\/}} $<$ {\tt{2}}$\;\;${\bf then }{\rm{list}}\,({\tt{1}}) \\ 
{\bf else }{\rm{cons}}\,({\tt{0}}, {\rm{one-bit-vector}}\,({\it{wordsize\/}} $-\;1$)\index{one-bit-vector})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{push-1-vector-program} \\  
\=\+{\rm{push-1-vector-program}}\,({\it{wordsize\/}})\index{push-1-vector-program} \\ 
$=$$\;\;\;\;${\rm{list}}\,(\=\+{\tt{'}}{\tt{push-1-vector}}, \\ 
{\bf{nil}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{push-constant}}, {\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\rm{one-bit-vector}}\,({\it{wordsize\/}})\index{one-bit-vector})), \\ 
{\rm{list}}\,({\tt{'}}{\tt{ret}}))\-\-
\end{tabbing}
   

\begin{tabbing}{\sc Definition}:\index{example-push-1-vector-state} \\  
\=\+{\sc{example-push-1-vector-state}}\index{example-push-1-vector-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{push-1-vector}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}, \\ 
{\rm{push-1-vector-program}}\,({\tt{8}})\index{push-1-vector-program})\-, \\ 
{\bf{nil}}, \\ 
{\tt{10}}, \\ 
{\tt{8}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{push-1-vector-input-conditionp} \\  
\=\+{\rm{push-1-vector-input-conditionp}}\,({\it{p0\/}})\index{push-1-vector-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+(\=\+{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size} \\ 
$\not<$$\;\;\;\;$({\tt{2}} $+$ {\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}))\- \\ 
$\wedge$$\;\;\;\;$({\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size} $\not<$ ({\tt{1}} $+$ {\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length})) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}))\-\-
\end{tabbing}

\begin{verbatim};(prove-lemma length-append (rewrite)
;	     (equal
;	      (length (append a b))
;	      (plus (length a) (length b))))
\end{verbatim}
\noindent{\sc Event}:   Enable length-append.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  equal-assoc-cons \\ \index{equal-assoc-cons}
\=\+({\rm{assoc}}\,({\it{k\/}}, {\it{a\/}}) $=$ {\rm{cons}}\,({\it{x\/}}, {\it{y\/}})) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{car}}\,({\rm{assoc}}\,({\it{k\/}}, {\it{a\/}})) $=$ {\it{x\/}}) $\wedge$ ({\rm{cdr}}\,({\rm{assoc}}\,({\it{k\/}}, {\it{a\/}})) $=$ {\it{y\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-push-1-vector \\ \index{correctness-of-push-1-vector}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{push-1-vector}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{push-1-vector}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\it{word-size\/}})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;${\rm{push-1-vector-input-conditionp}}\,({\it{p0\/}})\index{push-1-vector-input-conditionp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,({\it{p0\/}}, {\tt{3}})\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\rm{one-bit-vector}}\,({\it{word-size\/}})\index{one-bit-vector}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{verbatim};;;; nat-to-bv

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{nat-to-bv-program} \\  
\=\+{\sc{nat-to-bv-program}}\index{nat-to-bv-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{nat-to-bv}} \\ 
{\tt{(}}{\tt{value}}{\tt{)}} \\ 
{\tt{(}}{\tt{(}}{\tt{current-bit}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{temp}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{push-1-vector}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{current-bit}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{push-1-vector}}{\tt{)}} \\ 
{\tt{(}}{\tt{rsh-bitv}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{loop}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{value}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-nat-and-jump}}{\tt{ }}{\tt{zero}}{\tt{ }}{\tt{done}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{value}}{\tt{)}} \\ 
{\tt{(}}{\tt{div2-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{temp}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{value}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{temp}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-nat-and-jump}}{\tt{ }}{\tt{zero}}{\tt{ }}{\tt{lab}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{current-bit}}{\tt{)}} \\ 
{\tt{(}}{\tt{xor-bitv}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{lab}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{current-bit}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{lsh-bitv}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{current-bit}}{\tt{)}} \\ 
{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{loop}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{done}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{example-nat-to-bv-state} \\  
\=\+{\sc{example-nat-to-bv-state}}\index{example-nat-to-bv-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{86}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{nat-to-bv}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\rm{push-1-vector-program}}\,({\tt{8}})\index{push-1-vector-program}, \\ 
{\sc{nat-to-bv-program}}\index{nat-to-bv-program})\-, \\ 
{\bf{nil}}, \\ 
{\tt{10}}, \\ 
{\tt{8}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{zero-bit-vector} \\  
\=\+{\rm{zero-bit-vector}}\,({\it{size\/}})\index{zero-bit-vector} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{size\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{cons}}\,({\tt{0}}, {\rm{zero-bit-vector}}\,({\it{size\/}} $-\;1$)\index{zero-bit-vector})$\;${\bf  endif}\-\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{nat-to-bv2-helper} \\  
\=\+{\rm{nat-to-bv2-helper}}\,({\it{value\/}}, {\it{current-bit\/}}, {\it{bit-vector\/}})\index{nat-to-bv2-helper} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{value\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\it{bit-vector\/}} \\ 
{\bf else }{\rm{nat-to-bv2-helper}}\,(\=\+{\it{value\/}} $\div$ {\tt{2}}, \\ 
{\rm{append}}\,({\rm{cdr}}\,({\it{current-bit\/}}), {\rm{list}}\,({\tt{0}})), \\ 
\=\+{\bf if }({\it{value\/}} ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{1}} \\ 
{\bf then }{\rm{xor-bitv}}\,({\it{current-bit\/}}, {\it{bit-vector\/}})\index{xor-bitv} \\ 
{\bf else }{\it{bit-vector\/}}$\;${\bf  endif}\-)\-\index{nat-to-bv2-helper}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv2} \\  
\=\+{\rm{nat-to-bv2}}\,({\it{value\/}}, {\it{size\/}})\index{nat-to-bv2} \\ 
$=$$\;\;\;\;${\rm{nat-to-bv2-helper}}\,({\it{value\/}}, {\rm{one-bit-vector}}\,({\it{size\/}})\index{one-bit-vector}, {\rm{zero-bit-vector}}\,({\it{size\/}})\index{zero-bit-vector})\index{nat-to-bv2-helper}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv-loop-clock} \\  
\=\+{\rm{nat-to-bv-loop-clock}}\,({\it{value\/}})\index{nat-to-bv-loop-clock} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{value\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\tt{3}} \\ 
{\bf else }\=\+\=\+{\bf if }({\it{value\/}} ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{0}}$\;\;${\bf then }{\tt{12}} \\ 
{\bf else }{\tt{14}}$\;${\bf  endif}\- \\ 
$+$$\;\;\;\;${\rm{nat-to-bv-loop-clock}}\,({\it{value\/}} $\div$ {\tt{2}})\index{nat-to-bv-loop-clock}\-$\;${\bf  endif}\-\-
\end{tabbing}
	 
\begin{tabbing}{\sc Definition}:\index{correctness-of-nat-to-bv-genera!l-induct} \\  
\=\+{\rm{correctness-of-nat-to-bv-general-induct}}\,({\it{value\/}}, {\it{cb\/}}, {\it{temp\/}}, {\it{bv\/}})\index{correctness-of-nat-to-bv-genera!l-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{value\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{correctness-of-nat-to-bv-general-induct}}\,(\=\+{\it{value\/}} $\div$ {\tt{2}}, \\ 
{\rm{append}}\,(\=\+{\rm{cdr}}\,({\it{cb\/}}), \\ 
{\rm{list}}\,({\tt{0}}))\-, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{nat}}, \\ 
{\it{value\/}} ${}${\bf{mod}}${}$ {\tt{2}})\-, \\ 
\=\+{\bf if }\=\+({\it{value\/}} ${}${\bf{mod}}${}$ {\tt{2}}) \\ 
$=$$\;\;\;\;${\tt{0}}\- \\ 
{\bf then }{\it{bv\/}} \\ 
{\bf else }{\rm{xor-bitv}}\,(\=\+{\it{bv\/}}, \\ 
{\it{cb\/}})\-\index{xor-bitv}$\;${\bf  endif}\-)\-\index{correctness-of-nat-to-bv-genera!l-induct}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-remainder-simple \\ \index{lessp-remainder-simple}
({\it{y\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ (({\it{x\/}} ${}${\bf{mod}}${}$ {\it{y\/}}) $<$ {\it{y\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-exp-simple \\ \index{lessp-exp-simple}
(({\it{x\/}} $<$ {\it{y\/}}) $\wedge$ ({\it{z\/}} $\not\simeq {\tt{0}}$)) $\rightarrow$ ({\it{x\/}} $<$ {\rm{exp}}\,({\it{y\/}}, {\it{z\/}})\index{exp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-1 \\ \index{lessp-1}
({\it{x\/}} $<$ {\tt{1}}) $=$ ({\it{x\/}} $\simeq {\tt{0}}$)
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-remainder-x-exp-x \\ \index{lessp-remainder-x-exp-x}
\=\+(({\it{x\/}} ${}${\bf{mod}}${}$ {\it{y\/}}) $<$ {\rm{exp}}\,({\it{y\/}}, {\it{z\/}})\index{exp}) \\ 
$=$$\;\;\;\;$((({\it{z\/}} $\simeq {\tt{0}}$) $\wedge$ (({\it{x\/}} ${}${\bf{mod}}${}$ {\it{y\/}}) $=$ {\tt{0}})) $\vee$ (({\it{z\/}} $\not\simeq {\tt{0}}$) $\wedge$ ({\it{y\/}} $\not\simeq {\tt{0}}$)))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-append \\ \index{bit-vectorp-append}
\=\+{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{x-size\/}})\index{bit-vectorp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{bit-vectorp}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}), {\it{size\/}})\index{bit-vectorp} \\ 
$=$$\;\;\;\;$({\rm{bit-vectorp}}\,({\it{y\/}}, {\it{size\/}} $-$ {\it{x-size\/}})\index{bit-vectorp} $\wedge$ ({\it{size\/}} $\not<$ {\it{x-size\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-nat-to-bv-general \\ \index{correctness-of-nat-to-bv-genera!l}
\=\+(\=\+{\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{3}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{nat-to-bv}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{nat-to-bv-program}}\index{nat-to-bv-program}) \\ 
$\wedge$$\;\;\;\;$({\it{value\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\it{word-size\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{value\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{bv\/}}, {\it{word-size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{cb\/}}, {\it{word-size\/}})\index{bit-vectorp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{nat-to-bv}}{\tt{ .\ }}{\tt{4}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{list}}\,(\=\+{\rm{cons}}\,({\tt{'}}{\tt{value}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{value\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{current-bit}}, {\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{cb\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{temp}}, {\it{temp\/}}))\-, \\ 
{\it{ret-pc\/}})\-, \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{bv\/}}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{nat-to-bv-loop-clock}}\,({\it{value\/}})\index{nat-to-bv-loop-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\rm{nat-to-bv2-helper}}\,({\it{value\/}}, {\it{cb\/}}, {\it{bv\/}})\index{nat-to-bv2-helper}), \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv-clock} \\  
{\rm{nat-to-bv-clock}}\,({\it{value\/}})\index{nat-to-bv-clock} $=$ ({\tt{9}} $+$ {\rm{nat-to-bv-loop-clock}}\,({\it{value\/}})\index{nat-to-bv-loop-clock})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv-input-conditionp} \\  
\=\+{\rm{nat-to-bv-input-conditionp}}\,({\it{p0\/}})\index{nat-to-bv-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+({\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $<$ {\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{7}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{2}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}))\-\-
\end{tabbing}
	 
\begin{tabbing}{\sc Theorem}:  bit-vectorp-one-bit-vector \\ \index{bit-vectorp-one-bit-vector}
{\rm{bit-vectorp}}\,({\rm{one-bit-vector}}\,({\it{s\/}})\index{one-bit-vector}, {\it{s\/}})\index{bit-vectorp} $=$ ({\tt{0}} $<$ {\it{s\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-zero-bit-vector \\ \index{bit-vectorp-zero-bit-vector}
{\rm{bit-vectorp}}\,({\rm{zero-bit-vector}}\,({\it{s\/}})\index{zero-bit-vector}, {\it{s\/}})\index{bit-vectorp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-but-last-one-bit-vector \\ \index{all-but-last-one-bit-vector}
{\rm{all-but-last}}\,({\rm{one-bit-vector}}\,({\it{s\/}})\index{one-bit-vector})\index{all-but-last} $=$ {\rm{zero-bit-vector}}\,({\it{s\/}} $-\;1$)\index{zero-bit-vector}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-nat-to-bv-helper \\ \index{correctness-of-nat-to-bv-helper}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{value\/}}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{nat-to-bv}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{nat-to-bv}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{nat-to-bv-program}}\index{nat-to-bv-program}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{push-1-vector}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\it{word-size\/}})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;${\rm{nat-to-bv-input-conditionp}}\,({\it{p0\/}})\index{nat-to-bv-input-conditionp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,({\it{p0\/}}, {\rm{nat-to-bv-clock}}\,({\it{value\/}})\index{nat-to-bv-clock})\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\rm{nat-to-bv2}}\,({\it{value\/}}, {\it{word-size\/}})\index{nat-to-bv2}), \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bv-to-nat} \\  
\=\+{\rm{bv-to-nat}}\,({\it{bv\/}})\index{bv-to-nat} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{bv\/}}) \\ 
{\bf then }\=\+({\rm{fix-bit}}\,({\rm{car}}\,({\it{bv\/}}))\index{fix-bit} $*$ {\rm{exp}}\,({\tt{2}}, {\rm{length}}\,({\rm{cdr}}\,({\it{bv\/}}))\index{length})\index{exp}) \\ 
$+$$\;\;\;\;${\rm{bv-to-nat}}\,({\rm{cdr}}\,({\it{bv\/}}))\index{bv-to-nat}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-nat-to-bv \\ \index{length-nat-to-bv}
{\rm{length}}\,({\rm{nat-to-bv}}\,({\it{nat\/}}, {\it{size\/}})\index{nat-to-bv})\index{length} $=$ {\rm{fix}}\,({\it{size\/}})
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  bv-to-nat-nat-to-bv \\ \index{bv-to-nat-nat-to-bv}
\=\+{\rm{bv-to-nat}}\,({\rm{nat-to-bv}}\,({\it{nat\/}}, {\it{size\/}})\index{nat-to-bv})\index{bv-to-nat} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{nat\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}$\;\;${\bf then }{\rm{fix}}\,({\it{nat\/}}) \\ 
{\bf else }{\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp} $-\;1$$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Enable exp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  nat-to-bv-simple \\ \index{nat-to-bv-simple}
\=\+({\it{x\/}} $\simeq {\tt{0}}$) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{y\/}})\index{nat-to-bv} $=$ {\rm{zero-bit-vector}}\,({\it{y\/}})\index{zero-bit-vector}) $\wedge$ ({\rm{nat-to-bv}}\,({\it{y\/}}, {\it{x\/}})\index{nat-to-bv} $=$ {\bf{nil}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-to-bv-bv-to-nat \\ \index{nat-to-bv-bv-to-nat}
{\rm{bit-vectorp}}\,({\it{bv\/}}, {\it{size\/}})\index{bit-vectorp} $\rightarrow$ ({\rm{nat-to-bv}}\,({\rm{bv-to-nat}}\,({\it{bv\/}})\index{bv-to-nat}, {\it{size\/}})\index{nat-to-bv} $=$ {\it{bv\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat-append \\ \index{bv-to-nat-append}
\=\+{\rm{bv-to-nat}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{bv-to-nat} \\ 
$=$$\;\;\;\;$({\rm{bv-to-nat}}\,({\it{y\/}})\index{bv-to-nat} $+$ ({\rm{exp}}\,({\tt{2}}, {\rm{length}}\,({\it{y\/}})\index{length})\index{exp} $*$ {\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-plus-hacks \\ \index{lessp-plus-hacks}
\=\+(\=\+(({\it{a\/}} $+$ ({\it{b\/}} $+$ ({\it{c\/}} $+$ (({\it{d\/}} $*$ {\it{e\/}}) $+$ ({\it{d\/}} $*$ {\it{e\/}}))))) $<$ ({\it{e\/}} $+$ {\it{e\/}})) \\ 
$=$$\;\;\;\;$(({\it{d\/}} $\simeq {\tt{0}}$) $\wedge$ (({\it{a\/}} $+$ ({\it{b\/}} $+$ {\it{c\/}})) $<$ ({\it{e\/}} $+$ {\it{e\/}}))))\- \\ 
$\wedge$$\;\;\;\;$(\=\+(({\it{a\/}} $+$ ({\it{b\/}} $+$ ({\it{c\/}} $+$ ({\it{e\/}} $+$ (({\it{d\/}} $*$ {\it{g\/}}) $+$ {\it{h\/}}))))) $<$ {\it{g\/}}) \\ 
$=$$\;\;\;\;$(({\it{d\/}} $\simeq {\tt{0}}$) $\wedge$ (({\it{a\/}} $+$ ({\it{b\/}} $+$ ({\it{c\/}} $+$ ({\it{e\/}} $+$ {\it{h\/}})))) $<$ {\it{g\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat-xor-bitv \\ \index{bv-to-nat-xor-bitv}
\=\+(\=\+{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{y\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv} $=$ {\rm{zero-bit-vector}}\,({\it{size\/}})\index{zero-bit-vector}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{bv-to-nat}}\,({\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv})\index{bv-to-nat} $=$ ({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $+$ {\rm{bv-to-nat}}\,({\it{y\/}})\index{bv-to-nat}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-bv-to-nat-exp-2 \\ \index{lessp-bv-to-nat-exp-2}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorp} $\rightarrow$ (({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) $=$ {\bf{t}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-nat-to-bv \\ \index{equal-nat-to-bv}
\=\+({\rm{bit-vectorp}}\,({\it{bv\/}}, {\it{size\/}})\index{bit-vectorp} $\wedge$ ({\it{y\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\rm{nat-to-bv}}\,({\it{y\/}}, {\it{size\/}})\index{nat-to-bv} $=$ {\it{bv\/}}) $=$ ({\rm{bv-to-nat}}\,({\it{bv\/}})\index{bv-to-nat} $=$ {\rm{fix}}\,({\it{y\/}}))) \\ 
$\wedge$$\;\;\;\;$(({\it{bv\/}} $=$ {\rm{nat-to-bv}}\,({\it{y\/}}, {\it{size\/}})\index{nat-to-bv}) $=$ ({\rm{fix}}\,({\it{y\/}}) $=$ {\rm{bv-to-nat}}\,({\it{bv\/}})\index{bv-to-nat})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{least-bit-higher-than-high-bit} \\  
\=\+{\rm{least-bit-higher-than-high-bit}}\,({\it{x\/}}, {\it{y\/}})\index{least-bit-higher-than-high-bit} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length}) \\ 
$\wedge$$\;\;\;\;$\=\+{\bf if }{\rm{car}}\,({\it{y\/}}) $\not=$ {\tt{0}}$\;\;${\bf then }{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} \\ 
{\bf else }{\rm{least-bit-higher-than-high-bit}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{cdr}}\,({\it{y\/}}))\index{least-bit-higher-than-high-bit}$\;${\bf  endif}\-\- \\ 
{\bf else }{\it{y\/}} $\simeq\;${{\bf{nil}}}${}$$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  least-bit-higher-means-and-0 \\ \index{least-bit-higher-means-and-0}
\=\+(\=\+{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{y\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{least-bit-higher-than-high-bit}}\,({\it{x\/}}, {\it{y\/}})\index{least-bit-higher-than-high-bit})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv} $=$ {\rm{zero-bit-vector}}\,({\it{size\/}})\index{zero-bit-vector}) \\ 
$\wedge$$\;\;\;\;$({\rm{and-bitv}}\,({\it{y\/}}, {\it{x\/}})\index{and-bitv} $=$ {\rm{zero-bit-vector}}\,({\it{size\/}})\index{zero-bit-vector}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-zero-bit-vector \\ \index{all-zero-bitvp-zero-bit-vector}
{\rm{all-zero-bitvp}}\,({\rm{zero-bit-vector}}\,({\it{size\/}})\index{zero-bit-vector})\index{all-zero-bitvp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat-one-bit-vector \\ \index{bv-to-nat-one-bit-vector}
{\rm{bv-to-nat}}\,({\rm{one-bit-vector}}\,({\it{size\/}})\index{one-bit-vector})\index{bv-to-nat} $=$ {\tt{1}}
\end{tabbing}

\begin{verbatim};; renamed from firstn to avoid conflict with similar but different
;; definition in piton library
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{make-list-from} \\  
\=\+{\rm{make-list-from}}\,({\it{n\/}}, {\it{list\/}})\index{make-list-from} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{cons}}\,({\rm{car}}\,({\it{list\/}}), {\rm{make-list-from}}\,({\it{n\/}} $-\;1$, {\rm{cdr}}\,({\it{list\/}}))\index{make-list-from})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-make-list-from \\ \index{length-make-list-from}
{\rm{length}}\,({\rm{make-list-from}}\,({\it{n\/}}, {\it{list\/}})\index{make-list-from})\index{length} $=$ {\rm{fix}}\,({\it{n\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  make-list-from-1 \\ \index{make-list-from-1}
{\rm{make-list-from}}\,({\tt{1}}, {\it{x\/}})\index{make-list-from} $=$ {\rm{list}}\,({\rm{car}}\,({\it{x\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-make-list-from \\ \index{listp-make-list-from}
{\rm{listp}}\,({\rm{make-list-from}}\,({\it{n\/}}, {\it{x\/}})\index{make-list-from}) $=$ ({\it{n\/}} $\not\simeq {\tt{0}}$)
\end{tabbing}
			   
\begin{tabbing}{\sc Definition}:\index{double-cdr-induct} \\  
\=\+{\rm{double-cdr-induct}}\,({\it{x\/}}, {\it{z\/}})\index{double-cdr-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{double-cdr-induct}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{cdr}}\,({\it{z\/}}))\index{double-cdr-induct} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-append \\ \index{all-zero-bitvp-append}
{\rm{all-zero-bitvp}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{all-zero-bitvp} $=$ ({\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\wedge$ {\rm{all-zero-bitvp}}\,({\it{y\/}})\index{all-zero-bitvp})
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  least-bit-higher-than-high-bit-append-0s \\ \index{least-bit-higher-than-high-bit-!append-0s}
\=\+({\rm{all-zero-bitvp}}\,({\it{y\/}})\index{all-zero-bitvp} $\wedge$ ({\rm{length}}\,({\it{z\/}})\index{length} $=$ {\rm{length}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{length})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{least-bit-higher-than-high-bit}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}), {\it{z\/}})\index{least-bit-higher-than-high-bit} \\ 
$=$$\;\;\;\;${\rm{least-bit-higher-than-high-bit}}\,({\it{x\/}}, {\rm{make-list-from}}\,({\rm{length}}\,({\it{x\/}})\index{length}, {\it{z\/}})\index{make-list-from})\index{least-bit-higher-than-high-bit})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-xor-bitv-x-y-1 \\ \index{equal-xor-bitv-x-y-1}
({\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv} $=$ {\it{b\/}}) $=$ ({\rm{bit-vectorp}}\,({\it{b\/}}, {\rm{length}}\,({\it{a\/}})\index{length})\index{bit-vectorp} $\wedge$ {\rm{all-zero-bitvp}}\,({\it{a\/}})\index{all-zero-bitvp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-xor-bitv-x-y-2 \\ \index{equal-xor-bitv-x-y-2}
\=\+({\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv} $=$ {\it{a\/}}) \\ 
$=$$\;\;\;\;$(\=\+{\rm{all-zero-bitvp}}\,({\rm{make-list-from}}\,({\rm{length}}\,({\it{a\/}})\index{length}, {\it{b\/}})\index{make-list-from})\index{all-zero-bitvp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{a\/}}, {\rm{length}}\,({\it{a\/}})\index{length})\index{bit-vectorp})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  least-bit-higher-than-high-bit-simple \\ \index{least-bit-higher-than-high-bit-!simple}
\=\+{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} \\ 
$\rightarrow$$\;\;\;\;$({\rm{least-bit-higher-than-high-bit}}\,({\it{x\/}}, {\it{y\/}})\index{least-bit-higher-than-high-bit} $=$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  make-list-from-is-all-but-last \\ \index{make-list-from-is-all-but-last}
({\rm{length}}\,({\it{x\/}})\index{length} $=$ ($1\;+$ {\it{n\/}})) $\rightarrow$ ({\rm{make-list-from}}\,({\it{n\/}}, {\it{x\/}})\index{make-list-from} $=$ {\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  least-bit-higher-all-but-last \\ \index{least-bit-higher-all-but-last}
\=\+{\rm{least-bit-higher-than-high-bit}}\,({\it{a\/}}, {\it{b\/}})\index{least-bit-higher-than-high-bit} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{least-bit-higher-than-high-bit}}\,({\it{a\/}}, {\rm{cons}}\,({\tt{0}}, {\rm{all-but-last}}\,({\it{b\/}})\index{all-but-last}))\index{least-bit-higher-than-high-bit} \\ 
$=$$\;\;\;\;${\rm{listp}}\,({\it{a\/}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{at-most-one-bit-on} \\  
\=\+{\rm{at-most-one-bit-on}}\,({\it{bv\/}})\index{at-most-one-bit-on} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{bv\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{bv\/}}) $=$ {\tt{0}}$\;\;${\bf then }{\rm{at-most-one-bit-on}}\,({\rm{cdr}}\,({\it{bv\/}}))\index{at-most-one-bit-on} \\ 
{\bf else }{\rm{all-zero-bitvp}}\,({\rm{cdr}}\,({\it{bv\/}}))\index{all-zero-bitvp}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};
;(prove-lemma length-all-but-last (rewrite)
;	     (equal
;	      (length (all-but-last x))
;	      (if (listp x) (sub1 (length x)) 0)))
\end{verbatim}
\noindent{\sc Event}:   Enable length-all-but-last.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  listp-xor-bitv \\ \index{listp-xor-bitv}
{\rm{listp}}\,({\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv}) $=$ {\rm{listp}}\,({\it{a\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-means-at-most-one-bit-on \\ \index{all-zero-bitvp-means-at-most-one!-bit-on}
{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\rightarrow$ {\rm{at-most-one-bit-on}}\,({\it{x\/}})\index{at-most-one-bit-on}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  at-most-one-bit-on-append \\ \index{at-most-one-bit-on-append}
\=\+{\rm{at-most-one-bit-on}}\,({\rm{append}}\,({\it{a\/}}, {\it{b\/}}))\index{at-most-one-bit-on} \\ 
$=$$\;\;\;\;$(\=\+({\rm{all-zero-bitvp}}\,({\it{a\/}})\index{all-zero-bitvp} $\wedge$ {\rm{at-most-one-bit-on}}\,({\it{b\/}})\index{at-most-one-bit-on}) \\ 
$\vee$$\;\;\;\;$({\rm{at-most-one-bit-on}}\,({\it{a\/}})\index{at-most-one-bit-on} $\wedge$ {\rm{all-zero-bitvp}}\,({\it{b\/}})\index{all-zero-bitvp}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{fix-bitv} \\  
\=\+{\rm{fix-bitv}}\,({\it{list\/}})\index{fix-bitv} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{list\/}}) \\ 
{\bf then }{\rm{cons}}\,(\=\+\=\+{\bf if }{\rm{car}}\,({\it{list\/}}) $=$ {\tt{0}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\-, \\ 
{\rm{fix-bitv}}\,({\rm{cdr}}\,({\it{list\/}}))\index{fix-bitv})\- \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bitv-nlistp3 \\ \index{xor-bitv-nlistp3}
\=\+($\neg$ {\rm{listp}}\,({\it{x\/}})) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv} $=$ {\bf{nil}}) $\wedge$ ({\rm{xor-bitv}}\,({\it{y\/}}, {\it{x\/}})\index{xor-bitv} $=$ {\rm{fix-bitv}}\,({\it{y\/}})\index{fix-bitv}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable xor-bitv-nlistp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable xor-bitv-nlistp2.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  fix-bitv-all-but-last \\ \index{fix-bitv-all-but-last}
{\rm{fix-bitv}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})\index{fix-bitv} $=$ {\rm{all-but-last}}\,({\rm{fix-bitv}}\,({\it{x\/}})\index{fix-bitv})\index{all-but-last}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-but-last-xor-bitv \\ \index{all-but-last-xor-bitv}
\=\+{\rm{all-but-last}}\,({\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv})\index{all-but-last} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{length}}\,({\it{b\/}})\index{length} $<$ {\rm{length}}\,({\it{a\/}})\index{length}$\;\;${\bf then }{\rm{xor-bitv}}\,({\rm{all-but-last}}\,({\it{a\/}})\index{all-but-last}, {\it{b\/}})\index{xor-bitv} \\ 
{\bf else }{\rm{xor-bitv}}\,({\rm{all-but-last}}\,({\it{a\/}})\index{all-but-last}, {\rm{all-but-last}}\,({\it{b\/}})\index{all-but-last})\index{xor-bitv}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  least-bit-higher-cons-xor-bitv-hack \\ \index{least-bit-higher-cons-xor-bitv-!hack}
\=\+(\=\+{\rm{least-bit-higher-than-high-bit}}\,({\rm{cdr}}\,({\it{x\/}}), {\it{a\/}})\index{least-bit-higher-than-high-bit} \\ 
$\wedge$$\;\;\;\;${\rm{least-bit-higher-than-high-bit}}\,({\rm{cdr}}\,({\it{x\/}}), {\it{b\/}})\index{least-bit-higher-than-high-bit})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{least-bit-higher-than-high-bit}}\,({\it{x\/}}, {\rm{cons}}\,({\tt{0}}, {\rm{xor-bitv}}\,({\it{a\/}}, {\it{b\/}})\index{xor-bitv}))\index{least-bit-higher-than-high-bit} \\ 
$=$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  least-bit-higher-cdr-all-but-last \\ \index{least-bit-higher-cdr-all-but-la!st}
\=\+{\rm{least-bit-higher-than-high-bit}}\,({\it{a\/}}, {\it{b\/}})\index{least-bit-higher-than-high-bit} \\ 
$\rightarrow$$\;\;\;\;${\rm{least-bit-higher-than-high-bit}}\,({\rm{cdr}}\,({\it{a\/}}), {\rm{all-but-last}}\,({\it{b\/}})\index{all-but-last})\index{least-bit-higher-than-high-bit}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  least-bit-higher-x-all-but-last-x \\ \index{least-bit-higher-x-all-but-last!-x}
\=\+{\rm{at-most-one-bit-on}}\,({\it{x\/}})\index{at-most-one-bit-on} \\ 
$\rightarrow$$\;\;\;\;${\rm{least-bit-higher-than-high-bit}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})\index{least-bit-higher-than-high-bit}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-to-bv-equiv-helper \\ \index{nat-to-bv-equiv-helper}
\=\+(\=\+{\rm{bit-vectorp}}\,({\it{cb\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{bv\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\it{size\/}}) \\ 
$\wedge$$\;\;\;\;$(({\rm{bv-to-nat}}\,({\it{bv\/}})\index{bv-to-nat} $+$ ({\rm{bv-to-nat}}\,({\it{cb\/}})\index{bv-to-nat} $*$ {\it{value\/}})) $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{cb\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;${\rm{least-bit-higher-than-high-bit}}\,({\it{cb\/}}, {\it{bv\/}})\index{least-bit-higher-than-high-bit})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{nat-to-bv2-helper}}\,({\it{value\/}}, {\it{cb\/}}, {\it{bv\/}})\index{nat-to-bv2-helper} \\ 
$=$$\;\;\;\;${\rm{nat-to-bv}}\,(({\rm{bv-to-nat}}\,({\it{cb\/}})\index{bv-to-nat} $*$ {\it{value\/}}) $+$ {\rm{bv-to-nat}}\,({\it{bv\/}})\index{bv-to-nat}, {\it{size\/}})\index{nat-to-bv})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  at-most-one-bit-on-one-bit-vector \\ \index{at-most-one-bit-on-one-bit-vect!or}
{\rm{at-most-one-bit-on}}\,({\rm{one-bit-vector}}\,({\it{size\/}})\index{one-bit-vector})\index{at-most-one-bit-on}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat-all-zero-bitvp \\ \index{bv-to-nat-all-zero-bitvp}
{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\rightarrow$ ({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $=$ {\tt{0}})
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  least-bit-higher-than-high-bit-simple2 \\ \index{least-bit-higher-than-high-bit-!simple2}
\=\+{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} \\ 
$\rightarrow$$\;\;\;\;$({\rm{least-bit-higher-than-high-bit}}\,({\it{y\/}}, {\it{x\/}})\index{least-bit-higher-than-high-bit} $=$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-zero-bit-vector \\ \index{length-zero-bit-vector}
{\rm{length}}\,({\rm{zero-bit-vector}}\,({\it{size\/}})\index{zero-bit-vector})\index{length} $=$ {\rm{fix}}\,({\it{size\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-one-bit-vector \\ \index{length-one-bit-vector}
\=\+{\rm{length}}\,({\rm{one-bit-vector}}\,({\it{size\/}})\index{one-bit-vector})\index{length} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{size\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\tt{1}} \\ 
{\bf else }{\it{size\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-to-bv-equivalence \\ \index{nat-to-bv-equivalence}
\=\+(({\it{value\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) $\wedge$ ({\tt{0}} $<$ {\it{size\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{nat-to-bv2}}\,({\it{value\/}}, {\it{size\/}})\index{nat-to-bv2} $=$ {\rm{nat-to-bv}}\,({\it{value\/}}, {\it{size\/}})\index{nat-to-bv})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-nat-to-bv \\ \index{correctness-of-nat-to-bv}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{v\/}}, {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{v\/}}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\it{v\/}}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{nat-to-bv}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{nat-to-bv}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{nat-to-bv-program}}\index{nat-to-bv-program}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{push-1-vector}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\it{word-size\/}})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;$({\it{num\/}} $=$ {\rm{cadr}}\,({\it{v\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{nat-to-bv-input-conditionp}}\,({\it{p0\/}})\index{nat-to-bv-input-conditionp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{v\/}}, {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{nat-to-bv-clock}}\,({\it{num\/}})\index{nat-to-bv-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\rm{nat-to-bv}}\,({\rm{cadr}}\,({\it{v\/}}), {\it{word-size\/}})\index{nat-to-bv}), \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{verbatim};;;; bv-to-nat

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bv-to-nat-program} \\  
\=\+{\sc{bv-to-nat-program}}\index{bv-to-nat-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{bv-to-nat}} \\ 
{\tt{(}}{\tt{bv}}{\tt{)}} \\ 
{\tt{(}}{\tt{(}}{\tt{current-bit}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{current-2power}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{current-2power}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{push-1-vector}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{current-bit}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{loop}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{bv}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{current-bit}}{\tt{)}} \\ 
{\tt{(}}{\tt{and-bitv}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bitv-and-jump}}{\tt{ }}{\tt{all-zero}}{\tt{ }}{\tt{lab}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{current-2power}}{\tt{)}} \\ 
{\tt{(}}{\tt{add-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{lab}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{current-bit}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{lsh-bitv}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{current-bit}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bitv-and-jump}}{\tt{ }}{\tt{all-zero}}{\tt{ }}{\tt{done}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{current-2power}}{\tt{)}} \\ 
{\tt{(}}{\tt{mult2-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{current-2power}}{\tt{)}} \\ 
{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{loop}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{done}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{example-bv-to-nat-state} \\  
\=\+{\sc{example-bv-to-nat-state}}\index{example-bv-to-nat-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{bv-to-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\rm{push-1-vector-program}}\,({\tt{8}})\index{push-1-vector-program}, \\ 
{\sc{bv-to-nat-program}}\index{bv-to-nat-program})\-, \\ 
{\bf{nil}}, \\ 
{\tt{10}}, \\ 
{\tt{8}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{trailing-zeros-helper} \\  
\=\+{\rm{trailing-zeros-helper}}\,({\it{list\/}}, {\it{acc\/}})\index{trailing-zeros-helper} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{list\/}}) \\ 
{\bf then }{\rm{trailing-zeros-helper}}\,(\=\+{\rm{cdr}}\,({\it{list\/}}), \\ 
\=\+{\bf if }{\rm{car}}\,({\it{list\/}}) $=$ {\tt{0}}$\;\;${\bf then }$1\;+$ {\it{acc\/}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\index{trailing-zeros-helper} \\ 
{\bf else }{\rm{fix}}\,({\it{acc\/}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{trailing-zeros} \\  
{\rm{trailing-zeros}}\,({\it{list\/}})\index{trailing-zeros} $=$ {\rm{trailing-zeros-helper}}\,({\it{list\/}}, {\tt{0}})\index{trailing-zeros-helper}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  trailing-zeros-of-all-zero-bitvp \\ \index{trailing-zeros-of-all-zero-bitvp}
{\rm{all-zero-bitvp}}\,({\it{bv\/}})\index{all-zero-bitvp} $\rightarrow$ ({\rm{trailing-zeros-helper}}\,({\it{bv\/}}, {\it{n\/}})\index{trailing-zeros-helper} $=$ ({\rm{length}}\,({\it{bv\/}})\index{length} $+$ {\it{n\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  non-zero-means-acc-irrelevant-spec \\ \index{non-zero-means-acc-irrelevant-spe!c}
\=\+($\neg$ {\rm{all-zero-bitvp}}\,({\it{bv\/}})\index{all-zero-bitvp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{trailing-zeros-helper}}\,({\it{bv\/}}, $1\;+$ {\it{x\/}})\index{trailing-zeros-helper} $=$ {\rm{trailing-zeros-helper}}\,({\it{bv\/}}, {\it{x\/}})\index{trailing-zeros-helper})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  non-zero-means-acc-irrelevant \\ \index{non-zero-means-acc-irrelevant}
\=\+(($\neg$ {\rm{all-zero-bitvp}}\,({\it{bv\/}})\index{all-zero-bitvp}) $\wedge$ ({\it{x\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{trailing-zeros-helper}}\,({\it{bv\/}}, {\it{x\/}})\index{trailing-zeros-helper} $=$ {\rm{trailing-zeros-helper}}\,({\it{bv\/}}, {\tt{0}})\index{trailing-zeros-helper})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  trailing-zeros-helper-append \\ \index{trailing-zeros-helper-append}
\=\+{\rm{trailing-zeros-helper}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}), {\it{acc\/}})\index{trailing-zeros-helper} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\it{y\/}})\index{all-zero-bitvp}$\;\;${\bf then }\=\+{\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc\/}})\index{trailing-zeros-helper} \\ 
$+$$\;\;\;\;${\rm{length}}\,({\it{y\/}})\index{length}\- \\ 
{\bf else }{\rm{trailing-zeros-helper}}\,({\it{y\/}}, {\it{acc\/}})\index{trailing-zeros-helper}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  trailing-zeros-append \\ \index{trailing-zeros-append}
\=\+{\rm{trailing-zeros}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{trailing-zeros} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\it{y\/}})\index{all-zero-bitvp}$\;\;${\bf then }{\rm{trailing-zeros}}\,({\it{x\/}})\index{trailing-zeros} $+$ {\rm{length}}\,({\it{y\/}})\index{length} \\ 
{\bf else }{\rm{trailing-zeros}}\,({\it{y\/}})\index{trailing-zeros}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-trailing-zeros-helper \\ \index{lessp-trailing-zeros-helper}
\=\+({\it{n\/}} $\not<$ ({\it{acc\/}} $+$ {\rm{length}}\,({\it{x\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$(({\it{n\/}} $<$ {\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc\/}})\index{trailing-zeros-helper}) $=$ {\bf{f}})\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{last} \\  
\=\+{\rm{last}}\,({\it{list\/}})\index{last} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{list\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{list\/}}))$\;\;${\bf then }{\rm{last}}\,({\rm{cdr}}\,({\it{list\/}}))\index{last} \\ 
{\bf else }{\rm{car}}\,({\it{list\/}})$\;${\bf  endif}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-trailing-zeros-helper-0 \\ \index{equal-trailing-zeros-helper-0}
\=\+({\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc\/}})\index{trailing-zeros-helper} $=$ {\tt{0}}) \\ 
$=$$\;\;\;\;$((({\it{acc\/}} $\simeq {\tt{0}}$) $\wedge$ ({\it{x\/}} $\simeq\;${{\bf{nil}}}${}$)) $\vee$ ({\rm{last}}\,({\it{x\/}})\index{last} $\not=$ {\tt{0}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-length-cdr-trailing \\ \index{lessp-length-cdr-trailing}
\=\+(({\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length} $<$ {\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc\/}})\index{trailing-zeros-helper}) $\wedge$ {\rm{listp}}\,({\it{x\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\wedge$ {\rm{all-zero-bitvp}}\,({\rm{cdr}}\,({\it{x\/}}))\index{all-zero-bitvp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  not-all-zero-bitvp-cdr-means \\ \index{not-all-zero-bitvp-cdr-means}
\=\+($\neg$ {\rm{all-zero-bitvp}}\,({\rm{cdr}}\,({\it{x\/}}))\index{all-zero-bitvp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc\/}})\index{trailing-zeros-helper} $=$ {\rm{trailing-zeros-helper}}\,({\rm{cdr}}\,({\it{x\/}}), {\tt{0}})\index{trailing-zeros-helper})\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bv-to-nat2-helper} \\  
\=\+{\rm{bv-to-nat2-helper}}\,({\it{bv\/}}, {\it{cb\/}}, {\it{current-2power\/}})\index{bv-to-nat2-helper} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\it{cb\/}})\index{all-zero-bitvp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }\=\+\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{bv\/}}, {\it{cb\/}})\index{and-bitv})\index{all-zero-bitvp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\it{current-2power\/}}$\;${\bf  endif}\- \\ 
$+$$\;\;\;\;${\rm{bv-to-nat2-helper}}\,(\=\+{\it{bv\/}}, \\ 
{\rm{append}}\,({\rm{cdr}}\,({\it{cb\/}}), {\rm{list}}\,({\tt{0}})), \\ 
{\tt{2}} $*$ {\it{current-2power\/}})\-\index{bv-to-nat2-helper}\-$\;${\bf  endif}\-\-
\end{tabbing}
			   
\begin{tabbing}{\sc Definition}:\index{bv-to-nat2} \\  
{\rm{bv-to-nat2}}\,({\it{bv\/}})\index{bv-to-nat2} $=$ {\rm{bv-to-nat2-helper}}\,({\it{bv\/}}, {\rm{one-bit-vector}}\,({\rm{length}}\,({\it{bv\/}})\index{length})\index{one-bit-vector}, {\tt{1}})\index{bv-to-nat2-helper}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-length-trailing-zeros-hack \\ \index{lessp-length-trailing-zeros-hac!k}
({\it{acc\/}} $\simeq {\tt{0}}$) $\rightarrow$ ({\rm{length}}\,({\it{x\/}})\index{length} $\not<$ {\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc\/}})\index{trailing-zeros-helper})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bv-to-nat-loop-clock} \\  
\=\+{\rm{bv-to-nat-loop-clock}}\,({\it{cb\/}}, {\it{bv\/}})\index{bv-to-nat-loop-clock} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\rm{cdr}}\,({\it{cb\/}}))\index{all-zero-bitvp} \\ 
{\bf then }\=\+{\bf if }({\rm{car}}\,({\it{cb\/}}) $=$ {\tt{0}}) $\vee$ ({\rm{car}}\,({\it{bv\/}}) $=$ {\tt{0}})$\;\;${\bf then }{\tt{9}} \\ 
{\bf else }{\tt{11}}$\;${\bf  endif}\- \\ 
{\bf else }\=\+\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{cb\/}}, {\it{bv\/}})\index{and-bitv})\index{all-zero-bitvp}$\;\;${\bf then }{\tt{12}} \\ 
{\bf else }{\tt{14}}$\;${\bf  endif}\- \\ 
$+$$\;\;\;\;${\rm{bv-to-nat-loop-clock}}\,({\rm{append}}\,({\rm{cdr}}\,({\it{cb\/}}), {\tt{'}}{\tt{(}}{\tt{0}}{\tt{)}}), {\it{bv\/}})\index{bv-to-nat-loop-clock}\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bv-to-nat-induct} \\  
\=\+{\rm{bv-to-nat-induct}}\,({\it{value\/}}, {\it{bv\/}}, {\it{cb\/}}, {\it{current-2power\/}})\index{bv-to-nat-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\it{cb\/}})\index{all-zero-bitvp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{bv-to-nat-induct}}\,(\=\+\=\+\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{bv\/}}, {\it{cb\/}})\index{and-bitv})\index{all-zero-bitvp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\it{current-2power\/}}$\;${\bf  endif}\- \\ 
$+$$\;\;\;\;${\it{value\/}}\-, \\ 
{\it{bv\/}}, \\ 
{\rm{append}}\,({\rm{cdr}}\,({\it{cb\/}}), {\rm{list}}\,({\tt{0}})), \\ 
{\tt{2}} $*$ {\it{current-2power\/}})\-\index{bv-to-nat-induct}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{double-cdr-with-sub1-induct} \\  
\=\+{\rm{double-cdr-with-sub1-induct}}\,({\it{x\/}}, {\it{y\/}}, {\it{n\/}})\index{double-cdr-with-sub1-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{double-cdr-with-sub1-induct}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{cdr}}\,({\it{y\/}}), {\it{n\/}} $-\;1$)\index{double-cdr-with-sub1-induct} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-and-bitv-better \\ \index{bit-vectorp-and-bitv-better}
{\rm{bit-vectorp}}\,({\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv}, {\it{size\/}})\index{bit-vectorp} $=$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{fix}}\,({\it{size\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-bv-to-nat-exp \\ \index{lessp-bv-to-nat-exp}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorp} $\rightarrow$ ({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-bv-to-nat-0 \\ \index{equal-bv-to-nat-0}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorp} $\rightarrow$ (({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $=$ {\tt{0}}) $=$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp})
\end{tabbing}

\begin{verbatim};(prove-lemma commutativity-of-and-bitv (rewrite)
;	     (implies
;	      (equal (length x) (length y))
;	      (equal (and-bitv x y) (and-bitv y x))))
\end{verbatim}
\noindent{\sc Event}:   Enable commutativity-of-and-bitv.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  commutativity2-of-and-bitv \\ \index{commutativity2-of-and-bitv}
\=\+({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{and-bitv}}\,({\it{x\/}}, {\rm{and-bitv}}\,({\it{y\/}}, {\it{z\/}})\index{and-bitv})\index{and-bitv} $=$ {\rm{and-bitv}}\,({\it{y\/}}, {\rm{and-bitv}}\,({\it{x\/}}, {\it{z\/}})\index{and-bitv})\index{and-bitv})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  associativity-of-and-bitv \\ \index{associativity-of-and-bitv}
\=\+({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{and-bitv}}\,({\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv}, {\it{z\/}})\index{and-bitv} $=$ {\rm{and-bitv}}\,({\it{x\/}}, {\rm{and-bitv}}\,({\it{y\/}}, {\it{z\/}})\index{and-bitv})\index{and-bitv})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-and-bitv \\ \index{all-zero-bitvp-and-bitv}
\=\+{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} \\ 
$\rightarrow$$\;\;\;\;$({\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv})\index{all-zero-bitvp} $\wedge$ {\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{y\/}}, {\it{x\/}})\index{and-bitv})\index{all-zero-bitvp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat-loop-clock-open \\ \index{bv-to-nat-loop-clock-open}
{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\rightarrow$ ({\rm{bv-to-nat-loop-clock}}\,({\it{x\/}}, {\it{y\/}})\index{bv-to-nat-loop-clock} $=$ {\tt{9}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat2-helper-hack \\ \index{bv-to-nat2-helper-hack}
\=\+({\rm{all-zero-bitvp}}\,({\it{z\/}})\index{all-zero-bitvp} $\wedge$ ({\rm{length}}\,({\it{d\/}})\index{length} $=$ {\rm{length}}\,({\it{z\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{bv-to-nat2-helper}}\,({\rm{cons}}\,({\tt{1}}, {\it{d\/}}), {\rm{cons}}\,({\tt{1}}, {\it{z\/}}), {\it{v\/}})\index{bv-to-nat2-helper} $=$ {\rm{fix}}\,({\it{v\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat2-helper-hack2 \\ \index{bv-to-nat2-helper-hack2}
\=\+({\rm{all-zero-bitvp}}\,({\it{z\/}})\index{all-zero-bitvp} $\wedge$ ({\rm{length}}\,({\it{d\/}})\index{length} $=$ {\rm{length}}\,({\it{z\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{bv-to-nat2-helper}}\,({\rm{cons}}\,({\tt{0}}, {\it{d\/}}), {\rm{cons}}\,({\tt{1}}, {\it{z\/}}), {\it{v\/}})\index{bv-to-nat2-helper} $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-bv-to-nat-general \\ \index{correctness-of-bv-to-nat-genera!l}
\=\+(\=\+{\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{3}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{bv-to-nat}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{bv-to-nat-program}}\index{bv-to-nat-program}) \\ 
$\wedge$$\;\;\;\;$({\it{c2p\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\it{word-size\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{cb\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;$({\it{c2p\/}} $=$ {\rm{bv-to-nat}}\,({\it{cb\/}})\index{bv-to-nat}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{bv\/}}, {\it{word-size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{cb\/}}, {\it{word-size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\it{value\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{value\/}} $<$ {\it{c2p\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{bv-to-nat}}{\tt{ .\ }}{\tt{5}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{list}}\,(\=\+{\rm{cons}}\,({\tt{'}}{\tt{bv}}, {\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{bv\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{current-bit}}, {\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{cb\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{current-2power}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{c2p\/}})))\-, \\ 
{\it{ret-pc\/}})\-, \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{value\/}}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{bv-to-nat-loop-clock}}\,({\it{cb\/}}, {\it{bv\/}})\index{bv-to-nat-loop-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\tt{'}}{\tt{nat}}, \\ 
{\rm{bv-to-nat2-helper}}\,({\it{bv\/}}, {\it{cb\/}}, {\it{c2p\/}})\index{bv-to-nat2-helper} $+$ {\it{value\/}})\-, \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{bv-to-nat-clock} \\  
\=\+{\rm{bv-to-nat-clock}}\,({\it{word-size\/}}, {\it{bv\/}})\index{bv-to-nat-clock} \\ 
$=$$\;\;\;\;$({\tt{8}} $+$ {\rm{bv-to-nat-loop-clock}}\,({\rm{one-bit-vector}}\,({\it{word-size\/}})\index{one-bit-vector}, {\it{bv\/}})\index{bv-to-nat-loop-clock})\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bv-to-nat-input-conditionp} \\  
\=\+{\rm{bv-to-nat-input-conditionp}}\,({\it{p0\/}})\index{bv-to-nat-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{bitv}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}), {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{7}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{2}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-bv-to-nat-helper \\ \index{correctness-of-bv-to-nat-helper}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{bv\/}}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{bv-to-nat}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{bv-to-nat}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{bv-to-nat-program}}\index{bv-to-nat-program}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{push-1-vector}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\it{word-size\/}})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;${\rm{bv-to-nat-input-conditionp}}\,({\it{p0\/}})\index{bv-to-nat-input-conditionp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,({\it{p0\/}}, {\rm{bv-to-nat-clock}}\,({\it{word-size\/}}, {\it{bv\/}})\index{bv-to-nat-clock})\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{nat}}, {\rm{bv-to-nat2}}\,({\it{bv\/}})\index{bv-to-nat2}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-append-better \\ \index{bit-vectorp-append-better}
\=\+{\rm{bit-vectorp}}\,({\it{x\/}}, {\rm{length}}\,({\it{x\/}})\index{length})\index{bit-vectorp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{bit-vectorp}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}), {\it{size\/}})\index{bit-vectorp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{bit-vectorp}}\,({\it{y\/}}, {\rm{length}}\,({\it{y\/}})\index{length})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\rm{fix}}\,({\it{size\/}}) $=$ ({\rm{length}}\,({\it{x\/}})\index{length} $+$ {\rm{length}}\,({\it{y\/}})\index{length})))\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-hack \\ \index{bit-vectorp-hack}
\=\+{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{a\/}} $+$ {\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length})\index{bit-vectorp} \\ 
$=$$\;\;\;\;$(\=\+\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\it{a\/}} $=$ {\tt{1}} \\ 
{\bf else }{\it{a\/}} $\simeq {\tt{0}}$$\;${\bf  endif}\- \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{x\/}}, {\rm{length}}\,({\it{x\/}})\index{length})\index{bit-vectorp})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat-one-bit \\ \index{bv-to-nat-one-bit}
\=\+(($\neg$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp}) $\wedge$ {\rm{at-most-one-bit-on}}\,({\it{x\/}})\index{at-most-one-bit-on} $\wedge$ {\rm{bit-vectorp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $=$ {\rm{exp}}\,({\tt{2}}, {\rm{trailing-zeros}}\,({\it{x\/}})\index{trailing-zeros})\index{exp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-sub1-plus-hack \\ \index{lessp-sub1-plus-hack}
(({\it{x\/}} $-\;1$) $<$ ({\it{y\/}} $+$ {\it{x\/}})) $=$ (({\it{x\/}} $\not\simeq {\tt{0}}$) $\vee$ ({\it{y\/}} $\not\simeq {\tt{0}}$))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  quotient-plus-hack \\ \index{quotient-plus-hack}
(({\it{a\/}} $+$ {\it{b\/}} $+$ {\it{b\/}}) $\div$ {\tt{2}}) $=$ (({\it{a\/}} $\div$ {\tt{2}}) $+$ {\it{b\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat-all-but-last \\ \index{bv-to-nat-all-but-last}
\=\+{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\rightarrow$$\;\;\;\;$({\rm{bv-to-nat}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})\index{bv-to-nat} $=$ ({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $\div$ {\tt{2}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  make-list-from-cons \\ \index{make-list-from-cons}
\=\+{\rm{make-list-from}}\,({\it{n\/}}, {\rm{cons}}\,({\it{a\/}}, {\it{b\/}}))\index{make-list-from} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{cons}}\,({\it{a\/}}, {\rm{make-list-from}}\,({\it{n\/}} $-\;1$, {\it{b\/}})\index{make-list-from})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-plus-times-hack \\ \index{equal-plus-times-hack}
\=\+(({\it{a\/}} $+$ ({\it{a\/}} $*$ {\it{b\/}}) $+$ ({\it{a\/}} $*$ {\it{c\/}})) $=$ ({\it{a\/}} $*$ {\it{d\/}})) \\ 
$=$$\;\;\;\;$(({\it{a\/}} $\simeq {\tt{0}}$) $\vee$ (({\tt{1}} $+$ {\it{b\/}} $+$ {\it{c\/}}) $=$ {\it{d\/}}))\-
\end{tabbing}

\begin{verbatim};(defn nth (n list)
;  (if (zerop n)
;      (car list)
;    (nth (sub1 n) (cdr list))))
\end{verbatim}
\noindent{\sc Event}:   Enable nth.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  last-make-list-from \\ \index{last-make-list-from}
\=\+{\rm{last}}\,({\rm{make-list-from}}\,({\it{n\/}}, {\it{x\/}})\index{make-list-from})\index{last} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{nth}}\,({\it{n\/}} $-\;1$, {\it{x\/}})\index{nth}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  make-list-from-nlistp \\ \index{make-list-from-nlistp}
({\it{x\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ ({\rm{make-list-from}}\,({\it{n\/}}, {\it{x\/}})\index{make-list-from} $=$ {\rm{zero-bit-vector}}\,({\it{n\/}})\index{zero-bit-vector})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nth-nlistp \\ \index{nth-nlistp}
({\it{x\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ ({\rm{nth}}\,({\it{n\/}}, {\it{x\/}})\index{nth} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-make-list-from \\ \index{bit-vectorp-make-list-from}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorp} $\rightarrow$ {\rm{bit-vectorp}}\,({\rm{make-list-from}}\,({\it{n\/}}, {\it{x\/}})\index{make-list-from}, {\it{n\/}})\index{bit-vectorp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-bv-to-nat-0-2 \\ \index{equal-bv-to-nat-0-2}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\rm{length}}\,({\it{x\/}})\index{length})\index{bit-vectorp} $\rightarrow$ (({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $=$ {\tt{0}}) $=$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat-make-list-from-from-sub1-make-list-from \\ \index{bv-to-nat-make-list-from-from-s!ub1-make-list-from}
\=\+({\rm{bv-to-nat}}\,({\rm{make-list-from}}\,({\it{n\/}} $-\;1$, {\it{v\/}})\index{make-list-from})\index{bv-to-nat} $=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{bv-to-nat}}\,({\rm{make-list-from}}\,({\it{n\/}}, {\it{v\/}})\index{make-list-from})\index{bv-to-nat} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{fix-bit}}\,({\rm{nth}}\,({\it{n\/}} $-\;1$, {\it{v\/}})\index{nth})\index{fix-bit}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  plus-bv-to-nat-make-list-from \\ \index{plus-bv-to-nat-make-list-from}
\=\+({\rm{bv-to-nat}}\,({\rm{make-list-from}}\,({\it{z\/}} $-\;1$, {\it{v\/}})\index{make-list-from})\index{bv-to-nat} $+$ {\rm{bv-to-nat}}\,({\rm{make-list-from}}\,({\it{z\/}} $-\;1$, {\it{v\/}})\index{make-list-from})\index{bv-to-nat}) \\ 
$=$$\;\;\;\;$(\=\+{\rm{bv-to-nat}}\,({\rm{make-list-from}}\,({\it{z\/}}, {\it{v\/}})\index{make-list-from})\index{bv-to-nat} \\ 
$-$$\;\;\;\;${\rm{fix-bit}}\,({\rm{last}}\,({\rm{make-list-from}}\,({\it{z\/}}, {\it{v\/}})\index{make-list-from})\index{last})\index{fix-bit})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-bv-to-nat-1 \\ \index{equal-bv-to-nat-1}
\=\+{\rm{bit-vectorp}}\,({\it{x\/}}, {\rm{length}}\,({\it{x\/}})\index{length})\index{bit-vectorp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $=$ {\tt{1}}) \\ 
$=$$\;\;\;\;$({\rm{all-zero-bitvp}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})\index{all-zero-bitvp} $\wedge$ ({\rm{last}}\,({\it{x\/}})\index{last} $=$ {\tt{1}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-1-hack \\ \index{lessp-1-hack}
({\tt{1}} $<$ {\it{a\/}}) $=$ (({\it{a\/}} $\not\simeq {\tt{0}}$) $\wedge$ ({\it{a\/}} $\not=$ {\tt{1}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  not-equal-nth-0-means \\ \index{not-equal-nth-0-means}
\=\+(({\rm{nth}}\,({\it{n\/}}, {\it{v\/}})\index{nth} $\not=$ {\tt{0}}) $\wedge$ ({\it{n\/}} $<$ {\it{s\/}})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\rm{make-list-from}}\,({\it{s\/}}, {\it{v\/}})\index{make-list-from})\index{all-zero-bitvp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-all-but-last-means \\ \index{all-zero-bitvp-all-but-last-mea!ns}
\=\+(\=\+{\rm{all-zero-bitvp}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})\index{all-zero-bitvp} \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length}) \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\rm{trailing-zeros-helper}}\,({\it{y\/}}, {\it{acc\/}})\index{trailing-zeros-helper}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv})\index{all-zero-bitvp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-all-but-last-means-spec \\ \index{all-zero-bitvp-all-but-last-mea!ns-spec}
\=\+(\=\+{\rm{all-zero-bitvp}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})\index{all-zero-bitvp} \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length}) \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\rm{trailing-zeros-helper}}\,({\it{y\/}}, {\tt{0}})\index{trailing-zeros-helper}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv})\index{all-zero-bitvp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-means-to-and-bitv \\ \index{all-zero-means-to-and-bitv}
\=\+{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv} $=$ {\rm{zero-bit-vector}}\,({\rm{length}}\,({\it{x\/}})\index{length})\index{zero-bit-vector}) \\ 
$\wedge$$\;\;\;\;$({\rm{and-bitv}}\,({\it{y\/}}, {\it{x\/}})\index{and-bitv} $=$ {\rm{zero-bit-vector}}\,({\rm{length}}\,({\it{y\/}})\index{length})\index{zero-bit-vector}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  trailing-zeros-nth-proof \\ \index{trailing-zeros-nth-proof}
\=\+(\=\+({\it{n\/}} $=$ (({\rm{length}}\,({\it{x\/}})\index{length} $-$ {\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc\/}})\index{trailing-zeros-helper}) $-\;1$)) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{nth}}\,({\it{n\/}}, {\it{x\/}})\index{nth} $\not=$ {\tt{0}})\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  trailing-zeros-nth-spec \\ \index{trailing-zeros-nth-spec}
\=\+(\=\+({\it{n\/}} $=$ (({\rm{length}}\,({\it{x\/}})\index{length} $-$ {\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\tt{0}})\index{trailing-zeros-helper}) $-\;1$)) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{nth}}\,({\it{n\/}}, {\it{x\/}})\index{nth} $\not=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  and-bitv-special \\ \index{and-bitv-special}
\=\+(\=\+({\rm{nth}}\,({\it{n\/}}, {\it{w\/}})\index{nth} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{nth}}\,({\it{n\/}}, {\it{x\/}})\index{nth} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{x\/}})\index{length}) \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{x\/}})\index{at-most-one-bit-on})\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{and-bitv}}\,({\it{w\/}}, {\it{x\/}})\index{and-bitv} $=$ {\rm{zero-bit-vector}}\,({\rm{length}}\,({\it{w\/}})\index{length})\index{zero-bit-vector})\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  equal-trailing-zeros-length-spec \\ \index{equal-trailing-zeros-length-spe!c}
\=\+({\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc\/}})\index{trailing-zeros-helper} $=$ ({\it{acc\/}} $+$ {\rm{length}}\,({\it{x\/}})\index{length})) \\ 
$=$$\;\;\;\;${\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-trailing-zeros-length \\ \index{equal-trailing-zeros-length}
\=\+({\it{acc\/}} $\simeq {\tt{0}}$) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc\/}})\index{trailing-zeros-helper} $=$ {\rm{length}}\,({\it{x\/}})\index{length}) $=$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-trailing-zeros \\ \index{bit-vectorp-trailing-zeros}
\=\+{\rm{bit-vectorp}}\,({\it{x\/}}, {\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc\/}})\index{trailing-zeros-helper})\index{bit-vectorp} \\ 
$=$$\;\;\;\;$({\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\wedge$ {\rm{bit-vectorp}}\,({\it{x\/}}, {\rm{length}}\,({\it{x\/}})\index{length})\index{bit-vectorp} $\wedge$ ({\it{acc\/}} $\simeq {\tt{0}}$))\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  quotient-exp-hack \\ \index{quotient-exp-hack}
\=\+({\it{b\/}} $\not\simeq {\tt{0}}$) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\it{x\/}} $+$ {\rm{exp}}\,({\it{b\/}}, {\it{y\/}})\index{exp}) $\div$ {\it{b\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{y\/}} $\simeq {\tt{0}}$$\;\;${\bf then }($1\;+$ {\it{x\/}}) $\div$ {\it{b\/}} \\ 
{\bf else }{\rm{exp}}\,({\it{b\/}}, {\it{y\/}} $-\;1$)\index{exp} $+$ ({\it{x\/}} $\div$ {\it{b\/}})$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{verbatim};(defn properp (list)
;  (if (listp list)
;      (properp (cdr list))
;    (equal list nil)))

\end{verbatim}\begin{tabbing}{\sc Theorem}:  bit-vectorp-means-properp \\ \index{bit-vectorp-means-properp}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\rm{length}}\,({\it{x\/}})\index{length})\index{bit-vectorp} $\rightarrow$ {\rm{properp}}\,({\it{x\/}})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  make-list-from-simplify \\ \index{make-list-from-simplify}
(({\it{n\/}} $=$ {\rm{length}}\,({\it{x\/}})\index{length}) $\wedge$ {\rm{properp}}\,({\it{x\/}})\index{properp}) $\rightarrow$ ({\rm{make-list-from}}\,({\it{n\/}}, {\it{x\/}})\index{make-list-from} $=$ {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-add1-plus-hack \\ \index{equal-add1-plus-hack}
\=\+((($1\;+$ ({\it{a\/}} $+$ {\it{b\/}})) $=$ ({\it{c\/}} $+$ ({\it{d\/}} $+$ {\it{a\/}}))) $=$ (($1\;+$ {\it{b\/}}) $=$ ({\it{c\/}} $+$ {\it{d\/}}))) \\ 
$\wedge$$\;\;\;\;$((($1\;+$ ({\it{a\/}} $+$ {\it{b\/}})) $=$ ({\it{c\/}} $+$ {\it{a\/}})) $=$ (($1\;+$ {\it{b\/}}) $=$ {\rm{fix}}\,({\it{c\/}}))) \\ 
$\wedge$$\;\;\;\;$((($1\;+$ {\it{a\/}}) $=$ ({\it{b\/}} $+$ {\it{a\/}})) $=$ ({\tt{1}} $=$ {\rm{fix}}\,({\it{b\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  plus-quotient-bv-to-nat \\ \index{plus-quotient-bv-to-nat}
\=\+(({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $\div$ {\tt{2}}) $+$ ({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $\div$ {\tt{2}})) \\ 
$=$$\;\;\;\;$({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $-$ {\rm{fix-bit}}\,({\rm{last}}\,({\it{x\/}})\index{last})\index{fix-bit})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-plus-times-hack2 \\ \index{equal-plus-times-hack2}
\=\+((({\it{a\/}} $*$ {\it{b\/}}) $+$ ({\it{a\/}} $*$ {\it{c\/}})) $=$ ({\it{a\/}} $*$ {\it{d\/}})) \\ 
$=$$\;\;\;\;$(({\it{a\/}} $\simeq {\tt{0}}$) $\vee$ (({\it{b\/}} $+$ {\it{c\/}}) $=$ {\rm{fix}}\,({\it{d\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  and-bitv-special-special \\ \index{and-bitv-special-special}
\=\+(\=\+({\rm{last}}\,({\it{w\/}})\index{last} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{x\/}})\index{last} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{w\/}})\index{length}) \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{x\/}})\index{at-most-one-bit-on})\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{and-bitv}}\,({\it{w\/}}, {\it{x\/}})\index{and-bitv} $=$ {\rm{zero-bit-vector}}\,({\rm{length}}\,({\it{w\/}})\index{length})\index{zero-bit-vector})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  and-bitv-special-3 \\ \index{and-bitv-special-3}
\=\+(({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length}) $\wedge$ ({\rm{last}}\,({\it{x\/}})\index{last} $\not=$ {\tt{0}}) $\wedge$ ({\rm{last}}\,({\it{y\/}})\index{last} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv})\index{all-zero-bitvp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  and-bitv-special-4 \\ \index{and-bitv-special-4}
\=\+(({\rm{nth}}\,({\it{n\/}}, {\it{w\/}})\index{nth} $\not=$ {\tt{0}}) $\wedge$ ({\rm{nth}}\,({\it{n\/}}, {\it{x\/}})\index{nth} $\not=$ {\tt{0}}) $\wedge$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{x\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{w\/}}, {\it{x\/}})\index{and-bitv})\index{all-zero-bitvp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  and-bitv-special-5 \\ \index{and-bitv-special-5}
\=\+(\=\+({\rm{last}}\,({\it{w\/}})\index{last} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{x\/}})\index{last} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$(($1\;+$ {\rm{length}}\,({\it{x\/}})\index{length}) $=$ {\rm{length}}\,({\it{w\/}})\index{length}) \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{x\/}})\index{at-most-one-bit-on})\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{and-bitv}}\,({\it{w\/}}, {\rm{cons}}\,({\tt{0}}, {\it{x\/}}))\index{and-bitv} $=$ {\rm{zero-bit-vector}}\,({\rm{length}}\,({\it{w\/}})\index{length})\index{zero-bit-vector})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  and-bitv-special-6 \\ \index{and-bitv-special-6}
\=\+(({\rm{last}}\,({\it{w\/}})\index{last} $\not=$ {\tt{0}}) $\wedge$ ({\rm{last}}\,({\it{x\/}})\index{last} $\not=$ {\tt{0}}) $\wedge$ (($1\;+$ {\rm{length}}\,({\it{x\/}})\index{length}) $=$ {\rm{length}}\,({\it{w\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{w\/}}, {\rm{cons}}\,({\tt{0}}, {\it{x\/}}))\index{and-bitv})\index{all-zero-bitvp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  not-last-0-means-not-all-0 \\ \index{not-last-0-means-not-all-0}
({\rm{last}}\,({\it{x\/}})\index{last} $\not=$ {\tt{0}}) $\rightarrow$ ($\neg$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-plus-length-hack \\ \index{bit-vectorp-plus-length-hack}
\=\+({\rm{bit-vectorp}}\,({\it{x\/}}, {\it{z\/}} $+$ {\rm{length}}\,({\it{x\/}})\index{length})\index{bit-vectorp} $=$ ({\rm{bit-vectorp}}\,({\it{x\/}}, {\rm{length}}\,({\it{x\/}})\index{length})\index{bit-vectorp} $\wedge$ ({\it{z\/}} $\simeq {\tt{0}}$))) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{bit-vectorp}}\,({\it{x\/}}, ($1\;+$ {\it{z\/}}) $+$ {\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length})\index{bit-vectorp} \\ 
$=$$\;\;\;\;$({\rm{bit-vectorp}}\,({\it{x\/}}, {\rm{length}}\,({\it{x\/}})\index{length})\index{bit-vectorp} $\wedge$ {\rm{listp}}\,({\it{x\/}}) $\wedge$ ({\it{z\/}} $\simeq {\tt{0}}$)))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  last-append \\ \index{last-append}
\=\+{\rm{last}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{last} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{y\/}})$\;\;${\bf then }{\rm{last}}\,({\it{y\/}})\index{last} \\ 
{\bf else }{\rm{last}}\,({\it{x\/}})\index{last}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat2-helper-bv-to-nat \\ \index{bv-to-nat2-helper-bv-to-nat}
\=\+(\=\+{\rm{at-most-one-bit-on}}\,({\it{cb\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{cb\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{bv\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\it{c2\/}} $=$ {\rm{bv-to-nat}}\,({\it{cb\/}})\index{bv-to-nat}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{bv-to-nat2-helper}}\,({\it{bv\/}}, {\it{cb\/}}, {\it{c2\/}})\index{bv-to-nat2-helper} \\ 
$=$$\;\;\;\;${\rm{bv-to-nat}}\,({\rm{append}}\,(\=\+{\rm{make-list-from}}\,(\=\+\=\+{\rm{length}}\,({\it{bv\/}})\index{length} \\ 
$-$$\;\;\;\;${\rm{trailing-zeros}}\,({\it{cb\/}})\index{trailing-zeros}\-, \\ 
{\it{bv\/}})\-\index{make-list-from}, \\ 
{\rm{zero-bit-vector}}\,({\rm{trailing-zeros}}\,({\it{cb\/}})\index{trailing-zeros})\index{zero-bit-vector})\-)\index{bv-to-nat})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat2-helper-bv-to-nat-better \\ \index{bv-to-nat2-helper-bv-to-nat-bette!r}
\=\+(\=\+{\rm{at-most-one-bit-on}}\,({\it{cb\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{cb\/}}, {\rm{length}}\,({\it{cb\/}})\index{length})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{bv\/}}, {\rm{length}}\,({\it{cb\/}})\index{length})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\it{c2\/}} $=$ {\rm{bv-to-nat}}\,({\it{cb\/}})\index{bv-to-nat}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{bv-to-nat2-helper}}\,({\it{bv\/}}, {\it{cb\/}}, {\it{c2\/}})\index{bv-to-nat2-helper} \\ 
$=$$\;\;\;\;${\rm{bv-to-nat}}\,({\rm{append}}\,(\=\+{\rm{make-list-from}}\,(\=\+\=\+{\rm{length}}\,({\it{bv\/}})\index{length} \\ 
$-$$\;\;\;\;${\rm{trailing-zeros}}\,({\it{cb\/}})\index{trailing-zeros}\-, \\ 
{\it{bv\/}})\-\index{make-list-from}, \\ 
{\rm{zero-bit-vector}}\,({\rm{trailing-zeros}}\,({\it{cb\/}})\index{trailing-zeros})\index{zero-bit-vector})\-)\index{bv-to-nat})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nlistp-bv-to-nat2 \\ \index{nlistp-bv-to-nat2}
($\neg$ {\rm{listp}}\,({\it{x\/}})) $\rightarrow$ ({\rm{bv-to-nat2-helper}}\,({\it{x\/}}, {\it{a\/}}, {\it{b\/}})\index{bv-to-nat2-helper} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat2-bv-to-nat-helper \\ \index{bv-to-nat2-bv-to-nat-helper}
({\it{x\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ ({\rm{bv-to-nat2}}\,({\it{x\/}})\index{bv-to-nat2} $=$ {\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-one-bit-vector-rewrite \\ \index{bit-vectorp-one-bit-vector-rewrite}
\=\+{\rm{bit-vectorp}}\,({\rm{one-bit-vector}}\,({\it{s\/}})\index{one-bit-vector}, {\it{n\/}})\index{bit-vectorp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{s\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\it{n\/}} $=$ {\tt{1}} \\ 
{\bf else }{\rm{fix}}\,({\it{s\/}}) $=$ {\rm{fix}}\,({\it{n\/}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  trailing-zeros-helper-one-bit-vector \\ \index{trailing-zeros-helper-one-bit-ve!ctor}
{\rm{trailing-zeros-helper}}\,({\rm{one-bit-vector}}\,({\it{n\/}})\index{one-bit-vector}, {\it{acc\/}})\index{trailing-zeros-helper} $=$ {\tt{0}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat2-bv-to-nat \\ \index{bv-to-nat2-bv-to-nat}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\rm{length}}\,({\it{x\/}})\index{length})\index{bit-vectorp} $\rightarrow$ ({\rm{bv-to-nat2}}\,({\it{x\/}})\index{bv-to-nat2} $=$ {\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-length-weaker \\ \index{bv-length-weaker}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectorp} $\rightarrow$ {\rm{bit-vectorp}}\,({\it{x\/}}, {\rm{length}}\,({\it{x\/}})\index{length})\index{bit-vectorp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-bv-to-nat \\ \index{correctness-of-bv-to-nat}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{b\/}}, {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{bv-to-nat}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{bv-to-nat}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{bv-to-nat-program}}\index{bv-to-nat-program}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{push-1-vector}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\it{word-size\/}})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;$({\it{bv\/}} $=$ {\rm{cadr}}\,({\it{b\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{bv-to-nat-input-conditionp}}\,({\it{p0\/}})\index{bv-to-nat-input-conditionp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{b\/}}, {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{bv-to-nat-clock}}\,({\it{word-size\/}}, {\it{bv\/}})\index{bv-to-nat-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{nat}}, {\rm{bv-to-nat}}\,({\it{bv\/}})\index{bv-to-nat}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{verbatim};;;; number-with-at-least


\end{verbatim}\begin{tabbing}{\sc Definition}:\index{number-with-at-least-program} \\  
\=\+{\sc{number-with-at-least-program}}\index{number-with-at-least-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{number-with-at-least}} \\ 
{\tt{(}}{\tt{nums-addr}}{\tt{ }}{\tt{numnums}}{\tt{ }}{\tt{min}}{\tt{)}} \\ 
{\tt{(}}{\tt{(}}{\tt{i}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{loop}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{nums-addr}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{fetch}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{min}}{\tt{)}} \\ 
{\tt{(}}{\tt{lt-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bool-and-jump}}{\tt{ }}{\tt{t}}{\tt{ }}{\tt{lab}}{\tt{)}} \\ 
{\tt{(}}{\tt{add1-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{lab}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numnums}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{add1-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{sub-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-nat-and-jump}}{\tt{ }}{\tt{zero}}{\tt{ }}{\tt{done}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{nums-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{add-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{nums-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{loop}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{done}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{example-number-with-at-least-st!ate} \\  
\=\+{\sc{example-number-with-at-least-state}}\index{example-number-with-at-least-st!ate} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{nums}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{5}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{number-with-at-least}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\sc{number-with-at-least-program}}\index{number-with-at-least-program})\-, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{(}}\=\+{\tt{nums}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{8}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{9}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{2}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{100}}{\tt{)}}{\tt{)}}\-{\tt{)}}\-, \\ 
{\tt{10}}, \\ 
{\tt{8}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{number-with-at-least} \\  
\=\+{\rm{number-with-at-least}}\,({\it{numlist\/}}, {\it{min\/}})\index{number-with-at-least} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{numlist\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{numlist\/}}) $<$ {\it{min\/}} \\ 
{\bf then }{\rm{number-with-at-least}}\,({\rm{cdr}}\,({\it{numlist\/}}), {\it{min\/}})\index{number-with-at-least} \\ 
{\bf else }$1\;+$ {\rm{number-with-at-least}}\,({\rm{cdr}}\,({\it{numlist\/}}), {\it{min\/}})\index{number-with-at-least}$\;${\bf  endif}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-list-piton} \\  
\=\+{\rm{nat-list-piton}}\,({\it{array\/}}, {\it{word-size\/}})\index{nat-list-piton} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{array\/}}) \\ 
{\bf then }\=\+{\rm{listp}}\,({\rm{car}}\,({\it{array\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{caar}}\,({\it{array\/}}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cadar}}\,({\it{array\/}}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{cddar}}\,({\it{array\/}}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cadar}}\,({\it{array\/}}) $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,({\rm{cdr}}\,({\it{array\/}}), {\it{word-size\/}})\index{nat-list-piton}\- \\ 
{\bf else }{\it{array\/}} $=$ {\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{number-with-at-least-general-in!duct} \\  
\=\+{\rm{number-with-at-least-general-induct}}\,({\it{i\/}}, {\it{current\/}}, {\it{n\/}}, {\it{s\/}}, {\it{min\/}}, {\it{data-segment\/}})\index{number-with-at-least-general-in!duct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\it{n\/}} \\ 
{\bf then }{\rm{number-with-at-least-general-induct}}\,(\=\+$1\;+$ {\it{i\/}}, \\ 
\=\+{\bf if }\=\+{\rm{cadr}}\,({\rm{get}}\,(\=\+{\it{i\/}}, \\ 
{\rm{array}}\,(\=\+{\it{s\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\-\index{get}) \\ 
$<$$\;\;\;\;${\it{min\/}}\-$\;\;${\bf then }{\it{current\/}} \\ 
{\bf else }$1\;+$ {\it{current\/}}$\;${\bf  endif}\-, \\ 
{\it{n\/}}, \\ 
{\it{s\/}}, \\ 
{\it{min\/}}, \\ 
{\it{data-segment\/}})\-\index{number-with-at-least-general-in!duct} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{number-with-at-least-clock-loop} \\  
\=\+{\rm{number-with-at-least-clock-loop}}\,({\it{i\/}}, {\it{min\/}}, {\it{array\/}})\index{number-with-at-least-clock-loop} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $\not<$ {\rm{length}}\,({\it{array\/}})\index{length}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }\=\+\=\+{\bf if }{\rm{cadr}}\,({\rm{get}}\,({\it{i\/}}, {\it{array\/}})\index{get}) $<$ {\it{min\/}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\- \\ 
$+$$\;\;\;\;$\=\+{\bf if }($1\;+$ {\it{i\/}}) $=$ {\rm{length}}\,({\it{array\/}})\index{length}$\;\;${\bf then }{\tt{12}} \\ 
{\bf else }{\tt{16}} $+$ {\rm{number-with-at-least-clock-loop}}\,(\=\+$1\;+$ {\it{i\/}}, \\ 
{\it{min\/}}, \\ 
{\it{array\/}})\-\index{number-with-at-least-clock-loop}$\;${\bf  endif}\-\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-difference-1 \\ \index{equal-difference-1}
(({\it{x\/}} $-$ {\it{y\/}}) $=$ {\tt{1}}) $=$ ({\it{x\/}} $=$ ($1\;+$ {\it{y\/}}))
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  nat-list-piton-means \\ \index{nat-list-piton-means}
\=\+({\rm{nat-list-piton}}\,({\it{state\/}}, {\it{size\/}})\index{nat-list-piton} $\wedge$ ({\it{p\/}} $<$ {\rm{length}}\,({\it{state\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{car}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) $=$ {\bf{nil}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  number-with-at-least-nlistp \\ \index{number-with-at-least-nlistp}
($\neg$ {\rm{listp}}\,({\it{x\/}})) $\rightarrow$ ({\rm{number-with-at-least}}\,({\it{x\/}}, {\it{min\/}})\index{number-with-at-least} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-add1-length \\ \index{equal-add1-length}
(($1\;+$ {\it{x\/}}) $=$ {\rm{length}}\,({\it{y\/}})\index{length}) $=$ ({\rm{listp}}\,({\it{y\/}}) $\wedge$ ({\rm{fix}}\,({\it{x\/}}) $=$ {\rm{length}}\,({\rm{cdr}}\,({\it{y\/}}))\index{length}))
\end{tabbing}


\noindent{\sc Event}:   Disable number-with-at-least-clock-loop.

\addvspace{18pt}


\begin{tabbing}{\sc Theorem}:  length-cdr-untag-array \\ \index{length-cdr-untag-array}
{\rm{length}}\,({\rm{cdr}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array}))\index{length} $=$ {\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  number-with-at-least-correctness-general \\ \index{number-with-at-least-correctnes!s-general}
\=\+(\=\+({\rm{length}}\,({\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array})\index{length} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{word-size\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,({\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array}, {\it{word-size\/}})\index{nat-list-piton} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{3}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{number-with-at-least}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\sc{number-with-at-least-program}}\index{number-with-at-least-program})\- \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\it{s\/}}, {\it{data-segment\/}})\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\it{min\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{min\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $<$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{current\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $\not<$ {\it{current\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $=$ {\rm{length}}\,({\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array})\index{length}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{number-with-at-least}}{\tt{ .\ }}{\tt{2}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{list}}\,(\=\+{\rm{cons}}\,({\tt{'}}{\tt{nums-addr}}, {\rm{list}}\,({\tt{'}}{\tt{addr}}, {\rm{cons}}\,({\it{s\/}}, {\it{i\/}}))), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{numnums}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{n\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{min}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{min\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{i}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{i\/}})))\-, \\ 
{\it{ret-pc\/}})\-, \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{current\/}}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{number-with-at-least-clock-loop}}\,({\it{i\/}}, {\it{min\/}}, {\rm{array}}\,({\it{s\/}}, {\it{data-segment\/}})\index{array})\index{number-with-at-least-clock-loop})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\tt{'}}{\tt{nat}}, \\ 
{\it{current\/}} $+$ {\rm{number-with-at-least}}\,(\=\+{\rm{nthcdr}}\,(\=\+{\it{i\/}}, \\ 
{\rm{untag-array}}\,({\rm{array}}\,(\=\+{\it{s\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\index{untag-array})\-\index{nthcdr}, \\ 
{\it{min\/}})\-\index{number-with-at-least})\-, \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{number-with-at-least-clock} \\  
\=\+{\rm{number-with-at-least-clock}}\,({\it{min\/}}, {\it{array\/}})\index{number-with-at-least-clock} \\ 
$=$$\;\;\;\;$({\tt{3}} $+$ {\rm{number-with-at-least-clock-loop}}\,({\tt{0}}, {\it{min\/}}, {\it{array\/}})\index{number-with-at-least-clock-loop})\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{number-with-at-least-input-conditi!onp} \\  
\=\+{\rm{number-with-at-least-input-conditionp}}\,({\it{p0\/}})\index{number-with-at-least-input-conditi!onp} \\ 
$=$$\;\;\;\;$(\=\+({\rm{car}}\,({\rm{car}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{car}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{cadr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{cadr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{caddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdadr}}\,({\rm{caddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{caddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{cadr}}\,({\rm{caddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{length}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{cadr}}\,({\rm{caddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{length} \\ 
$<$$\;\;\;\;${\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp})\- \\ 
$\wedge$$\;\;\;\;$({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}) \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,(\=\+{\rm{array}}\,(\=\+{\rm{car}}\,({\rm{cadr}}\,({\rm{caddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\-\index{nat-list-piton} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{6}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{0}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{number-with-at-least}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\sc{number-with-at-least-program}}\index{number-with-at-least-program})\- \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\rm{car}}\,({\rm{cadr}}\,({\rm{caddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))), {\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{car}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})) $<$ {\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{car}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\rm{cadr}}\,({\rm{cadr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{cadr}}\,({\rm{cadr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})) \\ 
$=$$\;\;\;\;${\rm{length}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{cadr}}\,({\rm{caddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{length})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-number-with-at-least \\ \index{correctness-of-number-with-at-le!ast}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{m\/}}, {\rm{cons}}\,({\it{n\/}}, {\rm{cons}}\,({\it{s\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{number-with-at-least}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;${\rm{number-with-at-least-input-conditionp}}\,({\it{p0\/}})\index{number-with-at-least-input-conditi!onp} \\ 
$\wedge$$\;\;\;\;$({\it{minc\/}} $=$ {\rm{cadr}}\,({\it{m\/}})) \\ 
$\wedge$$\;\;\;\;$({\it{arrayc\/}} $=$ {\rm{array}}\,({\rm{car}}\,({\rm{cadr}}\,({\it{s\/}})), {\it{data-segment\/}})\index{array}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{m\/}}, {\rm{cons}}\,({\it{n\/}}, {\rm{cons}}\,({\it{s\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{number-with-at-least-clock}}\,({\it{minc\/}}, {\it{arrayc\/}})\index{number-with-at-least-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\tt{'}}{\tt{nat}}, \\ 
{\rm{number-with-at-least}}\,(\=\+{\rm{untag-array}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{cadr}}\,({\it{s\/}})), \\ 
{\it{data-segment\/}})\-\index{array})\index{untag-array}, \\ 
{\rm{cadr}}\,({\it{m\/}}))\-\index{number-with-at-least})\-, \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{verbatim};; highest-bit


\end{verbatim}\begin{tabbing}{\sc Definition}:\index{highest-bit-program} \\  
\=\+{\sc{highest-bit-program}}\index{highest-bit-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{highest-bit}} \\ 
{\tt{(}}{\tt{bv}}{\tt{)}} \\ 
{\tt{(}}{\tt{(}}{\tt{cb}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{push-1-vector}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{cb}}{\tt{)}} \\ 
{\tt{(}}{\tt{rsh-bitv}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{loop}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{cb}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bitv-and-jump}}{\tt{ }}{\tt{all-zero}}{\tt{ }}{\tt{done}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{bv}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{cb}}{\tt{)}} \\ 
{\tt{(}}{\tt{and-bitv}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bitv-and-jump}}{\tt{ }}{\tt{all-zero}}{\tt{ }}{\tt{lab}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{cb}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{lab}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{cb}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{lsh-bitv}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{cb}}{\tt{)}} \\ 
{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{loop}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{done}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{example-highest-bit-state} \\  
\=\+{\sc{example-highest-bit-state}}\index{example-highest-bit-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{highest-bit}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{highest-bit}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{highest-bit}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\sc{highest-bit-program}}\index{highest-bit-program}, \\ 
{\rm{push-1-vector-program}}\,({\tt{8}})\index{push-1-vector-program})\-, \\ 
{\bf{nil}}, \\ 
{\tt{10}}, \\ 
{\tt{8}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{highest-bit} \\  
\=\+{\rm{highest-bit}}\,({\it{x\/}})\index{highest-bit} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{0}}$\;\;${\bf then }{\rm{cons}}\,({\tt{0}}, {\rm{highest-bit}}\,({\rm{cdr}}\,({\it{x\/}}))\index{highest-bit}) \\ 
{\bf else }{\rm{cons}}\,({\tt{1}}, {\rm{zero-bit-vector}}\,({\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length})\index{zero-bit-vector})$\;${\bf  endif}\- \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-highest-bit \\ \index{listp-highest-bit}
{\rm{listp}}\,({\rm{highest-bit}}\,({\it{x\/}})\index{highest-bit}) $=$ {\rm{listp}}\,({\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-highest-bit \\ \index{length-highest-bit}
{\rm{length}}\,({\rm{highest-bit}}\,({\it{x\/}})\index{highest-bit})\index{length} $=$ {\rm{length}}\,({\it{x\/}})\index{length}
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{highest-bit-loop-clock} \\  
\=\+{\rm{highest-bit-loop-clock}}\,({\it{cb\/}}, {\it{bv\/}})\index{highest-bit-loop-clock} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\it{cb\/}})\index{all-zero-bitvp}$\;\;${\bf then }{\tt{3}} \\ 
{\bf else }\=\+{\tt{10}} \\ 
$+$$\;\;\;\;$\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{cb\/}}, {\it{bv\/}})\index{and-bitv})\index{all-zero-bitvp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{2}}$\;${\bf  endif}\- \\ 
$+$$\;\;\;\;${\rm{highest-bit-loop-clock}}\,({\rm{append}}\,({\rm{cdr}}\,({\it{cb\/}}), {\tt{'}}{\tt{(}}{\tt{0}}{\tt{)}}), {\it{bv\/}})\index{highest-bit-loop-clock}\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{highest-bit-induct} \\  
\=\+{\rm{highest-bit-induct}}\,({\it{current\/}}, {\it{bv\/}}, {\it{cb\/}})\index{highest-bit-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\it{cb\/}})\index{all-zero-bitvp}$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{highest-bit-induct}}\,(\=\+\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{cb\/}}, {\it{bv\/}})\index{and-bitv})\index{all-zero-bitvp} \\ 
{\bf then }{\it{current\/}} \\ 
{\bf else }{\it{cb\/}}$\;${\bf  endif}\-, \\ 
{\it{bv\/}}, \\ 
{\rm{append}}\,({\rm{cdr}}\,({\it{cb\/}}), {\tt{'}}{\tt{(}}{\tt{0}}{\tt{)}}))\-\index{highest-bit-induct}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-simple-not \\ \index{bit-vectorp-simple-not}
({\rm{length}}\,({\it{x\/}})\index{length} $\not=$ {\rm{fix}}\,({\it{y\/}})) $\rightarrow$ ($\neg$ {\rm{bit-vectorp}}\,({\it{x\/}}, {\it{y\/}})\index{bit-vectorp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  at-most-one-bit-on-cdr \\ \index{at-most-one-bit-on-cdr}
{\rm{at-most-one-bit-on}}\,({\it{x\/}})\index{at-most-one-bit-on} $\rightarrow$ {\rm{at-most-one-bit-on}}\,({\rm{cdr}}\,({\it{x\/}}))\index{at-most-one-bit-on}
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  equal-one-bit-vector \\ \index{equal-one-bit-vector}
\=\+({\it{x\/}} $=$ {\rm{one-bit-vector}}\,({\it{z\/}})\index{one-bit-vector}) \\ 
$=$$\;\;\;\;$(\=\+(({\it{z\/}} $\simeq {\tt{0}}$) $\wedge$ ({\it{x\/}} $=$ {\tt{'}}{\tt{(}}{\tt{1}}{\tt{)}})) \\ 
$\vee$$\;\;\;\;$(\=\+{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{z\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{all-zero-bitvp}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})\index{all-zero-bitvp} \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{x\/}})\index{last} $\not=$ {\tt{0}}))\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  at-most-one-bit-is-all-zeros \\ \index{at-most-one-bit-is-all-zeros}
\=\+({\rm{last}}\,({\it{x\/}})\index{last} $\not=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{at-most-one-bit-on}}\,({\it{x\/}})\index{at-most-one-bit-on} $=$ {\rm{all-zero-bitvp}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})\index{all-zero-bitvp})\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{highest-bit2-helper} \\  
\=\+{\rm{highest-bit2-helper}}\,({\it{current\/}}, {\it{cb\/}}, {\it{bv\/}})\index{highest-bit2-helper} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\it{cb\/}})\index{all-zero-bitvp}$\;\;${\bf then }{\it{current\/}} \\ 
{\bf else }{\rm{highest-bit2-helper}}\,(\=\+\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{bv\/}}, {\it{cb\/}})\index{and-bitv})\index{all-zero-bitvp} \\ 
{\bf then }{\it{current\/}} \\ 
{\bf else }{\it{cb\/}}$\;${\bf  endif}\-, \\ 
{\rm{append}}\,({\rm{cdr}}\,({\it{cb\/}}), {\tt{'}}{\tt{(}}{\tt{0}}{\tt{)}}), \\ 
{\it{bv\/}})\-\index{highest-bit2-helper}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-x-zero-bit-vector \\ \index{equal-x-zero-bit-vector}
({\it{x\/}} $=$ {\rm{zero-bit-vector}}\,({\it{y\/}})\index{zero-bit-vector}) $=$ ({\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\wedge$ {\rm{bit-vectorp}}\,({\it{x\/}}, {\it{y\/}})\index{bit-vectorp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-all-but-last-simple \\ \index{all-zero-bitvp-all-but-last-simp!le}
{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\rightarrow$ {\rm{all-zero-bitvp}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})\index{all-zero-bitvp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-trailing-zeros-acc-irrelevant \\ \index{equal-trailing-zeros-acc-irrelev!ant}
\=\+({\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc1\/}})\index{trailing-zeros-helper} $=$ {\rm{trailing-zeros-helper}}\,({\it{x\/}}, {\it{acc2\/}})\index{trailing-zeros-helper}) \\ 
$=$$\;\;\;\;$(({\rm{fix}}\,({\it{acc1\/}}) $=$ {\rm{fix}}\,({\it{acc2\/}})) $\vee$ ($\neg$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-trailing-zeros \\ \index{lessp-trailing-zeros}
($\neg$ {\rm{all-zero-bitvp}}\,({\it{z\/}})\index{all-zero-bitvp}) $\rightarrow$ ({\rm{trailing-zeros-helper}}\,({\it{z\/}}, {\it{acc\/}})\index{trailing-zeros-helper} $<$ {\rm{length}}\,({\it{z\/}})\index{length})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-append \\ \index{nthcdr-append}
\=\+{\rm{nthcdr}}\,({\it{n\/}}, {\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{nthcdr} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{length}}\,({\it{x\/}})\index{length} $<$ {\it{n\/}}$\;\;${\bf then }{\rm{nthcdr}}\,({\it{n\/}} $-$ {\rm{length}}\,({\it{x\/}})\index{length}, {\it{y\/}})\index{nthcdr} \\ 
{\bf else }{\rm{append}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{x\/}})\index{nthcdr}, {\it{y\/}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-zero-bit-vector \\ \index{listp-zero-bit-vector}
{\rm{listp}}\,({\rm{zero-bit-vector}}\,({\it{x\/}})\index{zero-bit-vector}) $=$ ({\it{x\/}} $\not\simeq {\tt{0}}$)
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  and-bitv-append \\ \index{and-bitv-append}
\=\+{\rm{and-bitv}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}), {\it{z\/}})\index{and-bitv} \\ 
$=$$\;\;\;\;${\rm{append}}\,(\=\+{\rm{and-bitv}}\,({\it{x\/}}, {\rm{make-list-from}}\,({\rm{length}}\,({\it{x\/}})\index{length}, {\it{z\/}})\index{make-list-from})\index{and-bitv}, \\ 
{\rm{and-bitv}}\,({\it{y\/}}, {\rm{nthcdr}}\,({\rm{length}}\,({\it{x\/}})\index{length}, {\it{z\/}})\index{nthcdr})\index{and-bitv})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  and-bitv-append2 \\ \index{and-bitv-append2}
\=\+({\rm{length}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{length} $=$ {\rm{length}}\,({\it{z\/}})\index{length}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{and-bitv}}\,({\it{z\/}}, {\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{and-bitv} \\ 
$=$$\;\;\;\;${\rm{append}}\,(\=\+{\rm{and-bitv}}\,({\it{x\/}}, {\rm{make-list-from}}\,({\rm{length}}\,({\it{x\/}})\index{length}, {\it{z\/}})\index{make-list-from})\index{and-bitv}, \\ 
{\rm{and-bitv}}\,({\it{y\/}}, {\rm{nthcdr}}\,({\rm{length}}\,({\it{x\/}})\index{length}, {\it{z\/}})\index{nthcdr})\index{and-bitv})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-and-bitv-append \\ \index{all-zero-bitvp-and-bitv-append}
\=\+{\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{z\/}}, {\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{and-bitv})\index{all-zero-bitvp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\rm{make-list-from}}\,({\rm{length}}\,({\it{x\/}})\index{length}, {\it{z\/}})\index{make-list-from}, {\it{x\/}})\index{and-bitv})\index{all-zero-bitvp} \\ 
$\wedge$$\;\;\;\;${\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\rm{nthcdr}}\,({\rm{length}}\,({\it{x\/}})\index{length}, {\it{z\/}})\index{nthcdr}, {\it{y\/}})\index{and-bitv})\index{all-zero-bitvp})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-cdr-zero-bit-vector \\ \index{length-cdr-zero-bit-vector}
{\rm{length}}\,({\rm{cdr}}\,({\rm{zero-bit-vector}}\,({\it{x\/}})\index{zero-bit-vector}))\index{length} $=$ ({\it{x\/}} $-\;1$)
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-nthcdr \\ \index{length-nthcdr}
{\rm{length}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{x\/}})\index{nthcdr})\index{length} $=$ ({\rm{length}}\,({\it{x\/}})\index{length} $-$ {\it{n\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable and-bitv-special.

\addvspace{18pt}

\noindent{\sc Event}:   Disable and-bitv-special-special.

\addvspace{18pt}

\noindent{\sc Event}:   Disable and-bitv-special-3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable and-bitv-special-4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable and-bitv-special-5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable and-bitv-special-6.

\addvspace{18pt}


\begin{tabbing}{\sc Theorem}:  bit-vectorp-zero-bit-vector-better \\ \index{bit-vectorp-zero-bit-vector-bette!r}
{\rm{bit-vectorp}}\,({\rm{zero-bit-vector}}\,({\it{x\/}})\index{zero-bit-vector}, {\it{size\/}})\index{bit-vectorp} $=$ ({\rm{fix}}\,({\it{x\/}}) $=$ {\rm{fix}}\,({\it{size\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  highest-bit-correctness-general \\ \index{highest-bit-correctness-general}
\=\+(\=\+({\it{word-size\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{cb\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{3}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{highest-bit}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{highest-bit-program}}\index{highest-bit-program}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{bv\/}}, {\it{word-size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{cb\/}}, {\it{word-size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{current\/}}, {\it{word-size\/}})\index{bit-vectorp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{highest-bit}}{\tt{ .\ }}{\tt{3}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{list}}\,(\=\+{\rm{cons}}\,({\tt{'}}{\tt{bv}}, {\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{bv\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{cb}}, {\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{cb\/}})))\-, \\ 
{\it{ret-pc\/}})\-, \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{current\/}}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{highest-bit-loop-clock}}\,({\it{cb\/}}, {\it{bv\/}})\index{highest-bit-loop-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\rm{highest-bit2-helper}}\,({\it{current\/}}, {\it{cb\/}}, {\it{bv\/}})\index{highest-bit2-helper}), \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  make-list-from-simple \\ \index{make-list-from-simple}
({\it{n\/}} $\simeq {\tt{0}}$) $\rightarrow$ ({\rm{make-list-from}}\,({\it{n\/}}, {\it{x\/}})\index{make-list-from} $=$ {\bf{nil}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  not-all-zero-bitvp-make-list-from \\ \index{not-all-zero-bitvp-make-list-fr!om}
\=\+({\rm{all-zero-bitvp}}\,({\rm{make-list-from}}\,({\it{n1\/}}, {\it{x\/}})\index{make-list-from})\index{all-zero-bitvp} $\wedge$ ({\it{n1\/}} $\not<$ {\it{n2\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{all-zero-bitvp}}\,({\rm{make-list-from}}\,({\it{n2\/}}, {\it{x\/}})\index{make-list-from})\index{all-zero-bitvp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable nthcdr-open.

\addvspace{18pt}

\begin{verbatim};(prove-lemma listp-append (rewrite)
;	     (equal
;	      (listp (append x y))
;	      (or (listp x) (listp y))))
\end{verbatim}
\noindent{\sc Event}:   Enable listp-append.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  highest-bit2-helper-cons-1 \\ \index{highest-bit2-helper-cons-1}
\=\+(\=\+($\neg$ {\rm{all-zero-bitvp}}\,({\it{cb\/}})\index{all-zero-bitvp}) \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{cb\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{cb\/}})\index{length} $=$ {\rm{length}}\,({\it{bv\/}})\index{length}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{cb\/}}, {\rm{length}}\,({\it{cb\/}})\index{length})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{bv\/}}) $=$ {\tt{1}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{highest-bit2-helper}}\,({\it{current\/}}, {\it{cb\/}}, {\it{bv\/}})\index{highest-bit2-helper} \\ 
$=$$\;\;\;\;${\rm{cons}}\,({\tt{1}}, {\rm{zero-bit-vector}}\,({\rm{length}}\,({\rm{cdr}}\,({\it{bv\/}}))\index{length})\index{zero-bit-vector}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-append-cdr-hack \\ \index{bit-vectorp-append-cdr-hack}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{n\/}})\index{bit-vectorp} $\rightarrow$ ({\rm{bit-vectorp}}\,({\rm{append}}\,({\rm{cdr}}\,({\it{x\/}}), {\tt{'}}{\tt{(}}{\tt{0}}{\tt{)}}), {\it{n\/}})\index{bit-vectorp} $=$ {\rm{listp}}\,({\it{x\/}}))
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{triple-cdr-with-sub1-induct} \\  
\=\+{\rm{triple-cdr-with-sub1-induct}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}}, {\it{n\/}})\index{triple-cdr-with-sub1-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{triple-cdr-with-sub1-induct}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{cdr}}\,({\it{y\/}}), {\rm{cdr}}\,({\it{z\/}}), {\it{n\/}} $-\;1$)\index{triple-cdr-with-sub1-induct}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  car-append-better \\ \index{car-append-better}
\=\+{\rm{car}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}})) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{car}}\,({\it{x\/}}) \\ 
{\bf else }{\rm{car}}\,({\it{y\/}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  open-highest-when-and-not-0 \\ \index{open-highest-when-and-not-0}
\=\+(($\neg$ {\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv})\index{all-zero-bitvp}) $\wedge$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{highest-bit2-helper}}\,({\it{c\/}}, {\it{x\/}}, {\it{y\/}})\index{highest-bit2-helper} \\ 
$=$$\;\;\;\;${\rm{highest-bit2-helper}}\,({\it{x\/}}, {\rm{append}}\,({\rm{cdr}}\,({\it{x\/}}), {\tt{'}}{\tt{(}}{\tt{0}}{\tt{)}}), {\it{y\/}})\index{highest-bit2-helper})\-\-
\end{tabbing}

\begin{verbatim};(prove-lemma cdr-append (rewrite)
;	     (equal
;	      (cdr (append x y))
;	      (if (listp x)
;		  (append (cdr x) y)
;		(cdr y))))
\end{verbatim}
\noindent{\sc Event}:   Enable cdr-append.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  highest-bit2-helper-cons-0 \\ \index{highest-bit2-helper-cons-0}
\=\+(\=\+($\neg$ {\rm{all-zero-bitvp}}\,({\it{cb\/}})\index{all-zero-bitvp}) \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{cb\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{cb\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{bv\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{current\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{bv\/}}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{current\/}}) $=$ {\tt{0}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{highest-bit2-helper}}\,({\it{current\/}}, {\it{cb\/}}, {\it{bv\/}})\index{highest-bit2-helper} \\ 
$=$$\;\;\;\;${\rm{cons}}\,({\tt{0}}, {\rm{highest-bit2-helper}}\,({\rm{cdr}}\,({\it{current\/}}), {\rm{cdr}}\,({\it{cb\/}}), {\rm{cdr}}\,({\it{bv\/}}))\index{highest-bit2-helper}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  highest-bit2-helper-cons-0-rewrite \\ \index{highest-bit2-helper-cons-0-rewrite}
\=\+(\=\+($\neg$ {\rm{all-zero-bitvp}}\,({\it{cb\/}})\index{all-zero-bitvp}) \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{cb\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{cb\/}}, {\rm{length}}\,({\it{cb\/}})\index{length})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{bv\/}}, {\rm{length}}\,({\it{cb\/}})\index{length})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{current\/}}, {\rm{length}}\,({\it{cb\/}})\index{length})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{bv\/}}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{current\/}}) $=$ {\tt{0}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{highest-bit2-helper}}\,({\it{current\/}}, {\it{cb\/}}, {\it{bv\/}})\index{highest-bit2-helper} \\ 
$=$$\;\;\;\;${\rm{cons}}\,({\tt{0}}, {\rm{highest-bit2-helper}}\,({\rm{cdr}}\,({\it{current\/}}), {\rm{cdr}}\,({\it{cb\/}}), {\rm{cdr}}\,({\it{bv\/}}))\index{highest-bit2-helper}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  append-zeros-0 \\ \index{append-zeros-0}
({\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\wedge$ {\rm{properp}}\,({\it{x\/}})\index{properp}) $\rightarrow$ ({\rm{append}}\,({\it{x\/}}, {\tt{'}}{\tt{(}}{\tt{0}}{\tt{)}}) $=$ {\rm{cons}}\,({\tt{0}}, {\it{x\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  highest-bit2-helper-cons-helper \\ \index{highest-bit2-helper-cons-helper}
\=\+(\=\+{\rm{bit-vectorp}}\,({\it{bv\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{cb\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{cb\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{current\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\it{cb\/}})\index{all-zero-bitvp}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{all-zero-bitvp}}\,({\it{current\/}})\index{all-zero-bitvp} \\ 
$\vee$$\;\;\;\;$({\rm{trailing-zeros}}\,({\it{current\/}})\index{trailing-zeros} $<$ {\rm{trailing-zeros}}\,({\it{cb\/}})\index{trailing-zeros}))\- \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{current\/}}, {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\it{size\/}} $\not\simeq {\tt{0}}$))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{highest-bit2-helper}}\,({\it{current\/}}, {\it{cb\/}}, {\it{bv\/}})\index{highest-bit2-helper} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{car}}\,({\it{bv\/}}) $=$ {\tt{0}} \\ 
{\bf then }{\rm{cons}}\,(\=\+{\tt{0}}, \\ 
{\rm{highest-bit2-helper}}\,({\rm{cdr}}\,({\it{current\/}}), {\rm{cdr}}\,({\it{cb\/}}), {\rm{cdr}}\,({\it{bv\/}}))\index{highest-bit2-helper})\- \\ 
{\bf else }{\rm{cons}}\,({\tt{1}}, {\rm{zero-bit-vector}}\,({\it{size\/}} $-\;1$)\index{zero-bit-vector})$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  highest-bit2-helper-cons-helper-rewrite \\ \index{highest-bit2-helper-cons-helper!-rewrite}
\=\+(\=\+{\rm{bit-vectorp}}\,({\it{bv\/}}, {\rm{length}}\,({\it{bv\/}})\index{length})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{cb\/}}, {\rm{length}}\,({\it{bv\/}})\index{length})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{cb\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;${\rm{at-most-one-bit-on}}\,({\it{current\/}})\index{at-most-one-bit-on} \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\it{cb\/}})\index{all-zero-bitvp}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{all-zero-bitvp}}\,({\it{current\/}})\index{all-zero-bitvp} \\ 
$\vee$$\;\;\;\;$({\rm{trailing-zeros}}\,({\it{current\/}})\index{trailing-zeros} $<$ {\rm{trailing-zeros}}\,({\it{cb\/}})\index{trailing-zeros}))\- \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{current\/}}, {\rm{length}}\,({\it{bv\/}})\index{length})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{bv\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{highest-bit2-helper}}\,({\it{current\/}}, {\it{cb\/}}, {\it{bv\/}})\index{highest-bit2-helper} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{car}}\,({\it{bv\/}}) $=$ {\tt{0}} \\ 
{\bf then }{\rm{cons}}\,(\=\+{\tt{0}}, \\ 
{\rm{highest-bit2-helper}}\,({\rm{cdr}}\,({\it{current\/}}), {\rm{cdr}}\,({\it{cb\/}}), {\rm{cdr}}\,({\it{bv\/}}))\index{highest-bit2-helper})\- \\ 
{\bf else }{\rm{cons}}\,({\tt{1}}, {\rm{zero-bit-vector}}\,({\rm{length}}\,({\it{bv\/}})\index{length} $-\;1$)\index{zero-bit-vector})$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-cdr-from-free \\ \index{bit-vectorp-cdr-from-free}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{n\/}})\index{bit-vectorp} $\rightarrow$ ({\rm{bit-vectorp}}\,({\rm{cdr}}\,({\it{x\/}}), {\it{s\/}})\index{bit-vectorp} $=$ (($1\;+$ {\it{s\/}}) $=$ {\it{n\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-one-bit-vector \\ \index{all-zero-bitvp-one-bit-vector}
$\neg$ {\rm{all-zero-bitvp}}\,({\rm{one-bit-vector}}\,({\it{x\/}})\index{one-bit-vector})\index{all-zero-bitvp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  trailing-zeros-one-bit-vector \\ \index{trailing-zeros-one-bit-vector}
{\rm{trailing-zeros}}\,({\rm{one-bit-vector}}\,({\it{n\/}})\index{one-bit-vector})\index{trailing-zeros} $=$ {\tt{0}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-zero-one-bit-vector \\ \index{cdr-zero-one-bit-vector}
\=\+(\=\+{\rm{cdr}}\,({\rm{one-bit-vector}}\,({\it{x\/}})\index{one-bit-vector}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $<$ {\tt{2}}$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{one-bit-vector}}\,({\it{x\/}} $-\;1$)\index{one-bit-vector}$\;${\bf  endif}\-)\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{cdr}}\,({\rm{zero-bit-vector}}\,({\it{x\/}})\index{zero-bit-vector}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{zero-bit-vector}}\,({\it{x\/}} $-\;1$)\index{zero-bit-vector}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  highest-bit2-helper-highest-bit \\ \index{highest-bit2-helper-highest-bit}
\=\+({\rm{bit-vectorp}}\,({\it{bv\/}}, {\it{word-size\/}})\index{bit-vectorp} $\wedge$ ({\it{word-size\/}} $\not\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{highest-bit2-helper}}\,(\=\+{\rm{zero-bit-vector}}\,({\it{word-size\/}})\index{zero-bit-vector}, \\ 
{\rm{one-bit-vector}}\,({\it{word-size\/}})\index{one-bit-vector}, \\ 
{\it{bv\/}})\-\index{highest-bit2-helper} \\ 
$=$$\;\;\;\;${\rm{highest-bit}}\,({\it{bv\/}})\index{highest-bit})\-\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{highest-bit-input-conditionp} \\  
\=\+{\rm{highest-bit-input-conditionp}}\,({\it{p0\/}})\index{highest-bit-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{bitv}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{6}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{2}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{highest-bit}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\sc{highest-bit-program}}\index{highest-bit-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{push-1-vector}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}), {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{bit-vectorp})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{highest-bit-clock} \\  
\=\+{\rm{highest-bit-clock}}\,({\it{bv\/}})\index{highest-bit-clock} \\ 
$=$$\;\;\;\;$({\tt{6}} $+$ {\rm{highest-bit-loop-clock}}\,({\rm{one-bit-vector}}\,({\rm{length}}\,({\it{bv\/}})\index{length})\index{one-bit-vector}, {\it{bv\/}})\index{highest-bit-loop-clock})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cons-0-zero-bit-vector \\ \index{cons-0-zero-bit-vector}
{\rm{cons}}\,({\tt{0}}, {\rm{zero-bit-vector}}\,({\it{x\/}})\index{zero-bit-vector}) $=$ {\rm{zero-bit-vector}}\,($1\;+$ {\it{x\/}})\index{zero-bit-vector}
\end{tabbing}


\noindent{\sc Event}:   Disable cons-0-zero-bit-vector.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-highest-bit \\ \index{correctness-of-highest-bit}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{b\/}}, {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{highest-bit}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$({\it{bc\/}} $=$ {\rm{cadr}}\,({\it{b\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{highest-bit-input-conditionp}}\,({\it{p0\/}})\index{highest-bit-input-conditionp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{b\/}}, {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{highest-bit-clock}}\,({\it{bc\/}})\index{highest-bit-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\rm{highest-bit}}\,({\rm{cadr}}\,({\it{b\/}}))\index{highest-bit}), {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}
	



\begin{verbatim};; match-and-xor

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{match-and-xor-program} \\  
\=\+{\sc{match-and-xor-program}}\index{match-and-xor-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{match-and-xor}} \\ 
{\tt{(}}{\tt{vecs}}{\tt{ }}{\tt{numvecs}}{\tt{ }}{\tt{match}}{\tt{ }}{\tt{xor-vector}}{\tt{)}} \\ 
{\tt{(}}{\tt{(}}{\tt{i}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{loop}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{vecs}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{fetch}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{match}}{\tt{)}} \\ 
{\tt{(}}{\tt{and-bitv}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bitv-and-jump}}{\tt{ }}{\tt{not-all-zeros}}{\tt{ }}{\tt{found}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{add1-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numvecs}}{\tt{)}} \\ 
{\tt{(}}{\tt{lt-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bool-and-jump}}{\tt{ }}{\tt{f}}{\tt{ }}{\tt{done}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{vecs}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{add-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{vecs}}{\tt{)}} \\ 
{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{loop}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{found}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{vecs}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{fetch}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{xor-vector}}{\tt{)}} \\ 
{\tt{(}}{\tt{xor-bitv}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{vecs}}{\tt{)}} \\ 
{\tt{(}}{\tt{deposit}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{done}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{example-match-and-xor-p-state} \\  
\=\+{\sc{example-match-and-xor-p-state}}\index{example-match-and-xor-p-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{6}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{match-and-xor}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\sc{match-and-xor-program}}\index{match-and-xor-program})\-, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{(}}\=\+{\tt{arr}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}}{\tt{)}}\-{\tt{)}}\-, \\ 
{\tt{10}}, \\ 
{\tt{8}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{match-and-xor} \\  
\=\+{\rm{match-and-xor}}\,({\it{bvs\/}}, {\it{match\/}}, {\it{xor-vector\/}})\index{match-and-xor} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{bvs\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\rm{car}}\,({\it{bvs\/}}), {\it{match\/}})\index{and-bitv})\index{all-zero-bitvp} \\ 
{\bf then }{\rm{cons}}\,({\rm{car}}\,({\it{bvs\/}}), {\rm{match-and-xor}}\,({\rm{cdr}}\,({\it{bvs\/}}), {\it{match\/}}, {\it{xor-vector\/}})\index{match-and-xor}) \\ 
{\bf else }{\rm{cons}}\,({\rm{xor-bitv}}\,({\rm{car}}\,({\it{bvs\/}}), {\it{xor-vector\/}})\index{xor-bitv}, {\rm{cdr}}\,({\it{bvs\/}}))$\;${\bf  endif}\- \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{match-and-xor-loop-clock} \\  
\=\+{\rm{match-and-xor-loop-clock}}\,({\it{bvs\/}}, {\it{match\/}})\index{match-and-xor-loop-clock} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{bvs\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\rm{car}}\,({\it{bvs\/}}), {\it{match\/}})\index{and-bitv})\index{all-zero-bitvp} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{bvs\/}})) \\ 
{\bf then }{\tt{16}} $+$ {\rm{match-and-xor-loop-clock}}\,({\rm{cdr}}\,({\it{bvs\/}}), {\it{match\/}})\index{match-and-xor-loop-clock} \\ 
{\bf else }{\tt{12}}$\;${\bf  endif}\- \\ 
{\bf else }{\tt{12}}$\;${\bf  endif}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{tag-array} \\  
\=\+{\rm{tag-array}}\,({\it{tag\/}}, {\it{array\/}})\index{tag-array} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{array\/}}) \\ 
{\bf then }{\rm{cons}}\,({\rm{tag}}\,({\it{tag\/}}, {\rm{car}}\,({\it{array\/}}))\index{tag}, {\rm{tag-array}}\,({\it{tag\/}}, {\rm{cdr}}\,({\it{array\/}}))\index{tag-array}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{match-and-xor-general-induct} \\  
\=\+{\rm{match-and-xor-general-induct}}\,({\it{numvecs\/}}, {\it{i\/}})\index{match-and-xor-general-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\it{numvecs\/}}$\;\;${\bf then }{\rm{match-and-xor-general-induct}}\,({\it{numvecs\/}}, $1\;+$ {\it{i\/}})\index{match-and-xor-general-induct} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tag-array-untag-array \\ \index{tag-array-untag-array}
\=\+{\rm{bit-vectors-piton}}\,({\it{x\/}}, {\rm{length}}\,({\rm{untag}}\,({\rm{car}}\,({\it{x\/}}))\index{untag})\index{length})\index{bit-vectors-piton} \\ 
$\rightarrow$$\;\;\;\;$({\rm{tag-array}}\,({\tt{'}}{\tt{bitv}}, {\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{tag-array} $=$ {\it{x\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectors-piton-free-means \\ \index{bit-vectors-piton-free-means}
\=\+{\rm{bit-vectors-piton}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectors-piton} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{bit-vectors-piton}}\,({\it{x\/}}, {\rm{length}}\,({\rm{cadr}}\,({\rm{car}}\,({\it{x\/}})))\index{length})\index{bit-vectors-piton} \\ 
$\wedge$$\;\;\;\;$({\rm{bit-vectors-piton}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{length}}\,({\rm{cadr}}\,({\rm{cadr}}\,({\it{x\/}})))\index{length})\index{bit-vectors-piton} $=$ {\rm{listp}}\,({\it{x\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-cdr-nthcdr \\ \index{listp-cdr-nthcdr}
{\rm{listp}}\,({\rm{cdr}}\,({\rm{nthcdr}}\,({\it{i\/}}, {\it{x\/}})\index{nthcdr})) $=$ ({\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-untag-array \\ \index{nthcdr-untag-array}
\=\+{\rm{nthcdr}}\,({\it{i\/}}, {\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{nthcdr} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length}$\;\;${\bf then }{\rm{untag-array}}\,({\rm{nthcdr}}\,({\it{i\/}}, {\it{x\/}})\index{nthcdr})\index{untag-array} \\ 
{\bf elseif }{\rm{fix}}\,({\it{i\/}}) $=$ {\rm{length}}\,({\it{x\/}})\index{length}$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  put-length-cdr \\ \index{put-length-cdr}
\=\+{\rm{properp}}\,({\it{x\/}})\index{properp} \\ 
$\rightarrow$$\;\;\;\;$({\rm{put}}\,({\it{val\/}}, {\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length}, {\it{x\/}})\index{put} $=$ {\rm{append}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last}, {\rm{list}}\,({\it{val\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-length-cdr \\ \index{nthcdr-length-cdr}
\=\+{\rm{properp}}\,({\it{x\/}})\index{properp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{nthcdr}}\,({\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length}, {\it{x\/}})\index{nthcdr} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{list}}\,({\rm{last}}\,({\it{x\/}})\index{last}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  get-length-cdr \\ \index{get-length-cdr}
\=\+{\rm{get}}\,({\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length}, {\it{x\/}})\index{get} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{last}}\,({\it{x\/}})\index{last} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  append-all-but-last-last \\ \index{append-all-but-last-last}
\=\+{\rm{properp}}\,({\it{x\/}})\index{properp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{append}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last}, {\rm{list}}\,({\rm{last}}\,({\it{x\/}})\index{last})) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\rm{list}}\,({\rm{last}}\,({\it{x\/}})\index{last}) \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-cdr-untag-array \\ \index{listp-cdr-untag-array}
{\rm{listp}}\,({\rm{cdr}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array})) $=$ {\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-last \\ \index{bit-vectorp-last}
\=\+{\rm{bit-vectors-piton}}\,({\it{bvs\/}}, {\it{s\/}})\index{bit-vectors-piton} \\ 
$\rightarrow$$\;\;\;\;$({\rm{bit-vectorp}}\,({\rm{cadr}}\,({\rm{last}}\,({\it{bvs\/}})\index{last}), {\it{s\/}})\index{bit-vectorp} $=$ {\rm{listp}}\,({\it{bvs\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectors-piton-means-properp \\ \index{bit-vectors-piton-means-properp}
{\rm{bit-vectors-piton}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectors-piton} $\rightarrow$ {\rm{properp}}\,({\it{x\/}})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectors-piton-means-last \\ \index{bit-vectors-piton-means-last}
\=\+({\rm{bit-vectors-piton}}\,({\it{state\/}}, {\it{size\/}})\index{bit-vectors-piton} $\wedge$ {\rm{listp}}\,({\it{state\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{car}}\,({\rm{last}}\,({\it{state\/}})\index{last}) $=$ {\tt{'}}{\tt{bitv}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{last}}\,({\it{state\/}})\index{last}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\rm{cadr}}\,({\rm{last}}\,({\it{state\/}})\index{last}), {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{last}}\,({\it{state\/}})\index{last}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\rm{cadr}}\,({\rm{last}}\,({\it{state\/}})\index{last}))\index{length} $=$ {\rm{fix}}\,({\it{size\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  list-bitv-cadr-bitvp \\ \index{list-bitv-cadr-bitvp}
\=\+(({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{bitv}}) $\wedge$ ({\rm{cddr}}\,({\it{x\/}}) $=$ {\bf{nil}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\rm{cadr}}\,({\it{x\/}})) $=$ {\it{x\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-x-put-assoc-x \\ \index{equal-x-put-assoc-x}
\=\+({\it{x\/}} $=$ {\rm{put-assoc}}\,({\it{val\/}}, {\it{name\/}}, {\it{x\/}})\index{put-assoc}) \\ 
$=$$\;\;\;\;$(($\neg$ {\rm{definedp}}\,({\it{name\/}}, {\it{x\/}})\index{definedp}) $\vee$ ({\rm{assoc}}\,({\it{name\/}}, {\it{x\/}}) $=$ {\rm{cons}}\,({\it{name\/}}, {\it{val\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cons-n-assoc-n \\ \index{cons-n-assoc-n}
\=\+{\rm{listp}}\,({\rm{assoc}}\,({\it{n\/}}, {\it{d\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{cons}}\,({\it{n\/}}, {\rm{cdr}}\,({\rm{assoc}}\,({\it{n\/}}, {\it{d\/}}))) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{definedp}}\,({\it{n\/}}, {\it{d\/}})\index{definedp}$\;\;${\bf then }{\rm{assoc}}\,({\it{n\/}}, {\it{d\/}}) \\ 
{\bf else }{\rm{cons}}\,({\it{n\/}}, {\tt{0}})$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cons-n-cadr-list-assoc-n \\ \index{cons-n-cadr-list-assoc-n}
\=\+({\rm{cddr}}\,({\rm{assoc}}\,({\it{n\/}}, {\it{d\/}})) $=$ {\bf{nil}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{list}}\,({\it{n\/}}, {\rm{cadr}}\,({\rm{assoc}}\,({\it{n\/}}, {\it{d\/}}))) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{definedp}}\,({\it{n\/}}, {\it{d\/}})\index{definedp}$\;\;${\bf then }{\rm{assoc}}\,({\it{n\/}}, {\it{d\/}}) \\ 
{\bf else }{\rm{cons}}\,({\it{n\/}}, {\tt{0}})$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cons-n-assoc-n-hack \\ \index{cons-n-assoc-n-hack}
\=\+{\rm{listp}}\,({\rm{cdr}}\,({\rm{assoc}}\,({\it{n\/}}, {\it{d\/}}))) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{cons}}\,({\it{n\/}}, {\rm{cdr}}\,({\rm{assoc}}\,({\it{n\/}}, {\it{d\/}}))) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{definedp}}\,({\it{n\/}}, {\it{d\/}})\index{definedp}$\;\;${\bf then }{\rm{assoc}}\,({\it{n\/}}, {\it{d\/}}) \\ 
{\bf else }{\rm{cons}}\,({\it{n\/}}, {\tt{0}})$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-untag-array \\ \index{car-untag-array}
{\rm{car}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array}) $=$ {\rm{untag}}\,({\rm{car}}\,({\it{x\/}}))\index{untag}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-nthcdr \\ \index{car-nthcdr}
{\rm{car}}\,({\rm{nthcdr}}\,({\it{i\/}}, {\it{x\/}})\index{nthcdr}) $=$ {\rm{get}}\,({\it{i\/}}, {\it{x\/}})\index{get}
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  tag-array-cdr-untag-array-hack \\ \index{tag-array-cdr-untag-array-hack}
\=\+{\rm{bit-vectors-piton}}\,({\it{x\/}}, {\rm{length}}\,({\rm{untag}}\,({\rm{car}}\,({\it{x\/}}))\index{untag})\index{length})\index{bit-vectors-piton} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{tag-array}}\,({\tt{'}}{\tt{bitv}}, {\rm{cdr}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array}))\index{tag-array} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{cdr}}\,({\it{x\/}}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-)\-\-
\end{tabbing}
		
\begin{tabbing}{\sc Theorem}:  bit-vectors-piton-means-car \\ \index{bit-vectors-piton-means-car}
\=\+({\rm{bit-vectors-piton}}\,({\it{state\/}}, {\it{size\/}})\index{bit-vectors-piton} $\wedge$ {\rm{listp}}\,({\it{state\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{caar}}\,({\it{state\/}}) $=$ {\tt{'}}{\tt{bitv}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{car}}\,({\it{state\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\rm{cadr}}\,({\rm{car}}\,({\it{state\/}})), {\it{size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{car}}\,({\it{state\/}})) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\rm{cadr}}\,({\rm{car}}\,({\it{state\/}})))\index{length} $=$ {\rm{fix}}\,({\it{size\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-put-assoc \\ \index{equal-put-assoc}
\=\+({\rm{put-assoc}}\,({\it{v1\/}}, {\it{n\/}}, {\it{s\/}})\index{put-assoc} $=$ {\rm{put-assoc}}\,({\it{v2\/}}, {\it{n\/}}, {\it{s\/}})\index{put-assoc}) \\ 
$=$$\;\;\;\;$(($\neg$ {\rm{definedp}}\,({\it{n\/}}, {\it{s\/}})\index{definedp}) $\vee$ ({\it{v1\/}} $=$ {\it{v2\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  get-nlistp-better \\ \index{get-nlistp-better}
({\it{i\/}} $\not<$ {\rm{length}}\,({\it{x\/}})\index{length}) $\rightarrow$ ({\rm{get}}\,({\it{i\/}}, {\it{x\/}})\index{get} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-append-zero-bit-vector-zero-bit-vector \\ \index{equal-append-zero-bit-vector-ze!ro-bit-vector}
\=\+({\rm{append}}\,({\rm{zero-bit-vector}}\,({\it{n1\/}})\index{zero-bit-vector}, {\it{x\/}}) $=$ {\rm{append}}\,({\rm{zero-bit-vector}}\,({\it{n2\/}})\index{zero-bit-vector}, {\it{y\/}})) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n1\/}} $<$ {\it{n2\/}}$\;\;${\bf then }{\it{x\/}} $=$ {\rm{append}}\,({\rm{zero-bit-vector}}\,({\it{n2\/}} $-$ {\it{n1\/}})\index{zero-bit-vector}, {\it{y\/}}) \\ 
{\bf else }{\it{y\/}} $=$ {\rm{append}}\,({\rm{zero-bit-vector}}\,({\it{n1\/}} $-$ {\it{n2\/}})\index{zero-bit-vector}, {\it{x\/}})$\;${\bf  endif}\-\-
\end{tabbing}
		
\begin{tabbing}{\sc Theorem}:  append-make-list-from-cons-get-hack \\ \index{append-make-list-from-cons-get-!hack}
\=\+{\rm{append}}\,({\rm{make-list-from}}\,({\it{i\/}}, {\it{x\/}})\index{make-list-from}, {\rm{cons}}\,({\rm{get}}\,({\it{i\/}}, {\it{x\/}})\index{get}, {\it{y\/}})) \\ 
$=$$\;\;\;\;${\rm{append}}\,({\rm{make-list-from}}\,($1\;+$ {\it{i\/}}, {\it{x\/}})\index{make-list-from}, {\it{y\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-untag-array-nthcdr \\ \index{cdr-untag-array-nthcdr}
\=\+({\it{i\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{cdr}}\,({\rm{untag-array}}\,({\rm{nthcdr}}\,({\it{i\/}}, {\it{x\/}})\index{nthcdr})\index{untag-array}) $=$ {\rm{untag-array}}\,({\rm{nthcdr}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{nthcdr})\index{untag-array})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-nil-nthcdr-length \\ \index{equal-nil-nthcdr-length}
({\bf{nil}} $=$ {\rm{nthcdr}}\,({\rm{length}}\,({\it{x\/}})\index{length}, {\it{x\/}})\index{nthcdr}) $=$ {\rm{properp}}\,({\it{x\/}})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-0-length-better \\ \index{lessp-0-length-better}
({\it{x\/}} $\simeq {\tt{0}}$) $\rightarrow$ (({\it{x\/}} $<$ {\rm{length}}\,({\it{y\/}})\index{length}) $=$ {\rm{listp}}\,({\it{y\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectors-piton-means-get-cdr \\ \index{bit-vectors-piton-means-get-cdr}
\=\+{\rm{bit-vectors-piton}}\,({\it{state\/}}, {\it{size\/}})\index{bit-vectors-piton} \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+{\rm{car}}\,({\rm{get}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{state\/}}))\index{get}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{state\/}}))\index{length}$\;\;${\bf then }{\tt{'}}{\tt{bitv}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\- \\ 
$\wedge$$\;\;\;\;$({\rm{listp}}\,({\rm{get}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{state\/}}))\index{get}) $=$ ({\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{state\/}}))\index{length})) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{bit-vectorp}}\,({\rm{cadr}}\,({\rm{get}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{state\/}}))\index{get}), {\it{size\/}})\index{bit-vectorp} \\ 
$=$$\;\;\;\;$({\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{state\/}}))\index{length}))\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{cddr}}\,({\rm{get}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{state\/}}))\index{get}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{state\/}}))\index{length}$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{length}}\,({\rm{cadr}}\,({\rm{get}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{state\/}}))\index{get}))\index{length} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{state\/}}))\index{length}$\;\;${\bf then }{\rm{fix}}\,({\it{size\/}}) \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectors-piton-nthcdr \\ \index{bit-vectors-piton-nthcdr}
\=\+{\rm{bit-vectors-piton}}\,({\it{x\/}}, {\it{s1\/}})\index{bit-vectors-piton} \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+{\rm{bit-vectors-piton}}\,({\rm{nthcdr}}\,({\it{i\/}}, {\it{x\/}})\index{nthcdr}, {\it{s\/}})\index{bit-vectors-piton} \\ 
$=$$\;\;\;\;$(\=\+(({\it{i\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length}) $\wedge$ ({\rm{fix}}\,({\it{s1\/}}) $=$ {\rm{fix}}\,({\it{s\/}}))) \\ 
$\vee$$\;\;\;\;$({\rm{fix}}\,({\it{i\/}}) $=$ {\rm{length}}\,({\it{x\/}})\index{length}))\-)\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{bit-vectors-piton}}\,({\rm{nthcdr}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{nthcdr}, {\it{s\/}})\index{bit-vectors-piton} \\ 
$=$$\;\;\;\;$(\=\+({\it{i\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length}) \\ 
$\wedge$$\;\;\;\;$(\=\+({\rm{fix}}\,({\it{s\/}}) $=$ {\rm{fix}}\,({\it{s1\/}})) \\ 
$\vee$$\;\;\;\;$({\rm{fix}}\,({\it{i\/}}) $=$ {\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length}))\-)\-)\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tag-array-untag-array-nthcdr-cddr-hack \\ \index{tag-array-untag-array-nthcdr-cd!dr-hack}
\=\+(({\it{i\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length}) $\wedge$ {\rm{bit-vectors-piton}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectors-piton}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{tag-array}}\,({\tt{'}}{\tt{bitv}}, {\rm{untag-array}}\,({\rm{nthcdr}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{nthcdr})\index{untag-array})\index{tag-array} \\ 
$=$$\;\;\;\;${\rm{nthcdr}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{nthcdr})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  append-make-list-from-put-hack \\ \index{append-make-list-from-put-hack}
\=\+({\it{i\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{append}}\,({\rm{make-list-from}}\,({\it{i\/}}, {\it{x\/}})\index{make-list-from}, {\rm{cons}}\,({\it{v\/}}, {\rm{nthcdr}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{nthcdr})) $=$ {\rm{put}}\,({\it{v\/}}, {\it{i\/}}, {\it{x\/}})\index{put})\-
\end{tabbing}


\noindent{\sc Event}:   Enable lessp-sub1-x-x.

\addvspace{18pt}

\noindent{\sc Event}:   Enable lessp-x-x.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-match-and-xor-general \\ \index{correctness-of-match-and-xor-ge!neral}
\=\+(\=\+{\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{p-ctrl-stk-size}}\,({\it{ctrl-stk\/}})\index{p-ctrl-stk-size}, {\tt{7}}, {\it{max-ctrl-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{4}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{match-and-xor}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\sc{match-and-xor-program}}\index{match-and-xor-program})\- \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{match\/}}, {\it{word-size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\it{xor-vector\/}}, {\it{word-size\/}})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$({\it{numvecs\/}} $=$ {\rm{length}}\,({\rm{array}}\,({\it{vecs\/}}, {\it{data-segment\/}})\index{array})\index{length}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectors-piton}}\,({\rm{array}}\,({\it{vecs\/}}, {\it{data-segment\/}})\index{array}, {\it{word-size\/}})\index{bit-vectors-piton} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\it{vecs\/}}, {\it{data-segment\/}})\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $<$ {\it{numvecs\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\rm{array}}\,({\it{vecs\/}}, {\it{data-segment\/}})\index{array})\index{length} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{match-and-xor}}{\tt{ .\ }}{\tt{2}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{list}}\,(\=\+{\rm{cons}}\,({\tt{'}}{\tt{vecs}}, {\rm{list}}\,({\tt{'}}{\tt{addr}}, {\rm{cons}}\,({\it{vecs\/}}, {\it{i\/}}))), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{numvecs}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{numvecs\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{match}}, {\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{match\/}})), \\ 
{\rm{cons}}\,(\=\+{\tt{'}}{\tt{xor-vector}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{bitv}}, {\it{xor-vector\/}}))\-, \\ 
{\rm{cons}}\,({\tt{'}}{\tt{i}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{i\/}})))\-, \\ 
{\it{ret-pc\/}})\-, \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{match-and-xor-loop-clock}}\,(\=\+{\rm{nthcdr}}\,(\=\+{\it{i\/}}, \\ 
{\rm{untag-array}}\,({\rm{array}}\,(\=\+{\it{vecs\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\index{untag-array})\-\index{nthcdr}, \\ 
{\it{match\/}})\-\index{match-and-xor-loop-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{append}}\,(\=\+{\rm{make-list-from}}\,(\=\+{\it{i\/}}, \\ 
{\rm{array}}\,(\=\+{\it{vecs\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\-\index{make-list-from}, \\ 
{\rm{tag-array}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{match-and-xor}}\,(\=\+{\rm{untag-array}}\,({\rm{nthcdr}}\,(\=\+{\it{i\/}}, \\ 
{\rm{array}}\,(\=\+{\it{vecs\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\-\index{nthcdr})\index{untag-array}, \\ 
{\it{match\/}}, \\ 
{\it{xor-vector\/}})\-\index{match-and-xor})\-\index{tag-array})\-, \\ 
{\it{vecs\/}}, \\ 
{\it{data-segment\/}})\-\index{put-assoc}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{match-and-xor-clock} \\  
\=\+{\rm{match-and-xor-clock}}\,({\it{bvs\/}}, {\it{match\/}})\index{match-and-xor-clock} \\ 
$=$$\;\;\;\;$({\tt{3}} $+$ {\rm{match-and-xor-loop-clock}}\,({\it{bvs\/}}, {\it{match\/}})\index{match-and-xor-loop-clock})\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{match-and-xor-input-conditionp} \\  
\=\+{\rm{match-and-xor-input-conditionp}}\,({\it{p0\/}})\index{match-and-xor-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{bitv}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{bitv}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cdddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdr}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cdddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cdddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cdddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{7}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{0}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{match-and-xor}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\sc{match-and-xor-program}}\index{match-and-xor-program})\- \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectorp}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}), {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{bit-vectorp} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{cadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) \\ 
$=$$\;\;\;\;${\rm{length}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cdddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{length})\- \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,(\=\+{\rm{car}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cdddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{definedp} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{length}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cdddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{length} \\ 
$<$$\;\;\;\;${\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp})\- \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectors-piton}}\,(\=\+{\rm{array}}\,(\=\+{\rm{car}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cdddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\-\index{bit-vectors-piton})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-match-and-xor \\ \index{correctness-of-match-and-xor}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{x\/}}, {\rm{cons}}\,({\it{m\/}}, {\rm{cons}}\,({\it{n\/}}, {\rm{cons}}\,({\it{v\/}}, {\it{temp-stk\/}})))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{match-and-xor}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;${\rm{match-and-xor-input-conditionp}}\,({\it{p0\/}})\index{match-and-xor-input-conditionp} \\ 
$\wedge$$\;\;\;\;$({\it{match\/}} $=$ {\rm{cadr}}\,({\it{m\/}})) \\ 
$\wedge$$\;\;\;\;$({\it{vecs-to-match\/}} $=$ {\rm{untag-array}}\,({\rm{array}}\,({\rm{caadr}}\,({\it{v\/}}), {\it{data-segment\/}})\index{array})\index{untag-array}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{x\/}}, {\rm{cons}}\,({\it{m\/}}, {\rm{cons}}\,({\it{n\/}}, {\rm{cons}}\,({\it{v\/}}, {\it{temp-stk\/}})))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{match-and-xor-clock}}\,({\it{vecs-to-match\/}}, {\it{match\/}})\index{match-and-xor-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{tag-array}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{match-and-xor}}\,(\=\+{\rm{untag-array}}\,({\rm{array}}\,(\=\+{\rm{caadr}}\,({\it{v\/}}), \\ 
{\it{data-segment\/}})\-\index{array})\index{untag-array}, \\ 
{\rm{cadr}}\,({\it{m\/}}), \\ 
{\rm{cadr}}\,({\it{x\/}}))\-\index{match-and-xor})\-\index{tag-array}, \\ 
{\rm{caadr}}\,({\it{v\/}}), \\ 
{\it{data-segment\/}})\-\index{put-assoc}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{verbatim};;; nat-to-bv-list

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{nat-to-bv-list-program} \\  
\=\+{\sc{nat-to-bv-list-program}}\index{nat-to-bv-list-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{nat-to-bv-list}} \\ 
{\tt{(}}{\tt{nat-list}}{\tt{ }}{\tt{bv-list}}{\tt{ }}{\tt{length}}{\tt{)}} \\ 
{\tt{(}}{\tt{(}}{\tt{i}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{loop}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{nat-list}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{fetch}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{nat-to-bv}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{bv-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{deposit}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{add1-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{length}}{\tt{)}} \\ 
{\tt{(}}{\tt{eq}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bool-and-jump}}{\tt{ }}{\tt{t}}{\tt{ }}{\tt{done}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{nat-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{add-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{nat-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{bv-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{add-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{bv-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{loop}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{done}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{example-nat-to-bv-list-p-state} \\  
\=\+{\sc{example-nat-to-bv-list-p-state}}\index{example-nat-to-bv-list-p-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr2}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{6}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{nat-to-bv-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\sc{nat-to-bv-list-program}}\index{nat-to-bv-list-program}, \\ 
{\sc{nat-to-bv-program}}\index{nat-to-bv-program}, \\ 
{\rm{push-1-vector-program}}\,({\tt{8}})\index{push-1-vector-program})\-, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{(}}\=\+{\tt{arr}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{5}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{8}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{23}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{9}}{\tt{)}}{\tt{)}}\- \\ 
{\tt{(}}{\tt{arr2}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{)}}{\tt{)}}\-, \\ 
{\tt{100}}, \\ 
{\tt{80}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv-list} \\  
\=\+{\rm{nat-to-bv-list}}\,({\it{nat-list\/}}, {\it{size\/}})\index{nat-to-bv-list} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{nat-list\/}}) \\ 
{\bf then }{\rm{cons}}\,(\=\+{\rm{nat-to-bv}}\,({\rm{car}}\,({\it{nat-list\/}}), {\it{size\/}})\index{nat-to-bv}, \\ 
{\rm{nat-to-bv-list}}\,({\rm{cdr}}\,({\it{nat-list\/}}), {\it{size\/}})\index{nat-to-bv-list})\- \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv-list-loop-clock} \\  
\=\+{\rm{nat-to-bv-list-loop-clock}}\,({\it{i\/}}, {\it{nats\/}})\index{nat-to-bv-list-loop-clock} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\it{nats\/}})\index{length} \\ 
{\bf then }{\rm{clock-plus}}\,(\=\+{\tt{'}}{\tt{2}}, \\ 
{\rm{clock-plus}}\,(\=\+{\rm{nat-to-bv-clock}}\,({\rm{untag}}\,({\rm{get}}\,({\it{i\/}}, {\it{nats\/}})\index{get})\index{untag})\index{nat-to-bv-clock}, \\ 
\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{nats\/}}))\index{length} \\ 
{\bf then }{\rm{clock-plus}}\,(\=\+{\tt{'}}{\tt{17}}, \\ 
{\rm{nat-to-bv-list-loop-clock}}\,(\=\+$1\;+$ {\it{i\/}}, \\ 
{\it{nats\/}})\-\index{nat-to-bv-list-loop-clock})\-\index{clock-plus} \\ 
{\bf else }{\tt{'}}{\tt{9}}$\;${\bf  endif}\-)\-\index{clock-plus})\-\index{clock-plus} \\ 
{\bf else }{\tt{'}}{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv-list-loop-induct} \\  
\=\+{\rm{nat-to-bv-list-loop-induct}}\,({\it{i\/}}, {\it{nats\/}}, {\it{bvs-name\/}}, {\it{word-size\/}}, {\it{data-segment\/}})\index{nat-to-bv-list-loop-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }({\it{i\/}} $<$ {\rm{length}}\,({\it{nats\/}})\index{length}) $\wedge$ ({\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{nats\/}}))\index{length}) \\ 
{\bf then }{\rm{nat-to-bv-list-loop-induct}}\,(\=\+$1\;+$ {\it{i\/}}, \\ 
{\it{nats\/}}, \\ 
{\it{bvs-name\/}}, \\ 
{\it{word-size\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{append}}\,(\=\+{\rm{make-list-from}}\,(\=\+{\it{i\/}}, \\ 
{\rm{cdr}}\,({\rm{assoc}}\,(\=\+{\it{bvs-name\/}}, \\ 
{\it{data-segment\/}})\-))\-\index{make-list-from}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{nat-to-bv}}\,(\=\+{\rm{untag}}\,({\rm{get}}\,(\=\+{\it{i\/}}, \\ 
{\it{nats\/}})\-\index{get})\index{untag}, \\ 
{\it{word-size\/}})\-\index{nat-to-bv})\-, \\ 
{\rm{nthcdr}}\,(\=\+$1\;+$ {\it{i\/}}, \\ 
{\rm{cdr}}\,({\rm{assoc}}\,(\=\+{\it{bvs-name\/}}, \\ 
{\it{data-segment\/}})\-))\-\index{nthcdr})\-)\-, \\ 
{\it{bvs-name\/}}, \\ 
{\it{data-segment\/}})\-\index{put-assoc})\-\index{nat-to-bv-list-loop-induct} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}



\begin{tabbing}{\sc Theorem}:  nat-list-piton-means-car \\ \index{nat-list-piton-means-car}
\=\+({\rm{nat-list-piton}}\,({\it{state\/}}, {\it{size\/}})\index{nat-list-piton} $\wedge$ {\rm{listp}}\,({\it{state\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{caar}}\,({\it{state\/}}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{car}}\,({\it{state\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{car}}\,({\it{state\/}})) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{car}}\,({\it{state\/}})) $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$(({\rm{cadr}}\,({\rm{car}}\,({\it{state\/}})) $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) $=$ {\bf{t}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{car}}\,({\it{state\/}})) $=$ {\bf{nil}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{array-pitonp} \\  
\=\+{\rm{array-pitonp}}\,({\it{array\/}}, {\it{length\/}})\index{array-pitonp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{array\/}}) \\ 
{\bf then }({\it{length\/}} $\not\simeq {\tt{0}}$) $\wedge$ {\rm{array-pitonp}}\,({\rm{cdr}}\,({\it{array\/}}), {\it{length\/}} $-\;1$)\index{array-pitonp} \\ 
{\bf else }({\it{array\/}} $=$ {\bf{nil}}) $\wedge$ ({\it{length\/}} $\simeq {\tt{0}}$)$\;${\bf  endif}\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  nat-list-piton-means-last \\ \index{nat-list-piton-means-last}
\=\+{\rm{nat-list-piton}}\,({\it{state\/}}, {\it{size\/}})\index{nat-list-piton} \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+{\rm{car}}\,({\rm{last}}\,({\it{state\/}})\index{last}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{state\/}})$\;\;${\bf then }{\tt{'}}{\tt{nat}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\- \\ 
$\wedge$$\;\;\;\;$({\rm{listp}}\,({\rm{last}}\,({\it{state\/}})\index{last}) $=$ {\rm{listp}}\,({\it{state\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{last}}\,({\it{state\/}})\index{last}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$(({\rm{cadr}}\,({\rm{last}}\,({\it{state\/}})\index{last}) $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) $=$ {\bf{t}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{cddr}}\,({\rm{last}}\,({\it{state\/}})\index{last}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{state\/}})$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-list-piton-means-last-cdr \\ \index{nat-list-piton-means-last-cdr}
\=\+({\rm{nat-list-piton}}\,({\it{state\/}}, {\it{size\/}})\index{nat-list-piton} $\wedge$ {\rm{listp}}\,({\it{state\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+{\rm{car}}\,({\rm{last}}\,({\rm{cdr}}\,({\it{state\/}}))\index{last}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{state\/}}))$\;\;${\bf then }{\tt{'}}{\tt{nat}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\- \\ 
$\wedge$$\;\;\;\;$({\rm{listp}}\,({\rm{last}}\,({\rm{cdr}}\,({\it{state\/}}))\index{last}) $=$ {\rm{listp}}\,({\rm{cdr}}\,({\it{state\/}}))) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{last}}\,({\rm{cdr}}\,({\it{state\/}}))\index{last}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$(({\rm{cadr}}\,({\rm{last}}\,({\rm{cdr}}\,({\it{state\/}}))\index{last}) $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) $=$ {\bf{t}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{cddr}}\,({\rm{last}}\,({\rm{cdr}}\,({\it{state\/}}))\index{last}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{state\/}}))$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-)\-\-
\end{tabbing}

\begin{verbatim};(prove-lemma definedp-put-assoc (rewrite)
;	     (equal
;	      (definedp n (put-assoc v n1 a))
;	      (definedp n a)))
\end{verbatim}
\noindent{\sc Event}:   Enable definedp-put-assoc.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  assoc-put-assoc-better \\ \index{assoc-put-assoc-better}
\=\+{\rm{assoc}}\,({\it{n1\/}}, {\rm{put-assoc}}\,({\it{v\/}}, {\it{n2\/}}, {\it{a\/}})\index{put-assoc}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{definedp}}\,({\it{n1\/}}, {\it{a\/}})\index{definedp} \\ 
{\bf then }\=\+{\bf if }{\it{n1\/}} $=$ {\it{n2\/}}$\;\;${\bf then }{\rm{cons}}\,({\it{n1\/}}, {\it{v\/}}) \\ 
{\bf else }{\rm{assoc}}\,({\it{n1\/}}, {\it{a\/}})$\;${\bf  endif}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable nat-to-bv-list-loop-clock.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  get-add1 \\ \index{get-add1}
({\it{n\/}} $<$ {\tt{4}}) $\rightarrow$ ({\rm{get}}\,($1\;+$ {\it{n\/}}, {\it{x\/}})\index{get} $=$ {\rm{get}}\,({\it{n\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{get})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  get-0-better \\ \index{get-0-better}
({\it{n\/}} $\simeq {\tt{0}}$) $\rightarrow$ ({\rm{get}}\,({\it{n\/}}, {\it{x\/}})\index{get} $=$ {\rm{car}}\,({\it{x\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-cdr-tag-array \\ \index{length-cdr-tag-array}
{\rm{length}}\,({\rm{cdr}}\,({\rm{tag-array}}\,({\it{l\/}}, {\it{x\/}})\index{tag-array}))\index{length} $=$ {\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-nat-to-bv-list \\ \index{length-nat-to-bv-list}
{\rm{length}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list})\index{length} $=$ {\rm{length}}\,({\it{x\/}})\index{length}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-cdr-nat-to-bv-list \\ \index{length-cdr-nat-to-bv-list}
{\rm{length}}\,({\rm{cdr}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list}))\index{length} $=$ {\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-tag-array \\ \index{length-tag-array}
{\rm{length}}\,({\rm{tag-array}}\,({\it{l\/}}, {\it{x\/}})\index{tag-array})\index{length} $=$ {\rm{length}}\,({\it{x\/}})\index{length}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-tag-array \\ \index{listp-tag-array}
{\rm{listp}}\,({\rm{tag-array}}\,({\it{l\/}}, {\it{x\/}})\index{tag-array}) $=$ {\rm{listp}}\,({\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-nat-to-bv-list \\ \index{listp-nat-to-bv-list}
{\rm{listp}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list}) $=$ {\rm{listp}}\,({\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  array-pitonp-tag-array \\ \index{array-pitonp-tag-array}
{\rm{array-pitonp}}\,({\rm{tag-array}}\,({\it{l\/}}, {\it{x\/}})\index{tag-array}, {\it{length\/}})\index{array-pitonp} $=$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{fix}}\,({\it{length\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  array-pitonp-append \\ \index{array-pitonp-append}
\=\+{\rm{array-pitonp}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}), {\it{size\/}})\index{array-pitonp} \\ 
$=$$\;\;\;\;$(({\it{size\/}} $\not<$ {\rm{length}}\,({\it{x\/}})\index{length}) $\wedge$ {\rm{array-pitonp}}\,({\it{y\/}}, {\it{size\/}} $-$ {\rm{length}}\,({\it{x\/}})\index{length})\index{array-pitonp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-list-piton-means-cadr \\ \index{nat-list-piton-means-cadr}
\=\+({\rm{nat-list-piton}}\,({\it{state\/}}, {\it{size\/}})\index{nat-list-piton} $\wedge$ {\rm{listp}}\,({\rm{cdr}}\,({\it{state\/}}))) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{caadr}}\,({\it{state\/}}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{cadr}}\,({\it{state\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{cadr}}\,({\it{state\/}})) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{cadr}}\,({\it{state\/}})) $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$(({\rm{cadr}}\,({\rm{cadr}}\,({\it{state\/}})) $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) $=$ {\bf{t}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{cadr}}\,({\it{state\/}})) $=$ {\bf{nil}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  array-pitonp-add1 \\ \index{array-pitonp-add1}
{\rm{array-pitonp}}\,({\it{x\/}}, $1\;+$ {\it{n\/}})\index{array-pitonp} $=$ ({\rm{listp}}\,({\it{x\/}}) $\wedge$ {\rm{array-pitonp}}\,({\rm{cdr}}\,({\it{x\/}}), {\it{n\/}})\index{array-pitonp})
\end{tabbing}

\begin{verbatim};(prove-lemma put-assoc-put-assoc (rewrite)
;	     (equal
;	      (put-assoc v n (put-assoc v2 n a))
;	      (put-assoc v n a)))
\end{verbatim}
\noindent{\sc Event}:   Enable put-assoc-put-assoc.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  length-cdr-nlistp \\ \index{length-cdr-nlistp}
\=\+($\neg$ {\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}}))) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{length}}\,({\it{x\/}})\index{length} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\tt{1}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-nil-cdr-tag-array-hack \\ \index{equal-nil-cdr-tag-array-hack}
({\bf{nil}} $=$ {\rm{cdr}}\,({\rm{tag-array}}\,({\it{l\/}}, {\it{x\/}})\index{tag-array})) $=$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\tt{1}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-from-array-pitonp \\ \index{length-from-array-pitonp}
{\rm{array-pitonp}}\,({\it{x\/}}, {\it{s\/}})\index{array-pitonp} $\rightarrow$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{fix}}\,({\it{s\/}}))
\end{tabbing}


\noindent{\sc Event}:   Disable nat-to-bv-clock.

\addvspace{18pt}


\noindent{\sc Event}:   Disable nat-to-bv-list-loop-clock.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  nat-list-piton-means-get \\ \index{nat-list-piton-means-get}
\=\+{\rm{nat-list-piton}}\,({\it{state\/}}, {\it{size\/}})\index{nat-list-piton} \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+{\rm{car}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{p\/}} $<$ {\rm{length}}\,({\it{state\/}})\index{length}$\;\;${\bf then }{\tt{'}}{\tt{nat}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\- \\ 
$\wedge$$\;\;\;\;$({\rm{listp}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) $=$ ({\it{p\/}} $<$ {\rm{length}}\,({\it{state\/}})\index{length})) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$(({\rm{cadr}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) $=$ {\bf{t}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{cddr}}\,({\rm{get}}\,({\it{p\/}}, {\it{state\/}})\index{get}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{p\/}} $<$ {\rm{length}}\,({\it{state\/}})\index{length}$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-list-piton-means-get-cdr \\ \index{nat-list-piton-means-get-cdr}
\=\+({\rm{nat-list-piton}}\,({\it{state\/}}, {\it{size\/}})\index{nat-list-piton} $\wedge$ {\rm{listp}}\,({\it{state\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+{\rm{car}}\,({\rm{get}}\,({\it{p\/}}, {\rm{cdr}}\,({\it{state\/}}))\index{get}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{p\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{state\/}}))\index{length}$\;\;${\bf then }{\tt{'}}{\tt{nat}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\- \\ 
$\wedge$$\;\;\;\;$({\rm{listp}}\,({\rm{get}}\,({\it{p\/}}, {\rm{cdr}}\,({\it{state\/}}))\index{get}) $=$ ({\it{p\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{state\/}}))\index{length})) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{get}}\,({\it{p\/}}, {\rm{cdr}}\,({\it{state\/}}))\index{get}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$(({\rm{cadr}}\,({\rm{get}}\,({\it{p\/}}, {\rm{cdr}}\,({\it{state\/}}))\index{get}) $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) $=$ {\bf{t}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{cddr}}\,({\rm{get}}\,({\it{p\/}}, {\rm{cdr}}\,({\it{state\/}}))\index{get}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{p\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{state\/}}))\index{length}$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-)\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable nat-list-piton-means.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  length-put-better \\ \index{length-put-better}
\=\+{\rm{length}}\,({\rm{put}}\,({\it{v\/}}, {\it{n\/}}, {\it{a\/}})\index{put})\index{length} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $<$ {\rm{length}}\,({\it{a\/}})\index{length}$\;\;${\bf then }{\rm{length}}\,({\it{a\/}})\index{length} \\ 
{\bf else }$1\;+$ {\it{n\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cons-car-x-put-append-make-list-from-hack \\ \index{cons-car-x-put-append-make-list!-from-hack}
\=\+{\rm{cons}}\,({\rm{car}}\,({\rm{put}}\,({\it{v\/}}, {\it{x\/}}, {\it{b\/}})\index{put}), {\rm{append}}\,({\rm{make-list-from}}\,({\it{x\/}}, {\rm{cdr}}\,({\rm{put}}\,({\it{v\/}}, {\it{x\/}}, {\it{b\/}})\index{put}))\index{make-list-from}, {\it{y\/}})) \\ 
$=$$\;\;\;\;${\rm{append}}\,({\rm{make-list-from}}\,({\it{x\/}}, {\it{b\/}})\index{make-list-from}, {\rm{cons}}\,({\it{v\/}}, {\it{y\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  array-pitonp-put \\ \index{array-pitonp-put}
\=\+({\rm{array-pitonp}}\,({\it{a\/}}, {\it{l\/}})\index{array-pitonp} $\wedge$ ({\rm{fix}}\,({\it{l\/}}) $=$ {\rm{fix}}\,({\it{length\/}}))) \\ 
$\rightarrow$$\;\;\;\;$({\rm{array-pitonp}}\,({\rm{put}}\,({\it{v\/}}, {\it{n\/}}, {\it{a\/}})\index{put}, {\it{length\/}})\index{array-pitonp} $=$ ({\it{n\/}} $<$ {\rm{length}}\,({\it{a\/}})\index{length}))\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  array-pitonp-means-properp \\ \index{array-pitonp-means-properp}
\=\+({\rm{array-pitonp}}\,({\it{x\/}}, {\it{s\/}})\index{array-pitonp} $\rightarrow$ {\rm{properp}}\,({\it{x\/}})\index{properp}) \\ 
$\wedge$$\;\;\;\;$({\rm{array-pitonp}}\,({\rm{cdr}}\,({\it{x\/}}), {\it{s\/}})\index{array-pitonp} $\rightarrow$ {\rm{properp}}\,({\it{x\/}})\index{properp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  put-length-cdr-general \\ \index{put-length-cdr-general}
\=\+({\rm{properp}}\,({\it{x\/}})\index{properp} $\wedge$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{put}}\,({\it{val\/}}, {\rm{length}}\,({\rm{cdr}}\,({\it{y\/}}))\index{length}, {\it{x\/}})\index{put} $=$ {\rm{append}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last}, {\rm{list}}\,({\it{val\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-x-cdr-put-x \\ \index{nthcdr-x-cdr-put-x}
\=\+{\rm{properp}}\,({\it{a\/}})\index{properp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{nthcdr}}\,({\it{x\/}}, {\rm{cdr}}\,({\rm{put}}\,({\it{val\/}}, {\it{x\/}}, {\it{a\/}})\index{put}))\index{nthcdr} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $<$ {\rm{length}}\,({\it{a\/}})\index{length}$\;\;${\bf then }{\rm{nthcdr}}\,({\it{x\/}}, {\rm{cdr}}\,({\it{a\/}}))\index{nthcdr} \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-append-a-append-a \\ \index{equal-append-a-append-a}
({\rm{append}}\,({\it{a\/}}, {\it{b\/}}) $=$ {\rm{append}}\,({\it{a\/}}, {\it{c\/}})) $=$ ({\it{b\/}} $=$ {\it{c\/}})
\end{tabbing}

\begin{verbatim};The correctness lemma of nat-to-bv-list could be more general - 
;the proof assumes the data areas are distinct, though the program
;works when they're not.  I did it this way because I had assumed
;I'd need distinct arrays in NIM, and designed the proof accordingly.
;This is a weakness I should correct in this proof as it will lead
;to sloppy use of memory in the program, but it takes so long
;to do these proofs I'll wait.


\end{verbatim}\begin{tabbing}{\sc Theorem}:  correctness-of-nat-to-bv-list-general \\ \index{correctness-of-nat-to-bv-list-ge!neral}
\=\+(\=\+{\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{p-ctrl-stk-size}}\,({\it{ctrl-stk\/}})\index{p-ctrl-stk-size}, {\tt{13}}, {\it{max-ctrl-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{3}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{nat-to-bv-list}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\sc{nat-to-bv-list-program}}\index{nat-to-bv-list-program})\- \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{nat-to-bv}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{nat-to-bv-program}}\index{nat-to-bv-program}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{push-1-vector}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\it{word-size\/}})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;$({\it{length\/}} $=$ {\rm{length}}\,({\rm{array}}\,({\it{nats\/}}, {\it{data-segment\/}})\index{array})\index{length}) \\ 
$\wedge$$\;\;\;\;${\rm{array-pitonp}}\,({\rm{array}}\,({\it{bvs\/}}, {\it{data-segment\/}})\index{array}, {\it{length\/}})\index{array-pitonp} \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,({\rm{array}}\,({\it{nats\/}}, {\it{data-segment\/}})\index{array}, {\it{word-size\/}})\index{nat-list-piton} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\it{nats\/}}, {\it{data-segment\/}})\index{definedp} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\it{bvs\/}}, {\it{data-segment\/}})\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\it{word-size\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $<$ {\it{length\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{length\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{nats\/}} $\not=$ {\it{bvs\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{natlist\/}} $=$ {\rm{array}}\,({\it{nats\/}}, {\it{data-segment\/}})\index{array}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{nat-to-bv-list}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{list}}\,(\=\+{\rm{cons}}\,(\=\+{\tt{'}}{\tt{nat-list}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{addr}}, {\rm{cons}}\,({\it{nats\/}}, {\it{i\/}})))\-, \\ 
{\rm{cons}}\,({\tt{'}}{\tt{bv-list}}, {\rm{list}}\,({\tt{'}}{\tt{addr}}, {\rm{cons}}\,({\it{bvs\/}}, {\it{i\/}}))), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{length}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{length\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{i}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{i\/}})))\-, \\ 
{\it{ret-pc\/}})\-, \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{nat-to-bv-list-loop-clock}}\,({\it{i\/}}, {\it{natlist\/}})\index{nat-to-bv-list-loop-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{append}}\,(\=\+{\rm{make-list-from}}\,(\=\+{\it{i\/}}, \\ 
{\rm{array}}\,(\=\+{\it{bvs\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\-\index{make-list-from}, \\ 
{\rm{tag-array}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{nat-to-bv-list}}\,(\=\+{\rm{untag-array}}\,({\rm{nthcdr}}\,(\=\+{\it{i\/}}, \\ 
{\rm{array}}\,(\=\+{\it{nats\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\-\index{nthcdr})\index{untag-array}, \\ 
{\it{word-size\/}})\-\index{nat-to-bv-list})\-\index{tag-array})\-, \\ 
{\it{bvs\/}}, \\ 
{\it{data-segment\/}})\-\index{put-assoc}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv-list-clock} \\  
\=\+{\rm{nat-to-bv-list-clock}}\,({\it{natlist\/}})\index{nat-to-bv-list-clock} \\ 
$=$$\;\;\;\;${\rm{clock-plus}}\,({\tt{1}}, {\rm{nat-to-bv-list-loop-clock}}\,({\tt{0}}, {\it{natlist\/}})\index{nat-to-bv-list-loop-clock})\index{clock-plus}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv-list-input-conditionp} \\  
\=\+{\rm{nat-to-bv-list-input-conditionp}}\,({\it{p0\/}})\index{nat-to-bv-list-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{13}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{0}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{nat-to-bv-list}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\sc{nat-to-bv-list-program}}\index{nat-to-bv-list-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{nat-to-bv}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\sc{nat-to-bv-program}}\index{nat-to-bv-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{push-1-vector}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) \\ 
$=$$\;\;\;\;${\rm{length}}\,({\rm{array}}\,(\=\+{\rm{caadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{length})\- \\ 
$\wedge$$\;\;\;\;${\rm{array-pitonp}}\,(\=\+{\rm{array}}\,(\=\+{\rm{caadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}))\-\index{array-pitonp} \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,(\=\+{\rm{array}}\,(\=\+{\rm{caadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\-\index{nat-list-piton} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\rm{caadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), {\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\index{definedp} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\rm{caadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), {\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{nat-to-bv-list}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{caadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) \\ 
$\not=$$\;\;\;\;${\rm{caadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}))\- \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $<$ {\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})) \\ 
$\wedge$$\;\;\;\;$({\rm{cdadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})) \\ 
$\wedge$$\;\;\;\;$({\rm{cdadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}))\-\-
\end{tabbing}

  
\begin{tabbing}{\sc Theorem}:  correctness-of-nat-to-bv-list \\ \index{correctness-of-nat-to-bv-list}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{l\/}}, {\rm{cons}}\,({\it{b\/}}, {\rm{cons}}\,({\it{n\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;${\rm{nat-to-bv-list-input-conditionp}}\,({\it{p0\/}})\index{nat-to-bv-list-input-conditionp} \\ 
$\wedge$$\;\;\;\;$({\it{natlist\/}} $=$ {\rm{array}}\,({\rm{caadr}}\,({\it{n\/}}), {\it{data-segment\/}})\index{array}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{l\/}}, {\rm{cons}}\,({\it{b\/}}, {\rm{cons}}\,({\it{n\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{nat-to-bv-list-clock}}\,({\it{natlist\/}})\index{nat-to-bv-list-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{tag-array}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{nat-to-bv-list}}\,(\=\+{\rm{untag-array}}\,({\rm{array}}\,(\=\+{\rm{caadr}}\,({\it{n\/}}), \\ 
{\it{data-segment\/}})\-\index{array})\index{untag-array}, \\ 
{\it{word-size\/}})\-\index{nat-to-bv-list})\-\index{tag-array}, \\ 
{\rm{caadr}}\,({\it{b\/}}), \\ 
{\it{data-segment\/}})\-\index{put-assoc}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}



\noindent{\sc Event}:   Disable nat-to-bv-list-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable match-and-xor-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable highest-bit-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable number-with-at-least-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bv-to-nat-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nat-to-bv-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable push-1-vector-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable xor-bvs-program.

\addvspace{18pt}


\begin{verbatim};; bv-to-nat-list

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bv-to-nat-list-program} \\  
\=\+{\sc{bv-to-nat-list-program}}\index{bv-to-nat-list-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{bv-to-nat-list}} \\ 
{\tt{(}}{\tt{bv-list}}{\tt{ }}{\tt{nat-list}}{\tt{ }}{\tt{length}}{\tt{)}} \\ 
{\tt{(}}{\tt{(}}{\tt{i}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{loop}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{bv-list}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{fetch}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{bv-to-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{nat-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{deposit}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{add1-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{length}}{\tt{)}} \\ 
{\tt{(}}{\tt{eq}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bool-and-jump}}{\tt{ }}{\tt{t}}{\tt{ }}{\tt{done}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{nat-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{add-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{nat-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{bv-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{add-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{bv-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{loop}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{done}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{example-bv-to-nat-list-p-state} \\  
\=\+{\sc{example-bv-to-nat-list-p-state}}\index{example-bv-to-nat-list-p-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr2}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{6}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{bv-to-nat-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\sc{bv-to-nat-list-program}}\index{bv-to-nat-list-program}, \\ 
{\sc{bv-to-nat-program}}\index{bv-to-nat-program}, \\ 
{\rm{push-1-vector-program}}\,({\tt{8}})\index{push-1-vector-program})\-, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{(}}\=\+{\tt{arr}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{bitv}}{\tt{ }}{\tt{(}}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{1}}{\tt{ }}{\tt{0}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}\- \\ 
{\tt{(}}{\tt{arr2}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{)}}{\tt{)}}\-, \\ 
{\tt{100}}, \\ 
{\tt{80}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{bv-to-nat-list-input-conditionp} \\  
\=\+{\rm{bv-to-nat-list-input-conditionp}}\,({\it{p0\/}})\index{bv-to-nat-list-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{13}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{0}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{bv-to-nat-list}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\sc{bv-to-nat-list-program}}\index{bv-to-nat-list-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{bv-to-nat}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\sc{bv-to-nat-program}}\index{bv-to-nat-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{push-1-vector}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) \\ 
$=$$\;\;\;\;${\rm{length}}\,({\rm{array}}\,(\=\+{\rm{caadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{length})\- \\ 
$\wedge$$\;\;\;\;${\rm{array-pitonp}}\,(\=\+{\rm{array}}\,(\=\+{\rm{caadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}))\-\index{array-pitonp} \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectors-piton}}\,(\=\+{\rm{array}}\,(\=\+{\rm{caadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\-\index{bit-vectors-piton} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\rm{caadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), {\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\index{definedp} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\rm{caadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}), {\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{bv-to-nat-list}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{caadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) \\ 
$\not=$$\;\;\;\;${\rm{caadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}))\- \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $<$ {\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})) \\ 
$\wedge$$\;\;\;\;$({\rm{cdadr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{cadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})) \\ 
$\wedge$$\;\;\;\;$({\rm{cdadr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bv-to-nat-list-loop-clock} \\  
\=\+{\rm{bv-to-nat-list-loop-clock}}\,({\it{wordsize\/}}, {\it{i\/}}, {\it{bvs\/}})\index{bv-to-nat-list-loop-clock} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\it{bvs\/}})\index{length} \\ 
{\bf then }{\rm{clock-plus}}\,(\=\+{\tt{'}}{\tt{2}}, \\ 
{\rm{clock-plus}}\,(\=\+{\rm{bv-to-nat-clock}}\,({\it{wordsize\/}}, {\rm{untag}}\,({\rm{get}}\,({\it{i\/}}, {\it{bvs\/}})\index{get})\index{untag})\index{bv-to-nat-clock}, \\ 
\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{bvs\/}}))\index{length} \\ 
{\bf then }{\rm{clock-plus}}\,(\=\+{\tt{'}}{\tt{17}}, \\ 
{\rm{bv-to-nat-list-loop-clock}}\,(\=\+{\it{wordsize\/}}, \\ 
$1\;+$ {\it{i\/}}, \\ 
{\it{bvs\/}})\-\index{bv-to-nat-list-loop-clock})\-\index{clock-plus} \\ 
{\bf else }{\tt{'}}{\tt{9}}$\;${\bf  endif}\-)\-\index{clock-plus})\-\index{clock-plus} \\ 
{\bf else }{\tt{'}}{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bv-to-nat-list} \\  
\=\+{\rm{bv-to-nat-list}}\,({\it{bv-list\/}})\index{bv-to-nat-list} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{bv-list\/}}) \\ 
{\bf then }{\rm{cons}}\,({\rm{bv-to-nat}}\,({\rm{car}}\,({\it{bv-list\/}}))\index{bv-to-nat}, {\rm{bv-to-nat-list}}\,({\rm{cdr}}\,({\it{bv-list\/}}))\index{bv-to-nat-list}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bv-to-nat-list-loop-induct} \\  
\=\+{\rm{bv-to-nat-list-loop-induct}}\,({\it{i\/}}, {\it{bvs\/}}, {\it{nats-name\/}}, {\it{data-segment\/}})\index{bv-to-nat-list-loop-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }({\it{i\/}} $<$ {\rm{length}}\,({\it{bvs\/}})\index{length}) $\wedge$ ({\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{bvs\/}}))\index{length}) \\ 
{\bf then }{\rm{bv-to-nat-list-loop-induct}}\,(\=\+$1\;+$ {\it{i\/}}, \\ 
{\it{bvs\/}}, \\ 
{\it{nats-name\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{append}}\,(\=\+{\rm{make-list-from}}\,(\=\+{\it{i\/}}, \\ 
{\rm{cdr}}\,({\rm{assoc}}\,(\=\+{\it{nats-name\/}}, \\ 
{\it{data-segment\/}})\-))\-\index{make-list-from}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\tt{'}}{\tt{nat}}, \\ 
{\rm{bv-to-nat}}\,({\rm{untag}}\,({\rm{get}}\,(\=\+{\it{i\/}}, \\ 
{\it{bvs\/}})\-\index{get})\index{untag})\index{bv-to-nat})\-, \\ 
{\rm{nthcdr}}\,(\=\+$1\;+$ {\it{i\/}}, \\ 
{\rm{cdr}}\,({\rm{assoc}}\,(\=\+{\it{nats-name\/}}, \\ 
{\it{data-segment\/}})\-))\-\index{nthcdr})\-)\-, \\ 
{\it{nats-name\/}}, \\ 
{\it{data-segment\/}})\-\index{put-assoc})\-\index{bv-to-nat-list-loop-induct} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable bv-to-nat-clock.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-bv-to-nat-list-general \\ \index{correctness-of-bv-to-nat-list-ge!neral}
\=\+(\=\+{\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{p-ctrl-stk-size}}\,({\it{ctrl-stk\/}})\index{p-ctrl-stk-size}, {\tt{13}}, {\it{max-ctrl-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{3}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{bv-to-nat-list}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\sc{bv-to-nat-list-program}}\index{bv-to-nat-list-program})\- \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{bv-to-nat}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{bv-to-nat-program}}\index{bv-to-nat-program}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{push-1-vector}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\it{word-size\/}})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;$({\it{length\/}} $=$ {\rm{length}}\,({\rm{array}}\,({\it{bvs\/}}, {\it{data-segment\/}})\index{array})\index{length}) \\ 
$\wedge$$\;\;\;\;${\rm{bit-vectors-piton}}\,({\rm{array}}\,({\it{bvs\/}}, {\it{data-segment\/}})\index{array}, {\it{word-size\/}})\index{bit-vectors-piton} \\ 
$\wedge$$\;\;\;\;${\rm{array-pitonp}}\,({\rm{array}}\,({\it{nats\/}}, {\it{data-segment\/}})\index{array}, {\it{length\/}})\index{array-pitonp} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\it{nats\/}}, {\it{data-segment\/}})\index{definedp} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\it{bvs\/}}, {\it{data-segment\/}})\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\it{word-size\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $<$ {\it{length\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{length\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{nats\/}} $\not=$ {\it{bvs\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{bvlist\/}} $=$ {\rm{array}}\,({\it{bvs\/}}, {\it{data-segment\/}})\index{array}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{bv-to-nat-list}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{list}}\,(\=\+{\rm{cons}}\,({\tt{'}}{\tt{bv-list}}, {\rm{list}}\,({\tt{'}}{\tt{addr}}, {\rm{cons}}\,({\it{bvs\/}}, {\it{i\/}}))), \\ 
{\rm{cons}}\,(\=\+{\tt{'}}{\tt{nat-list}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{addr}}, {\rm{cons}}\,({\it{nats\/}}, {\it{i\/}})))\-, \\ 
{\rm{cons}}\,({\tt{'}}{\tt{length}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{length\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{i}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{i\/}})))\-, \\ 
{\it{ret-pc\/}})\-, \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{bv-to-nat-list-loop-clock}}\,({\it{word-size\/}}, {\it{i\/}}, {\it{bvlist\/}})\index{bv-to-nat-list-loop-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{append}}\,(\=\+{\rm{make-list-from}}\,(\=\+{\it{i\/}}, \\ 
{\rm{array}}\,(\=\+{\it{nats\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\-\index{make-list-from}, \\ 
{\rm{tag-array}}\,(\=\+{\tt{'}}{\tt{nat}}, \\ 
{\rm{bv-to-nat-list}}\,({\rm{untag-array}}\,({\rm{nthcdr}}\,(\=\+{\it{i\/}}, \\ 
{\rm{array}}\,(\=\+{\it{bvs\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\-\index{nthcdr})\index{untag-array})\index{bv-to-nat-list})\-\index{tag-array})\-, \\ 
{\it{nats\/}}, \\ 
{\it{data-segment\/}})\-\index{put-assoc}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{bv-to-nat-list-clock} \\  
\=\+{\rm{bv-to-nat-list-clock}}\,({\it{word-size\/}}, {\it{natlist\/}})\index{bv-to-nat-list-clock} \\ 
$=$$\;\;\;\;${\rm{clock-plus}}\,({\tt{1}}, {\rm{bv-to-nat-list-loop-clock}}\,({\it{word-size\/}}, {\tt{0}}, {\it{natlist\/}})\index{bv-to-nat-list-loop-clock})\index{clock-plus}\-
\end{tabbing}


\noindent{\sc Event}:   Disable bv-to-nat-list-loop-clock.

\addvspace{18pt}


\noindent{\sc Event}:   Disable bv-to-nat-list-program.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-bv-to-nat-list \\ \index{correctness-of-bv-to-nat-list}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{l\/}}, {\rm{cons}}\,({\it{n\/}}, {\rm{cons}}\,({\it{b\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;${\rm{bv-to-nat-list-input-conditionp}}\,({\it{p0\/}})\index{bv-to-nat-list-input-conditionp} \\ 
$\wedge$$\;\;\;\;$({\it{bvlist\/}} $=$ {\rm{array}}\,({\rm{caadr}}\,({\it{b\/}}), {\it{data-segment\/}})\index{array}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{l\/}}, {\rm{cons}}\,({\it{n\/}}, {\rm{cons}}\,({\it{b\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{bv-to-nat-list-clock}}\,({\it{word-size\/}}, {\it{bvlist\/}})\index{bv-to-nat-list-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{tag-array}}\,(\=\+{\tt{'}}{\tt{nat}}, \\ 
{\rm{bv-to-nat-list}}\,({\rm{untag-array}}\,({\rm{array}}\,(\=\+{\rm{caadr}}\,({\it{b\/}}), \\ 
{\it{data-segment\/}})\-\index{array})\index{untag-array})\index{bv-to-nat-list})\-\index{tag-array}, \\ 
{\rm{caadr}}\,({\it{n\/}}), \\ 
{\it{data-segment\/}})\-\index{put-assoc}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{verbatim};; max-nat


\end{verbatim}\begin{tabbing}{\sc Definition}:\index{max-nat-program} \\  
\=\+{\sc{max-nat-program}}\index{max-nat-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{max-nat}} \\ 
{\tt{(}}{\tt{nat-list}}{\tt{ }}{\tt{length}}{\tt{)}} \\ 
{\tt{(}}{\tt{(}}{\tt{i}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{j}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{loop}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{j}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{j}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{nat-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{fetch}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{j}}{\tt{)}} \\ 
{\tt{(}}{\tt{lt-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bool-and-jump}}{\tt{ }}{\tt{f}}{\tt{ }}{\tt{lab}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{j}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{lab}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{i}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{add1-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{length}}{\tt{)}} \\ 
{\tt{(}}{\tt{eq}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bool-and-jump}}{\tt{ }}{\tt{t}}{\tt{ }}{\tt{done}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{nat-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{add-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{nat-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{loop}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{done}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}
		    

\begin{tabbing}{\sc Definition}:\index{example-max-nat-p-state} \\  
\=\+{\sc{example-max-nat-p-state}}\index{example-max-nat-p-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{6}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{max-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\sc{max-nat-program}}\index{max-nat-program})\-, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{(}}\=\+{\tt{arr}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{10}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{6}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{9}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}\- \\ 
{\tt{(}}{\tt{arr2}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}}{\tt{)}}{\tt{)}}\-, \\ 
{\tt{100}}, \\ 
{\tt{80}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{max-list-helper} \\  
\=\+{\rm{max-list-helper}}\,({\it{val\/}}, {\it{x\/}})\index{max-list-helper} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\it{val\/}} $<$ {\rm{car}}\,({\it{x\/}})$\;\;${\bf then }{\rm{max-list-helper}}\,({\rm{car}}\,({\it{x\/}}), {\rm{cdr}}\,({\it{x\/}}))\index{max-list-helper} \\ 
{\bf else }{\rm{max-list-helper}}\,({\it{val\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{max-list-helper}$\;${\bf  endif}\- \\ 
{\bf else }{\rm{fix}}\,({\it{val\/}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{max-list} \\  
\=\+{\rm{max-list}}\,({\it{x\/}})\index{max-list} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{max-list}}\,({\rm{cdr}}\,({\it{x\/}}))\index{max-list} $<$ {\rm{car}}\,({\it{x\/}})$\;\;${\bf then }{\rm{car}}\,({\it{x\/}}) \\ 
{\bf else }{\rm{max-list}}\,({\rm{cdr}}\,({\it{x\/}}))\index{max-list}$\;${\bf  endif}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  max-list-helper-max-list \\ \index{max-list-helper-max-list}
\=\+{\rm{max-list-helper}}\,({\it{val\/}}, {\it{x\/}})\index{max-list-helper} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{max-list}}\,({\it{x\/}})\index{max-list} $<$ {\it{val\/}}$\;\;${\bf then }{\it{val\/}} \\ 
{\bf else }{\rm{max-list}}\,({\it{x\/}})\index{max-list}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  max-list-helper-max-list-0 \\ \index{max-list-helper-max-list-0}
{\rm{max-list-helper}}\,({\tt{0}}, {\it{x\/}})\index{max-list-helper} $=$ {\rm{max-list}}\,({\it{x\/}})\index{max-list}
\end{tabbing}


\noindent{\sc Event}:   Disable max-list-helper-max-list.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{max-nat-loop-clock} \\  
\=\+{\rm{max-nat-loop-clock}}\,({\it{val\/}}, {\it{i\/}}, {\it{nats\/}})\index{max-nat-loop-clock} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\it{nats\/}})\index{length} \\ 
{\bf then }\=\+{\bf if }{\it{val\/}} $<$ {\rm{untag}}\,({\rm{get}}\,({\it{i\/}}, {\it{nats\/}})\index{get})\index{untag} \\ 
{\bf then }\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{nats\/}}))\index{length} \\ 
{\bf then }{\rm{clock-plus}}\,(\=\+{\tt{20}}, \\ 
{\rm{max-nat-loop-clock}}\,(\=\+{\rm{untag}}\,({\rm{get}}\,({\it{i\/}}, {\it{nats\/}})\index{get})\index{untag}, \\ 
$1\;+$ {\it{i\/}}, \\ 
{\it{nats\/}})\-\index{max-nat-loop-clock})\-\index{clock-plus} \\ 
{\bf else }{\tt{16}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\it{i\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{nats\/}}))\index{length} \\ 
{\bf then }{\rm{clock-plus}}\,({\tt{18}}, {\rm{max-nat-loop-clock}}\,({\it{val\/}}, $1\;+$ {\it{i\/}}, {\it{nats\/}})\index{max-nat-loop-clock})\index{clock-plus} \\ 
{\bf else }{\tt{14}}$\;${\bf  endif}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}
	
\begin{tabbing}{\sc Definition}:\index{max-nat-loop-induct} \\  
\=\+{\rm{max-nat-loop-induct}}\,({\it{i\/}}, {\it{j\/}}, {\it{x\/}}, {\it{natlist\/}}, {\it{length\/}})\index{max-nat-loop-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\it{length\/}} \\ 
{\bf then }{\rm{max-nat-loop-induct}}\,(\=\+$1\;+$ {\it{i\/}}, \\ 
{\rm{get}}\,({\it{i\/}}, {\it{natlist\/}})\index{get}, \\ 
\=\+{\bf if }{\rm{untag}}\,({\rm{get}}\,({\it{i\/}}, {\it{natlist\/}})\index{get})\index{untag} $<$ {\rm{untag}}\,({\it{x\/}})\index{untag} \\ 
{\bf then }{\rm{list}}\,({\tt{'}}{\tt{nat}}, {\rm{untag}}\,({\it{x\/}})\index{untag}) \\ 
{\bf else }{\rm{list}}\,({\tt{'}}{\tt{nat}}, {\rm{untag}}\,({\rm{get}}\,({\it{i\/}}, {\it{natlist\/}})\index{get})\index{untag})$\;${\bf  endif}\-, \\ 
{\it{natlist\/}}, \\ 
{\it{length\/}})\-\index{max-nat-loop-induct} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  list-nat-from-assoc-nat-list-piton-hack \\ \index{list-nat-from-assoc-nat-list-pit!on-hack}
\=\+{\rm{nat-list-piton}}\,({\it{nl\/}}, {\it{s\/}})\index{nat-list-piton} \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+({\it{z\/}} $<$ {\rm{length}}\,({\rm{cdr}}\,({\it{nl\/}}))\index{length}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{list}}\,({\tt{'}}{\tt{nat}}, {\rm{cadr}}\,({\rm{get}}\,({\it{z\/}}, {\rm{cdr}}\,({\it{nl\/}}))\index{get})) $=$ {\rm{get}}\,({\it{z\/}}, {\rm{cdr}}\,({\it{nl\/}}))\index{get}))\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{listp}}\,({\it{nl\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{list}}\,({\tt{'}}{\tt{nat}}, {\rm{cadr}}\,({\rm{last}}\,({\it{nl\/}})\index{last})) $=$ {\rm{last}}\,({\it{nl\/}})\index{last}) \\ 
$\wedge$$\;\;\;\;$({\rm{list}}\,({\tt{'}}{\tt{nat}}, {\rm{cadr}}\,({\rm{car}}\,({\it{nl\/}}))) $=$ {\rm{car}}\,({\it{nl\/}})))\-)\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-max-nat-general \\ \index{correctness-of-max-nat-general}
\=\+(\=\+{\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{p-ctrl-stk-size}}\,({\it{ctrl-stk\/}})\index{p-ctrl-stk-size}, {\tt{4}}, {\it{max-ctrl-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{4}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{max-nat}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{max-nat-program}}\index{max-nat-program}) \\ 
$\wedge$$\;\;\;\;$({\it{length\/}} $=$ {\rm{length}}\,({\rm{array}}\,({\it{nats\/}}, {\it{data-segment\/}})\index{array})\index{length}) \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,({\rm{array}}\,({\it{nats\/}}, {\it{data-segment\/}})\index{array}, {\it{word-size\/}})\index{nat-list-piton} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\it{nats\/}}, {\it{data-segment\/}})\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\it{word-size\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $<$ {\it{length\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\it{x\/}})\index{untag} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\it{x\/}})\index{untag} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\it{x\/}}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\it{length\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{natlist\/}} $=$ {\rm{array}}\,({\it{nats\/}}, {\it{data-segment\/}})\index{array}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{max-nat}}{\tt{ .\ }}{\tt{1}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{list}}\,(\=\+{\rm{cons}}\,(\=\+{\tt{'}}{\tt{nat-list}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{addr}}, {\rm{cons}}\,({\it{nats\/}}, {\it{i\/}})))\-, \\ 
{\rm{cons}}\,({\tt{'}}{\tt{length}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{length\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{i}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{i\/}})), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{j}}, {\it{j\/}}))\-, \\ 
{\it{ret-pc\/}})\-, \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\rm{cons}}\,({\it{x\/}}, {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{max-nat-loop-clock}}\,({\rm{untag}}\,({\it{x\/}})\index{untag}, {\it{i\/}}, {\rm{array}}\,({\it{nats\/}}, {\it{data-segment\/}})\index{array})\index{max-nat-loop-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\tt{'}}{\tt{nat}}, \\ 
{\rm{max-list-helper}}\,(\=\+{\rm{untag}}\,({\it{x\/}})\index{untag}, \\ 
{\rm{untag-array}}\,({\rm{nthcdr}}\,(\=\+{\it{i\/}}, \\ 
{\rm{array}}\,(\=\+{\it{nats\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\-\index{nthcdr})\index{untag-array})\-\index{max-list-helper})\-, \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{max-nat-clock} \\  
{\rm{max-nat-clock}}\,({\it{natlist\/}})\index{max-nat-clock} $=$ {\rm{clock-plus}}\,({\tt{2}}, {\rm{max-nat-loop-clock}}\,({\tt{0}}, {\tt{0}}, {\it{natlist\/}})\index{max-nat-loop-clock})\index{clock-plus}
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{max-nat-input-conditionp} \\  
\=\+{\rm{max-nat-input-conditionp}}\,({\it{p0\/}})\index{max-nat-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{6}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{2}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{max-nat}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\sc{max-nat-program}}\index{max-nat-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag} \\ 
$=$$\;\;\;\;${\rm{length}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{length})\- \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,(\=\+{\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\-\index{nat-list-piton} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag} $<$ {\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdr}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}) $=$ {\tt{0}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-max-nat \\ \index{correctness-of-max-nat}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{n\/}}, {\rm{cons}}\,({\it{s\/}}, {\it{temp-stk\/}})), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{max-nat}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;${\rm{max-nat-input-conditionp}}\,({\it{p0\/}})\index{max-nat-input-conditionp} \\ 
$\wedge$$\;\;\;\;$({\it{natlist\/}} $=$ {\rm{array}}\,({\rm{car}}\,({\rm{untag}}\,({\it{s\/}})\index{untag}), {\it{data-segment\/}})\index{array}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{n\/}}, {\rm{cons}}\,({\it{s\/}}, {\it{temp-stk\/}})), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{max-nat-clock}}\,({\it{natlist\/}})\index{max-nat-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,({\tt{'}}{\tt{nat}}, {\rm{max-list}}\,({\rm{untag-array}}\,({\it{natlist\/}})\index{untag-array})\index{max-list}), \\ 
{\it{temp-stk\/}})\-, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable max-nat-program.

\addvspace{18pt}

\begin{verbatim};; replace-value

;; replace the first occurrence of oldval by newval in list
;; of naturals (assumes oldval occurs in list)

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{replace-value-program} \\  
\=\+{\sc{replace-value-program}}\index{replace-value-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{replace-value}} \\ 
{\tt{(}}{\tt{list}}{\tt{ }}{\tt{oldval}}{\tt{ }}{\tt{newval}}{\tt{)}} \\ 
{\tt{nil}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{loop}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{list}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{fetch}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{oldval}}{\tt{)}} \\ 
{\tt{(}}{\tt{eq}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bool-and-jump}}{\tt{ }}{\tt{t}}{\tt{ }}{\tt{done}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{list}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{add-addr}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{list}}{\tt{)}} \\ 
{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{loop}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{done}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{newval}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{list}}{\tt{)}} \\ 
{\tt{(}}{\tt{deposit}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{example-replace-value-p-state} \\  
\=\+{\sc{example-replace-value-p-state}}\index{example-replace-value-p-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{replace-value}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\sc{replace-value-program}}\index{replace-value-program})\-, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{(}}\=\+{\tt{arr}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{9}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{10}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{6}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{9}}{\tt{)}} \\ 
{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}\-{\tt{)}}\-, \\ 
{\tt{100}}, \\ 
{\tt{80}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{replace-value-loop-clock} \\  
\=\+{\rm{replace-value-loop-clock}}\,({\it{i\/}}, {\it{list\/}}, {\it{oldvalue\/}})\index{replace-value-loop-clock} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\it{list\/}})\index{length} \\ 
{\bf then }\=\+{\bf if }{\rm{get}}\,({\it{i\/}}, {\it{list\/}})\index{get} $=$ {\it{oldvalue\/}}$\;\;${\bf then }{\tt{9}} \\ 
{\bf else }{\rm{clock-plus}}\,(\=\+{\tt{10}}, \\ 
{\rm{replace-value-loop-clock}}\,(\=\+$1\;+$ {\it{i\/}}, \\ 
{\it{list\/}}, \\ 
{\it{oldvalue\/}})\-\index{replace-value-loop-clock})\-\index{clock-plus}$\;${\bf  endif}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{replace-value-loop-induct} \\  
\=\+{\rm{replace-value-loop-induct}}\,({\it{i\/}}, {\it{list\/}}, {\it{list-addr\/}})\index{replace-value-loop-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\rm{length}}\,({\it{list\/}})\index{length} \\ 
{\bf then }{\rm{replace-value-loop-induct}}\,($1\;+$ {\it{i\/}}, {\it{list\/}}, {\rm{add1-addr}}\,({\it{list-addr\/}})\index{add1-addr})\index{replace-value-loop-induct} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{replace-value} \\  
\=\+{\rm{replace-value}}\,({\it{list\/}}, {\it{oldvalue\/}}, {\it{newvalue\/}})\index{replace-value} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{list\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{list\/}}) $=$ {\it{oldvalue\/}}$\;\;${\bf then }{\rm{cons}}\,({\it{newvalue\/}}, {\rm{cdr}}\,({\it{list\/}})) \\ 
{\bf else }{\rm{cons}}\,(\=\+{\rm{car}}\,({\it{list\/}}), \\ 
{\rm{replace-value}}\,({\rm{cdr}}\,({\it{list\/}}), {\it{oldvalue\/}}, {\it{newvalue\/}})\index{replace-value})\-$\;${\bf  endif}\- \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-nthcdr-means \\ \index{member-nthcdr-means}
({\it{x\/}} $\in$ {\rm{nthcdr}}\,({\it{i\/}}, {\it{y\/}})\index{nthcdr}) $\rightarrow$ ({\it{x\/}} $\in$ {\it{y\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-of-natlist-means \\ \index{member-of-natlist-means}
\=\+({\rm{nat-list-piton}}\,({\it{y\/}}, {\it{s\/}})\index{nat-list-piton} $\wedge$ ({\it{x\/}} $\in$ {\it{y\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\it{x\/}}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\it{x\/}}) $<$ {\rm{exp}}\,({\tt{2}}, {\it{s\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\it{x\/}}) $=$ {\bf{nil}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  replace-value-nthcdr-open \\ \index{replace-value-nthcdr-open}
\=\+(({\rm{get}}\,({\it{x\/}}, {\it{a\/}})\index{get} $\not=$ {\it{old\/}}) $\wedge$ ({\it{x\/}} $<$ {\rm{length}}\,({\it{a\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{replace-value}}\,({\rm{nthcdr}}\,({\it{x\/}}, {\it{a\/}})\index{nthcdr}, {\it{old\/}}, {\it{new\/}})\index{replace-value} \\ 
$=$$\;\;\;\;${\rm{cons}}\,({\rm{get}}\,({\it{x\/}}, {\it{a\/}})\index{get}, {\rm{replace-value}}\,({\rm{nthcdr}}\,({\it{x\/}}, {\rm{cdr}}\,({\it{a\/}}))\index{nthcdr}, {\it{old\/}}, {\it{new\/}})\index{replace-value}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  list-nat-cadr-get-hack \\ \index{list-nat-cadr-get-hack}
\=\+({\rm{nat-list-piton}}\,({\it{y\/}}, {\it{s\/}})\index{nat-list-piton} $\wedge$ ({\it{x\/}} $<$ {\rm{length}}\,({\it{y\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{list}}\,({\tt{'}}{\tt{nat}}, {\rm{cadr}}\,({\rm{get}}\,({\it{x\/}}, {\it{y\/}})\index{get})) $=$ {\rm{get}}\,({\it{x\/}}, {\it{y\/}})\index{get})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-nthcdr-simplify \\ \index{member-nthcdr-simplify}
\=\+(({\it{i\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length}) $\wedge$ ({\it{a\/}} $\not\in$ {\rm{nthcdr}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{nthcdr})) \\ 
$\rightarrow$$\;\;\;\;$(({\it{a\/}} $\in$ {\rm{nthcdr}}\,({\it{i\/}}, {\it{x\/}})\index{nthcdr}) $=$ ({\it{a\/}} $=$ {\rm{get}}\,({\it{i\/}}, {\it{x\/}})\index{get}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  append-make-list-from-cons-cdr \\ \index{append-make-list-from-cons-cdr}
\=\+({\it{i\/}} $<$ {\rm{length}}\,({\it{y\/}})\index{length}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{append}}\,({\rm{make-list-from}}\,({\it{i\/}}, {\it{y\/}})\index{make-list-from}, {\rm{cons}}\,({\it{v\/}}, {\rm{cdr}}\,({\rm{nthcdr}}\,({\it{i\/}}, {\it{y\/}})\index{nthcdr}))) $=$ {\rm{put}}\,({\it{v\/}}, {\it{i\/}}, {\it{y\/}})\index{put})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-replace-value-general \\ \index{correctness-of-replace-value-ge!neral}
\=\+(\=\+{\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{2}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{replace-value}}, {\it{prog-segment\/}})\index{definition} \\ 
$=$$\;\;\;\;${\sc{replace-value-program}}\index{replace-value-program})\- \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,({\rm{array}}\,({\it{list\/}}, {\it{data-segment\/}})\index{array}, {\it{word-size\/}})\index{nat-list-piton} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\it{list\/}}, {\it{data-segment\/}})\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\it{word-size\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{vallist\/}} $=$ {\rm{array}}\,({\it{list\/}}, {\it{data-segment\/}})\index{array}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{list-addr\/}}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\it{list-addr\/}}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{untag}}\,({\it{list-addr\/}})\index{untag}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{untag}}\,({\it{list-addr\/}})\index{untag}) $=$ {\it{list\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdr}}\,({\rm{untag}}\,({\it{list-addr\/}})\index{untag}) $=$ {\it{i\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{newvalue\/}}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\it{newvalue\/}}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{oldvalue\/}}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\it{oldvalue\/}}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\it{oldvalue\/}}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\it{oldvalue\/}}) $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\it{newvalue\/}})\index{untag} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\it{newvalue\/}})\index{untag} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{oldvalue\/}} $\in$ {\rm{nthcdr}}\,({\it{i\/}}, {\it{vallist\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{replace-value}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{list}}\,(\=\+{\rm{cons}}\,({\tt{'}}{\tt{list}}, {\it{list-addr\/}}), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{oldval}}, {\it{oldvalue\/}}), \\ 
{\rm{cons}}\,({\tt{'}}{\tt{newval}}, {\it{newvalue\/}}))\-, \\ 
{\it{ret-pc\/}})\-, \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{replace-value-loop-clock}}\,({\it{i\/}}, {\it{vallist\/}}, {\it{oldvalue\/}})\index{replace-value-loop-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{append}}\,(\=\+{\rm{make-list-from}}\,(\=\+{\it{i\/}}, \\ 
{\rm{array}}\,(\=\+{\it{list\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\-\index{make-list-from}, \\ 
{\rm{replace-value}}\,(\=\+{\rm{nthcdr}}\,(\=\+{\it{i\/}}, \\ 
{\rm{array}}\,(\=\+{\it{list\/}}, \\ 
{\it{data-segment\/}})\-\index{array})\-\index{nthcdr}, \\ 
{\it{oldvalue\/}}, \\ 
{\it{newvalue\/}})\-\index{replace-value})\-, \\ 
{\it{list\/}}, \\ 
{\it{data-segment\/}})\-\index{put-assoc}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{replace-value-clock} \\  
\=\+{\rm{replace-value-clock}}\,({\it{list\/}}, {\it{ov\/}})\index{replace-value-clock} \\ 
$=$$\;\;\;\;${\rm{clock-plus}}\,({\tt{1}}, {\rm{replace-value-loop-clock}}\,({\tt{0}}, {\it{list\/}}, {\it{ov\/}})\index{replace-value-loop-clock})\index{clock-plus}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{replace-value-input-conditionp} \\  
\=\+{\rm{replace-value-input-conditionp}}\,({\it{p0\/}})\index{replace-value-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{0}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{5}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{definition}}\,({\tt{'}}{\tt{replace-value}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} \\ 
$=$$\;\;\;\;${\sc{replace-value-program}}\index{replace-value-program})\- \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,(\=\+{\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\-\index{nat-list-piton} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{definedp} \\ 
$\wedge$$\;\;\;\;$({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdr}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag} $<$ {\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top} \\ 
$\in$$\;\;\;\;${\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\-)\-\-
\end{tabbing}
  
\begin{tabbing}{\sc Theorem}:  correctness-of-replace-value \\ \index{correctness-of-replace-value}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{nv\/}}, {\rm{cons}}\,({\it{ov\/}}, {\rm{cons}}\,({\it{nats\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{replace-value}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;${\rm{replace-value-input-conditionp}}\,({\it{p0\/}})\index{replace-value-input-conditionp} \\ 
$\wedge$$\;\;\;\;$({\it{natlist\/}} $=$ {\rm{array}}\,({\rm{car}}\,({\rm{untag}}\,({\it{nats\/}})\index{untag}), {\it{data-segment\/}})\index{array}) \\ 
$\wedge$$\;\;\;\;$({\it{ov\/}} $=$ {\it{ov2\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{nv\/}}, {\rm{cons}}\,({\it{ov\/}}, {\rm{cons}}\,({\it{nats\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{replace-value-clock}}\,({\it{natlist\/}}, {\it{ov2\/}})\index{replace-value-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{replace-value}}\,({\it{natlist\/}}, {\it{ov\/}}, {\it{nv\/}})\index{replace-value}, \\ 
{\rm{caadr}}\,({\it{nats\/}}), \\ 
{\it{data-segment\/}})\-\index{put-assoc}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable replace-value-program.

\addvspace{18pt}

\begin{verbatim};; smart-move

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{smart-move-program} \\  
\=\+{\sc{smart-move-program}}\index{smart-move-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{smart-move}} \\ 
{\tt{(}}{\tt{state}}{\tt{ }}{\tt{numpiles}}{\tt{ }}{\tt{work-area}}{\tt{)}} \\ 
{\tt{(}}{\tt{(}}{\tt{i}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{state}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{2}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{number-with-at-least}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{2}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{lt-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bool-and-jump}}{\tt{ }}{\tt{t}}{\tt{ }}{\tt{lab}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{state}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{work-area}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{nat-to-bv-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{work-area}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{work-area}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{xor-bvs}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{highest-bit}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{match-and-xor}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{work-area}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{state}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{bv-to-nat-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{lab}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{state}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{state}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{max-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{state}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{number-with-at-least}}{\tt{)}} \\ 
{\tt{(}}{\tt{div2-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{replace-value}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{example-smart-move-p-state} \\  
\=\+{\sc{example-smart-move-p-state}}\index{example-smart-move-p-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr5}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{smart-move}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr2}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr5}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{smart-move}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr3}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr5}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{smart-move}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr4}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr5}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{smart-move}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\sc{replace-value-program}}\index{replace-value-program}, \\ 
{\sc{max-nat-program}}\index{max-nat-program}, \\ 
{\sc{bv-to-nat-list-program}}\index{bv-to-nat-list-program}, \\ 
{\sc{nat-to-bv-list-program}}\index{nat-to-bv-list-program}, \\ 
{\sc{match-and-xor-program}}\index{match-and-xor-program}, \\ 
{\sc{highest-bit-program}}\index{highest-bit-program}, \\ 
{\sc{number-with-at-least-program}}\index{number-with-at-least-program}, \\ 
{\sc{bv-to-nat-program}}\index{bv-to-nat-program}, \\ 
{\sc{nat-to-bv-program}}\index{nat-to-bv-program}, \\ 
{\rm{push-1-vector-program}}\,({\tt{8}})\index{push-1-vector-program}, \\ 
{\sc{xor-bvs-program}}\index{xor-bvs-program}, \\ 
{\sc{smart-move-program}}\index{smart-move-program})\-, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{(}}{\tt{arr}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{2}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{arr2}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{9}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{arr3}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{9}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{arr4}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{arr5}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{2}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}}{\tt{)}}\-, \\ 
{\tt{100}}, \\ 
{\tt{80}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{smart-move} \\  
\=\+{\rm{smart-move}}\,({\it{state\/}}, {\it{wordsize\/}})\index{smart-move} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{number-with-at-least}}\,({\it{state\/}}, {\tt{2}})\index{number-with-at-least} $<$ {\tt{2}} \\ 
{\bf then }{\rm{replace-value}}\,(\=\+{\it{state\/}}, \\ 
{\rm{max-list}}\,({\it{state\/}})\index{max-list}, \\ 
{\rm{number-with-at-least}}\,({\it{state\/}}, {\tt{1}})\index{number-with-at-least} ${}${\bf{mod}}${}$ {\tt{2}})\-\index{replace-value} \\ 
{\bf else }{\rm{bv-to-nat-list}}\,({\rm{match-and-xor}}\,(\=\+{\rm{nat-to-bv-list}}\,({\it{state\/}}, {\it{wordsize\/}})\index{nat-to-bv-list}, \\ 
{\rm{highest-bit}}\,({\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,(\=\+{\it{state\/}}, \\ 
{\it{wordsize\/}})\-\index{nat-to-bv-list})\index{xor-bvs})\index{highest-bit}, \\ 
{\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,(\=\+{\it{state\/}}, \\ 
{\it{wordsize\/}})\-\index{nat-to-bv-list})\index{xor-bvs})\-\index{match-and-xor})\index{bv-to-nat-list}$\;${\bf  endif}\-\-
\end{tabbing}

%\item 
\begin{verbatim}


(defn smart-move-clock (state wordsize)
  (clock-plus 4
   (clock-plus (number-with-at-least-clock 2 (tag-array 'nat state))
    (clock-plus 3
     (if (lessp (number-with-at-least state 2) 2)
	 (clock-plus 3
	  (clock-plus (max-nat-clock (tag-array 'nat state))
	   (clock-plus 3
	    (clock-plus (number-with-at-least-clock 
			 1 (tag-array 'nat state))
	     (clock-plus 4
	      (clock-plus (replace-value-clock (tag-array 'nat state)
					       (list 'nat (max-list state)))
	       1))))))
       (clock-plus 3
	(clock-plus (nat-to-bv-list-clock (tag-array 'nat state))
 	 (clock-plus 4
	  (clock-plus (xor-bvs-clock (length state))
	   (clock-plus 1
	    (clock-plus (highest-bit-clock 
			 (xor-bvs (nat-to-bv-list state wordsize)))
	     (clock-plus 1
	      (clock-plus (match-and-xor-clock 
			   (nat-to-bv-list state wordsize)
			   (highest-bit 
			    (xor-bvs (nat-to-bv-list state wordsize))))
	       (clock-plus 3
		(clock-plus (bv-to-nat-list-clock
			     wordsize
			     (tag-array 
			      'bitv
			      (match-and-xor
			       (nat-to-bv-list state wordsize)
			       (highest-bit 
				(xor-bvs (nat-to-bv-list state wordsize)))
			       (xor-bvs (nat-to-bv-list state wordsize)))))
			    1)))))))))))))))
\end{verbatim}



\noindent{\sc Event}:   Disable replace-value-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable max-nat-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bv-to-nat-list-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nat-to-bv-list-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable match-and-xor-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable highest-bit-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable number-with-at-least-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bv-to-nat-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nat-to-bv-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable xor-bvs-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable replace-value-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable max-nat-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bv-to-nat-list-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nat-to-bv-list-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable match-and-xor-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable highest-bit-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable number-with-at-least-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bv-to-nat-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nat-to-bv-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable push-1-vector-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*xor-bvs-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*replace-value-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*max-nat-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*bv-to-nat-list-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*nat-to-bv-list-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*match-and-xor-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*highest-bit-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*number-with-at-least-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*bv-to-nat-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*nat-to-bv-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*push-1-vector-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*xor-bvs-program.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{nat-listp} \\  
\=\+{\rm{nat-listp}}\,({\it{list\/}}, {\it{size\/}})\index{nat-listp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{list\/}}) \\ 
{\bf then }\=\+({\rm{car}}\,({\it{list\/}}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{list\/}}) $<$ {\rm{exp}}\,({\tt{2}}, {\it{size\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;${\rm{nat-listp}}\,({\rm{cdr}}\,({\it{list\/}}), {\it{size\/}})\index{nat-listp}\- \\ 
{\bf else }{\it{list\/}} $=$ {\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bv-to-nat-list-nat-to-bv-list \\ \index{bv-to-nat-list-nat-to-bv-list}
{\rm{nat-listp}}\,({\it{x\/}}, {\it{size\/}})\index{nat-listp} $\rightarrow$ ({\rm{bv-to-nat-list}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{size\/}})\index{nat-to-bv-list})\index{bv-to-nat-list} $=$ {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorsp-nat-to-bv-list \\ \index{bit-vectorsp-nat-to-bv-list}
{\rm{bit-vectorsp}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{size\/}})\index{nat-to-bv-list}, {\it{size\/}})\index{bit-vectorsp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-to-bv-list-bv-to-nat-list \\ \index{nat-to-bv-list-bv-to-nat-list}
{\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorsp} $\rightarrow$ ({\rm{nat-to-bv-list}}\,({\rm{bv-to-nat-list}}\,({\it{x\/}})\index{bv-to-nat-list}, {\it{size\/}})\index{nat-to-bv-list} $=$ {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorsp-match-and-xor \\ \index{bit-vectorsp-match-and-xor}
{\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorsp} $\rightarrow$ {\rm{bit-vectorsp}}\,({\rm{match-and-xor}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{match-and-xor}, {\it{size\/}})\index{bit-vectorsp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-sub1-add1 \\ \index{equal-sub1-add1}
\=\+((({\it{x\/}} $-\;1$) $=$ ($1\;+$ {\it{y\/}})) $=$ ({\it{x\/}} $=$ ($1\;+$ ($1\;+$ {\it{y\/}})))) \\ 
$\wedge$$\;\;\;\;$((({\it{x\/}} $-\;1$) $=$ {\tt{0}}) $=$ (({\it{x\/}} $\simeq {\tt{0}}$) $\vee$ ({\it{x\/}} $=$ {\tt{1}})))\-
\end{tabbing}

\begin{verbatim};; part of more recent naturals library that's missing from Piton library
\end{verbatim}\begin{tabbing}{\sc Theorem}:  equal-times-x-x \\ \index{equal-times-x-x}
\=\+((({\it{x\/}} $*$ {\it{y\/}}) $=$ {\it{x\/}}) $=$ ((({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{y\/}} $=$ {\tt{1}})) $\vee$ ({\it{x\/}} $=$ {\tt{0}}))) \\ 
$\wedge$$\;\;\;\;$((({\it{y\/}} $*$ {\it{x\/}}) $=$ {\it{x\/}}) $=$ ((({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{y\/}} $=$ {\tt{1}})) $\vee$ ({\it{x\/}} $=$ {\tt{0}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-exp-x-y-x \\ \index{equal-exp-x-y-x}
\=\+({\rm{exp}}\,({\it{x\/}}, {\it{y\/}})\index{exp} $=$ {\it{x\/}}) \\ 
$=$$\;\;\;\;$(({\it{x\/}} $=$ {\tt{1}}) $\vee$ (({\it{x\/}} $=$ {\tt{0}}) $\wedge$ ({\it{y\/}} $\not\simeq {\tt{0}}$)) $\vee$ (({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{y\/}} $=$ {\tt{1}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-number-with-at-least \\ \index{lessp-number-with-at-least}
{\rm{length}}\,({\it{x\/}})\index{length} $\not<$ {\rm{number-with-at-least}}\,({\it{x\/}}, {\it{min\/}})\index{number-with-at-least}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectors-piton-tag-array \\ \index{bit-vectors-piton-tag-array}
{\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorsp} $\rightarrow$ {\rm{bit-vectors-piton}}\,({\rm{tag-array}}\,({\tt{'}}{\tt{bitv}}, {\it{x\/}})\index{tag-array}, {\it{size\/}})\index{bit-vectors-piton}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tag-array-untag-array-of-nat-list-piton \\ \index{tag-array-untag-array-of-nat-li!st-piton}
{\rm{nat-list-piton}}\,({\it{x\/}}, {\it{size\/}})\index{nat-list-piton} $\rightarrow$ ({\rm{tag-array}}\,({\tt{'}}{\tt{nat}}, {\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{tag-array} $=$ {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tag-array-untag-array-of-bit-vectors-piton \\ \index{tag-array-untag-array-of-bit-ve!ctors-piton}
{\rm{bit-vectors-piton}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectors-piton} $\rightarrow$ ({\rm{tag-array}}\,({\tt{'}}{\tt{bitv}}, {\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{tag-array} $=$ {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-xor-bvs-nat-to-bv-list \\ \index{bit-vectorp-xor-bvs-nat-to-bv-li!st}
{\rm{bit-vectorp}}\,({\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list})\index{xor-bvs}, {\it{s\/}})\index{bit-vectorp} $=$ ({\rm{listp}}\,({\it{x\/}}) $\vee$ ({\it{s\/}} $\simeq {\tt{0}}$))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-cdr-assoc-hack-from-free \\ \index{listp-cdr-assoc-hack-from-free}
\=\+(({\rm{length}}\,({\rm{cdr}}\,({\rm{assoc}}\,({\it{x\/}}, {\it{y\/}})))\index{length} $=$ {\it{free\/}}) $\wedge$ ({\it{free\/}} $\not\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;${\rm{listp}}\,({\rm{cdr}}\,({\rm{assoc}}\,({\it{x\/}}, {\it{y\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-highest-bit \\ \index{bit-vectorp-highest-bit}
{\rm{bit-vectorp}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectorp} $\rightarrow$ {\rm{bit-vectorp}}\,({\rm{highest-bit}}\,({\it{x\/}})\index{highest-bit}, {\it{s\/}})\index{bit-vectorp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-match-and-xor \\ \index{length-match-and-xor}
{\rm{length}}\,({\rm{match-and-xor}}\,({\it{list\/}}, {\it{m\/}}, {\it{v\/}})\index{match-and-xor})\index{length} $=$ {\rm{length}}\,({\it{list\/}})\index{length}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  array-pitonp-from-nat-list-piton \\ \index{array-pitonp-from-nat-list-pito!n}
\=\+{\rm{nat-list-piton}}\,({\it{x\/}}, {\it{s\/}})\index{nat-list-piton} \\ 
$\rightarrow$$\;\;\;\;$({\rm{array-pitonp}}\,({\it{x\/}}, {\it{length\/}})\index{array-pitonp} $=$ ({\rm{fix}}\,({\it{length\/}}) $=$ {\rm{length}}\,({\it{x\/}})\index{length}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  untag-array-tag-array-of-bit-vectorsp \\ \index{untag-array-tag-array-of-bit-ve!ctorsp}
{\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{size\/}})\index{bit-vectorsp} $\rightarrow$ ({\rm{untag-array}}\,({\rm{tag-array}}\,({\it{l\/}}, {\it{x\/}})\index{tag-array})\index{untag-array} $=$ {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  untag-array-tag-array-of-nat-to-bv-list \\ \index{untag-array-tag-array-of-nat-to!-bv-list}
{\rm{untag-array}}\,({\rm{tag-array}}\,({\it{l\/}}, {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{size\/}})\index{nat-to-bv-list})\index{tag-array})\index{untag-array} $=$ {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{size\/}})\index{nat-to-bv-list}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  untag-array-tag-array-of-match-and-xor-hack \\ \index{untag-array-tag-array-of-match-!and-xor-hack}
\=\+{\rm{untag-array}}\,({\rm{tag-array}}\,({\it{l\/}}, {\rm{match-and-xor}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list}, {\it{y\/}}, {\it{z\/}})\index{match-and-xor})\index{tag-array})\index{untag-array} \\ 
$=$$\;\;\;\;${\rm{match-and-xor}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list}, {\it{y\/}}, {\it{z\/}})\index{match-and-xor}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-list-max-list \\ \index{member-list-max-list}
\=\+{\rm{nat-list-piton}}\,({\it{x\/}}, {\it{s\/}})\index{nat-list-piton} \\ 
$\rightarrow$$\;\;\;\;$(({\rm{list}}\,({\tt{'}}{\tt{nat}}, {\rm{max-list}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{max-list}) $\in$ {\it{x\/}}) $=$ {\rm{listp}}\,({\it{x\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tag-array-replace-value-untag-array \\ \index{tag-array-replace-value-untag-a!rray}
\=\+{\rm{nat-list-piton}}\,({\it{x\/}}, {\it{s\/}})\index{nat-list-piton} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{tag-array}}\,({\tt{'}}{\tt{nat}}, {\rm{replace-value}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array}, {\it{y\/}}, {\it{z\/}})\index{replace-value})\index{tag-array} \\ 
$=$$\;\;\;\;${\rm{replace-value}}\,({\it{x\/}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{y\/}}), {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{z\/}}))\index{replace-value})\-\-
\end{tabbing}

	     
\begin{tabbing}{\sc Definition}:\index{smart-move-input-conditionp} \\  
\=\+{\rm{smart-move-input-conditionp}}\,({\it{p0\/}})\index{smart-move-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{3}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{19}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\tt{1}} $<$ {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag} $<$ {\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdr}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdr}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}), {\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\index{definedp} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{definedp} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}) \\ 
$\not=$$\;\;\;\;${\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}))\- \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,(\=\+{\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\-\index{nat-list-piton} \\ 
$\wedge$$\;\;\;\;${\rm{array-pitonp}}\,(\=\+{\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag})\-\index{array-pitonp} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{length}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{length} \\ 
$=$$\;\;\;\;${\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{smart-move}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{smart-move-program}}\index{smart-move-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{replace-value}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{replace-value-program}}\index{replace-value-program})\- \\ 
$\wedge$$\;\;\;\;$({\rm{assoc}}\,({\tt{'}}{\tt{max-nat}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) $=$ {\sc{max-nat-program}}\index{max-nat-program}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{bv-to-nat-list}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{bv-to-nat-list-program}}\index{bv-to-nat-list-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{nat-to-bv-list}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{nat-to-bv-list-program}}\index{nat-to-bv-list-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{match-and-xor}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{match-and-xor-program}}\index{match-and-xor-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{highest-bit}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{highest-bit-program}}\index{highest-bit-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{number-with-at-least}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{number-with-at-least-program}}\index{number-with-at-least-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{bv-to-nat}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{bv-to-nat-program}}\index{bv-to-nat-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{nat-to-bv}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{nat-to-bv-program}}\index{nat-to-bv-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{push-1-vector}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;$({\rm{assoc}}\,({\tt{'}}{\tt{xor-bvs}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) $=$ {\sc{xor-bvs-program}}\index{xor-bvs-program}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-smart-move \\ \index{correctness-of-smart-move}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{wa\/}}, {\rm{cons}}\,({\it{np\/}}, {\rm{cons}}\,({\it{s\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{smart-move}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$({\it{state\/}} $=$ {\rm{untag-array}}\,({\rm{array}}\,({\rm{car}}\,({\rm{untag}}\,({\it{s\/}})\index{untag}), {\it{data-segment\/}})\index{array})\index{untag-array}) \\ 
$\wedge$$\;\;\;\;$({\it{word-size\/}} $=$ {\it{word-size2\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{smart-move-input-conditionp}}\,({\it{p0\/}})\index{smart-move-input-conditionp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{wa\/}}, {\rm{cons}}\,({\it{np\/}}, {\rm{cons}}\,({\it{s\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{smart-move-clock}}\,({\it{state\/}}, {\it{word-size2\/}})\index{smart-move-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{tag-array}}\,(\=\+{\tt{'}}{\tt{nat}}, \\ 
{\rm{smart-move}}\,({\it{state\/}}, {\it{word-size\/}})\index{smart-move})\-\index{tag-array}, \\ 
{\rm{car}}\,({\rm{untag}}\,({\it{s\/}})\index{untag}), \\ 
\=\+{\bf if }{\rm{number-with-at-least}}\,({\it{state\/}}, {\tt{2}})\index{number-with-at-least} $<$ {\tt{2}} \\ 
{\bf then }{\it{data-segment\/}} \\ 
{\bf else }{\rm{put-assoc}}\,(\=\+{\rm{tag-array}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{nat-to-bv-list}}\,(\=\+{\rm{smart-move}}\,(\=\+{\it{state\/}}, \\ 
{\it{word-size\/}})\-\index{smart-move}, \\ 
{\it{word-size\/}})\-\index{nat-to-bv-list})\-\index{tag-array}, \\ 
{\rm{car}}\,({\rm{untag}}\,({\it{wa\/}})\index{untag}), \\ 
{\it{data-segment\/}})\-\index{put-assoc}$\;${\bf  endif}\-)\-\index{put-assoc}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable smart-move-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable smart-move-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*smart-move-program.

\addvspace{18pt}

\begin{verbatim};; delay

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{delay-program} \\  
\=\+{\sc{delay-program}}\index{delay-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{delay}} \\ 
{\tt{(}}{\tt{time}}{\tt{)}} \\ 
{\tt{nil}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{lab}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{time}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{sub1-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{set-local}}{\tt{ }}{\tt{time}}{\tt{)}} \\ 
{\tt{(}}{\tt{no-op}}{\tt{)}} \\ 
{\tt{(}}{\tt{no-op}}{\tt{)}} \\ 
{\tt{(}}{\tt{no-op}}{\tt{)}} \\ 
{\tt{(}}{\tt{no-op}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-nat-and-jump}}{\tt{ }}{\tt{zero}}{\tt{ }}{\tt{done}}{\tt{)}} \\ 
{\tt{(}}{\tt{no-op}}{\tt{)}} \\ 
{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{lab}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{done}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}
	

\begin{tabbing}{\sc Definition}:\index{example-delay-p-state} \\  
\=\+{\sc{example-delay-p-state}}\index{example-delay-p-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{delay}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\sc{delay-program}}\index{delay-program})\-, \\ 
{\bf{nil}}, \\ 
{\tt{100}}, \\ 
{\tt{80}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{delay-loop-clock} \\  
\=\+{\rm{delay-loop-clock}}\,({\it{time\/}})\index{delay-loop-clock} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{time\/}} $<$ {\tt{2}}$\;\;${\bf then }{\tt{9}} \\ 
{\bf else }{\tt{10}} $+$ {\rm{delay-loop-clock}}\,({\it{time\/}} $-\;1$)\index{delay-loop-clock}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-delay-general \\ \index{correctness-of-delay-general}
\=\+(\=\+{\rm{listp}}\,({\it{ctrl-stk\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{delay}}, {\it{prog-segment\/}})\index{definition} $=$ {\sc{delay-program}}\index{delay-program}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,({\rm{length}}\,({\it{temp-stk\/}})\index{length}, {\tt{1}}, {\it{max-temp-stk-size\/}})\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\it{time\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{time\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{word-size\/}})\index{exp}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{delay}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,({\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{time}}, {\rm{list}}\,({\tt{'}}{\tt{nat}}, {\it{time\/}}))), {\it{ret-pc\/}}), \\ 
{\it{ctrl-stk\/}})\-, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{delay-loop-clock}}\,({\it{time\/}})\index{delay-loop-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\it{ret-pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{delay-input-conditionp} \\  
\=\+{\rm{delay-input-conditionp}}\,({\it{p0\/}})\index{delay-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}) \\ 
$\wedge$$\;\;\;\;$({\rm{definition}}\,({\tt{'}}{\tt{delay}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment})\index{definition} $=$ {\sc{delay-program}}\index{delay-program}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{0}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{3}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $<$ {\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{delay-clock}$\;\;$
{\rm{delay-clock}}\,({\it{time\/}})\index{delay-clock} $=$ ($1\;+$ {\rm{delay-loop-clock}}\,({\it{time\/}})\index{delay-loop-clock})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-delay \\ \index{correctness-of-delay}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{n\/}}, {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{delay}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;${\rm{delay-input-conditionp}}\,({\it{p0\/}})\index{delay-input-conditionp} \\ 
$\wedge$$\;\;\;\;$({\it{time\/}} $=$ {\rm{cadr}}\,({\it{n\/}})))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{n\/}}, {\it{temp-stk\/}}), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{delay-clock}}\,({\it{time\/}})\index{delay-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{verbatim};; computer-move 

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{computer-move-program} \\  
\=\+{\sc{computer-move-program}}\index{computer-move-program} \\ 
$=$$\;\;\;\;${\tt{'}}{\tt{(}}\=\+{\tt{computer-move}} \\ 
{\tt{(}}{\tt{state}}{\tt{ }}{\tt{numpiles}}{\tt{ }}{\tt{work-area}}{\tt{)}} \\ 
{\tt{(}}{\tt{(}}{\tt{i}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{250}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{delay}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{250}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{delay}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{250}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{delay}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{250}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{delay}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{state}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{2}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{number-with-at-least}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-nat-and-jump}}{\tt{ }}{\tt{zero}}{\tt{ }}{\tt{lab}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{state}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{work-area}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{nat-to-bv-list}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{work-area}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{xor-bvs}}{\tt{)}} \\ 
{\tt{(}}{\tt{test-bitv-and-jump}}{\tt{ }}{\tt{all-zero}}{\tt{ }}{\tt{lab}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{state}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{work-area}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{smart-move}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{lab}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{state}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{state}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{numpiles}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{max-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{pop-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-local}}{\tt{ }}{\tt{i}}{\tt{)}} \\ 
{\tt{(}}{\tt{sub1-nat}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{replace-value}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{example-computer-move-p-state} \\  
\=\+{\sc{example-computer-move-p-state}}\index{example-computer-move-p-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr5}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{computer-move}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr2}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr5}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{computer-move}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr3}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr5}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{computer-move}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr4}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr5}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{computer-move}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\sc{computer-move-program}}\index{computer-move-program}, \\ 
{\sc{delay-program}}\index{delay-program}, \\ 
{\sc{replace-value-program}}\index{replace-value-program}, \\ 
{\sc{max-nat-program}}\index{max-nat-program}, \\ 
{\sc{bv-to-nat-list-program}}\index{bv-to-nat-list-program}, \\ 
{\sc{nat-to-bv-list-program}}\index{nat-to-bv-list-program}, \\ 
{\sc{match-and-xor-program}}\index{match-and-xor-program}, \\ 
{\sc{highest-bit-program}}\index{highest-bit-program}, \\ 
{\sc{number-with-at-least-program}}\index{number-with-at-least-program}, \\ 
{\sc{bv-to-nat-program}}\index{bv-to-nat-program}, \\ 
{\sc{nat-to-bv-program}}\index{nat-to-bv-program}, \\ 
{\rm{push-1-vector-program}}\,({\tt{8}})\index{push-1-vector-program}, \\ 
{\sc{xor-bvs-program}}\index{xor-bvs-program}, \\ 
{\sc{smart-move-program}}\index{smart-move-program})\-, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{(}}{\tt{arr}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{2}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{arr2}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{arr3}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{9}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{arr4}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{7}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{2}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{2}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{arr5}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{2}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}}{\tt{)}}\-, \\ 
{\tt{100}}, \\ 
{\tt{80}}, \\ 
{\tt{8}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{computer-move} \\  
\=\+{\rm{computer-move}}\,({\it{state\/}}, {\it{wordsize\/}})\index{computer-move} \\ 
$=$$\;\;\;\;$\=\+{\bf if }\=\+({\rm{number-with-at-least}}\,({\it{state\/}}, {\tt{2}})\index{number-with-at-least} $=$ {\tt{0}}) \\ 
$\vee$$\;\;\;\;${\rm{all-zero-bitvp}}\,({\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{state\/}}, {\it{wordsize\/}})\index{nat-to-bv-list})\index{xor-bvs})\index{all-zero-bitvp}\- \\ 
{\bf then }{\rm{replace-value}}\,({\it{state\/}}, {\rm{max-list}}\,({\it{state\/}})\index{max-list}, {\rm{max-list}}\,({\it{state\/}})\index{max-list} $-\;1$)\index{replace-value} \\ 
{\bf else }{\rm{smart-move}}\,({\it{state\/}}, {\it{wordsize\/}})\index{smart-move}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable delay-clock.

\addvspace{18pt}

%\item 
\begin{verbatim}


(defn computer-move-clock (state wordsize)
  (clock-plus
   2
   (clock-plus (delay-clock 250)
	       (clock-plus 1 (clock-plus (delay-clock 250)
	       (clock-plus 1 (clock-plus (delay-clock 250)
	       (clock-plus 1 (clock-plus (delay-clock 250)
  (clock-plus
   3
   (clock-plus
    (number-with-at-least-clock 2 (tag-array 'nat state))
    (clock-plus 
     1
    (if (equal (number-with-at-least state 2) 0) 
	(clock-plus
	    3
	    (clock-plus
	     (max-nat-clock (tag-array 'nat state))
	     (clock-plus
	      4
	      (clock-plus
	       (replace-value-clock 
		(tag-array 'nat state)
		(list 'nat (max-list state)))
	       1))))
  (clock-plus
   3
   (clock-plus
    (nat-to-bv-list-clock (tag-array 'nat state))
    (clock-plus
     2
     (clock-plus
      (xor-bvs-clock (length state))
      (clock-plus
       1
       (if (all-zero-bitvp (xor-bvs (nat-to-bv-list state wordsize)))
	   (clock-plus
	    3
	    (clock-plus
	     (max-nat-clock (tag-array 'nat state))
	     (clock-plus
	      4
	      (clock-plus
	       (replace-value-clock 
		(tag-array 'nat state)
		(list 'nat (max-list state)))
	       1))))
	 (clock-plus 
	  3
	  (clock-plus 
	   (smart-move-clock state wordsize)
	   1)))))))))))))))))))))
\end{verbatim}

		     
\begin{tabbing}{\sc Definition}:\index{computer-move-input-conditionp} \\  
\=\+{\rm{computer-move-input-conditionp}}\,({\it{p0\/}})\index{computer-move-input-conditionp} \\ 
$=$$\;\;\;\;$(\=\+($\neg$ {\rm{all-zero-bitvp}}\,({\rm{untag-array}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{untag-array})\index{all-zero-bitvp}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\tt{3}}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\tt{25}}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\tt{7}} $<$ {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size} $\not=$ {\tt{1}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag} $<$ {\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdr}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdr}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}), {\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\index{definedp} \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{definedp} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}) \\ 
$\not=$$\;\;\;\;${\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}))\- \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,(\=\+{\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\-\index{nat-list-piton} \\ 
$\wedge$$\;\;\;\;${\rm{array-pitonp}}\,(\=\+{\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag})\-\index{array-pitonp} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{length}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{length} \\ 
$=$$\;\;\;\;${\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag})\- \\ 
$\wedge$$\;\;\;\;$({\rm{assoc}}\,({\tt{'}}{\tt{delay}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) $=$ {\sc{delay-program}}\index{delay-program}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{computer-move}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{computer-move-program}}\index{computer-move-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{smart-move}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{smart-move-program}}\index{smart-move-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{replace-value}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{replace-value-program}}\index{replace-value-program})\- \\ 
$\wedge$$\;\;\;\;$({\rm{assoc}}\,({\tt{'}}{\tt{max-nat}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) $=$ {\sc{max-nat-program}}\index{max-nat-program}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{bv-to-nat-list}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{bv-to-nat-list-program}}\index{bv-to-nat-list-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{nat-to-bv-list}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{nat-to-bv-list-program}}\index{nat-to-bv-list-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{match-and-xor}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{match-and-xor-program}}\index{match-and-xor-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{highest-bit}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{highest-bit-program}}\index{highest-bit-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{number-with-at-least}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{number-with-at-least-program}}\index{number-with-at-least-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{bv-to-nat}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{bv-to-nat-program}}\index{bv-to-nat-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{nat-to-bv}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\sc{nat-to-bv-program}}\index{nat-to-bv-program})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\tt{'}}{\tt{push-1-vector}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) \\ 
$=$$\;\;\;\;${\rm{push-1-vector-program}}\,({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{push-1-vector-program})\- \\ 
$\wedge$$\;\;\;\;$({\rm{assoc}}\,({\tt{'}}{\tt{xor-bvs}}, {\rm{p-prog-segment}}\,({\it{p0\/}})\index{p-prog-segment}) $=$ {\sc{xor-bvs-program}}\index{xor-bvs-program}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  numberp-max-list \\ \index{numberp-max-list}
{\rm{max-list}}\,({\it{x\/}})\index{max-list} $\in\;${\bf{N}}${}$
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  max-0-means \\ \index{max-0-means}
\=\+{\rm{nat-list-piton}}\,({\it{x\/}}, {\it{s\/}})\index{nat-list-piton} \\ 
$\rightarrow$$\;\;\;\;$(({\rm{max-list}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{max-list} $=$ {\tt{0}}) $=$ {\rm{all-zero-bitvp}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{all-zero-bitvp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  max-list-not-too-big \\ \index{max-list-not-too-big}
\=\+({\rm{nat-list-piton}}\,({\it{x\/}}, {\it{s\/}})\index{nat-list-piton} $\wedge$ ({\it{s\/}} $\not\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{max-list}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{max-list} $<$ {\rm{exp}}\,({\tt{2}}, {\it{s\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$((({\rm{max-list}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{max-list} $-\;1$) $<$ {\rm{exp}}\,({\tt{2}}, {\it{s\/}})\index{exp}) $=$ {\bf{t}}))\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable delay-clock.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*delay-clock.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  lessp-exp-2-8-hack \\ \index{lessp-exp-2-8-hack}
\=\+(({\tt{7}} $<$ {\it{free\/}}) $\wedge$ ({\it{x\/}} $=$ {\it{free\/}}) $\wedge$ ({\it{val\/}} $<$ {\tt{256}})) \\ 
$\rightarrow$$\;\;\;\;$(({\it{val\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{x\/}})\index{exp}) $=$ {\bf{t}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-computer-move \\ \index{correctness-of-computer-move}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{wa\/}}, {\rm{cons}}\,({\it{np\/}}, {\rm{cons}}\,({\it{s\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{computer-move}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;$({\it{state\/}} $=$ {\rm{untag-array}}\,({\rm{array}}\,({\rm{car}}\,({\rm{untag}}\,({\it{s\/}})\index{untag}), {\it{data-segment\/}})\index{array})\index{untag-array}) \\ 
$\wedge$$\;\;\;\;$({\it{word-size\/}} $=$ {\it{word-size2\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{computer-move-input-conditionp}}\,({\it{p0\/}})\index{computer-move-input-conditionp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{p}}\,(\=\+{\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{wa\/}}, {\rm{cons}}\,({\it{np\/}}, {\rm{cons}}\,({\it{s\/}}, {\it{temp-stk\/}}))), \\ 
{\it{prog-segment\/}}, \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}, \\ 
{\rm{computer-move-clock}}\,({\it{state\/}}, {\it{word-size2\/}})\index{computer-move-clock})\-\index{p} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\it{temp-stk\/}}, \\ 
{\it{prog-segment\/}}, \\ 
{\rm{put-assoc}}\,(\=\+{\rm{tag-array}}\,(\=\+{\tt{'}}{\tt{nat}}, \\ 
{\rm{computer-move}}\,({\it{state\/}}, {\it{word-size\/}})\index{computer-move})\-\index{tag-array}, \\ 
{\rm{car}}\,({\rm{untag}}\,({\it{s\/}})\index{untag}), \\ 
\=\+{\bf if }{\rm{number-with-at-least}}\,({\it{state\/}}, {\tt{2}})\index{number-with-at-least} $=$ {\tt{0}} \\ 
{\bf then }{\it{data-segment\/}} \\ 
{\bf else }{\rm{put-assoc}}\,(\=\+\=\+{\bf if }\=\+{\rm{all-zero-bitvp}}\,({\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,(\=\+{\it{state\/}}, \\ 
{\it{word-size\/}})\-\index{nat-to-bv-list})\index{xor-bvs})\index{all-zero-bitvp} \\ 
$\vee$$\;\;\;\;$(\=\+{\rm{number-with-at-least}}\,(\=\+{\it{state\/}}, \\ 
{\tt{2}})\-\index{number-with-at-least} \\ 
$<$$\;\;\;\;${\tt{2}})\-\- \\ 
{\bf then }{\rm{tag-array}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{nat-to-bv-list}}\,(\=\+{\it{state\/}}, \\ 
{\it{word-size\/}})\-\index{nat-to-bv-list})\-\index{tag-array} \\ 
{\bf else }{\rm{tag-array}}\,(\=\+{\tt{'}}{\tt{bitv}}, \\ 
{\rm{nat-to-bv-list}}\,(\=\+{\rm{computer-move}}\,(\=\+{\it{state\/}}, \\ 
{\it{word-size\/}})\-\index{computer-move}, \\ 
{\it{word-size\/}})\-\index{nat-to-bv-list})\-\index{tag-array}$\;${\bf  endif}\-, \\ 
{\rm{car}}\,({\rm{untag}}\,({\it{wa\/}})\index{untag}), \\ 
{\it{data-segment\/}})\-\index{put-assoc}$\;${\bf  endif}\-)\-\index{put-assoc}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state})\-\-
\end{tabbing}

\begin{verbatim};;;;
;;;;
;;;;
;;;;
;;;; Having proved the behavior of the programs, we now introduce
;;;; the spec to which we've been writing code.  
;;;;
;;;;
;;;;

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{sum} \\  
\=\+{\rm{sum}}\,({\it{list\/}})\index{sum} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{list\/}})$\;\;${\bf then }{\rm{car}}\,({\it{list\/}}) $+$ {\rm{sum}}\,({\rm{cdr}}\,({\it{list\/}}))\index{sum} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sum-append \\ \index{sum-append}
{\rm{sum}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{sum} $=$ ({\rm{sum}}\,({\it{x\/}})\index{sum} $+$ {\rm{sum}}\,({\it{y\/}})\index{sum})
\end{tabbing}

\begin{verbatim};; returns a list of states that are valid moves from
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{all-valid-moves-helper} \\  
\=\+{\rm{all-valid-moves-helper}}\,({\it{old\/}}, {\it{val\/}}, {\it{origval\/}}, {\it{new\/}})\index{all-valid-moves-helper} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{val\/}} $\simeq {\tt{0}}$ \\ 
{\bf then }\=\+{\bf if }{\it{new\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{all-valid-moves-helper}}\,(\=\+{\rm{append}}\,({\it{old\/}}, {\rm{list}}\,({\it{origval\/}})), \\ 
{\rm{car}}\,({\it{new\/}}), \\ 
{\rm{car}}\,({\it{new\/}}), \\ 
{\rm{cdr}}\,({\it{new\/}}))\-\index{all-valid-moves-helper}$\;${\bf  endif}\- \\ 
{\bf else }{\rm{cons}}\,(\=\+{\rm{append}}\,({\it{old\/}}, {\rm{cons}}\,({\it{val\/}} $-\;1$, {\it{new\/}})), \\ 
{\rm{all-valid-moves-helper}}\,({\it{old\/}}, {\it{val\/}} $-\;1$, {\it{origval\/}}, {\it{new\/}})\index{all-valid-moves-helper})\-$\;${\bf  endif}\-\-
\end{tabbing}
	  
\begin{tabbing}{\sc Definition}:\index{all-valid-moves} \\  
{\rm{all-valid-moves}}\,({\it{x\/}})\index{all-valid-moves} $=$ {\rm{all-valid-moves-helper}}\,({\bf{nil}}, {\rm{car}}\,({\it{x\/}}), {\rm{car}}\,({\it{x\/}}), {\rm{cdr}}\,({\it{x\/}}))\index{all-valid-moves-helper}
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{max-sum} \\  
\=\+{\rm{max-sum}}\,({\it{list\/}})\index{max-sum} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{list\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{sum}}\,({\rm{car}}\,({\it{list\/}}))\index{sum} $<$ {\rm{max-sum}}\,({\rm{cdr}}\,({\it{list\/}}))\index{max-sum}$\;\;${\bf then }{\rm{max-sum}}\,({\rm{cdr}}\,({\it{list\/}}))\index{max-sum} \\ 
{\bf else }{\rm{sum}}\,({\rm{car}}\,({\it{list\/}}))\index{sum}$\;${\bf  endif}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-listp-append \\ \index{nat-listp-append}
\=\+{\rm{properp}}\,({\it{x\/}})\index{properp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{nat-listp}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}), {\it{size\/}})\index{nat-listp} \\ 
$=$$\;\;\;\;$({\rm{nat-listp}}\,({\it{x\/}}, {\it{size\/}})\index{nat-listp} $\wedge$ {\rm{nat-listp}}\,({\it{y\/}}, {\it{size\/}})\index{nat-listp}))\-\-
\end{tabbing}

\begin{verbatim};(prove-lemma properp-append (rewrite)
;	     (equal
;	      (properp (append x y))
;	      (properp y)))
\end{verbatim}
\noindent{\sc Event}:   Enable properp-append.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{nat-listp-simple} \\  
\=\+{\rm{nat-listp-simple}}\,({\it{list\/}})\index{nat-listp-simple} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{list\/}})$\;\;${\bf then }({\rm{car}}\,({\it{list\/}}) $\in\;${\bf{N}}${}$) $\wedge$ {\rm{nat-listp-simple}}\,({\rm{cdr}}\,({\it{list\/}}))\index{nat-listp-simple} \\ 
{\bf else }{\it{list\/}} $=$ {\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-listp-simple-append \\ \index{nat-listp-simple-append}
\=\+{\rm{properp}}\,({\it{x\/}})\index{properp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{nat-listp-simple}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{nat-listp-simple} \\ 
$=$$\;\;\;\;$({\rm{nat-listp-simple}}\,({\it{x\/}})\index{nat-listp-simple} $\wedge$ {\rm{nat-listp-simple}}\,({\it{y\/}})\index{nat-listp-simple}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-max-sum-helper \\ \index{lessp-max-sum-helper}
\=\+(\=\+({\it{c\/}} $\not<$ {\it{temp\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{properp}}\,({\it{x\/}})\index{properp} \\ 
$\wedge$$\;\;\;\;${\rm{nat-listp-simple}}\,({\rm{append}}\,({\it{x\/}}, {\rm{cons}}\,({\it{c\/}}, {\it{y\/}})))\index{nat-listp-simple} \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\rm{append}}\,({\it{x\/}}, {\rm{cons}}\,({\it{c\/}}, {\it{y\/}})))\index{all-zero-bitvp}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{max-sum}}\,({\rm{all-valid-moves-helper}}\,({\it{x\/}}, {\it{temp\/}}, {\it{c\/}}, {\it{y\/}})\index{all-valid-moves-helper})\index{max-sum} \\ 
$<$$\;\;\;\;${\rm{sum}}\,({\rm{append}}\,({\it{x\/}}, {\rm{cons}}\,({\it{c\/}}, {\it{y\/}})))\index{sum})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-max-sum-all-valid-moves \\ \index{lessp-max-sum-all-valid-moves}
\=\+({\rm{nat-listp-simple}}\,({\it{s\/}})\index{nat-listp-simple} $\wedge$ ($\neg$ {\rm{all-zero-bitvp}}\,({\it{s\/}})\index{all-zero-bitvp})) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{max-sum}}\,({\rm{all-valid-moves}}\,({\it{s\/}})\index{all-valid-moves})\index{max-sum} $<$ {\rm{sum}}\,({\it{s\/}})\index{sum}) $=$ {\bf{t}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-sum-max-sum \\ \index{lessp-sum-max-sum}
{\rm{max-sum}}\,({\it{x\/}})\index{max-sum} $\not<$ {\rm{sum}}\,({\rm{car}}\,({\it{x\/}}))\index{sum}
\end{tabbing}


\noindent{\sc Event}:   Disable all-valid-moves.

\addvspace{18pt}


\begin{tabbing}{\sc Definition}:\index{wsp-measure} \\  
\=\+{\rm{wsp-measure}}\,({\it{state\/}}, {\it{flag\/}})\index{wsp-measure} \\ 
$=$$\;\;\;\;${\rm{cons}}\,(\=\+\=\+{\bf if }{\it{flag\/}}$\;\;${\bf then }$1\;+$ {\rm{sum}}\,({\it{state\/}})\index{sum} \\ 
{\bf else }$1\;+$ {\rm{max-sum}}\,({\it{state\/}})\index{max-sum}$\;${\bf  endif}\-, \\ 
\=\+{\bf if }{\it{flag\/}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{length}}\,({\it{state\/}})\index{length}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{verbatim};; wsp searchs for a successor to  the current state on
;; a path to a guaranteed win.  
;; if flag
;;      state is a nim state - return state if all zeros.
;;      Return a successor state not wsp if one exists, f otherwise
;; if not flag
;;      state is a list of states - return member of list if it is
;;      not wsp, f is no such member.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{wsp} \\  
\=\+{\rm{wsp}}\,({\it{state\/}}, {\it{flag\/}})\index{wsp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{flag\/}} \\ 
{\bf then }\=\+{\bf if }{\rm{all-zero-bitvp}}\,({\it{state\/}})\index{all-zero-bitvp} $\vee$ ($\neg$ {\rm{nat-listp-simple}}\,({\it{state\/}})\index{nat-listp-simple}) \\ 
{\bf then }{\it{state\/}} \\ 
{\bf else }{\rm{wsp}}\,({\rm{all-valid-moves}}\,({\it{state\/}})\index{all-valid-moves}, {\bf{f}})\index{wsp}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{listp}}\,({\it{state\/}}) \\ 
{\bf then }\=\+{\bf if }$\neg$ {\rm{wsp}}\,({\rm{car}}\,({\it{state\/}}), {\bf{t}})\index{wsp}$\;\;${\bf then }{\rm{car}}\,({\it{state\/}}) \\ 
{\bf else }{\rm{wsp}}\,({\rm{cdr}}\,({\it{state\/}}), {\bf{f}})\index{wsp}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{green-statep} \\  
\=\+{\rm{green-statep}}\,({\it{state\/}}, {\it{wordsize\/}})\index{green-statep} \\ 
$=$$\;\;\;\;$(\=\+({\rm{number-with-at-least}}\,({\it{state\/}}, {\tt{2}})\index{number-with-at-least} $\simeq {\tt{0}}$) \\ 
$=$$\;\;\;\;${\rm{all-zero-bitvp}}\,({\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{state\/}}, {\it{wordsize\/}})\index{nat-to-bv-list})\index{xor-bvs})\index{all-zero-bitvp})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{non-green-in-list} \\  
\=\+{\rm{non-green-in-list}}\,({\it{list\/}}, {\it{wordsize\/}})\index{non-green-in-list} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{list\/}}) \\ 
{\bf then }\=\+($\neg$ {\rm{green-statep}}\,({\rm{car}}\,({\it{list\/}}), {\it{wordsize\/}})\index{green-statep}) \\ 
$\vee$$\;\;\;\;${\rm{non-green-in-list}}\,({\rm{cdr}}\,({\it{list\/}}), {\it{wordsize\/}})\index{non-green-in-list}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-listp-means-nat-listp-simple \\ \index{nat-listp-means-nat-listp-simple}
{\rm{nat-listp}}\,({\it{x\/}}, {\it{s\/}})\index{nat-listp} $\rightarrow$ {\rm{nat-listp-simple}}\,({\it{x\/}})\index{nat-listp-simple}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bitv-zero-bit-vector \\ \index{xor-bitv-zero-bit-vector}
\=\+{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} \\ 
$\rightarrow$$\;\;\;\;$({\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv} $=$ {\rm{make-list-from}}\,({\rm{length}}\,({\it{x\/}})\index{length}, {\rm{fix-bitv}}\,({\it{y\/}})\index{fix-bitv})\index{make-list-from})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-bitv-xor-bitv \\ \index{fix-bitv-xor-bitv}
{\rm{fix-bitv}}\,({\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv})\index{fix-bitv} $=$ {\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-bitv-and-bitv \\ \index{fix-bitv-and-bitv}
{\rm{fix-bitv}}\,({\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv})\index{fix-bitv} $=$ {\rm{and-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{and-bitv}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-bitv-xor-bvs \\ \index{fix-bitv-xor-bvs}
{\rm{fix-bitv}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{fix-bitv} $=$ {\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-make-list-from-simple \\ \index{all-zero-bitvp-make-list-from-si!mple}
{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\rightarrow$ {\rm{all-zero-bitvp}}\,({\rm{make-list-from}}\,({\it{n\/}}, {\it{x\/}})\index{make-list-from})\index{all-zero-bitvp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-xor-bvs-nat-to-bv-list-zeros \\ \index{all-zero-bitvp-xor-bvs-nat-to-bv!-list-zeros}
{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\rightarrow$ {\rm{all-zero-bitvp}}\,({\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list})\index{xor-bvs})\index{all-zero-bitvp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  number-with-at-least-of-all-zeros \\ \index{number-with-at-least-of-all-zer!os}
\=\+{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{number-with-at-least}}\,({\it{x\/}}, {\it{m\/}})\index{number-with-at-least} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{m\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\rm{length}}\,({\it{x\/}})\index{length} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-listp-listp} \\  
\=\+{\rm{nat-listp-listp}}\,({\it{list\/}}, {\it{wordsize\/}})\index{nat-listp-listp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{list\/}}) \\ 
{\bf then }\=\+{\rm{nat-listp}}\,({\rm{car}}\,({\it{list\/}}), {\it{wordsize\/}})\index{nat-listp} \\ 
$\wedge$$\;\;\;\;${\rm{nat-listp-listp}}\,({\rm{cdr}}\,({\it{list\/}}), {\it{wordsize\/}})\index{nat-listp-listp}\- \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-listp-listp-all-valid-moves-helper \\ \index{nat-listp-listp-all-valid-moves!-helper}
\=\+(\=\+{\rm{nat-listp}}\,({\it{a\/}}, {\it{s\/}})\index{nat-listp} \\ 
$\wedge$$\;\;\;\;$({\it{b\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{s\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{s\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{b\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{nat-listp}}\,({\it{d\/}}, {\it{s\/}})\index{nat-listp} \\ 
$\wedge$$\;\;\;\;${\rm{properp}}\,({\it{a\/}})\index{properp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{nat-listp-listp}}\,({\rm{all-valid-moves-helper}}\,({\it{a\/}}, {\it{b\/}}, {\it{c\/}}, {\it{d\/}})\index{all-valid-moves-helper}, {\it{s\/}})\index{nat-listp-listp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-listp-listp-all-valid-moves \\ \index{nat-listp-listp-all-valid-moves}
{\rm{nat-listp}}\,({\it{a\/}}, {\it{s\/}})\index{nat-listp} $\rightarrow$ {\rm{nat-listp-listp}}\,({\rm{all-valid-moves}}\,({\it{a\/}})\index{all-valid-moves}, {\it{s\/}})\index{nat-listp-listp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-all-valid-move-helper \\ \index{listp-all-valid-move-helper}
\=\+{\rm{nat-listp-simple}}\,({\it{d\/}})\index{nat-listp-simple} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{listp}}\,({\rm{all-valid-moves-helper}}\,({\it{a\/}}, {\it{b\/}}, {\it{c\/}}, {\it{d\/}})\index{all-valid-moves-helper}) \\ 
$=$$\;\;\;\;$(($\neg$ {\rm{all-zero-bitvp}}\,({\it{d\/}})\index{all-zero-bitvp}) $\vee$ ({\it{b\/}} $\not\simeq {\tt{0}}$)))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-all-valid-move \\ \index{listp-all-valid-move}
\=\+{\rm{nat-listp-simple}}\,({\it{x\/}})\index{nat-listp-simple} \\ 
$\rightarrow$$\;\;\;\;$({\rm{listp}}\,({\rm{all-valid-moves}}\,({\it{x\/}})\index{all-valid-moves}) $=$ ($\neg$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  number-with-at-least-append \\ \index{number-with-at-least-append}
\=\+{\rm{number-with-at-least}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}), {\it{m\/}})\index{number-with-at-least} \\ 
$=$$\;\;\;\;$({\rm{number-with-at-least}}\,({\it{x\/}}, {\it{m\/}})\index{number-with-at-least} $+$ {\rm{number-with-at-least}}\,({\it{y\/}}, {\it{m\/}})\index{number-with-at-least})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-xor-bvs2 \\ \index{length-xor-bvs2}
\=\+{\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{length}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{length} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{fix}}\,({\it{s\/}}) \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bitv-xor-bvs-hack \\ \index{xor-bitv-xor-bvs-hack}
\=\+{\rm{bit-vectorsp}}\,({\it{z\/}}, {\rm{length}}\,({\it{y\/}})\index{length})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{xor-bitv}}\,({\rm{xor-bitv}}\,({\it{y\/}}, {\rm{xor-bvs}}\,({\it{z\/}})\index{xor-bvs})\index{xor-bitv}, {\it{x\/}})\index{xor-bitv} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{z\/}})$\;\;${\bf then }{\rm{xor-bitv}}\,({\it{y\/}}, {\rm{xor-bitv}}\,({\rm{xor-bvs}}\,({\it{z\/}})\index{xor-bvs}, {\it{x\/}})\index{xor-bitv})\index{xor-bitv} \\ 
{\bf else }{\rm{xor-bitv}}\,({\it{y\/}}, {\it{x\/}})\index{xor-bitv}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bitv-fix-bitv \\ \index{xor-bitv-fix-bitv}
\=\+({\rm{xor-bitv}}\,({\rm{fix-bitv}}\,({\it{x\/}})\index{fix-bitv}, {\it{y\/}})\index{xor-bitv} $=$ {\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv}) \\ 
$\wedge$$\;\;\;\;$({\rm{xor-bitv}}\,({\it{x\/}}, {\rm{fix-bitv}}\,({\it{y\/}})\index{fix-bitv})\index{xor-bitv} $=$ {\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bvs-append \\ \index{xor-bvs-append}
\=\+({\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectorsp} $\wedge$ {\rm{bit-vectorsp}}\,({\it{y\/}}, {\it{s\/}})\index{bit-vectorsp} $\wedge$ ({\it{s\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{xor-bvs}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\index{xor-bvs} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{xor-bitv}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs}, {\rm{xor-bvs}}\,({\it{y\/}})\index{xor-bvs})\index{xor-bitv} \\ 
{\bf else }{\rm{xor-bvs}}\,({\it{y\/}})\index{xor-bvs}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bvs-append-hack \\ \index{xor-bvs-append-hack}
\=\+{\rm{bit-vectorsp}}\,({\it{y\/}}, {\it{ws\/}})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{xor-bvs}}\,({\rm{append}}\,({\rm{nat-to-bv-list}}\,({\it{a\/}}, {\it{ws\/}})\index{nat-to-bv-list}, {\it{y\/}}))\index{xor-bvs} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{a\/}}) \\ 
{\bf then }{\rm{xor-bitv}}\,({\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{a\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{xor-bvs}, {\rm{xor-bvs}}\,({\it{y\/}})\index{xor-bvs})\index{xor-bitv} \\ 
{\bf else }{\rm{xor-bvs}}\,({\it{y\/}})\index{xor-bvs}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-to-bv-list-append \\ \index{nat-to-bv-list-append}
\=\+{\rm{nat-to-bv-list}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}), {\it{s\/}})\index{nat-to-bv-list} \\ 
$=$$\;\;\;\;${\rm{append}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list}, {\rm{nat-to-bv-list}}\,({\it{y\/}}, {\it{s\/}})\index{nat-to-bv-list})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-nat-to-bv \\ \index{bit-vectorp-nat-to-bv}
{\rm{bit-vectorp}}\,({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv}, {\it{s2\/}})\index{bit-vectorp} $=$ ({\rm{fix}}\,({\it{s\/}}) $=$ {\rm{fix}}\,({\it{s2\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-bitv-nat-to-bv \\ \index{fix-bitv-nat-to-bv}
{\rm{fix-bitv}}\,({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv})\index{fix-bitv} $=$ {\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-bitv-zero-bit-vector \\ \index{fix-bitv-zero-bit-vector}
{\rm{fix-bitv}}\,({\rm{zero-bit-vector}}\,({\it{x\/}})\index{zero-bit-vector})\index{fix-bitv} $=$ {\rm{zero-bit-vector}}\,({\it{x\/}})\index{zero-bit-vector}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-nat-to-bv \\ \index{all-zero-bitvp-nat-to-bv}
{\rm{all-zero-bitvp}}\,({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv})\index{all-zero-bitvp} $=$ (({\it{x\/}} $\simeq {\tt{0}}$) $\vee$ ({\it{s\/}} $\simeq {\tt{0}}$))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-xor-bitv-better \\ \index{all-zero-bitvp-xor-bitv-better}
\=\+{\rm{all-zero-bitvp}}\,({\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv})\index{all-zero-bitvp} \\ 
$=$$\;\;\;\;$({\rm{fix-bitv}}\,({\it{x\/}})\index{fix-bitv} $=$ {\rm{make-list-from}}\,({\rm{length}}\,({\it{x\/}})\index{length}, {\rm{fix-bitv}}\,({\it{y\/}})\index{fix-bitv})\index{make-list-from})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-xor-bvs-nat-to-bv-list \\ \index{length-xor-bvs-nat-to-bv-list}
\=\+{\rm{length}}\,({\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list})\index{xor-bvs})\index{length} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{fix}}\,({\it{s\/}}) \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-bitv-make-list-from \\ \index{fix-bitv-make-list-from}
{\rm{fix-bitv}}\,({\rm{make-list-from}}\,({\it{s\/}}, {\it{x\/}})\index{make-list-from})\index{fix-bitv} $=$ {\rm{make-list-from}}\,({\it{s\/}}, {\rm{fix-bitv}}\,({\it{x\/}})\index{fix-bitv})\index{make-list-from}
\end{tabbing}
	      

\begin{tabbing}{\sc Definition}:\index{double-sub1-cdr} \\  
\=\+{\rm{double-sub1-cdr}}\,({\it{n1\/}}, {\it{n2\/}}, {\it{l\/}})\index{double-sub1-cdr} \\ 
$=$$\;\;\;\;$\=\+{\bf if }({\it{n1\/}} $\simeq {\tt{0}}$) $\vee$ ({\it{n2\/}} $\simeq {\tt{0}}$)$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{double-sub1-cdr}}\,({\it{n1\/}} $-\;1$, {\it{n2\/}} $-\;1$, {\rm{cdr}}\,({\it{l\/}}))\index{double-sub1-cdr}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  make-list-from-make-list-from \\ \index{make-list-from-make-list-from}
\=\+{\rm{make-list-from}}\,({\it{s1\/}}, {\rm{make-list-from}}\,({\it{s2\/}}, {\it{x\/}})\index{make-list-from})\index{make-list-from} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{s2\/}} $<$ {\it{s1\/}} \\ 
{\bf then }{\rm{append}}\,({\rm{make-list-from}}\,({\it{s2\/}}, {\it{x\/}})\index{make-list-from}, {\rm{zero-bit-vector}}\,({\it{s1\/}} $-$ {\it{s2\/}})\index{zero-bit-vector}) \\ 
{\bf else }{\rm{make-list-from}}\,({\it{s1\/}}, {\it{x\/}})\index{make-list-from}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};(prove-lemma associativity-of-append (rewrite)
;	     (equal
;	      (append (append a b) c)
;	      (append a (append b c))))
\end{verbatim}
\noindent{\sc Event}:   Enable associativity-of-append.

\addvspace{18pt}

\begin{verbatim};(prove-lemma append-cons (rewrite)
;	     (equal
;	      (append (cons a b) c)
;	      (cons a (append b c))))
\end{verbatim}
\noindent{\sc Event}:   Enable append-cons.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  properp-xor-bvs \\ \index{properp-xor-bvs}
{\rm{properp}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  properp-xor-bitv \\ \index{properp-xor-bitv}
{\rm{properp}}\,({\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{member-number-with-at-least} \\  
\=\+{\rm{member-number-with-at-least}}\,({\it{x\/}}, {\it{min\/}})\index{member-number-with-at-least} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{number-with-at-least}}\,({\rm{car}}\,({\it{x\/}}), {\it{min\/}})\index{number-with-at-least} $\not\simeq {\tt{0}}$$\;\;${\bf then }{\rm{car}}\,({\it{x\/}}) \\ 
{\bf else }{\rm{member-number-with-at-least}}\,({\rm{cdr}}\,({\it{x\/}}), {\it{min\/}})\index{member-number-with-at-least}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bvs-nat-to-bv-list-zerop-ws \\ \index{xor-bvs-nat-to-bv-list-zerop-ws}
({\it{ws\/}} $\simeq {\tt{0}}$) $\rightarrow$ ({\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{xor-bvs} $=$ {\bf{nil}})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-listp-listp-simple} \\  
\=\+{\rm{nat-listp-listp-simple}}\,({\it{x\/}})\index{nat-listp-listp-simple} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }{\rm{nat-listp-simple}}\,({\rm{car}}\,({\it{x\/}}))\index{nat-listp-simple} $\wedge$ {\rm{nat-listp-listp-simple}}\,({\rm{cdr}}\,({\it{x\/}}))\index{nat-listp-listp-simple} \\ 
{\bf else }{\it{x\/}} $=$ {\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}
 
\begin{tabbing}{\sc Theorem}:  non-green-in-list-zerop-ws \\ \index{non-green-in-list-zerop-ws}
\=\+(({\it{ws\/}} $\simeq {\tt{0}}$) $\wedge$ {\rm{nat-listp-listp-simple}}\,({\it{x\/}})\index{nat-listp-listp-simple}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{non-green-in-list}}\,({\it{x\/}}, {\it{ws\/}})\index{non-green-in-list} $\leftrightarrow$ {\rm{member-number-with-at-least}}\,({\it{x\/}}, {\tt{2}})\index{member-number-with-at-least})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-listp-listp-simple-means-properp \\ \index{nat-listp-listp-simple-means-pr!operp}
{\rm{nat-listp-listp-simple}}\,({\it{x\/}})\index{nat-listp-listp-simple} $\rightarrow$ {\rm{properp}}\,({\it{x\/}})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-listp-simple-means-properp \\ \index{nat-listp-simple-means-properp}
{\rm{nat-listp-simple}}\,({\it{x\/}})\index{nat-listp-simple} $\rightarrow$ {\rm{properp}}\,({\it{x\/}})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  make-list-from-xor-bvs-nat-to-bv-list \\ \index{make-list-from-xor-bvs-nat-to-bv!-list}
\=\+({\rm{fix}}\,({\it{ws\/}}) $=$ {\rm{fix}}\,({\it{s\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{make-list-from}}\,({\it{ws\/}}, {\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list})\index{xor-bvs})\index{make-list-from} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list})\index{xor-bvs} \\ 
{\bf else }{\rm{zero-bit-vector}}\,({\it{ws\/}})\index{zero-bit-vector}$\;${\bf  endif}\-)\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  last-xor-bitv \\ \index{last-xor-bitv}
\=\+{\rm{last}}\,({\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv})\index{last} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{xor-bit}}\,({\rm{last}}\,({\it{x\/}})\index{last}, {\rm{nth}}\,({\rm{length}}\,({\it{x\/}})\index{length} $-\;1$, {\it{y\/}})\index{nth})\index{xor-bit} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  last-one-bit-vector \\ \index{last-one-bit-vector}
{\rm{last}}\,({\rm{one-bit-vector}}\,({\it{x\/}})\index{one-bit-vector})\index{last} $=$ {\tt{1}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nth-as-last \\ \index{nth-as-last}
(($1\;+$ {\it{n\/}}) $=$ {\rm{length}}\,({\it{x\/}})\index{length}) $\rightarrow$ ({\rm{nth}}\,({\it{n\/}}, {\it{x\/}})\index{nth} $=$ {\rm{last}}\,({\it{x\/}})\index{last})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-nat-to-bv \\ \index{listp-nat-to-bv}
{\rm{listp}}\,({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv}) $=$ ({\it{s\/}} $\not\simeq {\tt{0}}$)
\end{tabbing}

\begin{verbatim};(prove-lemma remainder-plus-x-x-2 (rewrite)
;	     (equal (remainder (plus x x) 2) 0))
\end{verbatim}
\noindent{\sc Event}:   Enable remainder-plus-x-x-2.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  last-nat-to-bv \\ \index{last-nat-to-bv}
\=\+{\rm{last}}\,({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv})\index{last} \\ 
$=$$\;\;\;\;$\=\+{\bf if }({\it{s\/}} $\simeq {\tt{0}}$) $\vee$ (({\it{x\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{s\/}})\index{exp}) $\wedge$ (({\it{x\/}} ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{0}}))$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-bitv-one-bit-vector \\ \index{fix-bitv-one-bit-vector}
{\rm{fix-bitv}}\,({\rm{one-bit-vector}}\,({\it{x\/}})\index{one-bit-vector})\index{fix-bitv} $=$ {\rm{one-bit-vector}}\,({\it{x\/}})\index{one-bit-vector}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-to-bv-1 \\ \index{nat-to-bv-1}
\=\+{\rm{nat-to-bv}}\,({\tt{1}}, {\it{x\/}})\index{nat-to-bv} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{one-bit-vector}}\,({\it{x\/}})\index{one-bit-vector}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  last-zero-bit-vector \\ \index{last-zero-bit-vector}
{\rm{last}}\,({\rm{zero-bit-vector}}\,({\it{x\/}})\index{zero-bit-vector})\index{last} $=$ {\tt{0}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-to-bv-2 \\ \index{nat-to-bv-2}
\=\+{\rm{nat-to-bv}}\,({\it{x\/}}, {\tt{2}})\index{nat-to-bv} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\rm{list}}\,({\tt{0}}, {\tt{0}}) \\ 
{\bf elseif }{\it{x\/}} $=$ {\tt{1}}$\;\;${\bf then }{\rm{list}}\,({\tt{0}}, {\tt{1}}) \\ 
{\bf elseif }{\it{x\/}} $=$ {\tt{2}}$\;\;${\bf then }{\rm{list}}\,({\tt{1}}, {\tt{0}}) \\ 
{\bf else }{\rm{list}}\,({\tt{1}}, {\tt{1}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-all-but-last-nat-to-bv \\ \index{all-zero-bitvp-all-but-last-nat!-to-bv}
{\rm{all-zero-bitvp}}\,({\rm{all-but-last}}\,({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv})\index{all-but-last})\index{all-zero-bitvp} $=$ (({\it{x\/}} $<$ {\tt{2}}) $\vee$ ({\it{s\/}} $<$ {\tt{2}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bvs-of-list-of-0s-and-1s \\ \index{xor-bvs-of-list-of-0s-and-1s}
\=\+({\rm{number-with-at-least}}\,({\it{c\/}}, {\tt{2}})\index{number-with-at-least} $\simeq {\tt{0}}$) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{c\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{xor-bvs} \\ 
$=$$\;\;\;\;$\=\+{\bf if }({\it{c\/}} $\simeq\;${{\bf{nil}}}${}$) $\vee$ ({\it{ws\/}} $\simeq {\tt{0}}$)$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }({\rm{sum}}\,({\it{c\/}})\index{sum} ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{0}}$\;\;${\bf then }{\rm{zero-bit-vector}}\,({\it{ws\/}})\index{zero-bit-vector} \\ 
{\bf else }{\rm{one-bit-vector}}\,({\it{ws\/}})\index{one-bit-vector}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-nat-to-bv-nlistp \\ \index{equal-nat-to-bv-nlistp}
({\it{x\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ (({\it{x\/}} $=$ {\rm{nat-to-bv}}\,({\it{y\/}}, {\it{s\/}})\index{nat-to-bv}) $=$ (({\it{x\/}} $=$ {\bf{nil}}) $\wedge$ ({\it{s\/}} $\simeq {\tt{0}}$)))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-lengths-means-different-hack \\ \index{different-lengths-means-differe!nt-hack}
\=\+({\rm{fix}}\,({\it{s1\/}}) $\not=$ {\rm{fix}}\,({\it{s2\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{length}}\,({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s1\/}})\index{nat-to-bv})\index{length} $\not=$ {\rm{length}}\,({\rm{nat-to-bv}}\,({\it{y\/}}, {\it{s2\/}})\index{nat-to-bv})\index{length})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-lengths-means-different \\ \index{different-lengths-means-differe!nt}
({\rm{fix}}\,({\it{s1\/}}) $\not=$ {\rm{fix}}\,({\it{s2\/}})) $\rightarrow$ ({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s1\/}})\index{nat-to-bv} $\not=$ {\rm{nat-to-bv}}\,({\it{y\/}}, {\it{s2\/}})\index{nat-to-bv})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nat-to-bv-induct} \\  
\=\+{\rm{nat-to-bv-induct}}\,({\it{x\/}}, {\it{y\/}}, {\it{s1\/}}, {\it{s2\/}})\index{nat-to-bv-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{s1\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{nat-to-bv-induct}}\,(\=\+\=\+{\bf if }{\it{x\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{s1\/}} $-\;1$)\index{exp}$\;\;${\bf then }{\it{x\/}} \\ 
{\bf else }{\it{x\/}} $-$ {\rm{exp}}\,({\tt{2}}, {\it{s1\/}} $-\;1$)\index{exp}$\;${\bf  endif}\-, \\ 
\=\+{\bf if }{\it{y\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{s2\/}} $-\;1$)\index{exp}$\;\;${\bf then }{\it{y\/}} \\ 
{\bf else }{\it{y\/}} $-$ {\rm{exp}}\,({\tt{2}}, {\it{s2\/}} $-\;1$)\index{exp}$\;${\bf  endif}\-, \\ 
{\it{s1\/}} $-\;1$, \\ 
{\it{s2\/}} $-\;1$)\-\index{nat-to-bv-induct}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{all-ones-vector} \\  
\=\+{\rm{all-ones-vector}}\,({\it{x\/}})\index{all-ones-vector} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{cons}}\,({\tt{1}}, {\rm{all-ones-vector}}\,({\it{x\/}} $-\;1$)\index{all-ones-vector})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  not-lessp-exp-means-all-ones \\ \index{not-lessp-exp-means-all-ones}
({\it{x\/}} $\not<$ ({\rm{exp}}\,({\tt{2}}, {\it{s\/}})\index{exp} $-\;1$)) $\rightarrow$ ({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv} $=$ {\rm{all-ones-vector}}\,({\it{s\/}})\index{all-ones-vector})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-sub1-plus-sub1-hack \\ \index{lessp-sub1-plus-sub1-hack}
({\it{y\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ (((({\it{x\/}} $+$ {\it{y\/}}) $-\;1$) $<$ (({\it{y\/}} $-\;1$) $+$ {\it{z\/}})) $=$ ({\it{x\/}} $<$ {\it{z\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-cons-zero-bit-vector-nat-to-bv \\ \index{equal-cons-zero-bit-vector-nat-t!o-bv}
\=\+({\rm{cons}}\,({\tt{0}}, {\rm{zero-bit-vector}}\,({\it{x\/}})\index{zero-bit-vector}) $=$ {\rm{nat-to-bv}}\,({\it{a\/}}, {\it{b\/}})\index{nat-to-bv}) \\ 
$=$$\;\;\;\;$((($1\;+$ {\it{x\/}}) $=$ {\rm{fix}}\,({\it{b\/}})) $\wedge$ ({\it{a\/}} $\simeq {\tt{0}}$))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-all-ones-vector-all-ones-vector \\ \index{equal-all-ones-vector-all-ones-ve!ctor}
({\rm{all-ones-vector}}\,({\it{x\/}})\index{all-ones-vector} $=$ {\rm{all-ones-vector}}\,({\it{y\/}})\index{all-ones-vector}) $=$ ({\rm{fix}}\,({\it{x\/}}) $=$ {\rm{fix}}\,({\it{y\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-all-ones-vector-cons \\ \index{equal-all-ones-vector-cons}
\=\+({\rm{all-ones-vector}}\,({\it{x\/}})\index{all-ones-vector} $=$ {\rm{cons}}\,({\it{a\/}}, {\it{b\/}})) \\ 
$=$$\;\;\;\;$(({\it{x\/}} $\not\simeq {\tt{0}}$) $\wedge$ ({\it{a\/}} $=$ {\tt{1}}) $\wedge$ ({\rm{all-ones-vector}}\,({\it{x\/}} $-\;1$)\index{all-ones-vector} $=$ {\it{b\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-lengths-obvious \\ \index{different-lengths-obvious}
({\it{x\/}} $=$ {\it{y\/}}) $\rightarrow$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-all-ones-vector-nlistp \\ \index{equal-all-ones-vector-nlistp}
({\it{x\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ (({\rm{all-ones-vector}}\,({\it{y\/}})\index{all-ones-vector} $=$ {\it{x\/}}) $=$ (({\it{x\/}} $=$ {\bf{nil}}) $\wedge$ ({\it{y\/}} $\simeq {\tt{0}}$)))
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  length-all-ones-vector \\ \index{length-all-ones-vector}
{\rm{length}}\,({\rm{all-ones-vector}}\,({\it{x\/}})\index{all-ones-vector})\index{length} $=$ {\rm{fix}}\,({\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-lengths-hack \\ \index{different-lengths-hack}
({\rm{fix}}\,({\it{x\/}}) $\not=$ {\rm{fix}}\,({\it{y\/}})) $\rightarrow$ ({\rm{all-ones-vector}}\,({\it{x\/}})\index{all-ones-vector} $\not=$ {\rm{nat-to-bv}}\,({\it{a\/}}, {\it{y\/}})\index{nat-to-bv})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-difference-arg1 \\ \index{lessp-difference-arg1}
({\it{x\/}} $\not<$ {\it{y\/}}) $\rightarrow$ ((({\it{x\/}} $-$ {\it{y\/}}) $<$ {\it{z\/}}) $=$ ({\it{x\/}} $<$ ({\it{y\/}} $+$ {\it{z\/}})))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-difference \\ \index{equal-difference}
({\it{x\/}} $\not<$ {\it{y\/}}) $\rightarrow$ ((({\it{x\/}} $-$ {\it{y\/}}) $=$ {\it{z\/}}) $=$ (({\rm{fix}}\,({\it{x\/}}) $=$ ({\it{y\/}} $+$ {\it{z\/}})) $\wedge$ ({\it{z\/}} $\in\;${\bf{N}}${}$)))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-exp \\ \index{equal-exp}
\=\+({\rm{fix}}\,({\it{a\/}}) $=$ {\rm{fix}}\,({\it{b\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{exp}}\,({\it{a\/}}, {\it{c\/}})\index{exp} $=$ {\rm{exp}}\,({\it{b\/}}, {\it{d\/}})\index{exp}) \\ 
$=$$\;\;\;\;$(\=\+({\it{a\/}} $=$ {\tt{1}}) \\ 
$\vee$$\;\;\;\;$(({\it{a\/}} $\simeq {\tt{0}}$) $\wedge$ (({\it{c\/}} $\simeq {\tt{0}}$) $=$ ({\it{d\/}} $\simeq {\tt{0}}$))) \\ 
$\vee$$\;\;\;\;$({\rm{fix}}\,({\it{c\/}}) $=$ {\rm{fix}}\,({\it{d\/}})))\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-all-ones-nat-to-bv \\ \index{equal-all-ones-nat-to-bv}
\=\+({\rm{all-ones-vector}}\,({\it{x\/}})\index{all-ones-vector} $=$ {\rm{nat-to-bv}}\,({\it{a\/}}, {\it{b\/}})\index{nat-to-bv}) \\ 
$=$$\;\;\;\;$(({\rm{fix}}\,({\it{x\/}}) $=$ {\rm{fix}}\,({\it{b\/}})) $\wedge$ ({\it{a\/}} $\not<$ ({\rm{exp}}\,({\tt{2}}, {\it{b\/}})\index{exp} $-\;1$)))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-nat-to-bv-nat-to-bv \\ \index{equal-nat-to-bv-nat-to-bv}
\=\+({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s1\/}})\index{nat-to-bv} $=$ {\rm{nat-to-bv}}\,({\it{y\/}}, {\it{s2\/}})\index{nat-to-bv}) \\ 
$=$$\;\;\;\;$(\=\+({\rm{fix}}\,({\it{s1\/}}) $=$ {\rm{fix}}\,({\it{s2\/}})) \\ 
$\wedge$$\;\;\;\;$(\=\+({\rm{fix}}\,({\it{x\/}}) $=$ {\rm{fix}}\,({\it{y\/}})) \\ 
$\vee$$\;\;\;\;$(({\it{x\/}} $\not<$ ({\rm{exp}}\,({\tt{2}}, {\it{s1\/}})\index{exp} $-\;1$)) $\wedge$ ({\it{y\/}} $\not<$ ({\rm{exp}}\,({\tt{2}}, {\it{s1\/}})\index{exp} $-\;1$))))\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-xor-bvs \\ \index{listp-xor-bvs}
{\rm{listp}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs}) $=$ {\rm{listp}}\,({\rm{car}}\,({\it{x\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-nat-to-bv-list \\ \index{car-nat-to-bv-list}
\=\+{\rm{car}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv-list}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{nat-to-bv}}\,({\rm{car}}\,({\it{x\/}}), {\it{s\/}})\index{nat-to-bv} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; from later version of naturals that is used in this proof
\end{verbatim}\begin{tabbing}{\sc Theorem}:  quotient-difference \\ \index{quotient-difference}
\=\+(({\it{x\/}} $-$ {\it{y\/}}) $\div$ {\it{z\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }({\it{x\/}} ${}${\bf{mod}}${}$ {\it{z\/}}) $<$ ({\it{y\/}} ${}${\bf{mod}}${}$ {\it{z\/}})$\;\;${\bf then }(({\it{x\/}} $\div$ {\it{z\/}}) $-$ ({\it{y\/}} $\div$ {\it{z\/}})) $-\;1$ \\ 
{\bf else }({\it{x\/}} $\div$ {\it{z\/}}) $-$ ({\it{y\/}} $\div$ {\it{z\/}})$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Enable difference-x-sub1-x.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  all-but-last-nat-to-bv \\ \index{all-but-last-nat-to-bv}
\=\+{\rm{all-but-last}}\,({\rm{nat-to-bv}}\,({\it{x\/}}, {\it{s\/}})\index{nat-to-bv})\index{all-but-last} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{s\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{nat-to-bv}}\,({\it{x\/}} $\div$ {\tt{2}}, {\it{s\/}} $-\;1$)\index{nat-to-bv}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-last-xor-bvs-1 \\ \index{equal-last-xor-bvs-1}
({\rm{last}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{last} $=$ {\tt{1}}) $=$ ({\rm{last}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{last} $\not=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  not-green-state-means \\ \index{not-green-state-means}
\=\+(\=\+($\neg$ {\rm{green-statep}}\,({\rm{append}}\,({\it{a\/}}, {\rm{cons}}\,({\it{b\/}}, {\it{c\/}})), {\it{ws\/}})\index{green-statep}) \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{ws\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\it{b\/}} $<$ {\it{d\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{green-statep}}\,({\rm{append}}\,({\it{a\/}}, {\rm{cons}}\,({\it{d\/}}, {\it{c\/}})), {\it{ws\/}})\index{green-statep} \\ 
$=$$\;\;\;\;$(\=\+({\it{ws\/}} $\not\simeq {\tt{0}}$) \\ 
$\vee$$\;\;\;\;$({\rm{number-with-at-least}}\,({\rm{append}}\,({\it{a\/}}, {\rm{cons}}\,({\it{d\/}}, {\it{c\/}})), {\tt{2}})\index{number-with-at-least} $\simeq {\tt{0}}$))\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  green-in-list-all-valid-moves-helper \\ \index{green-in-list-all-valid-moves-he!lper}
\=\+(\=\+{\rm{nat-listp}}\,({\it{a\/}}, {\it{ws\/}})\index{nat-listp} \\ 
$\wedge$$\;\;\;\;${\rm{nat-listp}}\,({\it{d\/}}, {\it{ws\/}})\index{nat-listp} \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{ws\/}})\index{exp}) \\ 
$\wedge$$\;\;\;\;${\rm{properp}}\,({\it{a\/}})\index{properp} \\ 
$\wedge$$\;\;\;\;${\rm{non-green-in-list}}\,({\rm{all-valid-moves-helper}}\,({\it{a\/}}, {\it{b\/}}, {\it{c\/}}, {\it{d\/}})\index{all-valid-moves-helper}, {\it{ws\/}})\index{non-green-in-list} \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not<$ {\it{b\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{b\/}} $\in\;${\bf{N}}${}$))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{green-statep}}\,({\rm{append}}\,({\it{a\/}}, {\rm{cons}}\,({\it{c\/}}, {\it{d\/}})), {\it{ws\/}})\index{green-statep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  green-in-list-all-valid-moves-means \\ \index{green-in-list-all-valid-moves-me!ans}
\=\+({\rm{nat-listp}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ {\rm{non-green-in-list}}\,({\rm{all-valid-moves}}\,({\it{x\/}})\index{all-valid-moves}, {\it{ws\/}})\index{non-green-in-list}) \\ 
$\rightarrow$$\;\;\;\;${\rm{green-statep}}\,({\it{x\/}}, {\it{ws\/}})\index{green-statep}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{valid-movep} \\  
\=\+{\rm{valid-movep}}\,({\it{s1\/}}, {\it{s2\/}})\index{valid-movep} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{s1\/}}) $\wedge$ {\rm{listp}}\,({\it{s2\/}}) \\ 
{\bf then }\=\+(\=\+({\rm{car}}\,({\it{s2\/}}) $<$ {\rm{car}}\,({\it{s1\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{s2\/}}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{cdr}}\,({\it{s1\/}}) $=$ {\rm{cdr}}\,({\it{s2\/}})))\- \\ 
$\vee$$\;\;\;\;$(({\rm{car}}\,({\it{s1\/}}) $=$ {\rm{car}}\,({\it{s2\/}})) $\wedge$ {\rm{valid-movep}}\,({\rm{cdr}}\,({\it{s1\/}}), {\rm{cdr}}\,({\it{s2\/}}))\index{valid-movep})\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{match-member} \\  
\=\+{\rm{match-member}}\,({\it{m\/}}, {\it{list\/}})\index{match-member} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{list\/}}) \\ 
{\bf then }\=\+{\bf if }$\neg$ {\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\rm{car}}\,({\it{list\/}}), {\it{m\/}})\index{and-bitv})\index{all-zero-bitvp}$\;\;${\bf then }{\rm{car}}\,({\it{list\/}}) \\ 
{\bf else }{\rm{match-member}}\,({\it{m\/}}, {\rm{cdr}}\,({\it{list\/}}))\index{match-member}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bvs-match-and-xor \\ \index{xor-bvs-match-and-xor}
\=\+{\rm{bit-vectorsp}}\,({\it{list\/}}, {\rm{length}}\,({\it{value\/}})\index{length})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{xor-bvs}}\,({\rm{match-and-xor}}\,({\it{list\/}}, {\it{match\/}}, {\it{value\/}})\index{match-and-xor})\index{xor-bvs} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{match-member}}\,({\it{match\/}}, {\it{list\/}})\index{match-member} \\ 
{\bf then }{\rm{xor-bitv}}\,({\it{value\/}}, {\rm{xor-bvs}}\,({\it{list\/}})\index{xor-bvs})\index{xor-bitv} \\ 
{\bf else }{\rm{xor-bvs}}\,({\it{list\/}})\index{xor-bvs}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{remove-highest-bits} \\  
\=\+{\rm{remove-highest-bits}}\,({\it{x\/}})\index{remove-highest-bits} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{cons}}\,({\rm{cdar}}\,({\it{x\/}}), {\rm{remove-highest-bits}}\,({\rm{cdr}}\,({\it{x\/}}))\index{remove-highest-bits}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-remove-highest-bits \\ \index{car-remove-highest-bits}
{\rm{car}}\,({\rm{remove-highest-bits}}\,({\it{x\/}})\index{remove-highest-bits}) $=$ {\rm{cdr}}\,({\rm{car}}\,({\it{x\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-car-highest-bit-1 \\ \index{equal-car-highest-bit-1}
\=\+({\rm{car}}\,({\rm{highest-bit}}\,({\it{x\/}})\index{highest-bit}) $=$ {\tt{1}}) \\ 
$=$$\;\;\;\;$({\rm{highest-bit}}\,({\it{x\/}})\index{highest-bit} $=$ {\rm{cons}}\,({\tt{1}}, {\rm{zero-bit-vector}}\,({\rm{length}}\,({\it{x\/}})\index{length} $-\;1$)\index{zero-bit-vector}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-xor-bitv \\ \index{car-xor-bitv}
\=\+{\rm{car}}\,({\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{xor-bit}}\,({\rm{car}}\,({\it{x\/}}), {\rm{car}}\,({\it{y\/}}))\index{xor-bit} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  match-member-cons-0 \\ \index{match-member-cons-0}
{\rm{match-member}}\,({\rm{cons}}\,({\tt{0}}, {\it{x\/}}), {\it{y\/}})\index{match-member} $\leftrightarrow$ {\rm{match-member}}\,({\it{x\/}}, {\rm{remove-highest-bits}}\,({\it{y\/}})\index{remove-highest-bits})\index{match-member}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  match-member-cons \\ \index{match-member-cons}
\=\+({\rm{bit-vectorsp}}\,({\it{v\/}}, {\rm{length}}\,({\rm{cons}}\,({\it{a\/}}, {\it{b\/}}))\index{length})\index{bit-vectorsp} $\wedge$ ({\rm{car}}\,({\rm{xor-bvs}}\,({\it{v\/}})\index{xor-bvs}) $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{match-member}}\,({\rm{cons}}\,({\it{a\/}}, {\it{b\/}}), {\it{v\/}})\index{match-member} \\ 
$\leftrightarrow$$\;\;\;\;$(({\it{a\/}} $\not=$ {\tt{0}}) $\vee$ {\rm{match-member}}\,({\it{b\/}}, {\rm{remove-highest-bits}}\,({\it{v\/}})\index{remove-highest-bits})\index{match-member}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-highest-bit-cons-1 \\ \index{equal-highest-bit-cons-1}
\=\+({\rm{highest-bit}}\,({\it{x\/}})\index{highest-bit} $=$ {\rm{cons}}\,({\tt{1}}, {\it{y\/}})) \\ 
$=$$\;\;\;\;$(({\rm{car}}\,({\it{x\/}}) $\not=$ {\tt{0}}) $\wedge$ ({\it{y\/}} $=$ {\rm{zero-bit-vector}}\,({\rm{length}}\,({\it{x\/}})\index{length} $-\;1$)\index{zero-bit-vector}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-cdr-xor-bitv \\ \index{length-cdr-xor-bitv}
{\rm{length}}\,({\rm{cdr}}\,({\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv}))\index{length} $=$ {\rm{length}}\,({\rm{cdr}}\,({\it{x\/}}))\index{length}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-fix-bitv \\ \index{length-fix-bitv}
{\rm{length}}\,({\rm{fix-bitv}}\,({\it{x\/}})\index{fix-bitv})\index{length} $=$ {\rm{length}}\,({\it{x\/}})\index{length}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-cdr-xor-bvs \\ \index{length-cdr-xor-bvs}
\=\+{\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{length}}\,({\rm{cdr}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs}))\index{length} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\it{s\/}} $-\;1$ \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{highest-bits-induct} \\  
\=\+{\rm{highest-bits-induct}}\,({\it{x\/}}, {\it{s\/}})\index{highest-bits-induct} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{car}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\rm{highest-bit}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{highest-bit}) $=$ {\tt{1}}$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{highest-bits-induct}}\,({\rm{remove-highest-bits}}\,({\it{x\/}})\index{remove-highest-bits}, {\it{s\/}} $-\;1$)\index{highest-bits-induct}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorsp-remove-highest-bits \\ \index{bit-vectorsp-remove-highest-bit!s}
{\rm{bit-vectorsp}}\,({\it{x\/}}, $1\;+$ {\it{s\/}})\index{bit-vectorsp} $\rightarrow$ {\rm{bit-vectorsp}}\,({\rm{remove-highest-bits}}\,({\it{x\/}})\index{remove-highest-bits}, {\it{s\/}})\index{bit-vectorsp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  xor-bvs-remove-highest-bits \\ \index{xor-bvs-remove-highest-bits}
\=\+{\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{xor-bvs}}\,({\rm{remove-highest-bits}}\,({\it{x\/}})\index{remove-highest-bits})\index{xor-bvs} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) $\wedge$ ({\it{s\/}} $\not\simeq {\tt{0}}$)$\;\;${\bf then }{\rm{cdr}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  match-member-highest-bit-xor-bvs \\ \index{match-member-highest-bit-xor-bv!s}
\=\+{\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{match-member}}\,({\rm{highest-bit}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{highest-bit}, {\it{x\/}})\index{match-member} \\ 
$\leftrightarrow$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{all-zero-bitvp}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  match-member-highest-bit-xor-bvs-rewrite \\ \index{match-member-highest-bit-xor-bv!s-rewrite}
\=\+{\rm{bit-vectorsp}}\,({\it{x\/}}, {\rm{length}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{length})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{match-member}}\,({\rm{highest-bit}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{highest-bit}, {\it{x\/}})\index{match-member} \\ 
$\leftrightarrow$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{all-zero-bitvp}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorsp-nat-to-bv-list-better \\ \index{bit-vectorsp-nat-to-bv-list-bette!r}
\=\+{\rm{bit-vectorsp}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{size\/}})\index{nat-to-bv-list}, {\it{size2\/}})\index{bit-vectorsp} \\ 
$=$$\;\;\;\;$(({\it{x\/}} $\simeq\;${{\bf{nil}}}${}$) $\vee$ ({\rm{fix}}\,({\it{size\/}}) $=$ {\rm{fix}}\,({\it{size2\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  match-member-at-least-min-means \\ \index{match-member-at-least-min-means}
\=\+(\=\+{\rm{match-member}}\,({\it{y\/}}, {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{match-member} \\ 
$\wedge$$\;\;\;\;$({\rm{bv-to-nat}}\,({\rm{match-member}}\,({\it{y\/}}, {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{match-member})\index{bv-to-nat} $\not<$ {\it{min\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{number-with-at-least}}\,({\it{x\/}}, {\it{min\/}})\index{number-with-at-least} $\not=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-highest-bit-xor-bvs \\ \index{bit-vectorp-highest-bit-xor-bvs}
{\rm{bit-vectorp}}\,({\rm{highest-bit}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{highest-bit}, {\it{ws\/}})\index{bit-vectorp} $=$ {\rm{bit-vectorp}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs}, {\it{ws\/}})\index{bit-vectorp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  number-with-at-least-match-and-xor \\ \index{number-with-at-least-match-and-!xor}
\=\+({\rm{nat-listp}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ {\rm{bit-vectorp}}\,({\it{y\/}}, {\it{ws\/}})\index{bit-vectorp} $\wedge$ {\rm{bit-vectorp}}\,({\it{z\/}}, {\it{ws\/}})\index{bit-vectorp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{number-with-at-least}}\,(\=\+{\rm{bv-to-nat-list}}\,({\rm{match-and-xor}}\,(\=\+{\rm{nat-to-bv-list}}\,(\=\+{\it{x\/}}, \\ 
{\it{ws\/}})\-\index{nat-to-bv-list}, \\ 
{\it{y\/}}, \\ 
{\it{z\/}})\-\index{match-and-xor})\index{bv-to-nat-list}, \\ 
{\it{min\/}})\-\index{number-with-at-least} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{match-member}}\,({\it{y\/}}, {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{match-member} \\ 
{\bf then }\=\+(\=\+{\rm{number-with-at-least}}\,({\it{x\/}}, {\it{min\/}})\index{number-with-at-least} \\ 
$+$$\;\;\;\;$\=\+{\bf if }\=\+{\rm{bv-to-nat}}\,({\rm{xor-bitv}}\,(\=\+{\it{z\/}}, \\ 
{\rm{match-member}}\,(\=\+{\it{y\/}}, \\ 
{\rm{nat-to-bv-list}}\,(\=\+{\it{x\/}}, \\ 
{\it{ws\/}})\-\index{nat-to-bv-list})\-\index{match-member})\-\index{xor-bitv})\index{bv-to-nat} \\ 
$<$$\;\;\;\;${\it{min\/}}\-$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\-)\- \\ 
$-$$\;\;\;\;$\=\+{\bf if }\=\+{\rm{bv-to-nat}}\,({\rm{match-member}}\,({\it{y\/}}, {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{match-member})\index{bv-to-nat} \\ 
$<$$\;\;\;\;${\it{min\/}}\-$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\-\- \\ 
{\bf else }{\rm{number-with-at-least}}\,({\it{x\/}}, {\it{min\/}})\index{number-with-at-least}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  number-with-at-least-replace-value \\ \index{number-with-at-least-replace-va!lue}
\=\+{\rm{number-with-at-least}}\,({\rm{replace-value}}\,({\it{x\/}}, {\it{e\/}}, {\it{v\/}})\index{replace-value}, {\it{min\/}})\index{number-with-at-least} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{e\/}} $\in$ {\it{x\/}} \\ 
{\bf then }\=\+(\=\+{\rm{number-with-at-least}}\,({\it{x\/}}, {\it{min\/}})\index{number-with-at-least} \\ 
$+$$\;\;\;\;$\=\+{\bf if }{\it{v\/}} $<$ {\it{min\/}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\-)\- \\ 
$-$$\;\;\;\;$\=\+{\bf if }{\it{e\/}} $<$ {\it{min\/}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\-\- \\ 
{\bf else }{\rm{number-with-at-least}}\,({\it{x\/}}, {\it{min\/}})\index{number-with-at-least}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  max-list-means-number-0 \\ \index{max-list-means-number-0}
(({\rm{max-list}}\,({\it{x\/}})\index{max-list} $=$ {\it{n\/}}) $\wedge$ ({\it{n\/}} $<$ {\it{m\/}})) $\rightarrow$ ({\rm{number-with-at-least}}\,({\it{x\/}}, {\it{m\/}})\index{number-with-at-least} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-max-list \\ \index{member-max-list}
{\rm{nat-listp-simple}}\,({\it{x\/}})\index{nat-listp-simple} $\rightarrow$ (({\rm{max-list}}\,({\it{x\/}})\index{max-list} $\in$ {\it{x\/}}) $=$ {\rm{listp}}\,({\it{x\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-replace-value \\ \index{listp-replace-value}
{\rm{listp}}\,({\rm{replace-value}}\,({\it{x\/}}, {\it{e\/}}, {\it{v\/}})\index{replace-value}) $=$ {\rm{listp}}\,({\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-means-lessp-sum \\ \index{member-means-lessp-sum}
({\it{e\/}} $\in$ {\it{x\/}}) $\rightarrow$ ({\rm{sum}}\,({\it{x\/}})\index{sum} $\not<$ {\it{e\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sum-replace-value \\ \index{sum-replace-value}
\=\+{\rm{sum}}\,({\rm{replace-value}}\,({\it{x\/}}, {\it{e\/}}, {\it{v\/}})\index{replace-value})\index{sum} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{e\/}} $\in$ {\it{x\/}}$\;\;${\bf then }({\rm{sum}}\,({\it{x\/}})\index{sum} $+$ {\it{v\/}}) $-$ {\it{e\/}} \\ 
{\bf else }{\rm{sum}}\,({\it{x\/}})\index{sum}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  remainder-difference-2 \\ \index{remainder-difference-2}
\=\+(({\it{x\/}} $-$ {\it{y\/}}) ${}${\bf{mod}}${}$ {\tt{2}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $<$ {\it{y\/}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }({\it{x\/}} ${}${\bf{mod}}${}$ {\tt{2}}) $=$ ({\it{y\/}} ${}${\bf{mod}}${}$ {\tt{2}})$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-max-list \\ \index{lessp-max-list}
{\rm{sum}}\,({\it{x\/}})\index{sum} $\not<$ {\rm{max-list}}\,({\it{x\/}})\index{max-list}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  remainder-plus-remainder \\ \index{remainder-plus-remainder}
\=\+(((({\it{x\/}} ${}${\bf{mod}}${}$ {\it{y\/}}) $+$ {\it{z\/}}) ${}${\bf{mod}}${}$ {\it{y\/}}) $=$ (({\it{x\/}} $+$ {\it{z\/}}) ${}${\bf{mod}}${}$ {\it{y\/}})) \\ 
$\wedge$$\;\;\;\;$((({\it{z\/}} $+$ ({\it{x\/}} ${}${\bf{mod}}${}$ {\it{y\/}})) ${}${\bf{mod}}${}$ {\it{y\/}}) $=$ (({\it{x\/}} $+$ {\it{z\/}}) ${}${\bf{mod}}${}$ {\it{y\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  remainder-plus-remainder2 \\ \index{remainder-plus-remainder2}
\=\+((({\it{z\/}} $+$ ({\it{a\/}} $+$ ({\it{x\/}} ${}${\bf{mod}}${}$ {\it{y\/}}))) ${}${\bf{mod}}${}$ {\it{y\/}}) $=$ (({\it{z\/}} $+$ ({\it{a\/}} $+$ {\it{x\/}})) ${}${\bf{mod}}${}$ {\it{y\/}})) \\ 
$\wedge$$\;\;\;\;$((({\it{z\/}} $+$ (({\it{x\/}} ${}${\bf{mod}}${}$ {\it{y\/}}) $+$ {\it{a\/}})) ${}${\bf{mod}}${}$ {\it{y\/}}) $=$ (({\it{z\/}} $+$ ({\it{a\/}} $+$ {\it{x\/}})) ${}${\bf{mod}}${}$ {\it{y\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-max-list-from-number-with-at-least \\ \index{lessp-max-list-from-number-with!-at-least}
(({\rm{number-with-at-least}}\,({\it{x\/}}, {\it{m\/}})\index{number-with-at-least} $=$ {\tt{0}}) $\wedge$ ({\it{m\/}} $\not\simeq {\tt{0}}$)) $\rightarrow$ ({\rm{max-list}}\,({\it{x\/}})\index{max-list} $<$ {\it{m\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  number-with-at-least-as-sum \\ \index{number-with-at-least-as-sum}
({\rm{number-with-at-least}}\,({\it{x\/}}, {\tt{2}})\index{number-with-at-least} $\simeq {\tt{0}}$) $\rightarrow$ ({\rm{number-with-at-least}}\,({\it{x\/}}, {\tt{1}})\index{number-with-at-least} $=$ {\rm{sum}}\,({\it{x\/}})\index{sum})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-remainder-add1-2 \\ \index{equal-remainder-add1-2}
((($1\;+$ {\it{x\/}}) ${}${\bf{mod}}${}$ {\tt{2}}) $=$ (($1\;+$ {\it{y\/}}) ${}${\bf{mod}}${}$ {\tt{2}})) $=$ (({\it{x\/}} ${}${\bf{mod}}${}$ {\tt{2}}) $=$ ({\it{y\/}} ${}${\bf{mod}}${}$ {\tt{2}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  remainder-plus-sum-number-hack \\ \index{remainder-plus-sum-number-hack}
\=\+({\rm{number-with-at-least}}\,({\it{x\/}}, {\tt{2}})\index{number-with-at-least} $=$ {\tt{1}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\rm{sum}}\,({\it{x\/}})\index{sum} $+$ {\rm{number-with-at-least}}\,({\it{x\/}}, {\tt{1}})\index{number-with-at-least}) ${}${\bf{mod}}${}$ {\tt{2}}) \\ 
$=$$\;\;\;\;$(($1\;+$ {\rm{max-list}}\,({\it{x\/}})\index{max-list}) ${}${\bf{mod}}${}$ {\tt{2}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-remainder-add1 \\ \index{equal-remainder-add1}
((($1\;+$ {\it{x\/}}) ${}${\bf{mod}}${}$ {\it{y\/}}) $=$ ({\it{x\/}} ${}${\bf{mod}}${}$ {\it{y\/}})) $=$ ({\it{y\/}} $=$ {\tt{1}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  max-0-means-sum-0 \\ \index{max-0-means-sum-0}
({\rm{sum}}\,({\it{x\/}})\index{sum} $=$ {\tt{0}}) $=$ ({\rm{max-list}}\,({\it{x\/}})\index{max-list} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  max-0-means-all-zero-bitvp \\ \index{max-0-means-all-zero-bitvp}
(({\rm{max-list}}\,({\it{x\/}})\index{max-list} $=$ {\tt{0}}) $\wedge$ {\rm{nat-listp-simple}}\,({\it{x\/}})\index{nat-listp-simple}) $\rightarrow$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  remainder-add1-2 \\ \index{remainder-add1-2}
\=\+(((($1\;+$ {\it{x\/}}) ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{0}}) $=$ (({\it{x\/}} ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{1}})) \\ 
$\wedge$$\;\;\;\;$(((($1\;+$ {\it{x\/}}) ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{1}}) $=$ (({\it{x\/}} ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{0}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  remainder-sub1-2 \\ \index{remainder-sub1-2}
\=\+({\it{x\/}} $\not\simeq {\tt{0}}$) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(((({\it{x\/}} $-\;1$) ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{0}}) $=$ (({\it{x\/}} ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{1}})) \\ 
$\wedge$$\;\;\;\;$(((({\it{x\/}} $-\;1$) ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{1}}) $=$ (({\it{x\/}} ${}${\bf{mod}}${}$ {\tt{2}}) $=$ {\tt{0}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-x-remainder-sub1-x \\ \index{equal-x-remainder-sub1-x}
((({\it{x\/}} $-\;1$) ${}${\bf{mod}}${}$ {\it{y\/}}) $=$ {\it{x\/}}) $=$ ({\it{x\/}} $=$ {\tt{0}})
\end{tabbing}
	       
\begin{tabbing}{\sc Theorem}:  computer-move-makes-non-green \\ \index{computer-move-makes-non-green}
\=\+(\=\+{\rm{green-statep}}\,({\it{x\/}}, {\it{ws\/}})\index{green-statep} \\ 
$\wedge$$\;\;\;\;${\rm{nat-listp}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-listp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{ws\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp}))\- \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{green-statep}}\,({\rm{computer-move}}\,({\it{x\/}}, {\it{ws\/}})\index{computer-move}, {\it{ws\/}})\index{green-statep})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-listp-simplify \\ \index{nat-listp-simplify}
({\it{ws\/}} $\simeq {\tt{0}}$) $\rightarrow$ ({\rm{nat-listp}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-listp} $=$ ({\rm{properp}}\,({\it{x\/}})\index{properp} $\wedge$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  computer-move-makes-non-green-rewrite \\ \index{computer-move-makes-non-green-re!write}
\=\+({\rm{green-statep}}\,({\it{x\/}}, {\it{ws\/}})\index{green-statep} $\wedge$ {\rm{nat-listp}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ ($\neg$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{green-statep}}\,({\rm{computer-move}}\,({\it{x\/}}, {\it{ws\/}})\index{computer-move}, {\it{ws\/}})\index{green-statep})\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{make-properp} \\  
\=\+{\rm{make-properp}}\,({\it{x\/}})\index{make-properp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}})$\;\;${\bf then }{\rm{cons}}\,({\rm{car}}\,({\it{x\/}}), {\rm{make-properp}}\,({\rm{cdr}}\,({\it{x\/}}))\index{make-properp}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  properp-make-properp \\ \index{properp-make-properp}
{\rm{properp}}\,({\it{x\/}})\index{properp} $\rightarrow$ ({\rm{make-properp}}\,({\it{x\/}})\index{make-properp} $=$ {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  replace-value-simplify \\ \index{replace-value-simplify}
({\it{x\/}} $\not\in$ {\it{y\/}}) $\rightarrow$ ({\rm{replace-value}}\,({\it{y\/}}, {\it{x\/}}, {\it{z\/}})\index{replace-value} $=$ {\rm{make-properp}}\,({\it{y\/}})\index{make-properp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-make-properp \\ \index{member-make-properp}
({\it{x\/}} $\in$ {\rm{make-properp}}\,({\it{y\/}})\index{make-properp}) $=$ ({\it{x\/}} $\in$ {\it{y\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  valid-movep-x-x \\ \index{valid-movep-x-x}
$\neg$ {\rm{valid-movep}}\,({\it{x\/}}, {\it{x\/}})\index{valid-movep}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  valid-movep-replace-value \\ \index{valid-movep-replace-value}
\=\+{\rm{properp}}\,({\it{x\/}})\index{properp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{valid-movep}}\,({\it{x\/}}, {\rm{replace-value}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{replace-value})\index{valid-movep} \\ 
$=$$\;\;\;\;$(({\it{y\/}} $\in$ {\it{x\/}}) $\wedge$ ({\it{z\/}} $<$ {\it{y\/}}) $\wedge$ ({\it{z\/}} $\in\;${\bf{N}}${}$)))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  number-with-at-least-max-list \\ \index{number-with-at-least-max-list}
(({\rm{number-with-at-least}}\,({\it{x\/}}, {\it{m\/}})\index{number-with-at-least} $=$ {\it{v\/}}) $\wedge$ ({\tt{0}} $<$ {\it{v\/}})) $\rightarrow$ ({\rm{max-list}}\,({\it{x\/}})\index{max-list} $\not<$ {\it{m\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  valid-movep-match-and-xor \\ \index{valid-movep-match-and-xor}
\=\+({\rm{nat-listp}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ {\rm{bit-vectorp}}\,({\it{y\/}}, {\it{ws\/}})\index{bit-vectorp} $\wedge$ {\rm{bit-vectorp}}\,({\it{z\/}}, {\it{ws\/}})\index{bit-vectorp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{valid-movep}}\,(\=\+{\it{x\/}}, \\ 
{\rm{bv-to-nat-list}}\,({\rm{match-and-xor}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list}, {\it{y\/}}, {\it{z\/}})\index{match-and-xor})\index{bv-to-nat-list})\-\index{valid-movep} \\ 
$=$$\;\;\;\;$(\=\+{\rm{match-member}}\,({\it{y\/}}, {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{match-member} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{bv-to-nat}}\,({\rm{xor-bitv}}\,(\=\+{\it{z\/}}, \\ 
{\rm{match-member}}\,(\=\+{\it{y\/}}, \\ 
{\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\-\index{match-member})\-\index{xor-bitv})\index{bv-to-nat} \\ 
$<$$\;\;\;\;${\rm{bv-to-nat}}\,({\rm{match-member}}\,({\it{y\/}}, {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{match-member})\index{bv-to-nat})\-)\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{lessp-bv} \\  
\=\+{\rm{lessp-bv}}\,({\it{x\/}}, {\it{y\/}})\index{lessp-bv} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) $\wedge$ {\rm{listp}}\,({\it{y\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{fix-bit}}\,({\rm{car}}\,({\it{x\/}}))\index{fix-bit} $=$ {\rm{fix-bit}}\,({\rm{car}}\,({\it{y\/}}))\index{fix-bit} \\ 
{\bf then }{\rm{lessp-bv}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{cdr}}\,({\it{y\/}}))\index{lessp-bv} \\ 
{\bf else }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{0}}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-bv-to-nat \\ \index{lessp-bv-to-nat}
{\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $<$ {\rm{exp}}\,({\tt{2}}, {\rm{length}}\,({\it{x\/}})\index{length})\index{exp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-as-lessp-bv \\ \index{lessp-as-lessp-bv}
\=\+({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{bv-to-nat}}\,({\it{x\/}})\index{bv-to-nat} $<$ {\rm{bv-to-nat}}\,({\it{y\/}})\index{bv-to-nat}) $=$ {\rm{lessp-bv}}\,({\it{x\/}}, {\it{y\/}})\index{lessp-bv})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-bitv-highest-bit \\ \index{fix-bitv-highest-bit}
{\rm{fix-bitv}}\,({\rm{highest-bit}}\,({\it{x\/}})\index{highest-bit})\index{fix-bitv} $=$ {\rm{highest-bit}}\,({\it{x\/}})\index{highest-bit}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  properp-highest-bit \\ \index{properp-highest-bit}
{\rm{properp}}\,({\rm{highest-bit}}\,({\it{x\/}})\index{highest-bit})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorp-fix-bitv \\ \index{bit-vectorp-fix-bitv}
{\rm{bit-vectorp}}\,({\rm{fix-bitv}}\,({\it{x\/}})\index{fix-bitv}, {\it{s\/}})\index{bit-vectorp} $=$ ({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{fix}}\,({\it{s\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-bv-xor-bitv \\ \index{lessp-bv-xor-bitv}
\=\+({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\rm{length}}\,({\it{y\/}})\index{length}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{lessp-bv}}\,({\rm{xor-bitv}}\,({\it{x\/}}, {\it{y\/}})\index{xor-bitv}, {\it{y\/}})\index{lessp-bv} \\ 
$=$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{y\/}}, {\rm{highest-bit}}\,({\it{x\/}})\index{highest-bit})\index{and-bitv})\index{all-zero-bitvp}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-match-member-nat-to-bv-list \\ \index{length-match-member-nat-to-bv-li!st}
\=\+{\rm{length}}\,({\rm{match-member}}\,({\it{a\/}}, {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{match-member})\index{length} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{match-member}}\,({\it{a\/}}, {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{match-member}$\;\;${\bf then }{\rm{fix}}\,({\it{ws\/}}) \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bit-vectorsp-remove-highest-bits2 \\ \index{bit-vectorsp-remove-highest-bit!s2}
\=\+{\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{s1\/}})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{bit-vectorsp}}\,({\rm{remove-highest-bits}}\,({\it{x\/}})\index{remove-highest-bits}, {\it{s2\/}})\index{bit-vectorsp} \\ 
$=$$\;\;\;\;$((($1\;+$ {\it{s2\/}}) $=$ {\it{s1\/}}) $\vee$ ($\neg$ {\rm{listp}}\,({\it{x\/}}))))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  match-member-high-bit-xor-bvs-helper \\ \index{match-member-high-bit-xor-bvs-he!lper}
\=\+{\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{ws\/}})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{match-member}}\,({\rm{highest-bit}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{highest-bit}, {\it{x\/}})\index{match-member} \\ 
$\leftrightarrow$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\rm{xor-bvs}}\,({\it{x\/}})\index{xor-bvs})\index{all-zero-bitvp}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  match-member-high-bit-xor-bvs \\ \index{match-member-high-bit-xor-bvs}
\=\+{\rm{match-member}}\,({\rm{highest-bit}}\,({\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{y\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{xor-bvs})\index{highest-bit}, {\rm{nat-to-bv-list}}\,({\it{y\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{match-member} \\ 
$\leftrightarrow$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\rm{xor-bvs}}\,({\rm{nat-to-bv-list}}\,({\it{y\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{xor-bvs})\index{all-zero-bitvp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-match-member \\ \index{length-match-member}
\=\+{\rm{match-member}}\,({\it{a\/}}, {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{match-member} \\ 
$\rightarrow$$\;\;\;\;$({\rm{length}}\,({\rm{match-member}}\,({\it{a\/}}, {\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{match-member})\index{length} $=$ {\rm{fix}}\,({\it{ws\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-and-match-member \\ \index{all-zero-bitvp-and-match-member}
\=\+{\rm{bit-vectorsp}}\,({\it{b\/}}, {\rm{length}}\,({\it{a\/}})\index{length})\index{bit-vectorsp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{all-zero-bitvp}}\,({\rm{and-bitv}}\,({\it{a\/}}, {\rm{match-member}}\,({\it{a\/}}, {\it{b\/}})\index{match-member})\index{and-bitv})\index{all-zero-bitvp} \\ 
$=$$\;\;\;\;$($\neg$ {\rm{match-member}}\,({\it{a\/}}, {\it{b\/}})\index{match-member}))\-\-
\end{tabbing}
	      
\begin{tabbing}{\sc Theorem}:  valid-movep-computer-move-helper \\ \index{valid-movep-computer-move-helpe!r}
\=\+({\rm{nat-listp}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ ($\neg$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp}) $\wedge$ ({\it{ws\/}} $\not\simeq {\tt{0}}$) $\wedge$ {\rm{listp}}\,({\it{x\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{valid-movep}}\,({\it{x\/}}, {\rm{computer-move}}\,({\it{x\/}}, {\it{ws\/}})\index{computer-move})\index{valid-movep}\-
\end{tabbing}

\begin{verbatim};;; PART OF SPECIFICATION
\end{verbatim}\begin{tabbing}{\sc Theorem}:  valid-movep-computer-move \\ \index{valid-movep-computer-move}
\=\+({\rm{nat-listp}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ ($\neg$ {\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp})) \\ 
$\rightarrow$$\;\;\;\;${\rm{valid-movep}}\,({\it{x\/}}, {\rm{computer-move}}\,({\it{x\/}}, {\it{ws\/}})\index{computer-move})\index{valid-movep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-cdr \\ \index{nthcdr-cdr}
{\rm{nthcdr}}\,({\it{n\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{nthcdr} $=$ {\rm{cdr}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{x\/}})\index{nthcdr})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  make-list-from-append \\ \index{make-list-from-append}
\=\+{\rm{make-list-from}}\,({\it{n\/}}, {\rm{append}}\,({\it{a\/}}, {\it{b\/}}))\index{make-list-from} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{length}}\,({\it{a\/}})\index{length} $<$ {\it{n\/}}$\;\;${\bf then }{\rm{append}}\,({\it{a\/}}, {\rm{make-list-from}}\,({\it{n\/}} $-$ {\rm{length}}\,({\it{a\/}})\index{length}, {\it{b\/}})\index{make-list-from}) \\ 
{\bf else }{\rm{make-list-from}}\,({\it{n\/}}, {\it{a\/}})\index{make-list-from}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  make-list-from-simplify-better \\ \index{make-list-from-simplify-better}
({\it{n\/}} $=$ {\rm{length}}\,({\it{x\/}})\index{length}) $\rightarrow$ ({\rm{make-list-from}}\,({\it{n\/}}, {\it{x\/}})\index{make-list-from} $=$ {\rm{make-properp}}\,({\it{x\/}})\index{make-properp})
\end{tabbing}

\begin{verbatim};(prove-lemma length-cons (rewrite)
;	     (equal (length (cons a b)) (add1 (length b))))
\end{verbatim}
\noindent{\sc Event}:   Enable length-cons.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  cdr-nthcdr-cons \\ \index{cdr-nthcdr-cons}
{\rm{cdr}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\rm{cons}}\,({\it{a\/}}, {\it{b\/}}))\index{nthcdr}) $=$ {\rm{nthcdr}}\,({\it{n\/}}, {\it{b\/}})\index{nthcdr}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-append-2 \\ \index{equal-append-2}
\=\+({\it{x\/}} $=$ {\rm{append}}\,({\it{a\/}}, {\it{b\/}})) \\ 
$=$$\;\;\;\;$(\=\+({\rm{length}}\,({\it{x\/}})\index{length} $\not<$ {\rm{length}}\,({\it{a\/}})\index{length}) \\ 
$\wedge$$\;\;\;\;$({\rm{make-list-from}}\,({\rm{length}}\,({\it{a\/}})\index{length}, {\it{x\/}})\index{make-list-from} $=$ {\rm{make-properp}}\,({\it{a\/}})\index{make-properp}) \\ 
$\wedge$$\;\;\;\;$({\rm{nthcdr}}\,({\rm{length}}\,({\it{a\/}})\index{length}, {\it{x\/}})\index{nthcdr} $=$ {\it{b\/}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-cons-all-valid-moves-helper1 \\ \index{member-cons-all-valid-moves-helpe!r1}
\=\+{\rm{listp}}\,({\it{a\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{cons}}\,({\it{x\/}}, {\it{y\/}}) $\in$ {\rm{all-valid-moves-helper}}\,({\it{a\/}}, {\it{b\/}}, {\it{c\/}}, {\it{d\/}})\index{all-valid-moves-helper}) \\ 
$=$$\;\;\;\;$(\=\+({\it{x\/}} $=$ {\rm{car}}\,({\it{a\/}})) \\ 
$\wedge$$\;\;\;\;$({\it{y\/}} $\in$ {\rm{all-valid-moves-helper}}\,({\rm{cdr}}\,({\it{a\/}}), {\it{b\/}}, {\it{c\/}}, {\it{d\/}})\index{all-valid-moves-helper}))\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-all-valid-moves-means-prefix \\ \index{member-all-valid-moves-means-pre!fix}
\=\+{\rm{properp}}\,({\it{a\/}})\index{properp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\it{x\/}} $\in$ {\rm{all-valid-moves-helper}}\,({\it{a\/}}, {\it{b\/}}, {\it{c\/}}, {\it{d\/}})\index{all-valid-moves-helper}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{make-list-from}}\,({\rm{length}}\,({\it{a\/}})\index{length}, {\it{x\/}})\index{make-list-from} $=$ {\it{a\/}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-nthcdr-cons \\ \index{equal-nthcdr-cons}
({\it{n\/}} $\not<$ {\rm{length}}\,({\it{x\/}})\index{length}) $\rightarrow$ ({\rm{nthcdr}}\,({\it{n\/}}, {\it{x\/}})\index{nthcdr} $\not=$ {\rm{cons}}\,({\it{a\/}}, {\it{b\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-length-simple-member-all-valid-moves \\ \index{lessp-length-simple-member-all-v!alid-moves}
({\rm{length}}\,({\it{a\/}})\index{length} $\not<$ {\rm{length}}\,({\it{x\/}})\index{length}) $\rightarrow$ ({\it{x\/}} $\not\in$ {\rm{all-valid-moves-helper}}\,({\it{a\/}}, {\it{b\/}}, {\it{c\/}}, {\it{d\/}})\index{all-valid-moves-helper})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nth-cons \\ \index{nth-cons}
\=\+{\rm{nth}}\,({\it{n\/}}, {\rm{cons}}\,({\it{a\/}}, {\it{b\/}}))\index{nth} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\it{a\/}} \\ 
{\bf else }{\rm{nth}}\,({\it{n\/}} $-\;1$, {\it{b\/}})\index{nth}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nth-1 \\ \index{nth-1}
{\rm{nth}}\,({\tt{1}}, {\it{x\/}})\index{nth} $=$ {\rm{cadr}}\,({\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  get-as-nth \\ \index{get-as-nth}
{\rm{get}}\,({\it{n\/}}, {\it{x\/}})\index{get} $=$ {\rm{nth}}\,({\it{n\/}}, {\it{x\/}})\index{nth}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-cons-make-properp \\ \index{equal-cons-make-properp}
\=\+({\rm{cons}}\,({\it{a\/}}, {\it{b\/}}) $=$ {\rm{make-properp}}\,({\it{x\/}})\index{make-properp}) \\ 
$=$$\;\;\;\;$({\rm{listp}}\,({\it{x\/}}) $\wedge$ ({\it{a\/}} $=$ {\rm{car}}\,({\it{x\/}})) $\wedge$ ({\it{b\/}} $=$ {\rm{make-properp}}\,({\rm{cdr}}\,({\it{x\/}}))\index{make-properp}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-cons-make-list-from-hack \\ \index{nthcdr-cons-make-list-from-hack}
\=\+{\rm{nthcdr}}\,({\it{n\/}}, {\rm{cons}}\,({\it{a\/}}, {\rm{make-list-from}}\,({\it{n\/}}, {\it{z\/}})\index{make-list-from}))\index{nthcdr} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\rm{list}}\,({\it{a\/}}) \\ 
{\bf else }{\rm{list}}\,({\rm{nth}}\,({\it{n\/}} $-\;1$, {\it{z\/}})\index{nth})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-sub1-as-equal \\ \index{lessp-sub1-as-equal}
({\it{a\/}} $<$ {\it{b\/}}) $\rightarrow$ (({\it{a\/}} $<$ ({\it{b\/}} $-\;1$)) $=$ (($1\;+$ {\it{a\/}}) $\not=$ {\it{b\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-nthcdr-cons-better \\ \index{equal-nthcdr-cons-better}
\=\+({\rm{nthcdr}}\,({\it{n\/}}, {\it{x\/}})\index{nthcdr} $=$ {\rm{cons}}\,({\it{a\/}}, {\it{b\/}})) \\ 
$=$$\;\;\;\;$(({\it{n\/}} $<$ {\rm{length}}\,({\it{x\/}})\index{length}) $\wedge$ ({\rm{nth}}\,({\it{n\/}}, {\it{x\/}})\index{nth} $=$ {\it{a\/}}) $\wedge$ ({\rm{nthcdr}}\,($1\;+$ {\it{n\/}}, {\it{x\/}})\index{nthcdr} $=$ {\it{b\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-all-valid-moves-helper \\ \index{member-all-valid-moves-helper}
\=\+({\rm{nat-listp-simple}}\,({\it{a\/}})\index{nat-listp-simple} $\wedge$ {\rm{nat-listp-simple}}\,({\it{d\/}})\index{nat-listp-simple} $\wedge$ ({\it{b\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\it{x\/}} $\in$ {\rm{all-valid-moves-helper}}\,({\it{a\/}}, {\it{b\/}}, {\it{c\/}}, {\it{d\/}})\index{all-valid-moves-helper}) \\ 
$=$$\;\;\;\;$(\=\+({\rm{make-list-from}}\,({\rm{length}}\,({\it{a\/}})\index{length}, {\it{x\/}})\index{make-list-from} $=$ {\rm{make-properp}}\,({\it{a\/}})\index{make-properp}) \\ 
$\wedge$$\;\;\;\;$(\=\+(\=\+({\rm{nth}}\,({\rm{length}}\,({\it{a\/}})\index{length}, {\it{x\/}})\index{nth} $<$ {\it{b\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{nth}}\,({\rm{length}}\,({\it{a\/}})\index{length}, {\it{x\/}})\index{nth} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{nthcdr}}\,($1\;+$ {\rm{length}}\,({\it{a\/}})\index{length}, {\it{x\/}})\index{nthcdr} $=$ {\it{d\/}}))\- \\ 
$\vee$$\;\;\;\;$(\=\+({\rm{nth}}\,({\rm{length}}\,({\it{a\/}})\index{length}, {\it{x\/}})\index{nth} $=$ {\it{c\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{valid-movep}}\,(\=\+{\it{d\/}}, \\ 
{\rm{cdr}}\,({\rm{nthcdr}}\,({\rm{length}}\,({\it{a\/}})\index{length}, {\it{x\/}})\index{nthcdr}))\-\index{valid-movep})\-)\-)\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-all-valid-moves \\ \index{member-all-valid-moves}
{\rm{nat-listp-simple}}\,({\it{x\/}})\index{nat-listp-simple} $\rightarrow$ (({\it{y\/}} $\in$ {\rm{all-valid-moves}}\,({\it{x\/}})\index{all-valid-moves}) $=$ {\rm{valid-movep}}\,({\it{x\/}}, {\it{y\/}})\index{valid-movep})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  valid-movep-and-makes-nongreen-means \\ \index{valid-movep-and-makes-nongreen-!means}
(({\it{x\/}} $\in$ {\it{y\/}}) $\wedge$ ($\neg$ {\rm{green-statep}}\,({\it{x\/}}, {\it{ws\/}})\index{green-statep})) $\rightarrow$ {\rm{non-green-in-list}}\,({\it{y\/}}, {\it{ws\/}})\index{non-green-in-list}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  green-means-non-green-in-valid-moves \\ \index{green-means-non-green-in-valid-!moves}
\=\+({\rm{nat-listp}}\,({\it{s\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ ($\neg$ {\rm{all-zero-bitvp}}\,({\it{s\/}})\index{all-zero-bitvp}) $\wedge$ {\rm{green-statep}}\,({\it{s\/}}, {\it{ws\/}})\index{green-statep}) \\ 
$\rightarrow$$\;\;\;\;${\rm{non-green-in-list}}\,({\rm{all-valid-moves}}\,({\it{s\/}})\index{all-valid-moves}, {\it{ws\/}})\index{non-green-in-list}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  green-in-list-all-valid-moves \\ \index{green-in-list-all-valid-moves}
\=\+({\rm{nat-listp}}\,({\it{s\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ ($\neg$ {\rm{all-zero-bitvp}}\,({\it{s\/}})\index{all-zero-bitvp})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{non-green-in-list}}\,({\rm{all-valid-moves}}\,({\it{s\/}})\index{all-valid-moves}, {\it{ws\/}})\index{non-green-in-list} $\leftrightarrow$ {\rm{green-statep}}\,({\it{s\/}}, {\it{ws\/}})\index{green-statep})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sum-when-all-zero \\ \index{sum-when-all-zero}
{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\rightarrow$ ({\rm{sum}}\,({\it{x\/}})\index{sum} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  green-statep-all-zero-bitvp \\ \index{green-statep-all-zero-bitvp}
{\rm{all-zero-bitvp}}\,({\it{x\/}})\index{all-zero-bitvp} $\rightarrow$ {\rm{green-statep}}\,({\it{x\/}}, {\it{s\/}})\index{green-statep}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  wsp-green-state-proof \\ \index{wsp-green-state-proof}
\=\+(\=\+(\=\+({\it{flag\/}} $\wedge$ {\rm{nat-listp}}\,({\it{s\/}}, {\it{wordsize\/}})\index{nat-listp}) \\ 
$\vee$$\;\;\;\;$(($\neg$ {\it{flag\/}}) $\wedge$ {\rm{nat-listp-listp}}\,({\it{s\/}}, {\it{wordsize\/}})\index{nat-listp-listp}))\- \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{wsp}}\,({\it{s\/}}, {\it{flag\/}})\index{wsp} \\ 
$\leftrightarrow$$\;\;\;\;$\=\+{\bf if }{\it{flag\/}}$\;\;${\bf then }{\rm{green-statep}}\,({\it{s\/}}, {\it{wordsize\/}})\index{green-statep} \\ 
{\bf else }{\rm{non-green-in-list}}\,({\it{s\/}}, {\it{wordsize\/}})\index{non-green-in-list}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  wsp-green-state \\ \index{wsp-green-state}
{\rm{nat-listp}}\,({\it{s\/}}, {\it{wordsize\/}})\index{nat-listp} $\rightarrow$ ({\rm{wsp}}\,({\it{s\/}}, {\bf{t}})\index{wsp} $\leftrightarrow$ {\rm{green-statep}}\,({\it{s\/}}, {\it{wordsize\/}})\index{green-statep})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-listp-replace-value \\ \index{nat-listp-replace-value}
\=\+({\rm{nat-listp}}\,({\it{s\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ ({\it{new\/}} $<$ {\rm{exp}}\,({\tt{2}}, {\it{ws\/}})\index{exp}) $\wedge$ ({\it{new\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;${\rm{nat-listp}}\,({\rm{replace-value}}\,({\it{s\/}}, {\it{y\/}}, {\it{new\/}})\index{replace-value}, {\it{ws\/}})\index{nat-listp}\-
\end{tabbing}
	      
\begin{tabbing}{\sc Theorem}:  nat-listp-bv-to-nat-list \\ \index{nat-listp-bv-to-nat-list}
{\rm{bit-vectorsp}}\,({\it{x\/}}, {\it{s\/}})\index{bit-vectorsp} $\rightarrow$ {\rm{nat-listp}}\,({\rm{bv-to-nat-list}}\,({\it{x\/}})\index{bv-to-nat-list}, {\it{s\/}})\index{nat-listp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-listp-smart-move \\ \index{nat-listp-smart-move}
({\rm{nat-listp}}\,({\it{s\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ ({\it{ws\/}} $\not\simeq {\tt{0}}$)) $\rightarrow$ {\rm{nat-listp}}\,({\rm{smart-move}}\,({\it{s\/}}, {\it{ws\/}})\index{smart-move}, {\it{ws\/}})\index{nat-listp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-zero-bitvp-max-list \\ \index{all-zero-bitvp-max-list}
{\rm{all-zero-bitvp}}\,({\it{s\/}})\index{all-zero-bitvp} $\rightarrow$ ({\rm{max-list}}\,({\it{s\/}})\index{max-list} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  replace-value-x-x \\ \index{replace-value-x-x}
{\rm{properp}}\,({\it{x\/}})\index{properp} $\rightarrow$ ({\rm{replace-value}}\,({\it{x\/}}, {\it{y\/}}, {\it{y\/}})\index{replace-value} $=$ {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  smart-move-small-ws \\ \index{smart-move-small-ws}
({\rm{nat-listp}}\,({\it{s\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ ({\it{ws\/}} $\simeq {\tt{0}}$)) $\rightarrow$ ({\rm{smart-move}}\,({\it{s\/}}, {\it{ws\/}})\index{smart-move} $=$ {\it{s\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lessp-max-list-from-nat-listp \\ \index{lessp-max-list-from-nat-listp}
{\rm{nat-listp}}\,({\it{s\/}}, {\it{ws\/}})\index{nat-listp} $\rightarrow$ ({\rm{max-list}}\,({\it{s\/}})\index{max-list} $<$ {\rm{exp}}\,({\tt{2}}, {\it{ws\/}})\index{exp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nat-listp-computer-move \\ \index{nat-listp-computer-move}
{\rm{nat-listp}}\,({\it{s\/}}, {\it{ws\/}})\index{nat-listp} $\rightarrow$ {\rm{nat-listp}}\,({\rm{computer-move}}\,({\it{s\/}}, {\it{ws\/}})\index{computer-move}, {\it{ws\/}})\index{nat-listp}
\end{tabbing}

\begin{verbatim};; PART OF SPECIFICATION
\end{verbatim}\begin{tabbing}{\sc Theorem}:  computer-move-works \\ \index{computer-move-works}
\=\+({\rm{nat-listp}}\,({\it{state\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ ($\neg$ {\rm{all-zero-bitvp}}\,({\it{state\/}})\index{all-zero-bitvp}) $\wedge$ {\rm{wsp}}\,({\it{state\/}}, {\bf{t}})\index{wsp}) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{wsp}}\,({\rm{computer-move}}\,({\it{state\/}}, {\it{ws\/}})\index{computer-move}, {\bf{t}})\index{wsp})\-
\end{tabbing}


\begin{tabbing}{\sc Definition}:\index{nim-piton-ctrl-stk-requirement}$\;\;$
{\sc{nim-piton-ctrl-stk-requirement}}\index{nim-piton-ctrl-stk-requirement} $=$ {\tt{25}}
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{nim-piton-temp-stk-requirement}$\;\;$
{\sc{nim-piton-temp-stk-requirement}}\index{nim-piton-temp-stk-requirement} $=$ {\tt{3}}
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{computer-move-implemented-input!-conditionp} \\  
\=\+{\rm{computer-move-implemented-input-conditionp}}\,({\it{p0\/}})\index{computer-move-implemented-input!-conditionp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{listp}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk}) \\ 
$\wedge$$\;\;\;\;$({\tt{7}} $<$ {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size}) \\ 
$\wedge$$\;\;\;\;$({\tt{1}} $<$ {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size}) \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{length}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{length}, \\ 
{\sc{nim-piton-temp-stk-requirement}}\index{nim-piton-temp-stk-requirement}, \\ 
{\rm{p-max-temp-stk-size}}\,({\it{p0\/}})\index{p-max-temp-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;${\rm{at-least-morep}}\,(\=\+{\rm{p-ctrl-stk-size}}\,({\rm{p-ctrl-stk}}\,({\it{p0\/}})\index{p-ctrl-stk})\index{p-ctrl-stk-size}, \\ 
{\sc{nim-piton-ctrl-stk-requirement}}\index{nim-piton-ctrl-stk-requirement}, \\ 
{\rm{p-max-ctrl-stk-size}}\,({\it{p0\/}})\index{p-max-ctrl-stk-size})\-\index{at-least-morep} \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdr}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{definedp} \\ 
$\wedge$$\;\;\;\;${\rm{nat-list-piton}}\,(\=\+{\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\-\index{nat-list-piton} \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\tt{'}}{\tt{nat}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{length}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{length} \\ 
$=$$\;\;\;\;${\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag})\- \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag} $<$ {\rm{exp}}\,({\tt{2}}, {\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size})\index{exp}) \\ 
$\wedge$$\;\;\;\;$({\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\tt{'}}{\tt{addr}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cddr}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top}) $=$ {\bf{nil}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}) \\ 
$\wedge$$\;\;\;\;$({\rm{cdr}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}) $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{definedp}}\,({\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}), {\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\index{definedp} \\ 
$\wedge$$\;\;\;\;${\rm{array-pitonp}}\,(\=\+{\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array}, \\ 
{\rm{untag}}\,({\rm{top}}\,({\rm{cdr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag})\-\index{array-pitonp} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk})\index{top})\index{untag}) \\ 
$\not=$$\;\;\;\;${\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}))\- \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{all-zero-bitvp}}\,({\rm{untag-array}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\rm{top}}\,({\rm{cddr}}\,({\rm{p-temp-stk}}\,({\it{p0\/}})\index{p-temp-stk}))\index{top})\index{untag}), \\ 
{\rm{p-data-segment}}\,({\it{p0\/}})\index{p-data-segment})\-\index{array})\index{untag-array})\index{all-zero-bitvp}))\-\-
\end{tabbing}


\begin{verbatim};; cm-prog is the Nim program.  It may be disappointing to see that it is
;; a function of one argument rather than a constant, as programs ought to
;; be.  This is because we wish to use bit vectors in our program, and 
;; because of a weakness in the Piton design there is no way to push
;; a bit-vector on the stack without knowing the word-size.  The only 
;; subprogram that uses the word-size is push-1-vector, which is a 
;; one-line program that pushes a one-vector onto the stack.
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cm-prog} \\  
\=\+{\rm{cm-prog}}\,({\it{word-size\/}})\index{cm-prog} \\ 
$=$$\;\;\;\;${\rm{list}}\,(\=\+{\sc{xor-bvs-program}}\index{xor-bvs-program}, \\ 
{\rm{push-1-vector-program}}\,({\it{word-size\/}})\index{push-1-vector-program}, \\ 
{\sc{nat-to-bv-program}}\index{nat-to-bv-program}, \\ 
{\sc{bv-to-nat-program}}\index{bv-to-nat-program}, \\ 
{\sc{number-with-at-least-program}}\index{number-with-at-least-program}, \\ 
{\sc{highest-bit-program}}\index{highest-bit-program}, \\ 
{\sc{match-and-xor-program}}\index{match-and-xor-program}, \\ 
{\sc{nat-to-bv-list-program}}\index{nat-to-bv-list-program}, \\ 
{\sc{bv-to-nat-list-program}}\index{bv-to-nat-list-program}, \\ 
{\sc{max-nat-program}}\index{max-nat-program}, \\ 
{\sc{replace-value-program}}\index{replace-value-program}, \\ 
{\sc{smart-move-program}}\index{smart-move-program}, \\ 
{\sc{delay-program}}\index{delay-program}, \\ 
{\sc{computer-move-program}}\index{computer-move-program})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable computer-move-program.

\addvspace{18pt}

\noindent{\sc Event}:   Disable *1*computer-move-program.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  car-xor-bvs-program \\ \index{car-xor-bvs-program}
{\rm{car}}\,({\sc{xor-bvs-program}}\index{xor-bvs-program}) $=$ {\tt{'}}{\tt{xor-bvs}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-push-1-vector-program \\ \index{car-push-1-vector-program}
{\rm{car}}\,({\rm{push-1-vector-program}}\,({\it{word-size\/}})\index{push-1-vector-program}) $=$ {\tt{'}}{\tt{push-1-vector}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-nat-to-bv-program \\ \index{car-nat-to-bv-program}
{\rm{car}}\,({\sc{nat-to-bv-program}}\index{nat-to-bv-program}) $=$ {\tt{'}}{\tt{nat-to-bv}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-bv-to-nat-program \\ \index{car-bv-to-nat-program}
{\rm{car}}\,({\sc{bv-to-nat-program}}\index{bv-to-nat-program}) $=$ {\tt{'}}{\tt{bv-to-nat}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-number-with-at-least-program \\ \index{car-number-with-at-least-progra!m}
{\rm{car}}\,({\sc{number-with-at-least-program}}\index{number-with-at-least-program}) $=$ {\tt{'}}{\tt{number-with-at-least}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-highest-bit-program \\ \index{car-highest-bit-program}
{\rm{car}}\,({\sc{highest-bit-program}}\index{highest-bit-program}) $=$ {\tt{'}}{\tt{highest-bit}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-match-and-xor-program \\ \index{car-match-and-xor-program}
{\rm{car}}\,({\sc{match-and-xor-program}}\index{match-and-xor-program}) $=$ {\tt{'}}{\tt{match-and-xor}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-nat-to-bv-list-program \\ \index{car-nat-to-bv-list-program}
{\rm{car}}\,({\sc{nat-to-bv-list-program}}\index{nat-to-bv-list-program}) $=$ {\tt{'}}{\tt{nat-to-bv-list}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-bv-to-nat-list-program \\ \index{car-bv-to-nat-list-program}
{\rm{car}}\,({\sc{bv-to-nat-list-program}}\index{bv-to-nat-list-program}) $=$ {\tt{'}}{\tt{bv-to-nat-list}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-max-nat-program \\ \index{car-max-nat-program}
{\rm{car}}\,({\sc{max-nat-program}}\index{max-nat-program}) $=$ {\tt{'}}{\tt{max-nat}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-replace-value-program \\ \index{car-replace-value-program}
{\rm{car}}\,({\sc{replace-value-program}}\index{replace-value-program}) $=$ {\tt{'}}{\tt{replace-value}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-smart-move-program \\ \index{car-smart-move-program}
{\rm{car}}\,({\sc{smart-move-program}}\index{smart-move-program}) $=$ {\tt{'}}{\tt{smart-move}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-delay-program \\ \index{car-delay-program}
{\rm{car}}\,({\sc{delay-program}}\index{delay-program}) $=$ {\tt{'}}{\tt{delay}}
\end{tabbing}


\noindent{\sc Event}:   Disable delay-program.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  car-computer-move-program \\ \index{car-computer-move-program}
{\rm{car}}\,({\sc{computer-move-program}}\index{computer-move-program}) $=$ {\tt{'}}{\tt{computer-move}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-untag-array-tag-array-x-x \\ \index{equal-untag-array-tag-array-x-x}
({\rm{untag-array}}\,({\rm{tag-array}}\,({\it{l\/}}, {\it{x\/}})\index{tag-array})\index{untag-array} $=$ {\it{x\/}}) $=$ {\rm{properp}}\,({\it{x\/}})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  properp-replace-value \\ \index{properp-replace-value}
{\rm{properp}}\,({\it{x\/}})\index{properp} $\rightarrow$ {\rm{properp}}\,({\rm{replace-value}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{replace-value})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  properp-bv-to-nat-list \\ \index{properp-bv-to-nat-list}
{\rm{properp}}\,({\rm{bv-to-nat-list}}\,({\it{x\/}})\index{bv-to-nat-list})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  properp-nat-to-bv-list \\ \index{properp-nat-to-bv-list}
{\rm{properp}}\,({\rm{nat-to-bv-list}}\,({\it{x\/}}, {\it{ws\/}})\index{nat-to-bv-list})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  properp-computer-move \\ \index{properp-computer-move}
{\rm{properp}}\,({\it{x\/}})\index{properp} $\rightarrow$ {\rm{properp}}\,({\rm{computer-move}}\,({\it{x\/}}, {\it{s\/}})\index{computer-move})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  properp-untag-array \\ \index{properp-untag-array}
{\rm{properp}}\,({\rm{untag-array}}\,({\it{x\/}})\index{untag-array})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  properp-tag-array \\ \index{properp-tag-array}
{\rm{properp}}\,({\rm{tag-array}}\,({\it{l\/}}, {\it{x\/}})\index{tag-array})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  computer-move-implemented \\ \index{computer-move-implemented}
\=\+(\=\+({\it{p0\/}} $=$ {\rm{p-state}}\,(\=\+{\it{pc\/}}, \\ 
{\it{ctrl-stk\/}}, \\ 
{\rm{cons}}\,({\it{wa\/}}, {\rm{cons}}\,({\it{np\/}}, {\rm{cons}}\,({\it{s\/}}, {\it{temp-stk\/}}))), \\ 
{\rm{append}}\,({\rm{cm-prog}}\,({\it{word-size\/}})\index{cm-prog}, {\it{prog-segment\/}}), \\ 
{\it{data-segment\/}}, \\ 
{\it{max-ctrl-stk-size\/}}, \\ 
{\it{max-temp-stk-size\/}}, \\ 
{\it{word-size\/}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-current-instruction}}\,({\it{p0\/}})\index{p-current-instruction} $=$ {\tt{'}}{\tt{(}}{\tt{call}}{\tt{ }}{\tt{computer-move}}{\tt{)}}) \\ 
$\wedge$$\;\;\;\;${\rm{computer-move-implemented-input-conditionp}}\,({\it{p0\/}})\index{computer-move-implemented-input!-conditionp})\- \\ 
$\rightarrow$$\;\;\;\;$\=\+{\bf let }\=\+{\it{result\/}}{\bf $\;$ be$\;\;$}{\rm{p}}\,(\=\+{\it{p0\/}}, \\ 
{\rm{computer-move-clock}}\,(\=\+{\rm{untag-array}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\it{s\/}})\index{untag}), \\ 
{\it{data-segment\/}})\-\index{array})\index{untag-array}, \\ 
{\it{word-size\/}})\-\index{computer-move-clock})\-\index{p}\- \\ 
{\bf in} \\ 
\=\+({\rm{p-pc}}\,({\it{result\/}})\index{p-pc} $=$ {\rm{add1-addr}}\,({\it{pc\/}})\index{add1-addr}) \\ 
$\wedge$$\;\;\;\;$({\rm{p-psw}}\,({\it{result\/}})\index{p-psw} $=$ {\tt{'}}{\tt{run}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{untag-array}}\,({\rm{array}}\,({\rm{car}}\,({\rm{untag}}\,({\it{s\/}})\index{untag}), {\rm{p-data-segment}}\,({\it{result\/}})\index{p-data-segment})\index{array})\index{untag-array} \\ 
$=$$\;\;\;\;${\rm{computer-move}}\,(\=\+{\rm{untag-array}}\,({\rm{array}}\,(\=\+{\rm{car}}\,({\rm{untag}}\,({\it{s\/}})\index{untag}), \\ 
{\it{data-segment\/}})\-\index{array})\index{untag-array}, \\ 
{\it{word-size\/}})\-\index{computer-move})\-\-$\;${\bf  endlet}\-\-
\end{tabbing}

\begin{verbatim}#|
A proof of some constant bounds on the computer-move-clock function
was developed that makes slight use of the proof-checker enhancement of
NQTHM.  For completeness, here is the final theorem of that
digression, with no proof included so that this script is executable
in NQTHM without the enhancement

             (implies (and (nat-listp state ws)
                           (lessp 0 ws)
                           (not (lessp 32 ws))
                           (lessp 1 (length state))
                           (not (lessp 6 (length state))))
                      (and (lessp 10000
                                  (computer-move-clock state ws))
                           (lessp (computer-move-clock state ws)
                                  20000)))

|#

\end{verbatim}\begin{tabbing}{\sc Theorem}:  nim-piton-space-reasonable \\ \index{nim-piton-space-reasonable}
{\tt{1000}} $\not<$ (\=\+{\sc{nim-piton-ctrl-stk-requirement}}\index{nim-piton-ctrl-stk-requirement} \\ 
$+$$\;\;\;\;${\sc{nim-piton-temp-stk-requirement}}\index{nim-piton-temp-stk-requirement})\-
\end{tabbing}

\begin{verbatim};; bind up defns for presentation purposes
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{good-non-empty-nim-statep} \\  
\=\+{\rm{good-non-empty-nim-statep}}\,({\it{state\/}}, {\it{ws\/}})\index{good-non-empty-nim-statep} \\ 
$=$$\;\;\;\;$({\rm{nat-listp}}\,({\it{state\/}}, {\it{ws\/}})\index{nat-listp} $\wedge$ ($\neg$ {\rm{all-zero-bitvp}}\,({\it{state\/}})\index{all-zero-bitvp}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  valid-movep-computer-move-better \\ \index{valid-movep-computer-move-bette!r}
\=\+{\rm{good-non-empty-nim-statep}}\,({\it{state\/}}, {\it{ws\/}})\index{good-non-empty-nim-statep} \\ 
$\rightarrow$$\;\;\;\;${\rm{valid-movep}}\,({\it{state\/}}, {\rm{computer-move}}\,({\it{state\/}}, {\it{ws\/}})\index{computer-move})\index{valid-movep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  computer-move-works-better \\ \index{computer-move-works-better}
\=\+({\rm{good-non-empty-nim-statep}}\,({\it{state\/}}, {\it{ws\/}})\index{good-non-empty-nim-statep} $\wedge$ {\rm{wsp}}\,({\it{state\/}}, {\bf{t}})\index{wsp}) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{wsp}}\,({\rm{computer-move}}\,({\it{state\/}}, {\it{ws\/}})\index{computer-move}, {\bf{t}})\index{wsp})\-
\end{tabbing}

\begin{verbatim};;; An initial p-state to run the program on a particular NIM state, then
;;; enter an infinite loop.
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{example2-computer-move-p-state} \\  
\=\+{\sc{example2-computer-move-p-state}}\index{example2-computer-move-p-state} \\ 
$=$$\;\;\;\;${\rm{p-state}}\,(\=\+{\tt{'}}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}, \\ 
{\tt{'}}{\tt{(}}{\tt{(}}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{pc}}{\tt{ }}{\tt{(}}{\tt{main}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\bf{nil}}, \\ 
{\rm{cons}}\,(\=\+{\tt{'}}{\tt{(}}\=\+{\tt{main}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{nil}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{arr5}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{call}}{\tt{ }}{\tt{computer-move}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{push-constant}}{\tt{ }}{\tt{(}}{\tt{addr}}{\tt{ }}{\tt{(}}{\tt{flag}}{\tt{ .\ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{deposit}}{\tt{)}} \\ 
{\tt{(}}{\tt{dl}}{\tt{ }}{\tt{loop}}{\tt{ }}{\tt{nil}}{\tt{ }}{\tt{(}}{\tt{jump}}{\tt{ }}{\tt{loop}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{ret}}{\tt{)}}{\tt{)}}\-, \\ 
{\rm{cm-prog}}\,({\tt{32}})\index{cm-prog})\-, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{(}}{\tt{arr}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{15}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{7}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{arr5}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{3}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{4}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{2}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{1}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{flag}}{\tt{ }}{\tt{(}}{\tt{nat}}{\tt{ }}{\tt{0}}{\tt{)}}{\tt{)}}{\tt{)}}\-, \\ 
{\tt{30}}, \\ 
{\tt{10}}, \\ 
{\tt{32}}, \\ 
{\tt{'}}{\tt{run}})\-\index{p-state}\-
\end{tabbing}

\begin{verbatim};;; Extra event that shows that the program is compilable and loadable
;;; onto FM9001, and that the correctness lemma for the Piton interpreter
;;; therefore holds.   (ref: J's e-mail of 10 April 92.)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  cm-prog-fm9001-loadable \\ \index{cm-prog-fm9001-loadable}
\=\+{\bf let }\=\+{\it{p0\/}}{\bf $\;$ be$\;\;$}{\sc{example2-computer-move-p-state}}\index{example2-computer-move-p-state}\- \\ 
{\bf in} \\ 
\=\+{\rm{proper-p-statep}}\,({\it{p0\/}})\index{proper-p-statep} \\ 
$\wedge$$\;\;\;\;${\rm{p-loadablep}}\,({\it{p0\/}}, {\tt{0}})\index{p-loadablep} \\ 
$\wedge$$\;\;\;\;$({\rm{p-word-size}}\,({\it{p0\/}})\index{p-word-size} $=$ {\tt{32}})\-$\;${\bf  endlet}\-
\end{tabbing}


\begin{verbatim};;; Some events written by J Moore that produce an FM9001 image
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{pretty-load1} \\  
{\rm{pretty-load1}}\,({\it{p0\/}}, {\it{offset\/}})\index{pretty-load1} $=$ {\rm{i-$>$m}}\,({\rm{r-$>$i}}\,({\rm{p-$>$r}}\,({\it{p0\/}})\index{p-$>$r})\index{r-$>$i}, {\bf{nil}}, {\it{offset\/}})\index{i-$>$m}
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{pretty-vector1} \\  
\=\+{\rm{pretty-vector1}}\,({\it{lst\/}})\index{pretty-vector1} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{lst\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\rm{car}}\,({\it{lst\/}})$\;\;${\bf then }{\rm{cons}}\,({\tt{49}}, {\rm{pretty-vector1}}\,({\rm{cdr}}\,({\it{lst\/}}))\index{pretty-vector1}) \\ 
{\bf else }{\rm{cons}}\,({\tt{48}}, {\rm{pretty-vector1}}\,({\rm{cdr}}\,({\it{lst\/}}))\index{pretty-vector1})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{pretty-vector} \\  
{\rm{pretty-vector}}\,({\it{lst\/}})\index{pretty-vector} $=$ {\rm{pack}}\,({\rm{cons}}\,({\tt{66}}, {\rm{pretty-vector1}}\,({\it{lst\/}})\index{pretty-vector1}))
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{pretty-vector-lst} \\  
\=\+{\rm{pretty-vector-lst}}\,({\it{lst\/}})\index{pretty-vector-lst} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{lst\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{cons}}\,({\rm{pretty-vector}}\,({\rm{car}}\,({\it{lst\/}}))\index{pretty-vector}, {\rm{pretty-vector-lst}}\,({\rm{cdr}}\,({\it{lst\/}}))\index{pretty-vector-lst})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{pretty-state} \\  
\=\+{\rm{pretty-state}}\,({\it{m\/}})\index{pretty-state} \\ 
$=$$\;\;\;\;${\rm{list}}\,(\=\+{\tt{'}}{\tt{fm9001-state}}, \\ 
{\rm{pretty-vector-lst}}\,({\rm{m-regs}}\,({\it{m\/}})\index{m-regs})\index{pretty-vector-lst}, \\ 
{\rm{m-c-flg}}\,({\it{m\/}})\index{m-c-flg}, \\ 
{\rm{m-v-flg}}\,({\it{m\/}})\index{m-v-flg}, \\ 
{\rm{m-n-flg}}\,({\it{m\/}})\index{m-n-flg}, \\ 
{\rm{m-z-flg}}\,({\it{m\/}})\index{m-z-flg}, \\ 
{\rm{pretty-vector-lst}}\,({\rm{m-mem}}\,({\it{m\/}})\index{m-mem})\index{pretty-vector-lst})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{pretty-load} \\  
{\rm{pretty-load}}\,({\it{p\/}}, {\it{offset\/}})\index{pretty-load} $=$ {\rm{pretty-state}}\,({\rm{pretty-load1}}\,({\it{p\/}}, {\it{offset\/}})\index{pretty-load1})\index{pretty-state}
\end{tabbing}

\begin{verbatim};; Using pretty-load in r-loop, we produce the following image:

#|
 (LIST 'FM9001-STATE
       '(B00000000000000000000000000000000 B01001010001000000000000000000000
         B01001010001000000000000000000000 B11111010001000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B11010000000000000000000000000000)
       F F F F
       '(B11110000000000000000000000000000 B00100000000000000000000000000000
         B11100000000000000000000000000000 B10000000000000000000000000000000
         B11000000000000000000000000000000 B00100000000000000000000000000000
         B01000000000000000000000000000000 B10000000000000000000000000000000
         B00000000000000000000000000000000 B10000000000100010000011111110000
         B01000000001000000000011111110000 B11111100001100010000011111110000
         B00000000000000000000000000000000 B11111100001100010000011111110000
         B00100000000000000000000000000000 B11111100001100010000011111110000
         B00100000000000000000000000000000 B11111100000100010000011111110000
         B10101000000000000000000000000000 B11111000001111000000011111110000
         B10110101110000000000000000000000 B11111100001100010000011111110000
         B10000000000000000000000000000000 B11111100001100010000011111110000
         B00010000000000000000000000000000 B11001100000010000000011111110000
         B11001100000010100000011111110000 B11111000001111000000011111110000
         B11011000000000000000000000000000 B11111000001111000000011111110000
         B11111000000000000000000000000000 B10000000000100000000011111110000
         B01001100001000000000011111110000 B01001100001111000000011111110000
         B10000000000100010000011111110000 B01000000001000000000011111110000
         B11001100000100010000011111110000 B11001100000100010000011111110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001000001100100000011110100000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B00011010000000000000000000000000
         B00100000001111000000111011110000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001000001100100000011110100000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B11001100000010100000011111110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100001100010000011111110000 B10000000000000000000000000000000
         B11001100000010000000011111110000 B00100000001100100000011111000000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B11001000000010100000011111110000
         B11001100000010000000011111110000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00100000001100100000011111010000
         B11111000001111000000011111110000 B10101100000000000000000000000000
         B11111000001111000000011111110000 B01011010000000000000000000000000
         B10000000000100000000011111110000 B01001100001000000000011111110000
         B01001100001111000000011111110000 B10000000000100010000011111110000
         B01000000001000000000011111110000 B11111100001100010000011111110000
         B10000000000000000000000000000000 B11111000001111000000011111110000
         B11000110000000000000000000000000 B10000000000100000000011111110000
         B01001100001000000000011111110000 B01001100001111000000011111110000
         B10000000000100010000011111110000 B01000000001000000000011111110000
         B11111100000100010000011111110000 B00000000000000000000000000000000
         B11111100000100010000011111110000 B00000000000000000000000000000000
         B11001100000100010000011111110000 B11111100000100010000011111110000
         B10001110000000000000000000000000 B11111000001111000000011111110000
         B10111010000000000000000000000000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111100000100010000011111110000
         B10011110000000000000000000000000 B11111000001111000000011111110000
         B10111010000000000000000000000000 B11001000001100100000011101010000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100001010001000011111110000 B11111100000010000000011111110000
         B01110101000000000000000000000000 B00100000001111000000111011110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000001011111110000 B00100000000010000001011101010000
         B00100000001100010000011111110000 B11111100001100010000011111110000
         B00000000000000000000000000000000 B11111100001100100000100011110000
         B10000000000000000000000000000000 B11111100000010000000011111110000
         B01000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111100000010000000011111110000
         B01000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B11000101000000000000000000000000
         B00100000001111000000111011110000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B00100000001100100000011111010000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001000001100100000011111000000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B11001100000010100000011111110000
         B11111000001111000000011111110000 B01011110000000000000000000000000
         B11111000001111000000011111110000 B00001101000000000000000000000000
         B10000000000100000000011111110000 B01001100001000000000011111110000
         B01001100001111000000011111110000 B10000000000100010000011111110000
         B01000000001000000000011111110000 B11111100000100010000011111110000
         B00000000000000000000000000000000 B11111100000100010000011111110000
         B00000000000000000000000000000000 B11001100000100010000011111110000
         B11111100001100010000011111110000 B10000000000000000000000000000000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B11001100000010100000011111110000
         B11111100000100010000011111110000 B00100011000000000000000000000000
         B11111000001111000000011111110000 B10111010000000000000000000000000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B11001100000010100000011111110000
         B11111100001100010000011111110000 B00000000000000000000000000000000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00100000001100100000011110110000
         B11001100001010001000011111110000 B11111100000010000000011111110000
         B01111011000000000000000000000000 B00100000001111000000111011110000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00100000001100100000011111000000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001000001100100000011111000000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B11001000000010100000011111110000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B01101111000000000000000000000000
         B00100000001111000000111011110000 B11111100000010000000011111110000
         B01000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001000001100100000011111000000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B11001100000010100000011111110000
         B11111000001111000000011111110000 B01010011000000000000000000000000
         B11111000001111000000011111110000 B00011111000000000000000000000000
         B10000000000100000000011111110000 B01001100001000000000011111110000
         B01001100001111000000011111110000 B10000000000100010000011111110000
         B01000000001000000000011111110000 B11111100000100010000011111110000
         B00000000000000000000000000000000 B11001100000100010000011111110000
         B11001100000100010000011111110000 B11001100000100010000011111110000
         B11111100001100010000011111110000 B00000000000000000000000000000000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B11001000000010100000011111110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00100000001100100001011111100000
         B11001000001100100000011111010000 B11111100001100100000100011110000
         B10000000000000000000000000000000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B00111000100000000000000000000000
         B00100000001111000000011011110000 B11001000001100100000011110000000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001000001100100000011110000000 B11111100000010000000011111110000
         B11000000000000000000000000000000 B01000000000010000000011111000000
         B11001000000010100000011111110000 B11001100000010000000011111110000
         B00100000001100100000011111100000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B10111100100000000000000000000000
         B00100000001111000000111011110000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11111100001100010000011111110000
         B10000000000000000000000000000000 B11001100000010000000011111110000
         B00100000001100100000011111000000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111000001111000000011111110000
         B00010000100000000000000000000000 B11111000001111000000011111110000
         B11111100100000000000000000000000 B10000000000100000000011111110000
         B01001100001000000000011111110000 B01001100001111000000011111110000
         B10000000000100010000011111110000 B01000000001000000000011111110000
         B11111100000100010000011111110000 B00000000000000000000000000000000
         B11001100000100010000011111110000 B11111100000100010000011111110000
         B11010010100000000000000000000000 B11111000001111000000011111110000
         B10111010000000000000000000000000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B11001000000010100000011111110000 B11001000001100100000011101010000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100001010001000011111110000 B11111100000010000000011111110000
         B01101110100000000000000000000000 B00100000001111000000111011110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00100000001100100000011110110000
         B11001100001010001000011111110000 B11111100000010000000011111110000
         B11010110100000000000000000000000 B00100000001111000000111011110000
         B11001100000010000000011111110000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001000001100100000011111000000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B11001100000010100000011111110000
         B11111000001111000000011111110000 B00001010100000000000000000000000
         B11111000001111000000011111110000 B00011110100000000000000000000000
         B10000000000100000000011111110000 B01001100001000000000011111110000
         B01001100001111000000011111110000 B10000000000100010000011111110000
         B01000000001000000000011111110000 B11111100000100010000011111110000
         B00000000000000000000000000000000 B11001100000100010000011111110000
         B11001100000100010000011111110000 B11001100000100010000011111110000
         B11001100000100010000011111110000 B11111100001100010000011111110000
         B00000000000000000000000000000000 B11111100000010000000011111110000
         B00100000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B00101000001100010000011111110000 B11111100000010000000011111110000
         B01000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B00100000001100100000011110110000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B10111101100000000000000000000000
         B00100000001111000000011011110000 B11111100000010000000011111110000
         B00100000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001000001100100000011110000000
         B11111100000010000000011111110000 B00100000000000000000000000000000
         B01000000000010000000011111000000 B11001000000010100000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00100000001100100001011111100000
         B11001000001100100000011111010000 B11111100001100100000100011110000
         B10000000000000000000000000000000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B11110011100000000000000000000000
         B00100000001111000000111011110000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11111100001100010000011111110000
         B10000000000000000000000000000000 B11001100000010000000011111110000
         B00100000001100100000011111000000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111000001111000000011111110000
         B10010001100000000000000000000000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B00101000001100010000011111110000 B11111100000010000000011111110000
         B11000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B00100000001100100000011111010000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B11001100000010100000011111110000 B11111000001111000000011111110000
         B10001011100000000000000000000000 B10000000000100000000011111110000
         B01001100001000000000011111110000 B01001100001111000000011111110000
         B10000000000100010000011111110000 B01000000001000000000011111110000
         B11111100000100010000011111110000 B00000000000000000000000000000000
         B11001100000100010000011111110000 B11001100000100010000011111110000
         B11001100000100010000011111110000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B00101000001100010000011111110000 B11111100000100010000011111110000
         B10100111100000000000000000000000 B11111000001111000000011111110000
         B01100110000000000000000000000000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B11001100000010100000011111110000 B11111100000010000000011111110000
         B11000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001000001100100000011110000000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B11001000000010100000011111110000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00100000001100101000011111010000
         B11001000001100100000011111010000 B11111100001100100000111011110000
         B10000000000000000000000000000000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B11011000010000000000000000000000
         B00100000001111000000011011110000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11111100001100010000011111110000
         B10000000000000000000000000000000 B11001100000010000000011111110000
         B00100000001100100000011111000000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11111100001100010000011111110000
         B10000000000000000000000000000000 B11001100000010000000011111110000
         B00100000001100100000011111000000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111000001111000000011111110000
         B11011011100000000000000000000000 B11111000001111000000011111110000
         B10111000010000000000000000000000 B10000000000100000000011111110000
         B01001100001000000000011111110000 B01001100001111000000011111110000
         B10000000000100010000011111110000 B01000000001000000000011111110000
         B11111100000100010000011111110000 B00000000000000000000000000000000
         B11001100000100010000011111110000 B11001100000100010000011111110000
         B11001100000100010000011111110000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B00101000001100010000011111110000 B11111100000100010000011111110000
         B10001100010000000000000000000000 B11111000001111000000011111110000
         B11001101000000000000000000000000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B11001100000010100000011111110000 B11111100000010000000011111110000
         B11000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001000001100100000011110000000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B11001000000010100000011111110000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00100000001100101000011111010000
         B11001000001100100000011111010000 B11111100001100100000111011110000
         B10000000000000000000000000000000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B11100110010000000000000000000000
         B00100000001111000000011011110000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11111100001100010000011111110000
         B10000000000000000000000000000000 B11001100000010000000011111110000
         B00100000001100100000011111000000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11111100001100010000011111110000
         B10000000000000000000000000000000 B11001100000010000000011111110000
         B00100000001100100000011111000000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111000001111000000011111110000
         B11100100010000000000000000000000 B11111000001111000000011111110000
         B10010110010000000000000000000000 B10000000000100000000011111110000
         B01001100001000000000011111110000 B01001100001111000000011111110000
         B10000000000100010000011111110000 B01000000001000000000011111110000
         B11111100000100010000011111110000 B00000000000000000000000000000000
         B11111100000100010000011111110000 B00000000000000000000000000000000
         B11001100000100010000011111110000 B11001100000100010000011111110000
         B11111100001100010000011111110000 B00000000000000000000000000000000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B11001000000010100000011111110000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B11001000000010100000011111110000
         B11001100000010000000011111110000 B00100000001100100001011111100000
         B11001000001100100000011111010000 B11111100001100100000100011110000
         B10000000000000000000000000000000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B01101001010000000000000000000000
         B00100000001111000000111011110000 B11001100000010000000011111110000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001000001100100000011110000000 B11111100000010000000011111110000
         B01000000000000000000000000000000 B01000000000010000000011111000000
         B11001000000010100000011111110000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B00100000001100101000011111010000 B11001000001100100000011111010000
         B11111100001100100000111011110000 B10000000000000000000000000000000
         B11001100001010001000011111110000 B11111100000010000000011111110000
         B01011101010000000000000000000000 B00100000001111000000011011110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100001100010000011111110000 B10000000000000000000000000000000
         B11001100000010000000011111110000 B00100000001100100000011111000000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B11001100000010100000011111110000
         B11111000001111000000011111110000 B01101110010000000000000000000000
         B11111000001111000000011111110000 B00111101010000000000000000000000
         B10000000000100000000011111110000 B01001100001000000000011111110000
         B01001100001111000000011111110000 B10000000000100010000011111110000
         B01000000001000000000011111110000 B11001100000100010000011111110000
         B11001100000100010000011111110000 B11001100000100010000011111110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001100000010000000011111110000 B00100000001100101000011111010000
         B11001000001100100000011111010000 B11111100001100100000111011110000
         B10000000000000000000000000000000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B10100111010000000000000000000000
         B00100000001111000000011011110000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11111100001100010000011111110000
         B10000000000000000000000000000000 B11001100000010000000011111110000
         B00100000001100100000011111000000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11111000001111000000011111110000
         B00100011010000000000000000000000 B11111100000010000000011111110000
         B01000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11001100000010000000011111110000
         B11001100000010100000011111110000 B11111000001111000000011111110000
         B10001111010000000000000000000000 B10000000000100000000011111110000
         B01001100001000000000011111110000 B01001100001111000000011111110000
         B10000000000100010000011111110000 B01000000001000000000011111110000
         B11111100000100010000011111110000 B00000000000000000000000000000000
         B11001100000100010000011111110000 B11001100000100010000011111110000
         B11001100000100010000011111110000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11111100000010000000011111110000
         B10000000000000000000000000000000 B01000000000010000000011111000000
         B00101000001100010000011111110000 B11111100001100010000011111110000
         B01000000000000000000000000000000 B11111100000100010000011111110000
         B10010000110000000000000000000000 B11111000001111000000011111110000
         B11011111000000000000000000000000 B11111100001100010000011111110000
         B01000000000000000000000000000000 B11001100000010000000011111110000
         B00100000001100100001011111100000 B11001000001100100000011111010000
         B11111100001100100000100011110000 B10000000000000000000000000000000
         B11001100001010001000011111110000 B11111100000010000000011111110000
         B01011010110000000000000000000000 B00100000001111000000011011110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000100010000011111110000 B00100100110000000000000000000000
         B11111000001111000000011111110000 B00101011100000000000000000000000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000100010000011111110000 B00011100110000000000000000000000
         B11111000001111000000011111110000 B01000100000000000000000000000000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B11001000000010100000011111110000
         B11111100000100010000011111110000 B00000010110000000000000000000000
         B11111000001111000000011111110000 B01000010100000000000000000000000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000100010000011111110000 B00010010110000000000000000000000
         B11111000001111000000011111110000 B11011110100000000000000000000000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000100010000011111110000 B00011010110000000000000000000000
         B11111000001111000000011111110000 B00000100010000000000000000000000
         B11111000001111000000011111110000 B01110001110000000000000000000000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000100010000011111110000 B01010110110000000000000000000000
         B11111000001111000000011111110000 B00110110010000000000000000000000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100001100010000011111110000 B10000000000000000000000000000000
         B11111100000100010000011111110000 B00011110110000000000000000000000
         B11111000001111000000011111110000 B11011111000000000000000000000000
         B11001100000010000001011111110000 B00100000000010000001011101010000
         B00100000001100010000011111110000 B11111100001100010000011111110000
         B00000000000000000000000000000000 B11111100001100100000100011110000
         B10000000000000000000000000000000 B11111100000010000000011111110000
         B11000000000000000000000000000000 B01000000000010000000011111000000
         B11001100000010100000011111110000 B11001100000010000000011111110000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000100010000011111110000 B00110001110000000000000000000000
         B11111000001111000000011111110000 B11111101010000000000000000000000
         B11111000001111000000011111110000 B01110001110000000000000000000000
         B10000000000100000000011111110000 B01001100001000000000011111110000
         B01001100001111000000011111110000 B10000000000100010000011111110000
         B01000000001000000000011111110000 B11001100000100010000011111110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001000001100100000011110100000 B11111100000010000000011111110000
         B00000000000000000000000000000000 B01000000000010000000011111000000
         B11001000000010100000011111110000 B00100000000010000000011111110000
         B00100000000010000000011111110000 B00100000000010000000011111110000
         B00100000000010000000011111110000 B11001100001010001000011111110000
         B11111100000010000000011111110000 B00010101110000000000000000000000
         B00100000001111000000111011110000 B00100000000010000000011111110000
         B11111000001111000000011111110000 B00101001110000000000000000000000
         B11111000001111000000011111110000 B01010101110000000000000000000000
         B10000000000100000000011111110000 B01001100001000000000011111110000
         B01001100001111000000011111110000 B10000000000100010000011111110000
         B01000000001000000000011111110000 B11111100000100010000011111110000
         B00000000000000000000000000000000 B11001100000100010000011111110000
         B11001100000100010000011111110000 B11001100000100010000011111110000
         B11111100001100010000011111110000 B01011111000000000000000000000000
         B11111100000100010000011111110000 B01011101110000000000000000000000
         B11111000001111000000011111110000 B10001001110000000000000000000000
         B11111100001100010000011111110000 B01011111000000000000000000000000
         B11111100000100010000011111110000 B00000011110000000000000000000000
         B11111000001111000000011111110000 B10001001110000000000000000000000
         B11111100001100010000011111110000 B01011111000000000000000000000000
         B11111100000100010000011111110000 B01100011110000000000000000000000
         B11111000001111000000011111110000 B10001001110000000000000000000000
         B11111100001100010000011111110000 B01011111000000000000000000000000
         B11111100000100010000011111110000 B00110011110000000000000000000000
         B11111000001111000000011111110000 B10001001110000000000000000000000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100001100010000011111110000 B01000000000000000000000000000000
         B11111100000100010000011111110000 B01011011110000000000000000000000
         B11111000001111000000011111110000 B11011111000000000000000000000000
         B11001100001010001000011111110000 B11111100000010000000011111110000
         B00001000001000000000000000000000 B00100000001111000000111011110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000100010000011111110000 B01110111110000000000000000000000
         B11111000001111000000011111110000 B00101011100000000000000000000000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000100010000011111110000 B01011111110000000000000000000000
         B11111000001111000000011111110000 B01000100000000000000000000000000
         B11001100001010001000011111110000 B11111100000010000000011111110000
         B00001000001000000000000000000000 B00100000001111000000111011110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B01000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000100010000011111110000 B01110000001000000000000000000000
         B11111000001111000000011111110000 B00101111010000000000000000000000
         B11111000001111000000011111110000 B11001100001000000000000000000000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B00000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B10000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000100010000011111110000 B00000100001000000000000000000000
         B11111000001111000000011111110000 B00110110010000000000000000000000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B11001100000010100000011111110000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11111100000010000000011111110000 B11000000000000000000000000000000
         B01000000000010000000011111000000 B00101000001100010000011111110000
         B11001000001100100000011110100000 B11111100000100010000011111110000
         B10001100001000000000000000000000 B11111000001111000000011111110000
         B11111101010000000000000000000000 B11111000001111000000011111110000
         B11001100001000000000000000000000 B10000000000100000000011111110000
         B01001100001000000000011111110000 B01001100001111000000011111110000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B01001010001000000000000000000000 B11010000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B00000000000000000000000000000000 B00000000000000000000000000000000
         B01101100001000000000000000000000 B10101010001000000000000000000000
         B11111010001000000000000000000000))

|#

;;  This image above executed on a fabricated FM9001 in a test jig at Indiana 
;;  University with the help of M. Esen Tuna, Bhaskar Bose, and Steve Johnson.
;;  The resulting state that begins with the following:

#|

(2	 4	 7	 1
 2	 4	 7	 1
 1	 266373121	 266339330	 266374207
 0	 266374207	 4	 266374207
 4	 266373183	 21	 266353695
 941	 266374207	 1	 266374207
 8	 266342451	 266358835	 266353695
 27	 266353695	 31	 266340353
 266339378	 266353714	 266373121	 266339330
 266373171	 266373171	 266342463	 0
 65015810	 266374164	 266342451	 266374164
 266342463	 1	 65015810	 266374164
 98585619	 266342463	 1	 65015810
 266358835	 266342463	 1	 65015810
 266374164	 266409011	 266342463	 88
 259013636	 266342463	 1	 65015810
 266374164	 98585619	 266342463	 1
 65015810	 266358835	 266342463	 0
....


Note that the Nim state beginning in location 0 of 15 4 7 1 has been
transformed into 2 4 7 1, which by proof we know is an optimal move.

|#




  
\end{verbatim}
%\end{list}
\printindex
\end{document}
