\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) 1994 by Robert S. Boyer and J Strother Moore.  All Rights
 Reserved.

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

 NO WARRANTY

 Robert S. Boyer and J Strother Moore PROVIDE 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 Robert S. Boyer or J Strother Moore 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 initial {\bf nqthm} theory.

\addvspace{18pt}


\begin{verbatim};   The following list of events includes every theorem
;   claimed to have been proved in the paper

;               The Addition of Bounded Quantification
;                                and
;                         Partial Functions
;                                 to
;                       A Computational Logic
;                                and
;                        Its Theorem Prover

;   except for the Binomial Theorem, which is part of the
;   basic proveall.

; Section 1.  Introduction

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{double-list} \\  
\=\+{\rm{double-list}}\,({\it{l\/}})\index{double-list} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{l\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{cons}}\,({\tt{2}} $*$ {\rm{car}}\,({\it{l\/}}), {\rm{double-list}}\,({\rm{cdr}}\,({\it{l\/}}))\index{double-list})$\;${\bf  endif}\-\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  sum-distributes-over-plus \\ \index{sum-distributes-over-plus}
\=\+{\rm{for}}\,(\=\+{\it{i\/}}, \\ 
{\it{l\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{sum}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{plus}}, {\it{g\/}}, {\it{h\/}}), \\ 
{\it{a\/}})\- \\ 
$=$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{i\/}}, \\ 
{\it{l\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{sum}}, \\ 
{\it{g\/}}, \\ 
{\it{a\/}})\- \\ 
$+$$\;\;\;\;${\rm{for}}\,(\=\+{\it{i\/}}, \\ 
{\it{l\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{sum}}, \\ 
{\it{h\/}}, \\ 
{\it{a\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-distributes-over-plus \\ \index{eval\$-distributes-over-plus}
{\rm{eval\$}}\,({\bf{t}}, {\rm{list}}\,({\tt{'}}{\tt{plus}}, {\it{x\/}}, {\it{y\/}}), {\it{a\/}}) $=$ ({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $+$ {\rm{eval\$}}\,({\bf{t}}, {\it{y\/}}, {\it{a\/}}))
\end{tabbing}

\begin{verbatim}; Section 3.4.  Window Dressings

\end{verbatim}\begin{tabbing}{\sc Theorem}:  v\&c\$-list-defn \\ \index{v\&c\$-list-defn}
\=\+{\rm{v\&c\$}}\,({\tt{'}}{\tt{list}}, {\it{l\/}}, {\it{va\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{l\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{cons}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\rm{car}}\,({\it{l\/}}), {\it{va\/}}), {\rm{v\&c\$}}\,({\tt{'}}{\tt{list}}, {\rm{cdr}}\,({\it{l\/}}), {\it{va\/}}))$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  v\&c\$-defn \\ \index{v\&c\$-defn}
\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\it{x\/}}, {\it{va\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{litatom}}\,({\it{x\/}})$\;\;${\bf then }{\rm{cons}}\,({\rm{cdr}}\,({\rm{assoc}}\,({\it{x\/}}, {\it{va\/}})), {\tt{0}}) \\ 
{\bf elseif }{\it{x\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\rm{cons}}\,({\it{x\/}}, {\tt{0}}) \\ 
{\bf elseif }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{quote}}$\;\;${\bf then }{\rm{cons}}\,({\rm{cadr}}\,({\it{x\/}}), {\tt{0}}) \\ 
{\bf else }{\rm{v\&c-apply\$}}\,({\rm{car}}\,({\it{x\/}}), {\rm{v\&c\$}}\,({\tt{'}}{\tt{list}}, {\rm{cdr}}\,({\it{x\/}}), {\it{va\/}}))$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; The following lemma has a hideous but trivial proof.  It generates
; 1222 cases!  The final stats are: [ 0.2 348.0 162.9 ] = 8.5 minutes.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  eq-args-give-eq-values--apply-version \\ \index{eq-args-give-eq-values--apply-ve!rsion}
\=\+(\=\+({\it{fn\/}} $\not=$ {\tt{'}}{\tt{quote}}) \\ 
$\wedge$$\;\;\;\;$({\rm{strip-cars}}\,({\it{args1\/}}) $=$ {\rm{strip-cars}}\,({\it{args2\/}})) \\ 
$\wedge$$\;\;\;\;$({\bf{f}} $\not\in$ {\it{args1\/}}) \\ 
$\wedge$$\;\;\;\;$({\bf{f}} $\not\in$ {\it{args2\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args1\/}}) $\leftrightarrow$ {\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args2\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args1\/}})) $=$ {\rm{car}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args2\/}}))))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eq-args-give-eq-values \\ \index{eq-args-give-eq-values}
\=\+(\=\+({\it{fn\/}} $\not=$ {\tt{'}}{\tt{quote}}) \\ 
$\wedge$$\;\;\;\;$({\bf{f}} $\not\in$ {\rm{v\&c\$}}\,({\tt{'}}{\tt{list}}, {\it{args1\/}}, {\it{va1\/}})) \\ 
$\wedge$$\;\;\;\;$({\bf{f}} $\not\in$ {\rm{v\&c\$}}\,({\tt{'}}{\tt{list}}, {\it{args2\/}}, {\it{va2\/}})) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{strip-cars}}\,({\rm{v\&c\$}}\,({\tt{'}}{\tt{list}}, {\it{args1\/}}, {\it{va1\/}})) \\ 
$=$$\;\;\;\;${\rm{strip-cars}}\,({\rm{v\&c\$}}\,({\tt{'}}{\tt{list}}, {\it{args2\/}}, {\it{va2\/}})))\-)\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{v\&c\$}}\,({\bf{t}}, {\rm{cons}}\,({\it{fn\/}}, {\it{args1\/}}), {\it{va1\/}}) $\leftrightarrow$ {\rm{v\&c\$}}\,({\bf{t}}, {\rm{cons}}\,({\it{fn\/}}, {\it{args2\/}}), {\it{va2\/}})) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\rm{cons}}\,({\it{fn\/}}, {\it{args1\/}}), {\it{va1\/}})) \\ 
$=$$\;\;\;\;${\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\rm{cons}}\,({\it{fn\/}}, {\it{args2\/}}), {\it{va2\/}})))\-)\-\-
\end{tabbing}


\begin{verbatim}; Section 4.  Theorems about Partial Functions

; This section contains a series of events demonstrating a technique for proving
; theorems about interpreted functions.  The text was written 16 October, 1984,
; however it has been brought into conformance with the notation used in the
; quantifier paper.

; We would like to prove such theorems as
;     [(APPEND1 A B)] = (APPEND A B),
; where APPEND1 is a "partial" function whose body is exactly that of APPEND's with
; an APPEND1 in place of the APPEND call.

; The first question is which of the various equivalent formulations do we
; choose?

; It should be clear that the basic theorem we must prove is at the V&C level
; (V&C$ and V&C-APPLY$), not the EVAL level (EVAL$ and APPLY$).  EVAL recurses
; only through the s-expression it is given.  When given a concrete s-expression
; such as the one in the definition of APPEND1, the EVALs disappear and turn into
; function applications.  Function application at the EVAL level is performed by
; APPLY$ which defined in terms of V&C-APPLY$, which is in turn defined with V&C$
; of the BODY.  Thus, we see that the recursion needed to calculate the value of
; 'APPEND1 is actually carried out at the V&C level.  That is, it is V&C$, not EVAL$,
; that recurses on the body of 'APPEND1.   So we wish to formulate our basic lemma at
; the V&C$ level.

; To express the lemma we need we seem to have only two choices.  Either we
; express it in terms of the V&C$ of some typical 'APPEND1 expression, e.g.,
; (LIST 'APPEND1 E1 E2) or perhaps the body of 'APPEND1 itself; or we express it in
; terms of applying 'APPEND1 to some argument pairs with V&C-APPLY$.

; That is, we can use an expression like:

;      (V&C$ T (LIST 'APPEND1 E1 E2) A)
 
; or

;      (V&C$ T '(IF (LISTP X) (CONS & &) Y) *alist*) --

; or we can use an expression like:

;      (V&C-APPLY$ 'APPEND1 (LIST VC1 VC2)).

; I have found the V&C-APPLY$ route the simplest for the theorem prover.  The
; reason is that the V&C$ routes give rise to expressions which simplify by
; expanding the definition of V&C$ (or using our built in rewriters).  Let me
; describe the problem in more detail.

; My natural inclination was to use (V&C$ T '(IF (LISTP X) & &) a).  The idea of
; my proof was to have an induction hypothesis in which 'X is bound to (CDR X) in
; a and an induction conclusion in which 'X is bound to X in a.  Then I would
; expand the V&C$ in the conclusion, drive it through the body to the recursive
; call of 'APPEND1, open up that call to expose a V&C$ on the body of 'APPEND1 and observe
; that was my induction hypothesis.  But it was very messy because the natural
; inclination of the theorem prover to expand V&C$ on quoted s-expressions caused
; the inductive hypothesis to be rewritten to an IF and the inductive case was
; then splattered into several formulas.  The V&C$ in the conclusion naturally
; dove down to the recursive call as planned and was forcibly opened there to
; reveal the body.  But then the simplifier drove V&C$ through that before it
; could finally identify the induction hypothesis in it.  In short, by working at
; the V&C$ level on the body of the function we force the theorem prover to dive
; through the body 3 times:  once to put the hypothesis in normal form, once to
; drive the conclusion down to the recursive call we need to expand, and then
; after expanding the call to put the thing into normal form.

; We could turn off V&C$ to prevent it from expanding on the quoted function body
; in the inductive hypothesis.  However, we would then have to force manually its
; expansion on every subexpression of the body in the inductive conclusion.  The
; rather primitive proof checking commands at our disposal make it extremely
; awkward to expand V&C$ on a quoted constant in the conclusion without doing so
; in the hypothesis.  (The observation that the two calls of V&C$ in question
; have different alists permits one to distinguish them, but it as far as I know
; the only way to achieve the desired effect is to hint the expansion of V&C$ for
; every subexpression in the body.)

; The other V&C$ route, (V&C$ T (LIST 'APPEND1 E1 E2) A), suffers less extremely from
; the same tendency.  It expands into a V&C-APPLY$ both in the hypothesis and
; conclusion.  Manual intervention is required to open the V&C-APPLY$ in the
; conclusion to reveal a V&C$ of the body, but that V&C$ of the body is then
; automatically driven through the body and simplified to the same V&C-APPLY$
; expression to which the hypothesis simplified.  The only real problem with
; using (V&C$ T (LIST 'APPEND1 E1 E2) A) is that when we then turn to the question "Is
; (APPEND1 A B) equal to (APPEND A B)?" the lemma proved with V&C$ is useless as a
; rewrite rule.  That is because (APPEND1 A B) expands to a call of EVAL$ on the body
; and that is simplified to calls of APPLY$.  If APPLY$ is enabled, those calls
; become V&C-APPLY$ calls.  If V&C-APPLY$ were enabled, the V&C-APPLY$ calls
; would become calls of V&C$ on the body.  Only by driving through the body
; AGAIN would one arrive at a call of the form (V&C$ T (LIST 'APPEND1 E1 E2) A) to
; which the lemma would apply.

; I therefore decided to make my basic lemma be about V&C-APPLY$.  I leave V&C$
; enabled and V&C-APPLY$ disabled.  Because V&C-APPLY$ is disabled, my induction
; hypthesis stays put.  I have to force V&C-APPLY$ to expand ONCE in the
; induction conclusion to give rise to a V&C$ call on the body.  But then the
; enabled V&C$ is automatically driven through all quoted expressions giving rise
; to V&C-APPLY$ calls.  Those that are on subrs or total functions -- or
; functions about which we have already proved V&C-APPLY$ lemmas -- disappear,
; leaving only the V&C-APPLY$ calls of the "new" function being analyzed.  The
; induction hypothesis then hits those.  Once such a basic V&C-APPLY$ lemma is
; proved it is in the correct form to be used in subsequent proofs, both about
; V&C$ and about EVAL$.  In particular, the proof that (APPEND1 A B) is (APPEND A B)
; goes through immediately if APPLY$ is enabled and so converted to V&C-APPLY$.

; Most of the time V&C-APPLY$ is off but we would like V&C$ to walk through
; exprs composed of primitives.  So we "enable" V&C-APPLY$ on IF and
; SUBRs with the following two lemmas.  The variable and QUOTE cases are
; part of V&C$.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  v\&c-apply\$-if \\ \index{v\&c-apply\$-if}
\=\+{\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{if}}, {\it{args\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{car}}\,({\it{args\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\rm{car}}\,({\it{args\/}})) \\ 
{\bf then }{\rm{fix-cost}}\,({\rm{car}}\,({\rm{cdr}}\,({\it{args\/}})), $1\;+$ {\rm{cdr}}\,({\rm{car}}\,({\it{args\/}}))) \\ 
{\bf else }{\rm{fix-cost}}\,({\rm{car}}\,({\rm{cdr}}\,({\rm{cdr}}\,({\it{args\/}}))), $1\;+$ {\rm{cdr}}\,({\rm{car}}\,({\it{args\/}})))$\;${\bf  endif}\- \\ 
{\bf else }{\tt{'}}{\tt{*1*false}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  v\&c-apply\$-subrp \\ \index{v\&c-apply\$-subrp}
\=\+({\rm{subrp}}\,({\it{fn\/}}) $\wedge$ ({\it{fn\/}} $\not=$ {\tt{'}}{\tt{if}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\tt{'}}{\tt{*1*false}} $\in$ {\it{args\/}}$\;\;${\bf then }{\tt{'}}{\tt{*1*false}} \\ 
{\bf else }{\rm{cons}}\,(\=\+{\rm{apply-subr}}\,({\it{fn\/}}, {\rm{strip-cars}}\,({\it{args\/}})), \\ 
$1\;+$ {\rm{sum-cdrs}}\,({\it{args\/}}))\-$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{verbatim}; The basic observation used to prove non-termination is:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  basic-nonterminating-lemma \\ \index{basic-nonterminating-lemma}
({\rm{cdr}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}})) $<$ {\it{c\/}}) $\rightarrow$ ({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}}) $\not=$ {\rm{cons}}\,({\it{v\/}}, {\it{c\/}}))
\end{tabbing}

\begin{verbatim}; This lemma is really just the observation that X is not Y if their
; CDRs are different.  It's specialized to prevent its overuse.
; In addition, we convert "their CDRs are different" into
; "(CDR X) < (CDR Y)."

; It never occurs to the theorem prover to try to prove that x is non-F
; by proving (LISTP x).  We force it to make this consideration for
; V&C-APPLY$.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  embarrassing-observation \\ \index{embarrassing-observation}
{\rm{listp}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}})) $\rightarrow$ {\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}})
\end{tabbing}

\begin{verbatim}; We are now prepared to prove the cited theorems about partial functions.

; We begin with APP.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{app} \\  
\=\+{\rm{app}}\,({\it{x\/}}, {\it{y\/}})\index{app} \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{if}} \\ 
{\tt{(}}{\tt{equal}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{'}}{\tt{nil}}{\tt{)}} \\ 
{\tt{y}} \\ 
{\tt{(}}{\tt{cons}}{\tt{ }}{\tt{(}}{\tt{car}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{app}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{ }}{\tt{y}}{\tt{)}}{\tt{)}}{\tt{)}}\-, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}), {\rm{cons}}\,({\tt{'}}{\tt{y}}, {\it{y\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  app-0-loops \\ \index{app-0-loops}
{\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{app}}, {\rm{list}}\,({\tt{'}}{\tt{(}}{\tt{0}}{\tt{ .\ }}{\tt{1}}{\tt{)}}, {\rm{cons}}\,({\it{y\/}}, {\tt{0}}))) $=$ {\bf{f}}
\end{tabbing}

\begin{verbatim}; We are interested in the question, "What is (V&C-APPLY$ 'APP (LIST
; VC1 VC2))?"  (An earlier formulation of the lemma had explicit
; CONSes for the VCi above.  We discuss why that was inappropriate in
; the discussion of REVERSE1 below.)  VC1 and VC2 are typically pairs,
; containing the two lists to be appended in the CARs and the costs of
; computing them in their CDRs.  We must prove simultaneously that the
; above application returns a pair iff the first list is PROPERP and
; that the CAR of that pair is the desired answer.  [It is not
; strictly true that we must prove termination and correctness
; simultaneously in all cases.  See the footnote on COP below.]

; We will prove it by induction on the CAR of VC1.  When we expand the
; application of 'APP in the induction conclusion we will get a V&C$ of
; the body of 'APP.  The V&C$ will walk through the primitive function parts
; of the expression and will convert the recursive call of 'APP into
; another (V&C-APPLY$ 'APP (LIST vc1 vc2)).  We wish to have an inductive
; hypothesis about that application.  Thus, vc1 should be a pair whose
; CAR is (CDR (CAR VC1)) -- the CDR of the first arg -- and
; vc2 should be a pair whose CAR is the second arg.  What about the costs?
; From inspection of the body of 'APP we see the cost of computing the first
; arg to the recursion in 'APP is 1 and that of the second is 0.  Hence,
; we get the following rather odd induction hint:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{app-induction-hint} \\  
\=\+{\rm{app-induction-hint}}\,({\it{vc1\/}}, {\it{vc2\/}})\index{app-induction-hint} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\rm{car}}\,({\it{vc1\/}})) \\ 
{\bf then }{\rm{app-induction-hint}}\,({\rm{cons}}\,({\rm{cdr}}\,({\rm{car}}\,({\it{vc1\/}})), {\tt{1}}), {\rm{cons}}\,({\rm{car}}\,({\it{vc2\/}}), {\tt{0}}))\index{app-induction-hint} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  app-is-partially-append--apply-version \\ \index{app-is-partially-append--apply-ve!rsion}
\=\+({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{app}}, {\rm{list}}\,({\it{vc1\/}}, {\it{vc2\/}})) $\leftrightarrow$ ({\it{vc1\/}} $\wedge$ {\it{vc2\/}} $\wedge$ {\rm{properp}}\,({\rm{car}}\,({\it{vc1\/}}))\index{properp})) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{app}}, {\rm{list}}\,({\it{vc1\/}}, {\it{vc2\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{app}}, {\rm{list}}\,({\it{vc1\/}}, {\it{vc2\/}}))) \\ 
$=$$\;\;\;\;${\rm{append}}\,({\rm{car}}\,({\it{vc1\/}}), {\rm{car}}\,({\it{vc2\/}})))\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  app-is-partially-append \\ \index{app-is-partially-append}
\=\+({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{app}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{y}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}), {\rm{cons}}\,({\tt{'}}{\tt{y}}, {\it{y\/}}))) $\leftrightarrow$ {\rm{properp}}\,({\it{x\/}})\index{properp}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{app}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{y}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}), {\rm{cons}}\,({\tt{'}}{\tt{y}}, {\it{y\/}}))) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{app}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{y}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}), {\rm{cons}}\,({\tt{'}}{\tt{y}}, {\it{y\/}})))) \\ 
$=$$\;\;\;\;${\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\-)\-\-
\end{tabbing}

\begin{verbatim}; The paper now turns to proving things about [(APPEND X Y)].  That is easy,
; because the functions in question are TAMEP:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  append-x-y-is-tamep \\ \index{append-x-y-is-tamep}
\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{append}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{y}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}), {\rm{cons}}\,({\tt{'}}{\tt{y}}, {\it{y\/}}))) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{append}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{y}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}), {\rm{cons}}\,({\tt{'}}{\tt{y}}, {\it{y\/}})))) \\ 
$=$$\;\;\;\;${\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\-\-
\end{tabbing}
            

\begin{verbatim}; But the spirit of the remarks in the paper is to avoid the use of new
; (derived) rules of inference and construct the proofs from first
; principles.  To that end I define an interpreted version of APPEND,
; called APPEND1:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{append1} \\  
\=\+{\rm{append1}}\,({\it{x\/}}, {\it{y\/}})\index{append1} \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{if}} \\ 
{\tt{(}}{\tt{listp}}{\tt{ }}{\tt{x}}{\tt{)}} \\ 
{\tt{(}}{\tt{cons}}{\tt{ }}{\tt{(}}{\tt{car}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{append1}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{ }}{\tt{y}}{\tt{)}}{\tt{)}} \\ 
{\tt{y}}{\tt{)}}\-, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}), {\rm{cons}}\,({\tt{'}}{\tt{y}}, {\it{y\/}})))\-\-
\end{tabbing}

\begin{verbatim}; and using the same methodology as used in APP, construct the proof
; that it is TAMEP and is APPEND:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{append1-induction-hint} \\  
\=\+{\rm{append1-induction-hint}}\,({\it{vc1\/}}, {\it{vc2\/}})\index{append1-induction-hint} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\rm{car}}\,({\it{vc1\/}})) \\ 
{\bf then }{\rm{append1-induction-hint}}\,({\rm{cons}}\,({\rm{cdr}}\,({\rm{car}}\,({\it{vc1\/}})), {\tt{1}}), {\rm{cons}}\,({\rm{car}}\,({\it{vc2\/}}), {\tt{0}}))\index{append1-induction-hint} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  append1-is-tamep-and-is-append--apply-version \\ \index{append1-is-tamep-and-is-append-!-apply-version}
\=\+({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{append1}}, {\rm{list}}\,({\it{vc1\/}}, {\it{vc2\/}})) $\leftrightarrow$ ({\it{vc1\/}} $\wedge$ {\it{vc2\/}})) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{append1}}, {\rm{list}}\,({\it{vc1\/}}, {\it{vc2\/}}))) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{vc1\/}} $\wedge$ {\it{vc2\/}}$\;\;${\bf then }{\rm{append}}\,({\rm{car}}\,({\it{vc1\/}}), {\rm{car}}\,({\it{vc2\/}})) \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  append1-x-y-is-tamep \\ \index{append1-x-y-is-tamep}
\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{append}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{y}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}), {\rm{cons}}\,({\tt{'}}{\tt{y}}, {\it{y\/}}))) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{append}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{y}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}), {\rm{cons}}\,({\tt{'}}{\tt{y}}, {\it{y\/}})))) \\ 
$=$$\;\;\;\;${\rm{append}}\,({\it{x\/}}, {\it{y\/}}))\-\-
\end{tabbing}


\begin{verbatim}; For the record, though I do not think it is mentioned in the paper,
; we can also prove:

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

\begin{verbatim}; Following the development in the paper, we now turn to:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{russell}$\;\;$
{\sc{russell}}\index{russell} $=$ {\rm{eval\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{not}}{\tt{ }}{\tt{(}}{\tt{russell}}{\tt{)}}{\tt{)}}, {\bf{nil}})
\end{tabbing}

\begin{verbatim}; The proof that 'RUSSELL does not terminate is now straightforward:
; just expand the definition of V&C-APPLY$ once to produce a V&C$,
; which walks through the formula and produces an identical call of
; V&C-APPLY$.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  russell-does-not-terminate \\ \index{russell-does-not-terminate}
{\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{russell}}, {\bf{nil}}) $=$ {\bf{f}}
\end{tabbing}

\begin{verbatim}; Note that I use USE and not EXPAND.  EXPAND would replace the V&C-APPLY$
; by its definition.  USE adds the instanitated definition as a hypothesis.
; But under the assumption that (V&C-APPLY$ 'RUSSELL NIL) is not F, that
; hypothesis is contradictory.

; Consequently:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  russell-is-f \\ \index{russell-is-f}
{\sc{russell}}\index{russell} $=$ {\bf{f}}
\end{tabbing}

\begin{verbatim}; The abstract of the paper claims we can prove facts about
; LEN, even though those facts aren't mentioned in the body
; of the paper.  This is a good time in the development of
; our methodology to do LEN:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{len} \\  
\=\+{\rm{len}}\,({\it{x\/}})\index{len} \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}{\tt{if}}{\tt{ }}{\tt{(}}{\tt{equal}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{'}}{\tt{nil}}{\tt{)}}{\tt{ }}{\tt{'}}{\tt{0}}{\tt{ }}{\tt{(}}{\tt{add1}}{\tt{ }}{\tt{(}}{\tt{len}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))\-\-
\end{tabbing}

\begin{verbatim}; The definition of 'LEN terminates only on proper lists.  We
; can apply much the same program to such functions.

; We wish to prove that 'LEN is LENGTH when it terminates, and we
; want to characterize its termination.

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

\begin{verbatim}; The key observation is that when applied to a 0 the function does
; not terminate.  In the application in question, namely, when we
; are proving the general fact about 'LEN and have to worry about
; recursion into a non-LISTP, the 0 arises by evaluating '(CDR X)
; and so has a cost of 1.  So, following the program carried out
; for RUSSELL, we observe that 'LEN doesn't terminate in that case:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  len-loops-on-0 \\ \index{len-loops-on-0}
{\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{len}}, {\rm{list}}\,({\rm{cons}}\,({\tt{0}}, {\tt{1}}))) $=$ {\bf{f}}
\end{tabbing}

\begin{verbatim}; We then follow the program carried out for 'APPEND1 and the others except
; our induction hint is sound (terminates on NLISTP not a NIL check).

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{len-induction-hint} \\  
\=\+{\rm{len-induction-hint}}\,({\it{vc\/}})\index{len-induction-hint} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\rm{car}}\,({\it{vc\/}}))$\;\;${\bf then }{\rm{len-induction-hint}}\,({\rm{cons}}\,({\rm{cdr}}\,({\rm{car}}\,({\it{vc\/}})), {\tt{1}}))\index{len-induction-hint} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  len-is-partially-length--apply-version \\ \index{len-is-partially-length--apply-ve!rsion}
\=\+({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{len}}, {\rm{list}}\,({\it{vc\/}})) $\leftrightarrow$ ({\it{vc\/}} $\wedge$ {\rm{properp}}\,({\rm{car}}\,({\it{vc\/}}))\index{properp})) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{len}}, {\rm{list}}\,({\it{vc\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{len}}, {\rm{list}}\,({\it{vc\/}}))) $=$ {\rm{length}}\,({\rm{car}}\,({\it{vc\/}}))\index{length}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  len-x-is-partially-length \\ \index{len-x-is-partially-length}
\=\+({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{len}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}))) $\leftrightarrow$ {\rm{properp}}\,({\it{x\/}})\index{properp}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{len}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}))) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{len}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))) $=$ {\rm{length}}\,({\it{x\/}})\index{length}))\-\-
\end{tabbing}

\begin{verbatim}; Note that all these proofs are exactly the same from the user's
; point of view:  
; (0)  If the function is partial distill the reason it loops,
;      e.g., LEN-LOOPS-ON-0.
; (1)  Define the induction hint, which is mechanically derivable
;      from the interpreted definition, e.g., LEN-INDUCTION-HINT.
; (2)  Prove the termination and value properties about an arbitrary
;      V&C-APPLY$ of the function, e.g., 
;      LEN-IS-PARTIALLY-LENGTH--APPLY-VERSION.
; (3)  Prove the V&C$ version of the termination and value properties,
;      e.g., LEN-X-IS-PARTIALLY-LENGTH.

; We have done this for APPEND1 and LEN and will do it repeatedly
; for the other functions mentioned.  Ocassionally we have to prove
; lemmas to make the proofs go through, but the lemmas are not facts
; about V&C$ but just ordinary facts about the functions used in
; the definitions.  For example, when we prove F91 function we'll need
; some arithmetic, and when we deal with the various reverse functions
; we'll need some list processing stuff.

; Perhaps the key weakness in the programs developed so far is the
; concern about the cost of evaluating arguments as encoded in the
; induction hints.  The good news is that we are only concerned about
; the cost of evaluating the arguments of recursive calls of the
; function being considered, not the cost of all arguments.  (Consider
; that when we proved 'REVERSE1 correct we did not care how long
; 'REVERSE1 takes to produce the argument for 'AP, we merely cared how
; long 'CDR takes to produce the argument for 'REVERSE1.  That is, our
; concern with costs is focussed entirely in inductive hypotheses and
; not in the statement of our lemmas.)

; The bad news is that if the function being introduced recurses on some
; nonprimitive we seem to need lemmas telling us what the cost of
; the relevant computations are, if we are to follow this program.  The
; worse case seems to be when a function recurses on itself, as does
; TAK, for then we'd have to be deriving its cost as we go.  However, we
; do not have to compute the cost of an actual in closed form; we can use
; instead (CDR (V&C$ actual alist)) or its V&C-APPLY$ equivalent.

; To illustrate this, we attack the simple analogue of TAK, namely FID:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{fid} \\  
\=\+{\rm{fid}}\,({\it{x\/}})\index{fid} \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}{\tt{if}}{\tt{ }}{\tt{(}}{\tt{zerop}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{ }}{\tt{'}}{\tt{0}}{\tt{ }}{\tt{(}}{\tt{add1}}{\tt{ }}{\tt{(}}{\tt{fid}}{\tt{ }}{\tt{(}}{\tt{fid}}{\tt{ }}{\tt{(}}{\tt{sub1}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{fid-induction-hint} \\  
\=\+{\rm{fid-induction-hint}}\,({\it{vc\/}})\index{fid-induction-hint} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{car}}\,({\it{vc\/}}) $\simeq {\tt{0}}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }\=\+{\rm{fid-induction-hint}}\,({\rm{cons}}\,({\rm{car}}\,({\it{vc\/}}) $-\;1$, {\tt{1}}))\index{fid-induction-hint} \\ 
$\wedge$$\;\;\;\;${\rm{fid-induction-hint}}\,({\rm{cons}}\,(\=\+{\rm{car}}\,({\it{vc\/}}) $-\;1$, \\ 
{\rm{cdr}}\,({\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{fid}}, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\rm{car}}\,({\it{vc\/}}) $-\;1$, \\ 
{\tt{1}})\-))\-))\-)\index{fid-induction-hint}\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; Note that we provide two induction hypotheses, one for each call of FID.
; The first is simple:  the actual is one less than it was and the cost is 1.
; The second is complicated:  the actual is one less than it was and the
; cost is ... whatever it is!  The cost expression for the second hypothesis
; -- indeed for all the hypotheses generated -- can be obtained mechanically
; by just using the CDR of the V&C$ of the actual expression.  However, because
; FID recurses on itself, the induction hint for it cannot be written until
; one understands what the value delivered is.  If we tried to do with the
; value component what we did with the cost component, namely put in the
; CAR of the V&C$ of the actual expression, FID-INDUCTION-HINT would not be
; admissible.

; The only trouble with the above hint is that the second induction hypothesis
; will not be used because the outer application of 'FID is not on an
; explict CONS but on a (V&C-APPLY$ 'FID ...) that is known to be a list
; whose CAR is (SUB1 (CAR VC)).  We sort of wish we could do an elim and
; replace a LISTP by the CONS of its CAR and CDR, even for non-variables.
; That loops.  So we must be more devious.  The following lemma does an
; ELIM of a V&C-APPLY$ expression provided it occurs in a CONS.  That
; is the only case we are interested in since the V&C-APPLY$ in question
; is in the arglist of another V&C-APPLY$.  

\end{verbatim}\begin{tabbing}{\sc Theorem}:  fake-elim \\ \index{fake-elim}
\=\+{\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{cons}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}}), {\it{tl\/}}) \\ 
$=$$\;\;\;\;${\rm{cons}}\,(\=\+{\rm{cons}}\,({\rm{car}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}})), {\rm{cdr}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}}))), \\ 
{\it{tl\/}})\-)\-\-
\end{tabbing}

\begin{verbatim}; This lemma is dangerous because (CONS (CAR X) (CDR X)) = X can cause
; it to loop.  It doesn't if (CAR (V&C-APPLY$ FN ARGS)) is rewritten to
; something else first though!  If you try to prove termination without
; simultaneously proving a rewrite rule for the value, this lemma will
; bite you!

; We now prove the basic lemma for 'FID.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  fid-is-tamep-and-id--apply-version \\ \index{fid-is-tamep-and-id--apply-versi!on}
\=\+({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{fid}}, {\rm{list}}\,({\it{vc\/}})) $\leftrightarrow$ {\it{vc\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{fid}}, {\rm{list}}\,({\it{vc\/}}))) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{vc\/}}$\;\;${\bf then }{\rm{fix}}\,({\rm{car}}\,({\it{vc\/}})) \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fid-x-is-tamep \\ \index{fid-x-is-tamep}
\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{fid}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}))) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{fid}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))) $=$ {\rm{fix}}\,({\it{x\/}}))\-
\end{tabbing}

\begin{verbatim}; Note that the program followed for 'FID is exactly that followed for
; 'APPEND1, except we have now generalized the costs specified in the induction
; hints, from closed forms such as 1 or 0, to the very expressions generated
; by V&C$.

; So now let's do something more complex, like GOPHER:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{ro} \\  
\=\+{\rm{ro}}\,({\it{x\/}})\index{ro} \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{cons}} \\ 
{\tt{(}}{\tt{car}}{\tt{ }}{\tt{(}}{\tt{car}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{cons}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{(}}{\tt{car}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{)}}{\tt{)}}\-, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{rot}$\;\;$
{\rm{rot}}\,({\it{x\/}})\index{rot} $=$ {\rm{cons}}\,({\rm{caar}}\,({\it{x\/}}), {\rm{cons}}\,({\rm{cdar}}\,({\it{x\/}}), {\rm{cdr}}\,({\it{x\/}})))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ro-is-tamep-and-rot--apply-version \\ \index{ro-is-tamep-and-rot--apply-versi!on}
\=\+({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{ro}}, {\rm{list}}\,({\it{vc\/}})) $\leftrightarrow$ {\it{vc\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{ro}}, {\rm{list}}\,({\it{vc\/}}))) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{vc\/}}$\;\;${\bf then }{\rm{rot}}\,({\rm{car}}\,({\it{vc\/}}))\index{rot} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ro-x-is-tamep \\ \index{ro-x-is-tamep}
\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{ro}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}))) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{ro}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))) $=$ {\rm{rot}}\,({\it{x\/}})\index{rot})\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{gop} \\  
\=\+{\rm{gop}}\,({\it{x\/}})\index{gop} \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{if}} \\ 
{\tt{(}}{\tt{or}}{\tt{ }}{\tt{(}}{\tt{nlistp}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{nlistp}}{\tt{ }}{\tt{(}}{\tt{car}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{x}} \\ 
{\tt{(}}{\tt{gop}}{\tt{ }}{\tt{(}}{\tt{ro}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{)}}{\tt{)}}\-, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{gopher} \\  
\=\+{\rm{gopher}}\,({\it{x\/}})\index{gopher} \\ 
$=$$\;\;\;\;$\=\+{\bf if }({\it{x\/}} $\simeq\;${{\bf{nil}}}${}$) $\vee$ ({\rm{car}}\,({\it{x\/}}) $\simeq\;${{\bf{nil}}}${}$)$\;\;${\bf then }{\it{x\/}} \\ 
{\bf else }{\rm{gopher}}\,({\rm{rot}}\,({\it{x\/}})\index{rot})\index{gopher}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{gop-induction-hint} \\  
\=\+{\rm{gop-induction-hint}}\,({\it{vc\/}})\index{gop-induction-hint} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\rm{car}}\,({\it{vc\/}})) $\wedge$ {\rm{listp}}\,({\rm{caar}}\,({\it{vc\/}})) \\ 
{\bf then }{\rm{gop-induction-hint}}\,({\rm{cons}}\,(\=\+{\rm{rot}}\,({\rm{car}}\,({\it{vc\/}}))\index{rot}, \\ 
{\rm{cdr}}\,({\rm{v\&c\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}{\tt{ro}}{\tt{ }}{\tt{x}}{\tt{)}}, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\rm{car}}\,({\it{vc\/}}))))\-))\-)\index{gop-induction-hint} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; Observe that the cost component above is just the CDR of the V&C$ of the
; actual expression.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  gop-is-tamep-and-gopher--apply-version \\ \index{gop-is-tamep-and-gopher--apply-ve!rsion}
\=\+({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{gop}}, {\rm{list}}\,({\it{vc\/}})) $\leftrightarrow$ {\it{vc\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{gop}}, {\rm{list}}\,({\it{vc\/}}))) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{vc\/}}$\;\;${\bf then }{\rm{gopher}}\,({\rm{car}}\,({\it{vc\/}}))\index{gopher} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  gop-x-is-tamep \\ \index{gop-x-is-tamep}
\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{gop}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}))) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{gop}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))) $=$ {\rm{gopher}}\,({\it{x\/}})\index{gopher})\-
\end{tabbing}

\begin{verbatim}; It should be obvious that we do not need to think about the costs of
; interpreting these functions.

; We'll now do the 91 function.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{f91} \\  
\=\+{\rm{f91}}\,({\it{x\/}})\index{f91} \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{if}} \\ 
{\tt{(}}{\tt{lessp}}{\tt{ }}{\tt{'}}{\tt{100}}{\tt{ }}{\tt{x}}{\tt{)}} \\ 
{\tt{(}}{\tt{difference}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{'}}{\tt{10}}{\tt{)}} \\ 
{\tt{(}}{\tt{f91}}{\tt{ }}{\tt{(}}{\tt{f91}}{\tt{ }}{\tt{(}}{\tt{plus}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{'}}{\tt{11}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}\-, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{g91} \\  
\=\+{\rm{g91}}\,({\it{x\/}})\index{g91} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\tt{100}} $<$ {\it{x\/}}$\;\;${\bf then }{\it{x\/}} $-$ {\tt{10}} \\ 
{\bf else }{\tt{91}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-difference-0 \\ \index{equal-difference-0}
({\it{x\/}} $\not<$ {\it{y\/}}) $\rightarrow$ (({\it{y\/}} $-$ {\it{x\/}}) $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{f91-induction-hint} \\  
\=\+{\rm{f91-induction-hint}}\,({\it{vc\/}})\index{f91-induction-hint} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\tt{100}} $<$ {\rm{car}}\,({\it{vc\/}})$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }\=\+{\rm{f91-induction-hint}}\,({\rm{cons}}\,(\=\+{\rm{car}}\,({\it{vc\/}}) $+$ {\tt{11}}, \\ 
{\rm{cdr}}\,({\rm{v\&c\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}{\tt{plus}}{\tt{ }}{\tt{x}}{\tt{ }}{\tt{'}}{\tt{11}}{\tt{)}}, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\rm{car}}\,({\it{vc\/}}))))\-))\-)\index{f91-induction-hint} \\ 
$\wedge$$\;\;\;\;${\rm{f91-induction-hint}}\,({\rm{cons}}\,(\=\+{\rm{g91}}\,({\rm{car}}\,({\it{vc\/}}) $+$ {\tt{11}})\index{g91}, \\ 
{\rm{cdr}}\,({\rm{v\&c\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{f91}} \\ 
{\tt{(}}\=\+{\tt{plus}}{\tt{ }}{\tt{x}} \\ 
{\tt{'}}{\tt{11}}{\tt{)}}\-{\tt{)}}\-, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\tt{'}}{\tt{x}}, \\ 
{\rm{car}}\,({\it{vc\/}}))\-))\-))\-)\index{f91-induction-hint}\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; As for FID, the induction hint for F91 requires the knowledge of what
; the function returns.  Note however our cavalier treatment of the cost
; again.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  f91-x-is-tamep-and-g91--apply-version \\ \index{f91-x-is-tamep-and-g91--apply-ve!rsion}
\=\+({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{f91}}, {\rm{list}}\,({\it{vc\/}})) $\leftrightarrow$ {\it{vc\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{f91}}, {\rm{list}}\,({\it{vc\/}}))) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{vc\/}}$\;\;${\bf then }{\rm{g91}}\,({\rm{car}}\,({\it{vc\/}}))\index{g91} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  f91-x-is-tamep \\ \index{f91-x-is-tamep}
\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{f91}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}))) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{f91}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))) $=$ {\rm{g91}}\,({\it{x\/}})\index{g91})\-
\end{tabbing}

\begin{verbatim}; Footnote:  It is not necessary always to prove termination and
; correctness simultaneously.  The following trivial exercise demonstrates
; that they can be done separately sometimes.  However, in the case of
; a function like FID or just when a partial function is used in the
; definition of another function (e.g., if some function 'FOO called 'LEN
; on (FOO (CDR X))) it is necessary to know properties of the value delivered
; while one is proving termination.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cop} \\  
\=\+{\rm{cop}}\,({\it{x\/}})\index{cop} \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}{\tt{if}}{\tt{ }}{\tt{(}}{\tt{listp}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{cons}}{\tt{ }}{\tt{(}}{\tt{car}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{cop}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{ }}{\tt{x}}{\tt{)}}, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{cop-induction-hint} \\  
\=\+{\rm{cop-induction-hint}}\,({\it{vc\/}})\index{cop-induction-hint} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\rm{car}}\,({\it{vc\/}}))$\;\;${\bf then }{\rm{cop-induction-hint}}\,({\rm{cons}}\,({\rm{cdr}}\,({\rm{car}}\,({\it{vc\/}})), {\tt{1}}))\index{cop-induction-hint} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  v\&c-apply\$-cop-terminates \\ \index{v\&c-apply\$-cop-terminates}
{\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{cop}}, {\rm{list}}\,({\it{vc\/}})) $\leftrightarrow$ {\it{vc\/}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  v\&c-apply\$-cop-copies \\ \index{v\&c-apply\$-cop-copies}
{\rm{car}}\,({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{cop}}, {\rm{list}}\,({\it{vc\/}}))) $=$ {\rm{car}}\,({\it{vc\/}})
\end{tabbing}

\begin{verbatim};  We complete the exercises on interpreting inadmissible functions
;  by showing that Burstall's one argument reverse function is total
;  and computes REVERSE.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{rv} \\  
\=\+{\rm{rv}}\,({\it{l\/}})\index{rv} \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{if}} \\ 
{\tt{(}}{\tt{nlistp}}{\tt{ }}{\tt{l}}{\tt{)}} \\ 
{\tt{'}}{\tt{nil}} \\ 
{\tt{(}}\=\+{\tt{if}} \\ 
{\tt{(}}{\tt{nlistp}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{l}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{cons}}{\tt{ }}{\tt{(}}{\tt{car}}{\tt{ }}{\tt{l}}{\tt{)}}{\tt{ }}{\tt{'}}{\tt{nil}}{\tt{)}} \\ 
{\tt{(}}\=\+{\tt{cons}} \\ 
{\tt{(}}{\tt{car}}{\tt{ }}{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{l}}{\tt{)}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{(}}{\tt{cons}}{\tt{ }}{\tt{(}}{\tt{car}}{\tt{ }}{\tt{l}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{l}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}\-{\tt{)}}\-{\tt{)}}\-, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{l}}, {\it{l\/}})))\-\-
\end{tabbing}

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


\noindent{\sc Event}:   Disable fake-elim.

\addvspace{18pt}

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

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

\begin{tabbing}{\sc Theorem}:  length-cdr \\ \index{length-cdr}
{\rm{listp}}\,({\it{l\/}}) $\rightarrow$ ({\rm{length}}\,({\rm{cdr}}\,({\it{l\/}}))\index{length} $<$ {\rm{length}}\,({\it{l\/}})\index{length})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{rv-induction-hint} \\  
\=\+{\rm{rv-induction-hint}}\,({\it{vc\/}})\index{rv-induction-hint} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{car}}\,({\it{vc\/}}) $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf elseif }{\rm{cdr}}\,({\rm{car}}\,({\it{vc\/}})) $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }\=\+{\rm{rv-induction-hint}}\,({\rm{cons}}\,({\rm{cdr}}\,({\rm{car}}\,({\it{vc\/}})), {\tt{1}}))\index{rv-induction-hint} \\ 
$\wedge$$\;\;\;\;${\rm{rv-induction-hint}}\,({\rm{cons}}\,(\=\+{\rm{cdr}}\,({\rm{reverse}}\,({\rm{cdr}}\,({\rm{car}}\,({\it{vc\/}})))\index{reverse}), \\ 
{\rm{cdr}}\,({\rm{v\&c\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{cdr}} \\ 
{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{l}}{\tt{)}}{\tt{)}}{\tt{)}}\-, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\tt{'}}{\tt{l}}, \\ 
{\rm{car}}\,({\it{vc\/}}))\-))\-))\-)\index{rv-induction-hint} \\ 
$\wedge$$\;\;\;\;${\rm{rv-induction-hint}}\,({\rm{cons}}\,(\=\+{\rm{cons}}\,(\=\+{\rm{car}}\,({\rm{car}}\,({\it{vc\/}})), \\ 
{\rm{reverse}}\,({\rm{cdr}}\,({\rm{reverse}}\,({\rm{cdr}}\,({\rm{car}}\,({\it{vc\/}})))\index{reverse}))\index{reverse})\-, \\ 
{\rm{cdr}}\,({\rm{v\&c\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{cons}} \\ 
{\tt{(}}{\tt{car}}{\tt{ }}{\tt{l}}{\tt{)}} \\ 
{\tt{(}}\=\+{\tt{rv}} \\ 
{\tt{(}}\=\+{\tt{cdr}} \\ 
{\tt{(}}\=\+{\tt{rv}} \\ 
{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{l}}{\tt{)}}{\tt{)}}\-{\tt{)}}\-{\tt{)}}\-{\tt{)}}\-, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\tt{'}}{\tt{l}}, \\ 
{\rm{car}}\,({\it{vc\/}}))\-))\-))\-)\index{rv-induction-hint}\-$\;${\bf  endif}\-\-
\end{tabbing}

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

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

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

\begin{tabbing}{\sc Theorem}:  fake-elim2 \\ \index{fake-elim2}
\=\+(({\rm{car}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}})) $=$ {\it{v\/}}) $\wedge$ {\rm{listp}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}}))) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{cons}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}}), {\it{tl\/}}) \\ 
$=$$\;\;\;\;${\rm{cons}}\,({\rm{cons}}\,({\it{v\/}}, {\rm{cdr}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}}))), {\it{tl\/}}))\-\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  numberp-cdr-v\&c\$ \\ \index{numberp-cdr-v\&c\$}
{\rm{cdr}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}})) $\in\;${\bf{N}}${}$
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  numberp-cdr-v\&c-apply\$ \\ \index{numberp-cdr-v\&c-apply\$}
{\rm{cdr}}\,({\rm{v\&c-apply\$}}\,({\it{fn\/}}, {\it{args\/}})) $\in\;${\bf{N}}${}$
\end{tabbing}

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

\begin{verbatim};  When trying to prove anything about the body of 'RV the theorem
;  prover spends an inordinant amount of time.  To speed things up
;  we prove the following sequence of 4 lemmas, the last of which
;  permits us to simplify (V&C$ T body alist) to its normal form
;  in one step.  The preceding 3 lemmas speed the proof of the last.
;  I think technically these 4 lemmas are unnecessary.  Except for
;  these "short-cut" lemmas the program followed for RV is exactly
;  the same as that followed for LEN and APPEND1.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  short-cut1 \\ \index{short-cut1}
\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{l}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{l}}, {\it{l\/}}))) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{rv}}, {\rm{list}}\,({\rm{cons}}\,({\rm{cdr}}\,({\it{l\/}}), {\tt{1}}))) \\ 
{\bf then }{\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\rm{cdar}}\,({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{rv}}, {\rm{list}}\,({\rm{cons}}\,({\rm{cdr}}\,({\it{l\/}}), {\tt{1}})))), \\ 
$1\;+$ {\rm{cdr}}\,({\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,({\rm{cdr}}\,({\it{l\/}}), {\tt{1}})))\-))\-))\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  short-cut2 \\ \index{short-cut2}
\=\+{\rm{v\&c\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{(}}{\tt{cons}}{\tt{ }}{\tt{(}}{\tt{car}}{\tt{ }}{\tt{l}}{\tt{)}}{\tt{ }}{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{l}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}{\tt{)}}, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{l}}, {\it{l\/}})))\- \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{rv}}, {\rm{list}}\,({\rm{cons}}\,({\rm{cdr}}\,({\it{l\/}}), {\tt{1}}))) \\ 
{\bf then }\=\+{\bf if }{\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\rm{cdar}}\,({\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,({\rm{cdr}}\,({\it{l\/}}), {\tt{1}})))\-), \\ 
$1\;+$ {\rm{cdr}}\,({\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,({\rm{cdr}}\,({\it{l\/}}), {\tt{1}})))\-))\-))\- \\ 
{\bf then }{\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\rm{cons}}\,(\=\+{\rm{car}}\,({\it{l\/}}), \\ 
{\rm{car}}\,({\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\rm{cdar}}\,({\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\rm{cdr}}\,({\it{l\/}}), \\ 
{\tt{1}})\-))\-), \\ 
$1\;+$ {\rm{cdr}}\,({\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\rm{cdr}}\,({\it{l\/}}), \\ 
{\tt{1}})\-))\-))\-))\-))\-, \\ 
$1\;+$ ($1\;+$ {\rm{cdr}}\,({\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\rm{cdar}}\,({\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\rm{cdr}}\,({\it{l\/}}), \\ 
{\tt{1}})\-))\-), \\ 
$1\;+$ {\rm{cdr}}\,({\rm{v\&c-apply\$}}\,(\=\+{\tt{'}}{\tt{rv}}, \\ 
{\rm{list}}\,({\rm{cons}}\,(\=\+{\rm{cdr}}\,({\it{l\/}}), \\ 
{\tt{1}})\-))\-))\-))\-)))\-))\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

%\item 
\begin{verbatim}


(PROVE-LEMMA SHORT-CUT3
  (REWRITE)
  (EQUAL
   (V&C$ T
         '(CONS (CAR (RV (CDR L)))
                (RV (CONS (CAR L) (RV (CDR (RV (CDR L)))))))
         (LIST (CONS 'L L)))
   (IF (V&C-APPLY$ 'RV
                  (LIST (CONS (CDR L) 1)))
    (IF (V&C-APPLY$ 'RV
               (LIST (CONS (CDAR (V&C-APPLY$ 'RV
                                             (LIST (CONS (CDR L) 1))))
                           (ADD1 (CDR (V&C-APPLY$ 'RV
                                                  (LIST (CONS (CDR L) 1))))))))
     (IF      (V&C-APPLY$ 'RV
      (LIST
       (CONS
        (CONS
         (CAR L)
         (CAR
          (V&C-APPLY$ 'RV
             (LIST (CONS (CDAR (V&C-APPLY$ 'RV
                                           (LIST (CONS (CDR L) 1))))
                         (ADD1 (CDR (V&C-APPLY$ 'RV
                                                (LIST (CONS (CDR L) 1))))))))))
        (ADD1
         (ADD1
          (CDR
           (V&C-APPLY$ 'RV
             (LIST (CONS (CDAR (V&C-APPLY$ 'RV
                                           (LIST (CONS (CDR L) 1))))
                         (ADD1 (PLUS (CDR (V&C-APPLY$ 'RV
                                                      (LIST (CONS (CDR L) 1))))
                                     0)))))))))))
    (CONS
     (CONS
      (CAAR (V&C-APPLY$ 'RV
                        (LIST (CONS (CDR L) 1))))
      (CAR
       (V&C-APPLY$ 'RV
        (LIST
         (CONS
          (CONS
           (CAR L)
           (CAR
            (V&C-APPLY$ 'RV
             (LIST (CONS (CDAR (V&C-APPLY$ 'RV
                                           (LIST (CONS (CDR L) 1))))
                         (ADD1 (CDR (V&C-APPLY$ 'RV
                                                (LIST (CONS (CDR L) 1))))))))))
          (ADD1
           (ADD1
            (CDR
             (V&C-APPLY$ 'RV
              (LIST
               (CONS
                   (CDAR (V&C-APPLY$ 'RV
                                     (LIST (CONS (CDR L) 1))))
                   (ADD1 (CDR (V&C-APPLY$ 'RV
                                          (LIST (CONS (CDR L) 1))))))))))))))))
     (ADD1
      (ADD1
       (PLUS
        (CDR (V&C-APPLY$ 'RV
                         (LIST (CONS (CDR L) 1))))
        (CDR
         (V&C-APPLY$ 'RV
          (LIST
           (CONS
            (CONS
             (CAR L)
             (CAR
              (V&C-APPLY$ 'RV
               (LIST
                   (CONS (CDAR (V&C-APPLY$ 'RV
                                           (LIST (CONS (CDR L) 1))))
                         (ADD1 (CDR (V&C-APPLY$ 'RV
                                                (LIST (CONS (CDR L) 1))))))))))
            (ADD1
             (ADD1
              (CDR
               (V&C-APPLY$ 'RV
                (LIST
                 (CONS
                  (CDAR (V&C-APPLY$ 'RV
                                    (LIST (CONS (CDR L) 1))))
                  (ADD1
                      (CDR (V&C-APPLY$ 'RV
                                       (LIST (CONS (CDR L) 1)))))))))))))))))))
    F)
     F)
    F)))
\end{verbatim}


%\item 
\begin{verbatim}


(PROVE-LEMMA SHORT-CUT4
  (REWRITE)
  (EQUAL
   (V&C$ T
         '(IF (NLISTP L)
              'NIL
              (IF (NLISTP (CDR L))
                  (CONS (CAR L) 'NIL)
                  (CONS (CAR (RV (CDR L)))
                        (RV (CONS (CAR L)
                                 (RV (CDR (RV (CDR L)))))))))
         (LIST (CONS 'L L)))
   (IF
    (NLISTP L)
    (CONS NIL 2)
    (IF
     (NLISTP (CDR L))
     (CONS (LIST (CAR L)) 7)
       (IF (V&C-APPLY$ 'RV
                  (LIST (CONS (CDR L) 1)))
    (IF (V&C-APPLY$ 'RV
               (LIST (CONS (CDAR (V&C-APPLY$ 'RV
                                             (LIST (CONS (CDR L) 1))))
                           (ADD1 (CDR (V&C-APPLY$ 'RV
                                                  (LIST (CONS (CDR L) 1))))))))
     (IF      (V&C-APPLY$ 'RV
      (LIST
       (CONS
        (CONS
         (CAR L)
         (CAR
          (V&C-APPLY$ 'RV
             (LIST (CONS (CDAR (V&C-APPLY$ 'RV
                                           (LIST (CONS (CDR L) 1))))
                         (ADD1 (CDR (V&C-APPLY$ 'RV
                                                (LIST (CONS (CDR L) 1))))))))))
        (ADD1
         (ADD1
          (CDR
           (V&C-APPLY$ 'RV
             (LIST (CONS (CDAR (V&C-APPLY$ 'RV
                                           (LIST (CONS (CDR L) 1))))
                         (ADD1 (PLUS (CDR (V&C-APPLY$ 'RV
                                                      (LIST (CONS (CDR L) 1))))
                                     0)))))))))))
    (CONS
     (CONS
      (CAAR (V&C-APPLY$ 'RV
                        (LIST (CONS (CDR L) 1))))
      (CAR
       (V&C-APPLY$ 'RV
        (LIST
         (CONS
          (CONS
           (CAR L)
           (CAR
            (V&C-APPLY$ 'RV
             (LIST (CONS (CDAR (V&C-APPLY$ 'RV
                                           (LIST (CONS (CDR L) 1))))
                         (ADD1 (CDR (V&C-APPLY$ 'RV
                                                (LIST (CONS (CDR L) 1))))))))))
          (ADD1
           (ADD1
            (CDR
             (V&C-APPLY$ 'RV
              (LIST
               (CONS
                   (CDAR (V&C-APPLY$ 'RV
                                     (LIST (CONS (CDR L) 1))))
                   (ADD1 (CDR (V&C-APPLY$ 'RV
                                          (LIST (CONS (CDR L) 1))))))))))))))))
     (ADD1 (ADD1 (ADD1 (ADD1 (ADD1
     (ADD1
      (ADD1
       (PLUS
        (CDR (V&C-APPLY$ 'RV
                         (LIST (CONS (CDR L) 1))))
        (CDR
         (V&C-APPLY$ 'RV
          (LIST
           (CONS
            (CONS
             (CAR L)
             (CAR
              (V&C-APPLY$ 'RV
               (LIST
                   (CONS (CDAR (V&C-APPLY$ 'RV
                                           (LIST (CONS (CDR L) 1))))
                         (ADD1 (CDR (V&C-APPLY$ 'RV
                                                (LIST (CONS (CDR L) 1))))))))))
            (ADD1
             (ADD1
              (CDR
               (V&C-APPLY$ 'RV
                (LIST
                 (CONS
                  (CDAR (V&C-APPLY$ 'RV
                                    (LIST (CONS (CDR L) 1))))
                  (ADD1
                      (CDR (V&C-APPLY$ 'RV
                                       (LIST (CONS (CDR L) 1))))))))))))))))))))))))
    F)
     F)
    F)
     ))))
\end{verbatim}


\begin{tabbing}{\sc Theorem}:  rv-is-tamep-and-reverse--apply-version \\ \index{rv-is-tamep-and-reverse--apply-ve!rsion}
\=\+({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{rv}}, {\rm{list}}\,({\it{vc\/}})) $\leftrightarrow$ {\it{vc\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{rv}}, {\rm{list}}\,({\it{vc\/}}))) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{vc\/}}$\;\;${\bf then }{\rm{reverse}}\,({\rm{car}}\,({\it{vc\/}}))\index{reverse} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rv-x-is-tamep \\ \index{rv-x-is-tamep}
\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}))) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{rv}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))) $=$ {\rm{reverse}}\,({\it{x\/}})\index{reverse})\-
\end{tabbing}

\begin{verbatim}; Section 5.  Proofs about Partial Functions.

; Many of the theorems noted in this section were proved above.  
; However, we here prove the "metatheorems" cited.

; The following formula was not a theorem until we added
; the new axiom of (SUBRP 'QUOTE) = F.  The need for this was
; not known until we tried to prove the formula for the paper.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  definedness-condition-for-subrp \\ \index{definedness-condition-for-subrp}
\=\+(({\it{fn\/}} $\not=$ {\tt{'}}{\tt{if}}) $\wedge$ {\rm{subrp}}\,({\it{fn\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{v\&c\$}}\,({\bf{t}}, {\rm{cons}}\,({\it{fn\/}}, {\it{args\/}}), {\it{a\/}}) $\leftrightarrow$ ({\bf{f}} $\not\in$ {\rm{v\&c\$}}\,({\tt{'}}{\tt{list}}, {\it{args\/}}, {\it{a\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  value-theorem-for-subrp-lemma \\ \index{value-theorem-for-subrp-lemma}
\=\+({\rm{caddr}}\,({\rm{strip-cars}}\,({\it{l\/}})) $=$ {\rm{caaddr}}\,({\it{l\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{strip-cars}}\,({\it{l\/}})) $=$ {\rm{caadr}}\,({\it{l\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{strip-cars}}\,({\it{l\/}})) $=$ {\rm{caar}}\,({\it{l\/}}))\-
\end{tabbing}

\begin{verbatim}; The following formula wasn't a theorem until we added the
; axiom (SUBRP 'QUOTE) = F.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  value-theorem-for-subrp \\ \index{value-theorem-for-subrp}
\=\+({\rm{subrp}}\,({\it{fn\/}}) $\wedge$ {\rm{v\&c\$}}\,({\bf{t}}, {\rm{cons}}\,({\it{fn\/}}, {\it{args\/}}), {\it{a\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\rm{cons}}\,({\it{fn\/}}, {\it{args\/}}), {\it{a\/}})) \\ 
$=$$\;\;\;\;${\rm{apply-subr}}\,({\it{fn\/}}, {\rm{strip-cars}}\,({\rm{v\&c\$}}\,({\tt{'}}{\tt{list}}, {\it{args\/}}, {\it{a\/}}))))\-\-
\end{tabbing}

\begin{verbatim}; !!! BUG.  I HAD TO ADD THE STRIP-CARS TO THE RHS BELOW!
; !!! BUG.  I HAD TO THE ADD THE FN /= 'QUOTE BELOW!

\end{verbatim}\begin{tabbing}{\sc Theorem}:  cost-theorem-for-non-subrp \\ \index{cost-theorem-for-non-subrp}
\=\+(({\it{fn\/}} $\not=$ {\tt{'}}{\tt{quote}}) $\wedge$ ($\neg$ {\rm{subrp}}\,({\it{fn\/}})) $\wedge$ {\rm{v\&c\$}}\,({\bf{t}}, {\rm{cons}}\,({\it{fn\/}}, {\it{args\/}}), {\it{a\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{cdr}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\rm{cons}}\,({\it{fn\/}}, {\it{args\/}}), {\it{a\/}})) \\ 
$>$$\;\;\;\;${\rm{cdr}}\,({\rm{v\&c\$}}\,(\=\+{\bf{t}}, \\ 
{\rm{body}}\,({\it{fn\/}}), \\ 
{\rm{pairlist}}\,(\=\+{\rm{formals}}\,({\it{fn\/}}), \\ 
{\rm{strip-cars}}\,({\rm{v\&c\$}}\,({\tt{'}}{\tt{list}}, {\it{args\/}}, {\it{a\/}})))\-)\-))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  append1-is-tame \\ \index{append1-is-tame}
\=\+({\rm{v\&c\$}}\,({\bf{t}}, {\it{u\/}}, {\it{a\/}}) $\wedge$ {\rm{v\&c\$}}\,({\bf{t}}, {\it{v\/}}, {\it{a\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\rm{list}}\,({\tt{'}}{\tt{append1}}, {\it{u\/}}, {\it{v\/}}), {\it{a\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\rm{list}}\,({\tt{'}}{\tt{append1}}, {\it{u\/}}, {\it{v\/}}), {\it{a\/}})) \\ 
$=$$\;\;\;\;${\rm{append}}\,({\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\it{u\/}}, {\it{a\/}})), {\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\it{v\/}}, {\it{a\/}}))))\-)\-\-
\end{tabbing}
                
\begin{verbatim}; We now prove that REVERSE is TAMEP from the fact that APPEND is.
; Once again, we introduce REVERSE1 so as not to use the built-in
; TAMEP rules.

; It was in this proof that we learned that it is better to consider
;      (V&C-APPLY 'APPEND1 (LIST VC1 VC2))
; than
;      (V&C-APPLY 'APPEND1 (LIST (CONS A C1) (CONS B C2))).
; Our first use of V&C-APPLY$ in these basic lemmas contained CONSes
; as shown above.  This made the induction hint easier because we could
; instantiate A with (CDR A), C1 with 1, etc., instead of using that
; horrid CONS.  Unfortunately, no term of the form
;      (V&C-APPLY 'APPEND1 (LIST (CONS A C1) (CONS B C2))).
; arises when proving facts about 'REVERSE1 because the 'APPEND1 call in 'REVERSE1
; becomes
;      (V&C-APPLY 'APPEND1 (LIST (V&C-APPLY$ 'REVERSE1 &) &))
; where (V&C-APPLY$ 'REVERSE1 ...) is known to be LISTP.  Therefore, we
; phrase our basic lemmas in the form shown:
;      (V&C-APPLY 'APPEND1 (LIST VC1 VC2))


\end{verbatim}\begin{tabbing}{\sc Definition}:\index{reverse1} \\  
\=\+{\rm{reverse1}}\,({\it{x\/}})\index{reverse1} \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\tt{'}}{\tt{(}}\=\+{\tt{if}} \\ 
{\tt{(}}{\tt{listp}}{\tt{ }}{\tt{x}}{\tt{)}} \\ 
{\tt{(}}\=\+{\tt{append1}} \\ 
{\tt{(}}{\tt{reverse1}}{\tt{ }}{\tt{(}}{\tt{cdr}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{)}} \\ 
{\tt{(}}{\tt{cons}}{\tt{ }}{\tt{(}}{\tt{car}}{\tt{ }}{\tt{x}}{\tt{)}}{\tt{ }}{\tt{'}}{\tt{nil}}{\tt{)}}{\tt{)}}\- \\ 
{\tt{'}}{\tt{nil}}{\tt{)}}\-, \\ 
{\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{reverse1-induction-hint} \\  
\=\+{\rm{reverse1-induction-hint}}\,({\it{vc\/}})\index{reverse1-induction-hint} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\rm{car}}\,({\it{vc\/}}))$\;\;${\bf then }{\rm{reverse1-induction-hint}}\,({\rm{cons}}\,({\rm{cdr}}\,({\rm{car}}\,({\it{vc\/}})), {\tt{1}}))\index{reverse1-induction-hint} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  reverse1-is-tamep-and-reverse--apply-version \\ \index{reverse1-is-tamep-and-reverse--!apply-version}
\=\+({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{reverse1}}, {\rm{list}}\,({\it{vc\/}})) $\leftrightarrow$ {\it{vc\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{car}}\,({\rm{v\&c-apply\$}}\,({\tt{'}}{\tt{reverse1}}, {\rm{list}}\,({\it{vc\/}}))) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{vc\/}}$\;\;${\bf then }{\rm{reverse}}\,({\rm{car}}\,({\it{vc\/}}))\index{reverse} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  reverse1-x-is-tamep \\ \index{reverse1-x-is-tamep}
\=\+{\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{reverse1}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}}))) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{v\&c\$}}\,({\bf{t}}, {\tt{'}}{\tt{(}}{\tt{reverse1}}{\tt{ }}{\tt{x}}{\tt{)}}, {\rm{list}}\,({\rm{cons}}\,({\tt{'}}{\tt{x}}, {\it{x\/}})))) $=$ {\rm{reverse}}\,({\it{x\/}})\index{reverse})\-
\end{tabbing}

\begin{verbatim}; Section 6.  EVAL and APPLY

; The use of FREE-VARS in the paper suggests it is a fn of one argument,
; but it actually is mutually recursive with FREE-VARS-LIST and we handle
; it in the expected way.  I don't bother to define the one argument
; sugar coating and prove theorems more general than those given in the
; paper.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{free-vars} \\  
\=\+{\rm{free-vars}}\,({\it{flg\/}}, {\it{x\/}})\index{free-vars} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{flg\/}} $=$ {\tt{'}}{\tt{list}} \\ 
{\bf then }\=\+{\bf if }{\it{x\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{free-vars}}\,({\bf{t}}, {\rm{car}}\,({\it{x\/}}))\index{free-vars} $\cup$ {\rm{free-vars}}\,({\tt{'}}{\tt{list}}, {\rm{cdr}}\,({\it{x\/}}))\index{free-vars}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{litatom}}\,({\it{x\/}})$\;\;${\bf then }{\rm{cons}}\,({\it{x\/}}, {\bf{nil}}) \\ 
{\bf elseif }{\it{x\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{quote}}$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{free-vars}}\,({\tt{'}}{\tt{list}}, {\rm{cdr}}\,({\it{x\/}}))\index{free-vars}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-union \\ \index{member-union}
({\it{a\/}} $\in$ ({\it{x\/}} $\cup$ {\it{y\/}})) $=$ (({\it{a\/}} $\in$ {\it{x\/}}) $\vee$ ({\it{a\/}} $\in$ {\it{y\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  irrelevant-bindings-can-be-deleted \\ \index{irrelevant-bindings-can-be-delete!d}
\=\+({\it{v\/}} $\not\in$ {\rm{free-vars}}\,({\it{flg\/}}, {\it{x\/}})\index{free-vars}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{eval\$}}\,({\it{flg\/}}, {\it{x\/}}, {\rm{cons}}\,({\rm{cons}}\,({\it{v\/}}, {\it{val\/}}), {\it{a\/}})) $=$ {\rm{eval\$}}\,({\it{flg\/}}, {\it{x\/}}, {\it{a\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{substitute} \\  
\=\+{\rm{substitute}}\,({\it{x\/}}, {\it{y\/}}, {\it{flg\/}}, {\it{z\/}})\index{substitute} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{flg\/}} $=$ {\tt{'}}{\tt{list}} \\ 
{\bf then }\=\+{\bf if }{\it{z\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{cons}}\,(\=\+{\rm{substitute}}\,({\it{x\/}}, {\it{y\/}}, {\bf{t}}, {\rm{car}}\,({\it{z\/}}))\index{substitute}, \\ 
{\rm{substitute}}\,({\it{x\/}}, {\it{y\/}}, {\tt{'}}{\tt{list}}, {\rm{cdr}}\,({\it{z\/}}))\index{substitute})\-$\;${\bf  endif}\- \\ 
{\bf elseif }{\it{y\/}} $=$ {\it{z\/}}$\;\;${\bf then }{\it{x\/}} \\ 
{\bf elseif }{\rm{litatom}}\,({\it{z\/}})$\;\;${\bf then }{\it{z\/}} \\ 
{\bf elseif }{\it{z\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\it{z\/}} \\ 
{\bf elseif }{\rm{car}}\,({\it{z\/}}) $=$ {\tt{'}}{\tt{quote}}$\;\;${\bf then }{\it{z\/}} \\ 
{\bf else }{\rm{cons}}\,({\rm{car}}\,({\it{z\/}}), {\rm{substitute}}\,({\it{x\/}}, {\it{y\/}}, {\tt{'}}{\tt{list}}, {\rm{cdr}}\,({\it{z\/}}))\index{substitute})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; I interchanged the names of X and Y in transcribing this theorem
; to bring them into accordance with the names used in the defn above.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  substitution-of-equal-eval\$s \\ \index{substitution-of-equal-eval\$s}
\=\+({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\it{y\/}}, {\it{a\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{eval\$}}\,({\it{flg\/}}, {\rm{substitute}}\,({\it{x\/}}, {\it{y\/}}, {\it{flg\/}}, {\it{z\/}})\index{substitute}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\it{flg\/}}, {\it{z\/}}, {\it{a\/}}))\-
\end{tabbing}

\begin{verbatim}; Section 8.  Theorems about Quantifiers

; The following lemmas suggest an improvement to TYPE-SET.
; These lemmas are not mentioned in the paper but some are
; used in subsequent proofs.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  for-always-is-boolean \\ \index{for-always-is-boolean}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{y\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{always}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{y\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{always}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\bf{t}})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-exists-is-boolean \\ \index{for-exists-is-boolean}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{y\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{y\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\bf{t}})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  numberp-for-sum \\ \index{numberp-for-sum}
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{y\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{sum}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- $\in\;${\bf{N}}${}$
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  numberp-for-multiply \\ \index{numberp-for-multiply}
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{y\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{multiply}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- $\in\;${\bf{N}}${}$
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  numberp-for-count \\ \index{numberp-for-count}
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{y\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{count}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- $\in\;${\bf{N}}${}$
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  numberp-for-max \\ \index{numberp-for-max}
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{y\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{max}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- $\in\;${\bf{N}}${}$
\end{tabbing}

\begin{verbatim}; Now I begin the classical quantifier theorems...

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

\begin{tabbing}{\sc Theorem}:  for-append-collect \\ \index{for-append-collect}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{collect}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{append}}\,(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{collect}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{collect}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-append-count \\ \index{for-append-count}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{count}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{count}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$+$$\;\;\;\;${\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{count}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-append-add-to-set \\ \index{for-append-add-to-set}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{add-to-set}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{add-to-set}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$\cup$$\;\;\;\;${\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{add-to-set}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-append-do-return \\ \index{for-append-do-return}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{do-return}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{cond\/}}, \\ 
{\it{alist\/}})\- \\ 
{\bf then }{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{do-return}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
{\bf else }{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{do-return}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};  I am going to prove this by proving each case separately and
;  then combining them...

;(PROVE-LEMMA FOR-APPEND-ALWAYS-MAX-EXISTS-SUM-APPEND-MULTIPLY-UNION NIL
;  (IMPLIES (MEMBER OP '(ALWAYS MAX EXISTS SUM
;                               APPEND MULTIPLY UNION))
;           (EQUAL
;             (FOR X (APPEND A B) COND OP BODY ALIST)
;             (QUANTIFIER-OPERATION OP
;                                   (FOR X A COND OP BODY ALIST)
;                                   (FOR X B COND OP BODY ALIST)))))

\end{verbatim}\begin{tabbing}{\sc Theorem}:  for-append-always \\ \index{for-append-always}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{always}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{quantifier-operation}}\,(\=\+{\tt{'}}{\tt{always}}, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{always}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{always}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-append-max \\ \index{for-append-max}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{max}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{quantifier-operation}}\,(\=\+{\tt{'}}{\tt{max}}, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{max}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{max}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-append-exists \\ \index{for-append-exists}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{quantifier-operation}}\,(\=\+{\tt{'}}{\tt{exists}}, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-append-sum \\ \index{for-append-sum}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{sum}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{quantifier-operation}}\,(\=\+{\tt{'}}{\tt{sum}}, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{sum}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{sum}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-append-append \\ \index{for-append-append}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{append}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{quantifier-operation}}\,(\=\+{\tt{'}}{\tt{append}}, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{append}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{append}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  assoc-of-times \\ \index{assoc-of-times}
(({\it{i\/}} $*$ {\it{j\/}}) $*$ {\it{k\/}}) $=$ ({\it{i\/}} $*$ ({\it{j\/}} $*$ {\it{k\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-append-multiply \\ \index{for-append-multiply}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{multiply}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{quantifier-operation}}\,(\=\+{\tt{'}}{\tt{multiply}}, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{multiply}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{multiply}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  assoc-of-union \\ \index{assoc-of-union}
(({\it{a\/}} $\cup$ {\it{b\/}}) $\cup$ {\it{c\/}}) $=$ ({\it{a\/}} $\cup$ ({\it{b\/}} $\cup$ {\it{c\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-append-union \\ \index{for-append-union}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{union}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{quantifier-operation}}\,(\=\+{\tt{'}}{\tt{union}}, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{union}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{union}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-append-always-max-exists-sum-append-multiply-union \\ \index{for-append-always-max-exists-su!m-append-multiply-union}
\=\+({\it{op\/}} $\in$ {\tt{'}}{\tt{(}}{\tt{always}}{\tt{ }}{\tt{max}}{\tt{ }}{\tt{exists}}{\tt{ }}{\tt{sum}}{\tt{ }}{\tt{append}}{\tt{ }}{\tt{multiply}}{\tt{ }}{\tt{union}}{\tt{)}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\rm{append}}\,({\it{a\/}}, {\it{b\/}}), \\ 
{\it{cond\/}}, \\ 
{\it{op\/}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{quantifier-operation}}\,(\=\+{\it{op\/}}, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{a\/}}, \\ 
{\it{cond\/}}, \\ 
{\it{op\/}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{b\/}}, \\ 
{\it{cond\/}}, \\ 
{\it{op\/}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-sum-plus \\ \index{for-sum-plus}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{sum}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{plus}}, {\it{g\/}}, {\it{h\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{sum}}, \\ 
{\it{g\/}}, \\ 
{\it{alist\/}})\- \\ 
$+$$\;\;\;\;${\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{sum}}, \\ 
{\it{h\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  times-0 \\ \index{times-0}
({\it{y\/}} $\simeq {\tt{0}}$) $\rightarrow$ (({\it{x\/}} $*$ {\it{y\/}}) $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  times-add1 \\ \index{times-add1}
({\it{x\/}} $*$ ($1\;+$ {\it{y\/}})) $=$ ({\it{x\/}} $+$ ({\it{x\/}} $*$ {\it{y\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  commut-of-times \\ \index{commut-of-times}
({\it{x\/}} $*$ {\it{y\/}}) $=$ ({\it{y\/}} $*$ {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  commut2-of-times \\ \index{commut2-of-times}
({\it{x\/}} $*$ ({\it{y\/}} $*$ {\it{z\/}})) $=$ ({\it{y\/}} $*$ ({\it{x\/}} $*$ {\it{z\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-multiply-times \\ \index{for-multiply-times}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{multiply}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{times}}, {\it{g\/}}, {\it{h\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{multiply}}, \\ 
{\it{g\/}}, \\ 
{\it{alist\/}})\- \\ 
$*$$\;\;\;\;${\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{multiply}}, \\ 
{\it{h\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-always-and \\ \index{for-always-and}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{always}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{and}}, {\it{g\/}}, {\it{h\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{always}}, \\ 
{\it{g\/}}, \\ 
{\it{alist\/}})\- \\ 
$\wedge$$\;\;\;\;${\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{always}}, \\ 
{\it{h\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-exists-or \\ \index{for-exists-or}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{or}}, {\it{g\/}}, {\it{h\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{g\/}}, \\ 
{\it{alist\/}})\- \\ 
$\vee$$\;\;\;\;${\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{h\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  unused-indicial-can-be-dropped-from-body \\ \index{unused-indicial-can-be-dropped-!from-body}
\=\+({\it{x\/}} $\not\in$ {\rm{free-vars}}\,({\bf{t}}, {\it{body\/}})\index{free-vars}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\it{op\/}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\it{op\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\rm{eval\$}}\,({\bf{t}}, {\it{body\/}}, {\it{alist\/}})), \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  unused-indicial-can-be-dropped-from-cond \\ \index{unused-indicial-can-be-dropped-!from-cond}
\=\+({\it{x\/}} $\not\in$ {\rm{free-vars}}\,({\bf{t}}, {\it{cond\/}})\index{free-vars}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\it{op\/}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\rm{eval\$}}\,({\bf{t}}, {\it{cond\/}}, {\it{alist\/}})), \\ 
{\it{op\/}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-sum-constant \\ \index{for-sum-constant}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{sum}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\it{body\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$({\it{body\/}} $*$ {\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\tt{'}}{\tt{count}}, \\ 
{\it{cond\/}}, \\ 
{\it{alist\/}})\-)\-
\end{tabbing}

\begin{verbatim}; The following theorems about constant bodies are proved
; but not mentioned in the paper.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  for-count-constant \\ \index{for-count-constant}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\tt{'}}{\tt{count}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\it{body\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{body\/}}$\;\;${\bf then }{\rm{length}}\,({\it{r\/}})\index{length} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{exp} \\  
\=\+{\rm{exp}}\,({\it{i\/}}, {\it{j\/}})\index{exp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{j\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\tt{1}} \\ 
{\bf else }{\it{i\/}} $*$ {\rm{exp}}\,({\it{i\/}}, {\it{j\/}} $-\;1$)\index{exp}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  for-multiply-constant \\ \index{for-multiply-constant}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{multiply}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\it{body\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{exp}}\,(\=\+{\it{body\/}}, \\ 
{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\tt{'}}{\tt{count}}, \\ 
{\it{cond\/}}, \\ 
{\it{alist\/}})\-)\-\index{exp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  max-constant \\ \index{max-constant}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{max}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\it{body\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{cond\/}}, \\ 
{\it{alist\/}})\-$\;\;${\bf then }{\rm{fix}}\,({\it{body\/}}) \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; The next two lemmas are interesting hacks.  Consider EXISTS-CONSTANT
; below.  The first rewrite rule in it applies to
; quoted bodies and moves the arbitrary cond into the body of a new
; exists.  This would loop forever by itself if the cond were itself
; quoted.  However, to stop that loop we prove the second rewrite rule
; which addresses itself only to the case of a quoted body and a true
; cond clause.  The second rule could not be proved as a separate
; event after the first because the first makes it loop forever.
; If the second is proved before the first, the resulting set of
; rewrite rules loops forever because the first one -- proved last --
; has priority.  By proving them simultaneously and putting the second
; rule into the second conjunct we arrange for it to be the first
; of the two rules tried and for it to be proved before the other rule
; is available.  Crock, Crock, Crock.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  always-constant \\ \index{always-constant}
\=\+(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{always}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\it{body\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$({\it{body\/}} $\vee$ {\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\tt{'}}{\tt{always}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{not}}, {\it{cond\/}}), \\ 
{\it{alist\/}})\-))\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\tt{'}}{\tt{always}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\it{body\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$({\it{body\/}} $\vee$ ({\it{r\/}} $\simeq\;${{\bf{nil}}}${}$)))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  exists-constant \\ \index{exists-constant}
\=\+(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\it{body\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$({\it{body\/}} $\wedge$ {\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{cond\/}}, \\ 
{\it{alist\/}})\-))\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\it{body\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$({\it{body\/}} $\wedge$ {\rm{listp}}\,({\it{r\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  add-to-set-constant \\ \index{add-to-set-constant}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{add-to-set}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\it{body\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{cond\/}}, \\ 
{\it{alist\/}})\-$\;\;${\bf then }{\rm{list}}\,({\it{body\/}}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  do-return-constant \\ \index{do-return-constant}
\=\+{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\it{cond\/}}, \\ 
{\tt{'}}{\tt{do-return}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\it{body\/}}), \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{for}}\,(\=\+{\it{x\/}}, \\ 
{\it{r\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{cond\/}}, \\ 
{\it{alist\/}})\-$\;\;${\bf then }{\it{body\/}} \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; The only quantifiers for which we do not have a theorem about
; a quoted body are APPEND COLLECT and UNION for which I could not
; think of a lemma.



; The next three are not mentioned in the paper but are
; our versions of classical theorems.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  always-in-particular \\ \index{always-in-particular}
\=\+(\=\+({\it{z\/}} $\in$ {\it{a\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{litatom}}\,({\it{v\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{for}}\,(\=\+{\it{v\/}}, \\ 
{\it{a\/}}, \\ 
{\tt{'}}{\tt{'}}{\tt{t}}, \\ 
{\tt{'}}{\tt{always}}, \\ 
{\it{x\/}}, \\ 
{\it{al\/}})\-)\- \\ 
$\rightarrow$$\;\;\;\;${\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\rm{cons}}\,({\rm{cons}}\,({\it{v\/}}, {\it{z\/}}), {\it{al\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  exists-in-particular \\ \index{exists-in-particular}
\=\+(({\it{z\/}} $\in$ {\it{a\/}}) $\wedge$ {\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\rm{cons}}\,({\rm{cons}}\,({\it{v\/}}, {\it{z\/}}), {\it{al\/}})) $\wedge$ {\rm{litatom}}\,({\it{v\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{for}}\,(\=\+{\it{v\/}}, \\ 
{\it{a\/}}, \\ 
{\tt{'}}{\tt{'}}{\tt{t}}, \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\it{x\/}}, \\ 
{\it{al\/}})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  exists-vs-always \\ \index{exists-vs-always}
\=\+{\rm{for}}\,(\=\+{\it{v\/}}, \\ 
{\it{a\/}}, \\ 
{\it{c\/}}, \\ 
{\tt{'}}{\tt{always}}, \\ 
{\it{x\/}}, \\ 
{\it{al\/}})\- \\ 
$=$$\;\;\;\;$($\neg$ {\rm{for}}\,(\=\+{\it{v\/}}, \\ 
{\it{a\/}}, \\ 
{\it{c\/}}, \\ 
{\tt{'}}{\tt{exists}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{not}}, {\it{x\/}}), \\ 
{\it{al\/}})\-)\-
\end{tabbing}

\begin{verbatim}; Now I move on to the simple theorems about FOLDR.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{foldr} \\  
\=\+{\rm{foldr}}\,({\it{op\/}}, {\it{k\/}}, {\it{lst\/}})\index{foldr} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{lst\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\it{k\/}} \\ 
{\bf else }{\rm{apply\$}}\,({\it{op\/}}, {\rm{list}}\,({\rm{car}}\,({\it{lst\/}}), {\rm{foldr}}\,({\it{op\/}}, {\it{k\/}}, {\rm{cdr}}\,({\it{lst\/}}))\index{foldr}))$\;${\bf  endif}\-\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  foldr-cons-is-append \\ \index{foldr-cons-is-append}
{\rm{foldr}}\,({\tt{'}}{\tt{cons}}, {\it{b\/}}, {\it{a\/}})\index{foldr} $=$ {\rm{append}}\,({\it{a\/}}, {\it{b\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  foldr-and-t-is-for-always \\ \index{foldr-and-t-is-for-always}
\=\+{\rm{foldr}}\,({\tt{'}}{\tt{and}}, {\bf{t}}, {\it{lst\/}})\index{foldr} \\ 
$=$$\;\;\;\;$\=\+{\bf for }{\it{p\/}}{\bf $\;$ in }{\it{lst\/}} \\ 
{\bf always} {\it{p\/}}$\;${{\bf  endfor}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  foldr-or-f-is-for-exists \\ \index{foldr-or-f-is-for-exists}
\=\+{\rm{foldr}}\,({\tt{'}}{\tt{or}}, {\bf{f}}, {\it{lst\/}})\index{foldr} \\ 
$=$$\;\;\;\;$\=\+{\bf for }{\it{p\/}}{\bf $\;$ in }{\it{lst\/}} \\ 
{\bf exists} {\it{p\/}}$\;${{\bf  endfor}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  foldr-plus-0-is-for-sum \\ \index{foldr-plus-0-is-for-sum}
\=\+{\rm{foldr}}\,({\tt{'}}{\tt{plus}}, {\tt{0}}, {\it{lst\/}})\index{foldr} \\ 
$=$$\;\;\;\;$\=\+{\bf for }{\it{x\/}}{\bf $\;$ in }{\it{lst\/}} \\ 
{\bf sum} {\it{x\/}}$\;${{\bf  endfor}}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  foldr-times-1-is-for-multiply \\ \index{foldr-times-1-is-for-multiply}
\=\+{\rm{foldr}}\,({\tt{'}}{\tt{times}}, {\tt{1}}, {\it{lst\/}})\index{foldr} \\ 
$=$$\;\;\;\;$\=\+{\bf for }{\it{x\/}}{\bf $\;$ in }{\it{lst\/}} \\ 
{\bf multiply} {\it{x\/}}$\;${{\bf  endfor}}\-\-
\end{tabbing}


\begin{verbatim}; Section 10.  Proof of the Binomial Theorem

; In the proof we cite a more general quantifier manipulation
; lemma than we actually used in the binomial proof.  I prove
; it here.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{from-to} \\  
\=\+{\rm{from-to}}\,({\it{i\/}}, {\it{j\/}})\index{from-to} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{j\/}} $<$ {\it{i\/}}$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }{\rm{fix}}\,({\it{i\/}}) $=$ {\rm{fix}}\,({\it{j\/}})$\;\;${\bf then }{\rm{list}}\,({\rm{fix}}\,({\it{j\/}})) \\ 
{\bf else }{\rm{append}}\,({\rm{from-to}}\,({\it{i\/}}, {\it{j\/}} $-\;1$)\index{from-to}, {\rm{list}}\,({\it{j\/}}))$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-substitute \\ \index{eval\$-substitute}
\=\+{\rm{litatom}}\,({\it{v\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{eval\$}}\,({\it{flg\/}}, {\rm{substitute}}\,({\it{form\/}}, {\it{v\/}}, {\it{flg\/}}, {\it{body\/}})\index{substitute}, {\it{alist\/}}) \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,({\it{flg\/}}, {\it{body\/}}, {\rm{cons}}\,({\rm{cons}}\,({\it{v\/}}, {\rm{eval\$}}\,({\bf{t}}, {\it{form\/}}, {\it{alist\/}})), {\it{alist\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  redundant-binding-can-be-deleted \\ \index{redundant-binding-can-be-delete!d}
\=\+{\rm{eval\$}}\,({\it{flg\/}}, {\it{x\/}}, {\rm{cons}}\,({\rm{cons}}\,({\it{v\/}}, {\it{val1\/}}), {\rm{cons}}\,({\rm{cons}}\,({\it{v\/}}, {\it{val2\/}}), {\it{alist\/}}))) \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,({\it{flg\/}}, {\it{x\/}}, {\rm{cons}}\,({\rm{cons}}\,({\it{v\/}}, {\it{val1\/}}), {\it{alist\/}}))\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  down-shift-from-to \\ \index{down-shift-from-to}
\=\+(({\it{j\/}} $\not\simeq {\tt{0}}$) $\wedge$ ({\it{k\/}} $\not\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{down-shift}}\,({\rm{from-to}}\,({\it{j\/}}, {\it{k\/}})\index{from-to})\index{down-shift} $=$ {\rm{from-to}}\,({\it{j\/}} $-\;1$, {\it{k\/}} $-\;1$)\index{from-to})\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{all-non-zerop} \\  
\=\+{\rm{all-non-zerop}}\,({\it{l\/}})\index{all-non-zerop} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{l\/}})$\;\;${\bf then }({\rm{car}}\,({\it{l\/}}) $\not\simeq {\tt{0}}$) $\wedge$ {\rm{all-non-zerop}}\,({\rm{cdr}}\,({\it{l\/}}))\index{all-non-zerop} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-non-zerop-append \\ \index{all-non-zerop-append}
{\rm{all-non-zerop}}\,({\rm{append}}\,({\it{a\/}}, {\it{b\/}}))\index{all-non-zerop} $=$ ({\rm{all-non-zerop}}\,({\it{a\/}})\index{all-non-zerop} $\wedge$ {\rm{all-non-zerop}}\,({\it{b\/}})\index{all-non-zerop})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-non-zerop-from-to \\ \index{all-non-zerop-from-to}
({\it{j\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ {\rm{all-non-zerop}}\,({\rm{from-to}}\,({\it{j\/}}, {\it{k\/}})\index{from-to})\index{all-non-zerop}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  down-shift-for \\ \index{down-shift-for}
\=\+({\rm{litatom}}\,({\it{v\/}}) $\wedge$ {\rm{all-non-zerop}}\,({\it{l\/}})\index{all-non-zerop}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{v\/}}, \\ 
{\rm{down-shift}}\,({\it{l\/}})\index{down-shift}, \\ 
{\rm{substitute}}\,({\rm{list}}\,({\tt{'}}{\tt{add1}}, {\it{v\/}}), {\it{v\/}}, {\bf{t}}, {\it{cond\/}})\index{substitute}, \\ 
{\it{op\/}}, \\ 
{\rm{substitute}}\,({\rm{list}}\,({\tt{'}}{\tt{add1}}, {\it{v\/}}), {\it{v\/}}, {\bf{t}}, {\it{body\/}})\index{substitute}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{for}}\,(\=\+{\it{v\/}}, \\ 
{\it{l\/}}, \\ 
{\it{cond\/}}, \\ 
{\it{op\/}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}

\begin{verbatim}; !!! BUG IN THE PAPER !!!
; The range shift theorem was wrong!  I needed to add that K also was
; not ZEROP.  If J=1 and K=0 then (FROM-TO J K) is NIL but
; (FROM-TO (SUB1 J) (SUB1 K)) is (FROM-TO 0 0) = '(0).

\end{verbatim}\begin{tabbing}{\sc Theorem}:  range-shift \\ \index{range-shift}
\=\+({\rm{litatom}}\,({\it{v\/}}) $\wedge$ ({\it{j\/}} $\not\simeq {\tt{0}}$) $\wedge$ ({\it{k\/}} $\not\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{for}}\,(\=\+{\it{v\/}}, \\ 
{\rm{from-to}}\,({\it{j\/}}, {\it{k\/}})\index{from-to}, \\ 
{\it{cond\/}}, \\ 
{\it{op\/}}, \\ 
{\it{body\/}}, \\ 
{\it{alist\/}})\- \\ 
$=$$\;\;\;\;${\rm{for}}\,(\=\+{\it{v\/}}, \\ 
{\rm{from-to}}\,({\it{j\/}} $-\;1$, {\it{k\/}} $-\;1$)\index{from-to}, \\ 
{\rm{substitute}}\,({\rm{list}}\,({\tt{'}}{\tt{add1}}, {\it{v\/}}), {\it{v\/}}, {\bf{t}}, {\it{cond\/}})\index{substitute}, \\ 
{\it{op\/}}, \\ 
{\rm{substitute}}\,({\rm{list}}\,({\tt{'}}{\tt{add1}}, {\it{v\/}}), {\it{v\/}}, {\bf{t}}, {\it{body\/}})\index{substitute}, \\ 
{\it{alist\/}})\-)\-\-
\end{tabbing}


%\end{list}
\printindex
\end{document}
