\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 John Cowles.  All Rights Reserved.

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

 NO WARRANTY

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

 IN NO EVENT WILL John Cowles 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};                   A brief introduction to the
;                   Boyer-Moore Theorem Prover
     
;                               by
;                         John R. Cowles
       

;  The theorem prover is a computer program, written in Common Lisp and
;  about one million characters long, under continuous development since
;  1971 by B.S. Boyer and J S. Moore.  The purpose of the program is to
;  mechanize a mathematical logic suitable for the study of computation.

;  Some data types such as the nonnegative integers and the Boolean truth
;  values are built into the prover.  The user may add new recursively
;  defined data types and recursively defined functions on such data
;  types as well as prove theorems.  The prover specializes in induction
;  proofs.

;  The prover uses the prefix syntax of Lisp.  For example, the prover
;  uses (PLUS x y) where others might use PLUS( x,y ) or x + y.

;  As an example, the prover is given the task of proving the following.
      
;                   The SUM, from k=0 to n, of k*k!  
;                                equals  
;                              (n+1)! - 1.

;  First the theorem prover is initialized and arrangements are made to
;  record the proof as well as other useful information in files by the
;  command (BOOT-STRAP NQTHM) executed at the start of this file.

;  Recursively define a function that computes n!.

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

\begin{verbatim};  Recursively define a function, called SUM<K*FACT_K>, that computes the
;  sum on the left side of the equation given above.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{sum$<$k*fact\_k$>$} \\  
\=\+{\rm{sum$<$k*fact\_k$>$}}\,({\it{n\/}})\index{sum$<$k*fact\_k$>$} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{sum$<$k*fact\_k$>$}}\,({\it{n\/}} $-\;1$)\index{sum$<$k*fact\_k$>$} $+$ ({\it{n\/}} $*$ {\rm{fact}}\,({\it{n\/}})\index{fact})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};  The formal argument of each of these functions is N.  The functions
;  IF, ZEROP, TIMES, SUB1, PLUS, FACT, and SUM<K*FACT_K> give the
;  following results when y and z are nonnegative integers.

;      (IF x y z)  returns  y  if x <> false
;                           z  if x =  false

;      (ZEROP y)  returns  true  if y =  0
;                          false if y <> 0

;      (TIMES y z)  returns  y * z

;      (SUB1 y)   returns  y - 1  if y > 0
;                          0      if y = 0

;      (PLUS y z)  returns  y + z

;      (FACT y)  returns  y!

;      (SUM<K*FACT_K> y)  returns  the SUM, from k=0 to y, of k*k!

;  Before the prover will accept these proposed recursive definitions for
;  the functions, FACT and SUM<K*FACT_K>, the recursion must be proved to
;  terminate.  That is, the prover verifies that functions actually exist
;  that satisfy the proposed definitions.

;  Next the prover is asked to prove the following trivial algebraic
;  modification of the theorem originally suggested above.

;                   The SUM, from k=0 to n, of k*k!
;                                plus 1 
; 
;                                equals
;  
;                                (n+1)!.

;  The results produced by the functions EQUAL and ADD1 are given below.

;      (EQUAL x y)  returns  true  if x =  y
;                            false if x <> y

;      (ADD1 y)  returns  y + 1 


\end{verbatim}\begin{tabbing}{\sc Theorem}:  sum$<$k*fact\_k$>$+1=fact$<$n+1$>$ \\ \index{sum$<$k*fact\_k$>$+1=fact$<$n+1!$>$}
($1\;+$ {\rm{sum$<$k*fact\_k$>$}}\,({\it{n\/}})\index{sum$<$k*fact\_k$>$}) $=$ {\rm{fact}}\,($1\;+$ {\it{n\/}})\index{fact}
\end{tabbing}

\begin{verbatim};  After some simplification, the prover decides to use induction in the
;  proof of this lemma.

;  Now the prover is asked to prove the original version of the theorem.
;  The prover is informed that the theorem just proved is a useful hint.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  sum$<$k*fact\_k$>$=fact$<$n+1$>$-1 \\ \index{sum$<$k*fact\_k$>$=fact$<$n+1$>$!-1}
{\rm{sum$<$k*fact\_k$>$}}\,({\it{n\/}})\index{sum$<$k*fact\_k$>$} $=$ ({\rm{fact}}\,($1\;+$ {\it{n\/}})\index{fact} $-\;1$)
\end{tabbing}

\begin{verbatim};  With the hint, the prover has no trouble completing the proof.

;  The previous two lemmas together produce a proof by induction which
;  should be easy to follow by a person new to the theorem prover.
;  However, the hint is not needed by the prover to complete the proof of
;  the original theorem.  Let's start over and this time let the prover
;  work directly on the last lemma without first proving the first lemma.

\end{verbatim}
\noindent{\sc Event}:   Undo back through the event named `sum$<$k*fact\_k$>$+1=fact$<$n+1$>$'.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  sum$<$k*fact\_k$>$=fact$<$n+1$>$-1 \\ \index{sum$<$k*fact\_k$>$=fact$<$n+1$>$!-1}
{\rm{sum$<$k*fact\_k$>$}}\,({\it{n\/}})\index{sum$<$k*fact\_k$>$} $=$ ({\rm{fact}}\,($1\;+$ {\it{n\/}})\index{fact} $-\;1$)
\end{tabbing}

\begin{verbatim};  This produces a mechanical proof that is much longer and no doubt more
;  mysterious to a new user of the prover.  It is also more interesting.
;  There is an induction inside an induction, some use of elimination,
;  and also some generalization.  The details of the theorem prover,
;  including induction, elimination, and generalization, are explained in:
;  R.S. Boyer and J S. Moore, A Computational Logic Handbook. Academic
;  Press, San Diego, 1988.


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