\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 Computational Logic, Inc.  All Rights Reserved.

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

 NO WARRANTY

 Computational Logic, Inc. 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 Computational Logic, Inc. 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.
|#

; Matt Kaufmann, William R. Bevier, and Matt Wilding

\end{verbatim}
\noindent{\sc Event}:   Start with the library {\tt{"naturals"}} using the compiled version.

\addvspace{18pt}

\begin{verbatim};; from /disk1/wilding/nums/integers.events.

;; 15 January 91 version by Matt Wilding.  Includes all of the
;; Matt Kaufmann's library's functionality, plus various additional
;; facts and numerous tiny changes, mostly having to do with igcd
;; and irem.

;; Several theories are set up:
;; integers  -  general integer strategy
;; integer-defns - integer definitions (does not include igcd)
;; nats-to-ints - rules that rewrite naturals to integers

;; By Matt Kaufmann, modified from earlier integer library of Bill
;; Bevier and Matt Wilding.  A few functions (even ILESSP) have
;; been changed, but I expect the functionality of this library to
;; include all the functionality of the old one in most or even all
;; cases.

;; Modified from /local/src/nqthm-libs/integers.events to get ILEQ
;; expressed in terms of ILESSP and IDIFFERENCE in terms of INEG and
;; IPLUS.  There are other changes too.  The highlights are the new
;; metalemmas.

;; I'm going to leave the eval$ rules on that are proved here, and
;; leave eval$ off.

;; My intention is that this library be used in a mode in which ILEQ
;; and IDIFFERENCE are left enabled.  Otherwise, the aforementioned
;; meta lemmas may not be very useful, and also a number of additional
;; replacement rules may be needed.

;; There are three theories created by this library.  INTEGER-DEFNS is
;; a list of definitions of all integer functions (not including the
;; cancellation metafunctions and their auxiliaries, though), except
;; that ILEQ and IDIFFERENCE have been omitted.  This is a useful
;; theory for an ENABLE-THEORY hint when one simply wants to blast all
;; integer functions open, and it's also useful if one wants to close
;; them down with a DISABLE-THEORY hint (perhaps to go with an
;; (ENABLE-THEORY T) hint).  Second, ALL-INTEGER-DEFNS is the same as
;; INTEGER-DEFNS except that ILEQ and IDIFFERENCE are included in this
;; one.  Finally, INTEGERS is a list of all events to be "exported as
;; enabled" from this file when working in a mode where everything not
;; enabled by an ENABLE-THEORY hint is to be disabled.  Notice that
;; some rewrite rules have been included that might appear to be
;; unnecessary in light of the metalemmas; that's because metalemmas
;; only work on tame terms.  However, there's no guarantee that the
;; rewrite rules alone will prove very useful (on non-tame terms).
;; Also notice that INTEGER-DEFNS is disjoint from INTEGERS, since we
;; expect the basic definitions (other than ILEQ and IDIFFERENCE) to
;; remain disabled.

;; It's easy to see what I have and haven't placed in INTEGERS, since
;; I'll simply comment out the event names that I want to exclude (see
;; end of this file).

;; One might wish to consider changing (fix-int (minus ...)) in some
;; of the definitions below to (ineg ...).

;; The following meta rules are in this library.  
;; (A little documentation added by Matt Wilding July 90)
;; 
;; CORRECTNESS-OF-CANCEL-INEG
;;  cancel the first argument of an iplus term with a member of the second 
;;  argument.
;; 
;;  ex:  (iplus (ineg y) (iplus (ineg x) (iplus y z)))  
;;     -->
;;       (iplus (ineg x) (fix-int z))
;; 
;; CORRECTNESS-OF-CANCEL-IPLUS
;;  cancel the sides of an equality of iplus sums
;; 
;;  ex:  (equal (iplus x (iplus y z)) (iplus a (iplus z x)))
;;     -->
;;       (equal (fix-int y) (fix-int a))
;; 
;; CORRECTNESS-OF-CANCEL-IPLUS-ILESSP
;;  cancel the sides of an ilessp inequality of sums
;; 
;;  ex:  (ilessp (iplus x (iplus y z)) (iplus a (iplus z x)))
;;     -->
;;       (ilessp y a)
;; 
;; CORRECTNESS-OF-CANCEL-ITIMES
;;  cancel the sides of an equality of itimes products
;;  
;;  ex: (equal (itimes x (itimes y z)) (itimes a (itimes z x)))
;;     -->
;;      (if (equal (itimes x z) '0)
;;        t
;;        (equal (fix-int y) (fix-int a)))
;; 
;; CORRECTNESS-OF-CANCEL-ITIMES-ILESSP
;;  cancel the sides of an inequality of itimes products
;; 
;;  ex: (ilessp (itimes x (itimes y z)) (itimes a (itimes z x)))
;;     -->
;;      (if (ilessp (itimes x z) '0)
;;         (ilessp a y)
;;        (if (ilessp 0 (itimes x z))
;;           (ilessp y a)
;;           f))
;; 
;; CORRECTNESS-OF-CANCEL-ITIMES-FACTORS
;;  cancel factors in equality terms
;;  ex: (equal (iplus (itimes x y) x) (itimes z x))
;;     -->
;;      (if (equal (fix-int x) '0)
;;         t
;;        (equal (fix-int (plus y 1)) (fix-int z)))
;; 
;; CORRECTNESS-OF-CANCEL-ITIMES-ILESSP-FACTORS
;;  cancel factors in ilessp terms
;;  ex: (equal (iplus (itimes x y) x) (itimes z x))
;;     -->
;;      (if (ilessp x '0)
;;         (ilessp z (iplus y 1))
;;        (if (ilessp '0 x)
;;           (ilessp (iplus y '1) z)
;;          f))
;; 
;; CORRECTNESS-OF-CANCEL-FACTORS-0
;;  factor one side of equality when other side is constant 0
;; 
;;  ex: (equal (iplus x (itimes x y)) '0)
;;     -->
;;      (or (equal (fix-int (iplus '1 y)) '0)
;;          (equal (fix-int x) '0))
;; 
;; CORRECTNESS-OF-CANCEL-FACTORS-ILESSP-0
;;  factor one side of inequality when other side is constant 0
;; 
;;  ex: (ilessp (iplus x (itimes x y)) '0)
;;     -->
;;      (or (and (ilessp (iplus '1 y) '0)
;;               (ilessp '0 x))
;;          (and (ilessp '0 (iplus '1 y))
;;               (ilessp x '0)))
;; 
;; CORRECTNESS-OF-CANCEL-INEG-TERMS-FROM-EQUALITY
;;  rewrite equality to remove ineg terms
;; 
;;  ex: (equal (iplus (ineg x) (ineg y)) (iplus (ineg z) w))
;;     --> 
;;      (equal (fix-int z) (iplus x (iplus y w)))
;; 
;; CORRECTNESS-OF-CANCEL-INEG-TERMS-FROM-INEQUALITY
;;  rewrite inequalities to remove ineg terms
;; 
;;  ex: (ilessp (iplus (ineg x) (ineg y)) (iplus (ineg z) w))
;;     -->
;;      (ilessp (fix-int z) (iplus x (iplus y w)))


;;(note-lib "/local/src/nqthm-libs/naturals")

;;(compile-uncompiled-defns "xxx")

; --------------------------------------------------------------------------------
; Integers
; --------------------------------------------------------------------------------


#| The function below has no AND or OR, for efficiency
(defn integerp (x)
  (or (numberp x)
      (and (negativep x)
           (not (zerop (negative-guts x))))))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{integerp} \\  
\=\+{\rm{integerp}}\,({\it{x\/}})\index{integerp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\in\;${\bf{N}}${}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf elseif }{\rm{negativep}}\,({\it{x\/}})$\;\;${\bf then }{\rm{negative-guts}}\,({\it{x\/}}) $\not\simeq {\tt{0}}$ \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

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

\begin{verbatim};; Even though I'll include a definition for izerop here, I'll
;; often avoid using it.
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{izerop}$\;\;$
{\rm{izerop}}\,({\it{i\/}})\index{izerop} $=$ ({\rm{fix-int}}\,({\it{i\/}})\index{fix-int} $=$ {\tt{0}})
\end{tabbing}

\begin{verbatim}#| old version:
(defn izerop (i)
  (if (integerp i)
      (equal i 0)
      t))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{ilessp} \\  
\=\+{\rm{ilessp}}\,({\it{i\/}}, {\it{j\/}})\index{ilessp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{negativep}}\,({\it{i\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{negativep}}\,({\it{j\/}})$\;\;${\bf then }{\rm{negative-guts}}\,({\it{j\/}}) $<$ {\rm{negative-guts}}\,({\it{i\/}}) \\ 
{\bf elseif }{\it{i\/}} $=$ ($-$ {\tt{0}})$\;\;${\bf then }{\tt{0}} $<$ {\it{j\/}} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{negativep}}\,({\it{j\/}})$\;\;${\bf then }{\bf{f}} \\ 
{\bf else }{\it{i\/}} $<$ {\it{j\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{ileq}$\;\;$
{\rm{ileq}}\,({\it{i\/}}, {\it{j\/}})\index{ileq} $=$ ($\neg$ {\rm{ilessp}}\,({\it{j\/}}, {\it{i\/}})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{iplus} \\  
\=\+{\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{negativep}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{negativep}}\,({\it{y\/}}) \\ 
{\bf then }\=\+{\bf if }({\rm{negative-guts}}\,({\it{x\/}}) $\simeq {\tt{0}}$) $\wedge$ ({\rm{negative-guts}}\,({\it{y\/}}) $\simeq {\tt{0}}$)$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }$-$ ({\rm{negative-guts}}\,({\it{x\/}}) $+$ {\rm{negative-guts}}\,({\it{y\/}}))$\;${\bf  endif}\- \\ 
{\bf elseif }{\it{y\/}} $<$ {\rm{negative-guts}}\,({\it{x\/}})$\;\;${\bf then }$-$ ({\rm{negative-guts}}\,({\it{x\/}}) $-$ {\it{y\/}}) \\ 
{\bf else }{\it{y\/}} $-$ {\rm{negative-guts}}\,({\it{x\/}})$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{negativep}}\,({\it{y\/}}) \\ 
{\bf then }\=\+{\bf if }{\it{x\/}} $<$ {\rm{negative-guts}}\,({\it{y\/}})$\;\;${\bf then }$-$ ({\rm{negative-guts}}\,({\it{y\/}}) $-$ {\it{x\/}}) \\ 
{\bf else }{\it{x\/}} $-$ {\rm{negative-guts}}\,({\it{y\/}})$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}} $+$ {\it{y\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{ineg} \\  
\=\+{\rm{ineg}}\,({\it{x\/}})\index{ineg} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{negativep}}\,({\it{x\/}})$\;\;${\bf then }{\rm{negative-guts}}\,({\it{x\/}}) \\ 
{\bf elseif }{\it{x\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }$-$ {\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{idifference}$\;\;$
{\rm{idifference}}\,({\it{x\/}}, {\it{y\/}})\index{idifference} $=$ {\rm{iplus}}\,({\it{x\/}}, {\rm{ineg}}\,({\it{y\/}})\index{ineg})\index{iplus}
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{iabs} \\  
\=\+{\rm{iabs}}\,({\it{i\/}})\index{iabs} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{negativep}}\,({\it{i\/}})$\;\;${\bf then }{\rm{negative-guts}}\,({\it{i\/}}) \\ 
{\bf else }{\rm{fix}}\,({\it{i\/}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{itimes} \\  
\=\+{\rm{itimes}}\,({\it{i\/}}, {\it{j\/}})\index{itimes} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{negativep}}\,({\it{i\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{negativep}}\,({\it{j\/}})$\;\;${\bf then }{\rm{negative-guts}}\,({\it{i\/}}) $*$ {\rm{negative-guts}}\,({\it{j\/}}) \\ 
{\bf else }{\rm{fix-int}}\,($-$ ({\rm{negative-guts}}\,({\it{i\/}}) $*$ {\it{j\/}}))\index{fix-int}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{negativep}}\,({\it{j\/}})$\;\;${\bf then }{\rm{fix-int}}\,($-$ ({\it{i\/}} $*$ {\rm{negative-guts}}\,({\it{j\/}})))\index{fix-int} \\ 
{\bf else }{\it{i\/}} $*$ {\it{j\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{iquotient} \\  
\=\+{\rm{iquotient}}\,({\it{i\/}}, {\it{j\/}})\index{iquotient} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{fix-int}}\,({\it{j\/}})\index{fix-int} $=$ {\tt{0}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\rm{negativep}}\,({\it{i\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{negativep}}\,({\it{j\/}}) \\ 
{\bf then }\=\+{\bf if }({\rm{negative-guts}}\,({\it{i\/}}) ${}${\bf{mod}}${}$ {\rm{negative-guts}}\,({\it{j\/}})) $=$ {\tt{0}} \\ 
{\bf then }{\rm{negative-guts}}\,({\it{i\/}}) $\div$ {\rm{negative-guts}}\,({\it{j\/}}) \\ 
{\bf else }$1\;+$ ({\rm{negative-guts}}\,({\it{i\/}}) $\div$ {\rm{negative-guts}}\,({\it{j\/}}))$\;${\bf  endif}\- \\ 
{\bf elseif }({\rm{negative-guts}}\,({\it{i\/}}) ${}${\bf{mod}}${}$ {\it{j\/}}) $=$ {\tt{0}} \\ 
{\bf then }{\rm{fix-int}}\,($-$ ({\rm{negative-guts}}\,({\it{i\/}}) $\div$ {\it{j\/}}))\index{fix-int} \\ 
{\bf else }{\rm{fix-int}}\,($-$ ($1\;+$ ({\rm{negative-guts}}\,({\it{i\/}}) $\div$ {\it{j\/}})))\index{fix-int}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{negativep}}\,({\it{j\/}})$\;\;${\bf then }{\rm{fix-int}}\,($-$ ({\it{i\/}} $\div$ {\rm{negative-guts}}\,({\it{j\/}})))\index{fix-int} \\ 
{\bf else }{\it{i\/}} $\div$ {\it{j\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{iremainder} \\  
{\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder} $=$ {\rm{idifference}}\,({\it{i\/}}, {\rm{itimes}}\,({\it{j\/}}, {\rm{iquotient}}\,({\it{i\/}}, {\it{j\/}})\index{iquotient})\index{itimes})\index{idifference}
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{idiv} \\  
\=\+{\rm{idiv}}\,({\it{i\/}}, {\it{j\/}})\index{idiv} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{fix-int}}\,({\it{j\/}})\index{fix-int} $=$ {\tt{0}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\rm{negativep}}\,({\it{i\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{negativep}}\,({\it{j\/}})$\;\;${\bf then }{\rm{negative-guts}}\,({\it{i\/}}) $\div$ {\rm{negative-guts}}\,({\it{j\/}}) \\ 
{\bf elseif }({\rm{negative-guts}}\,({\it{i\/}}) ${}${\bf{mod}}${}$ {\it{j\/}}) $=$ {\tt{0}} \\ 
{\bf then }{\rm{fix-int}}\,($-$ ({\rm{negative-guts}}\,({\it{i\/}}) $\div$ {\it{j\/}}))\index{fix-int} \\ 
{\bf else }{\rm{fix-int}}\,($-$ ($1\;+$ ({\rm{negative-guts}}\,({\it{i\/}}) $\div$ {\it{j\/}})))\index{fix-int}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{negativep}}\,({\it{j\/}}) \\ 
{\bf then }\=\+{\bf if }({\it{i\/}} ${}${\bf{mod}}${}$ {\rm{negative-guts}}\,({\it{j\/}})) $=$ {\tt{0}} \\ 
{\bf then }{\rm{fix-int}}\,($-$ ({\it{i\/}} $\div$ {\rm{negative-guts}}\,({\it{j\/}})))\index{fix-int} \\ 
{\bf else }{\rm{fix-int}}\,($-$ ($1\;+$ ({\it{i\/}} $\div$ {\rm{negative-guts}}\,({\it{j\/}}))))\index{fix-int}$\;${\bf  endif}\- \\ 
{\bf else }{\it{i\/}} $\div$ {\it{j\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{imod} \\  
{\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod} $=$ {\rm{idifference}}\,({\rm{fix-int}}\,({\it{i\/}})\index{fix-int}, {\rm{itimes}}\,({\it{j\/}}, {\rm{idiv}}\,({\it{i\/}}, {\it{j\/}})\index{idiv})\index{itimes})\index{idifference}
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{iquo} \\  
\=\+{\rm{iquo}}\,({\it{i\/}}, {\it{j\/}})\index{iquo} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{fix-int}}\,({\it{j\/}})\index{fix-int} $=$ {\tt{0}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\rm{negativep}}\,({\it{i\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{negativep}}\,({\it{j\/}})$\;\;${\bf then }{\rm{negative-guts}}\,({\it{i\/}}) $\div$ {\rm{negative-guts}}\,({\it{j\/}}) \\ 
{\bf else }{\rm{fix-int}}\,($-$ ({\rm{negative-guts}}\,({\it{i\/}}) $\div$ {\it{j\/}}))\index{fix-int}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{negativep}}\,({\it{j\/}})$\;\;${\bf then }{\rm{fix-int}}\,($-$ ({\it{i\/}} $\div$ {\rm{negative-guts}}\,({\it{j\/}})))\index{fix-int} \\ 
{\bf else }{\it{i\/}} $\div$ {\it{j\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{irem} \\  
{\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem} $=$ {\rm{idifference}}\,({\rm{fix-int}}\,({\it{i\/}})\index{fix-int}, {\rm{itimes}}\,({\it{j\/}}, {\rm{iquo}}\,({\it{i\/}}, {\it{j\/}})\index{iquo})\index{itimes})\index{idifference}
\end{tabbing}

\begin{verbatim}; ---------- DEFTHEORY events for definitions ----------

\end{verbatim}
\noindent{\sc Event}:   Let us define the theory {\it{integer-defns}} to consist of the following events: integerp,
fix-int,
ilessp,
iplus,
ineg,
iabs,
itimes,
iquotient,
iremainder,
idiv,
imod,
iquo,
irem,
ileq,
idifference,
izerop.\index{integer-defns}

\addvspace{18pt}


\noindent{\sc Event}:   Disable integerp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable fix-int.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable iplus.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ineg.

\addvspace{18pt}

\noindent{\sc Event}:   Disable iabs.

\addvspace{18pt}

\noindent{\sc Event}:   Disable itimes.

\addvspace{18pt}
\begin{verbatim};; I've disabled the rest later in the file, just because the lemmas
;; about division were (re-)proved with the remaining functions enabled.

; ---------- INTEGERP ----------

\end{verbatim}\begin{tabbing}{\sc Theorem}:  integerp-fix-int \\ \index{integerp-fix-int}
{\rm{integerp}}\,({\rm{fix-int}}\,({\it{x\/}})\index{fix-int})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  integerp-iplus \\ \index{integerp-iplus}
{\rm{integerp}}\,({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  integerp-idifference \\ \index{integerp-idifference}
{\rm{integerp}}\,({\rm{idifference}}\,({\it{x\/}}, {\it{y\/}})\index{idifference})\index{integerp}
\end{tabbing}

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

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

\begin{tabbing}{\sc Theorem}:  integerp-itimes \\ \index{integerp-itimes}
{\rm{integerp}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes})\index{integerp}
\end{tabbing}

\begin{verbatim}; ---------- FIX-INT ----------

;; The first of these, FIX-INT-REMOVER, is potentially dangerous from
;; a backchaining point of view, but I believe it's necessary.  At least
;; the lemmas below it should go a long way toward preventing its application.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  fix-int-remover \\ \index{fix-int-remover}
{\rm{integerp}}\,({\it{x\/}})\index{integerp} $\rightarrow$ ({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\it{x\/}})
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  fix-int-iplus \\ \index{fix-int-iplus}
{\rm{fix-int}}\,({\rm{iplus}}\,({\it{a\/}}, {\it{b\/}})\index{iplus})\index{fix-int} $=$ {\rm{iplus}}\,({\it{a\/}}, {\it{b\/}})\index{iplus}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-int-idifference \\ \index{fix-int-idifference}
{\rm{fix-int}}\,({\rm{idifference}}\,({\it{a\/}}, {\it{b\/}})\index{idifference})\index{fix-int} $=$ {\rm{idifference}}\,({\it{a\/}}, {\it{b\/}})\index{idifference}
\end{tabbing}

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

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

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

\begin{verbatim}; ---------- INEG ----------

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ineg-iplus \\ \index{ineg-iplus}
{\rm{ineg}}\,({\rm{iplus}}\,({\it{a\/}}, {\it{b\/}})\index{iplus})\index{ineg} $=$ {\rm{iplus}}\,({\rm{ineg}}\,({\it{a\/}})\index{ineg}, {\rm{ineg}}\,({\it{b\/}})\index{ineg})\index{iplus}
\end{tabbing}

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

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

\begin{tabbing}{\sc Theorem}:  ineg-of-non-integerp \\ \index{ineg-of-non-integerp}
($\neg$ {\rm{integerp}}\,({\it{x\/}})\index{integerp}) $\rightarrow$ ({\rm{ineg}}\,({\it{x\/}})\index{ineg} $=$ {\tt{0}})
\end{tabbing}

\begin{verbatim};; I don't want the backchaining to slow down the prover.
\end{verbatim}
\noindent{\sc Event}:   Disable ineg-of-non-integerp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  ineg-0 \\ \index{ineg-0}
{\rm{ineg}}\,({\tt{0}})\index{ineg} $=$ {\tt{0}}
\end{tabbing}

\begin{verbatim}; ---------- IPLUS ----------

;; The first two of these really aren't necessary, in light
;; of the cancellation metalemma.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  iplus-left-id \\ \index{iplus-left-id}
($\neg$ {\rm{integerp}}\,({\it{x\/}})\index{integerp}) $\rightarrow$ ({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus} $=$ {\rm{fix-int}}\,({\it{y\/}})\index{fix-int})
\end{tabbing}

\begin{verbatim};; I don't want the backchaining to slow down the prover.
\end{verbatim}
\noindent{\sc Event}:   Disable iplus-left-id.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  iplus-right-id \\ \index{iplus-right-id}
($\neg$ {\rm{integerp}}\,({\it{y\/}})\index{integerp}) $\rightarrow$ ({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus} $=$ {\rm{fix-int}}\,({\it{x\/}})\index{fix-int})
\end{tabbing}

\begin{verbatim};; I don't want the backchaining to slow down the prover.
\end{verbatim}
\noindent{\sc Event}:   Disable iplus-right-id.

\addvspace{18pt}

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

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

\begin{tabbing}{\sc Theorem}:  commutativity2-of-iplus \\ \index{commutativity2-of-iplus}
{\rm{iplus}}\,({\it{x\/}}, {\rm{iplus}}\,({\it{y\/}}, {\it{z\/}})\index{iplus})\index{iplus} $=$ {\rm{iplus}}\,({\it{y\/}}, {\rm{iplus}}\,({\it{x\/}}, {\it{z\/}})\index{iplus})\index{iplus}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  commutativity-of-iplus \\ \index{commutativity-of-iplus}
{\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus} $=$ {\rm{iplus}}\,({\it{y\/}}, {\it{x\/}})\index{iplus}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  associativity-of-iplus \\ \index{associativity-of-iplus}
{\rm{iplus}}\,({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus}, {\it{z\/}})\index{iplus} $=$ {\rm{iplus}}\,({\it{x\/}}, {\rm{iplus}}\,({\it{y\/}}, {\it{z\/}})\index{iplus})\index{iplus}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-cancellation-1 \\ \index{iplus-cancellation-1}
({\rm{iplus}}\,({\it{a\/}}, {\it{b\/}})\index{iplus} $=$ {\rm{iplus}}\,({\it{a\/}}, {\it{c\/}})\index{iplus}) $=$ ({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{c\/}})\index{fix-int})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-cancellation-2 \\ \index{iplus-cancellation-2}
({\rm{iplus}}\,({\it{b\/}}, {\it{a\/}})\index{iplus} $=$ {\rm{iplus}}\,({\it{c\/}}, {\it{a\/}})\index{iplus}) $=$ ({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{c\/}})\index{fix-int})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-ineg1 \\ \index{iplus-ineg1}
{\rm{iplus}}\,({\rm{ineg}}\,({\it{a\/}})\index{ineg}, {\it{a\/}})\index{iplus} $=$ {\tt{0}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-ineg2 \\ \index{iplus-ineg2}
{\rm{iplus}}\,({\it{a\/}}, {\rm{ineg}}\,({\it{a\/}})\index{ineg})\index{iplus} $=$ {\tt{0}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-fix-int1 \\ \index{iplus-fix-int1}
{\rm{iplus}}\,({\rm{fix-int}}\,({\it{a\/}})\index{fix-int}, {\it{b\/}})\index{iplus} $=$ {\rm{iplus}}\,({\it{a\/}}, {\it{b\/}})\index{iplus}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-fix-int2 \\ \index{iplus-fix-int2}
{\rm{iplus}}\,({\it{a\/}}, {\rm{fix-int}}\,({\it{b\/}})\index{fix-int})\index{iplus} $=$ {\rm{iplus}}\,({\it{a\/}}, {\it{b\/}})\index{iplus}
\end{tabbing}

\begin{verbatim}; ---------- IDIFFERENCE ----------

;; mostly omitted, but I'll keep a few

\end{verbatim}\begin{tabbing}{\sc Theorem}:  idifference-fix-int1 \\ \index{idifference-fix-int1}
{\rm{idifference}}\,({\rm{fix-int}}\,({\it{a\/}})\index{fix-int}, {\it{b\/}})\index{idifference} $=$ {\rm{idifference}}\,({\it{a\/}}, {\it{b\/}})\index{idifference}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  idifference-fix-int2 \\ \index{idifference-fix-int2}
{\rm{idifference}}\,({\it{a\/}}, {\rm{fix-int}}\,({\it{b\/}})\index{fix-int})\index{idifference} $=$ {\rm{idifference}}\,({\it{a\/}}, {\it{b\/}})\index{idifference}
\end{tabbing}


\begin{verbatim}; --------------------------------------------------------------------------------
; Cancel INEG
; --------------------------------------------------------------------------------

;; We assume that the given term (IPLUS x y) has the property that y has already
;; been reduced and x is not an iplus-term.  So, the only question is whether
;; or not the formal negative of x appears in the fringe of y.

#| The function below has no AND or OR, for efficiency
(defn cancel-ineg-aux (x y)
  ;; returns nil or else a new term provably equal to (IPLUS x y)
  (if (and (listp x)
           (equal (car x) 'ineg))
      (cond 
       ((equal y (cadr x))
        ''0)
       ((and (listp y)
             (equal (car y) 'iplus))
        (let ((y1 (cadr y)) (y2 (caddr y)))
          (if (equal y1 (cadr x))
              (list 'fix-int y2)
            (let ((z (cancel-ineg-aux x y2)))
              (if z
                  (list 'iplus y1 z)
                f)))))
       (t f))
    (cond
     ((nlistp y)
      f)
     ((equal (car y) 'ineg)
      (if (equal x (cadr y))
          ''0
        f))
     ((equal (car y) 'iplus)
      (let ((y1 (cadr y)) (y2 (caddr y)))
        (if (and (listp y1)
                 (equal (car y1) 'ineg)
                 (equal x (cadr y1)))
            (list 'fix-int y2)
          (let ((z (cancel-ineg-aux x y2)))
            (if z
                (list 'iplus y1 z)
              f)))))
     (t f))))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cancel-ineg-aux} \\  
\=\+{\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\it{y\/}})\index{cancel-ineg-aux} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{ineg}} \\ 
{\bf then }\=\+{\bf if }{\it{y\/}} $=$ {\rm{cadr}}\,({\it{x\/}})$\;\;${\bf then }{\tt{'}}{\tt{'}}{\tt{0}} \\ 
{\bf elseif }{\rm{listp}}\,({\it{y\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{y\/}}) $=$ {\tt{'}}{\tt{iplus}} \\ 
{\bf then }\=\+{\bf if }{\rm{cadr}}\,({\it{y\/}}) $=$ {\rm{cadr}}\,({\it{x\/}}) \\ 
{\bf then }{\rm{list}}\,({\tt{'}}{\tt{fix-int}}, {\rm{caddr}}\,({\it{y\/}})) \\ 
{\bf elseif }{\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{iplus}}, \\ 
{\rm{cadr}}\,({\it{y\/}}), \\ 
{\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux})\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\it{y\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{f}} \\ 
{\bf elseif }{\rm{car}}\,({\it{y\/}}) $=$ {\tt{'}}{\tt{ineg}} \\ 
{\bf then }\=\+{\bf if }{\it{x\/}} $=$ {\rm{cadr}}\,({\it{y\/}})$\;\;${\bf then }{\tt{'}}{\tt{'}}{\tt{0}} \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{car}}\,({\it{y\/}}) $=$ {\tt{'}}{\tt{iplus}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{cadr}}\,({\it{y\/}})) \\ 
{\bf then }\=\+{\bf if }{\rm{caadr}}\,({\it{y\/}}) $=$ {\tt{'}}{\tt{ineg}} \\ 
{\bf then }\=\+{\bf if }{\it{x\/}} $=$ {\rm{cadadr}}\,({\it{y\/}}) \\ 
{\bf then }{\rm{list}}\,({\tt{'}}{\tt{fix-int}}, {\rm{caddr}}\,({\it{y\/}})) \\ 
{\bf elseif }{\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{iplus}}, \\ 
{\rm{cadr}}\,({\it{y\/}}), \\ 
{\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux})\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux} \\ 
{\bf then }{\rm{list}}\,({\tt{'}}{\tt{iplus}}, {\rm{cadr}}\,({\it{y\/}}), {\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux}) \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux} \\ 
{\bf then }{\rm{list}}\,({\tt{'}}{\tt{iplus}}, {\rm{cadr}}\,({\it{y\/}}), {\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux}) \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\it{y\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{f}} \\ 
{\bf elseif }{\rm{car}}\,({\it{y\/}}) $=$ {\tt{'}}{\tt{ineg}} \\ 
{\bf then }\=\+{\bf if }{\it{x\/}} $=$ {\rm{cadr}}\,({\it{y\/}})$\;\;${\bf then }{\tt{'}}{\tt{'}}{\tt{0}} \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{car}}\,({\it{y\/}}) $=$ {\tt{'}}{\tt{iplus}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{cadr}}\,({\it{y\/}})) \\ 
{\bf then }\=\+{\bf if }{\rm{caadr}}\,({\it{y\/}}) $=$ {\tt{'}}{\tt{ineg}} \\ 
{\bf then }\=\+{\bf if }{\it{x\/}} $=$ {\rm{cadadr}}\,({\it{y\/}})$\;\;${\bf then }{\rm{list}}\,({\tt{'}}{\tt{fix-int}}, {\rm{caddr}}\,({\it{y\/}})) \\ 
{\bf elseif }{\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux} \\ 
{\bf then }{\rm{list}}\,({\tt{'}}{\tt{iplus}}, {\rm{cadr}}\,({\it{y\/}}), {\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux}) \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux} \\ 
{\bf then }{\rm{list}}\,({\tt{'}}{\tt{iplus}}, {\rm{cadr}}\,({\it{y\/}}), {\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux}) \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux} \\ 
{\bf then }{\rm{list}}\,({\tt{'}}{\tt{iplus}}, {\rm{cadr}}\,({\it{y\/}}), {\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\rm{caddr}}\,({\it{y\/}}))\index{cancel-ineg-aux}) \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}#| The function below has no AND or OR, for efficiency
(defn cancel-ineg (x)
  (if (and (listp x)
           (equal (car x) 'iplus))
      (let ((temp (cancel-ineg-aux (cadr x) (caddr x))))
        (if temp
            temp
          x))
    x))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cancel-ineg} \\  
\=\+{\rm{cancel-ineg}}\,({\it{x\/}})\index{cancel-ineg} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}} \\ 
{\bf then }\=\+{\bf if }{\rm{cancel-ineg-aux}}\,({\rm{cadr}}\,({\it{x\/}}), {\rm{caddr}}\,({\it{x\/}}))\index{cancel-ineg-aux} \\ 
{\bf then }{\rm{cancel-ineg-aux}}\,({\rm{cadr}}\,({\it{x\/}}), {\rm{caddr}}\,({\it{x\/}}))\index{cancel-ineg-aux} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; It seems a big win to turn off eval$.  I'll leave the recursive step out in
;; hopes that rewrite-eval$ handles it OK.

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

\begin{tabbing}{\sc Theorem}:  eval\$-list-nlistp \\ \index{eval\$-list-nlistp}
({\it{x\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ ({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}) $=$ {\bf{nil}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-litatom \\ \index{eval\$-litatom}
{\rm{litatom}}\,({\it{x\/}}) $\rightarrow$ ({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{cdr}}\,({\rm{assoc}}\,({\it{x\/}}, {\it{a\/}})))
\end{tabbing}

\begin{verbatim}#|
(prove-lemma eval$-quotep (rewrite)
  (equal (eval$ t (list 'quote x) a)
         x))
|#

;; In place of the above I'll do the following, from
;; the naturals library.
\end{verbatim}
\noindent{\sc Event}:   Enable eval\$-quote.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  eval\$-other \\ \index{eval\$-other}
(($\neg$ {\rm{litatom}}\,({\it{x\/}})) $\wedge$ ({\it{x\/}} $\simeq\;${{\bf{nil}}}${}$)) $\rightarrow$ ({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\it{x\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable eval\$.

\addvspace{18pt}

\begin{verbatim};; What I'd like to do is say what (eval$ t (cancel-ineg-aux x y) a),
;; but a rewrite rule will loop because of the recursion.  So I
;; introduce a silly auxiliary function so that the opening-up
;; heuristics can help me.  The function body has (listp y) tests
;; so that it can be accepted.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{eval\$-cancel-ineg-aux-fn} \\  
\=\+{\rm{eval\$-cancel-ineg-aux-fn}}\,({\it{x\/}}, {\it{y\/}}, {\it{a\/}})\index{eval\$-cancel-ineg-aux-fn} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) $\wedge$ ({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{ineg}}) \\ 
{\bf then }\=\+{\bf if }{\it{y\/}} $=$ {\rm{cadr}}\,({\it{x\/}})$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }\=\+{\bf let }\=\+{\it{y1\/}}{\bf $\;$ be$\;\;$}{\rm{cadr}}\,({\it{y\/}}), \\ 
{\it{y2\/}}{\bf $\;$ be$\;\;$}{\rm{caddr}}\,({\it{y\/}})\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\it{y1\/}} $=$ {\rm{cadr}}\,({\it{x\/}})$\;\;${\bf then }{\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{y2\/}}, {\it{a\/}}))\index{fix-int} \\ 
{\bf elseif }{\rm{listp}}\,({\it{y\/}}) \\ 
{\bf then }{\rm{iplus}}\,(\=\+{\rm{eval\$}}\,({\bf{t}}, {\it{y1\/}}, {\it{a\/}}), \\ 
{\rm{eval\$-cancel-ineg-aux-fn}}\,({\it{x\/}}, {\it{y2\/}}, {\it{a\/}})\index{eval\$-cancel-ineg-aux-fn})\-\index{iplus} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-$\;${\bf  endlet}\-$\;${\bf  endif}\- \\ 
{\bf else }\=\+{\bf if }{\rm{car}}\,({\it{y\/}}) $=$ {\tt{'}}{\tt{ineg}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }\=\+{\bf let }\=\+{\it{y1\/}}{\bf $\;$ be$\;\;$}{\rm{cadr}}\,({\it{y\/}}), \\ 
{\it{y2\/}}{\bf $\;$ be$\;\;$}{\rm{caddr}}\,({\it{y\/}})\- \\ 
{\bf in} \\ 
\=\+{\bf if }\=\+{\rm{listp}}\,({\it{y1\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{y1\/}}) $=$ {\tt{'}}{\tt{ineg}}) \\ 
$\wedge$$\;\;\;\;$({\it{x\/}} $=$ {\rm{cadr}}\,({\it{y1\/}}))\- \\ 
{\bf then }{\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{y2\/}}, {\it{a\/}}))\index{fix-int} \\ 
{\bf elseif }{\rm{listp}}\,({\it{y\/}}) \\ 
{\bf then }{\rm{iplus}}\,(\=\+{\rm{eval\$}}\,({\bf{t}}, {\it{y1\/}}, {\it{a\/}}), \\ 
{\rm{eval\$-cancel-ineg-aux-fn}}\,(\=\+{\it{x\/}}, \\ 
{\it{y2\/}}, \\ 
{\it{a\/}})\-\index{eval\$-cancel-ineg-aux-fn})\-\index{iplus} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-$\;${\bf  endlet}\-$\;${\bf  endif}\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-cancel-ineg-aux-is-its-fn \\ \index{eval\$-cancel-ineg-aux-is-its-f!n}
\=\+({\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\it{y\/}})\index{cancel-ineg-aux} $\not=$ {\bf{f}}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\it{y\/}})\index{cancel-ineg-aux}, {\it{a\/}}) $=$ {\rm{eval\$-cancel-ineg-aux-fn}}\,({\it{x\/}}, {\it{y\/}}, {\it{a\/}})\index{eval\$-cancel-ineg-aux-fn})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-ineg3 \\ \index{iplus-ineg3}
{\rm{iplus}}\,({\rm{ineg}}\,({\it{x\/}})\index{ineg}, {\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus})\index{iplus} $=$ {\rm{fix-int}}\,({\it{y\/}})\index{fix-int}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-ineg4 \\ \index{iplus-ineg4}
{\rm{iplus}}\,({\it{x\/}}, {\rm{iplus}}\,({\rm{ineg}}\,({\it{x\/}})\index{ineg}, {\it{y\/}})\index{iplus})\index{iplus} $=$ {\rm{fix-int}}\,({\it{y\/}})\index{fix-int}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-ineg-promote \\ \index{iplus-ineg-promote}
{\rm{iplus}}\,({\it{y\/}}, {\rm{ineg}}\,({\it{x\/}})\index{ineg})\index{iplus} $=$ {\rm{iplus}}\,({\rm{ineg}}\,({\it{x\/}})\index{ineg}, {\it{y\/}})\index{iplus}
\end{tabbing}

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

\noindent{\sc Event}:   Disable iplus-ineg-promote.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-ineg-aux \\ \index{correctness-of-cancel-ineg-aux}
\=\+({\rm{cancel-ineg-aux}}\,({\it{x\/}}, {\it{y\/}})\index{cancel-ineg-aux} $\not=$ {\bf{f}}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{eval\$-cancel-ineg-aux-fn}}\,({\it{x\/}}, {\it{y\/}}, {\it{a\/}})\index{eval\$-cancel-ineg-aux-fn} $=$ {\rm{iplus}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}), {\rm{eval\$}}\,({\bf{t}}, {\it{y\/}}, {\it{a\/}}))\index{iplus})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-ineg \\ \index{correctness-of-cancel-ineg}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-ineg}}\,({\it{x\/}})\index{cancel-ineg}, {\it{a\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable correctness-of-cancel-ineg-aux.

\addvspace{18pt}

\begin{verbatim}; --------------------------------------------------------------------------------
; Cancel IPLUS
; --------------------------------------------------------------------------------

;; All I do here is cancel like terms from both sides.  The problem of handling
;; INEG cancellation IS handled completely separately above.  That hasn't always
;; been the case -- in my first try I attempted to integrate the operations.
;; But now I see that for things like (equal z (iplus x (iplus y (ineg x))))
;; the integrated approach will fail.  Also, thanks to Matt Wilding, for pointing
;; out that the "four squares" example that Bill Pase sent me ran faster with
;; the newer approach (on his previously-implemented version for the rationals).

#| The function below has no AND or OR, for efficiency
(defn iplus-fringe (x)
  (if (and (listp x)
           (equal (car x)
                  (quote iplus)))
      (append (iplus-fringe (cadr x))
              (iplus-fringe (caddr x)))
      (cons x nil)))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{iplus-fringe} \\  
\=\+{\rm{iplus-fringe}}\,({\it{x\/}})\index{iplus-fringe} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}} \\ 
{\bf then }{\rm{append}}\,({\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, {\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe}) \\ 
{\bf else }{\rm{list}}\,({\it{x\/}})$\;${\bf  endif}\- \\ 
{\bf else }{\rm{list}}\,({\it{x\/}})$\;${\bf  endif}\-\-
\end{tabbing}

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

\begin{tabbing}{\sc Definition}:\index{iplus-tree-rec} \\  
\=\+{\rm{iplus-tree-rec}}\,({\it{l\/}})\index{iplus-tree-rec} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{cdr}}\,({\it{l\/}}) $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\rm{car}}\,({\it{l\/}}) \\ 
{\bf else }{\rm{list}}\,({\tt{'}}{\tt{iplus}}, {\rm{car}}\,({\it{l\/}}), {\rm{iplus-tree-rec}}\,({\rm{cdr}}\,({\it{l\/}}))\index{iplus-tree-rec})$\;${\bf  endif}\-\-
\end{tabbing}

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

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

\begin{tabbing}{\sc Theorem}:  integerp-iplus-list \\ \index{integerp-iplus-list}
{\rm{integerp}}\,({\rm{iplus-list}}\,({\it{x\/}})\index{iplus-list})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-iplus-tree-rec \\ \index{eval\$-iplus-tree-rec}
\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{iplus-tree-rec}}\,({\it{x\/}})\index{iplus-tree-rec}, {\it{a\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}}))$\;\;${\bf then }{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{iplus-list} \\ 
{\bf else }{\rm{eval\$}}\,({\bf{t}}, {\rm{car}}\,({\it{x\/}}), {\it{a\/}})$\;${\bf  endif}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}
           
\begin{tabbing}{\sc Theorem}:  eval\$-iplus-tree \\ \index{eval\$-iplus-tree}
{\rm{eval\$}}\,({\bf{t}}, {\rm{iplus-tree}}\,({\it{x\/}})\index{iplus-tree}, {\it{a\/}}) $=$ {\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{iplus-list}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-list-append \\ \index{eval\$-list-append}
\=\+{\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{append}}\,({\it{x\/}}, {\it{y\/}}), {\it{a\/}}) \\ 
$=$$\;\;\;\;${\rm{append}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}), {\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\-
\end{tabbing}

\begin{verbatim}#| The function below has no AND or OR, for efficiency
(defn cancel-iplus (x)
  (if (and (listp x)
           (equal (car x) (quote equal)))
      (if (and (listp (cadr x))
               (equal (caadr x) (quote iplus))
               (listp (caddr x))
               (equal (caaddr x) (quote iplus)))
          (let ((xs (iplus-fringe (cadr x)))
                (ys (iplus-fringe (caddr x))))
            (let ((bagint (bagint xs ys)))
              (if (listp bagint)
                  (list (quote equal)
                        (iplus-tree (bagdiff xs bagint))
                        (iplus-tree (bagdiff ys bagint)))
                x)))
        (if (and (listp (cadr x))
                 (equal (caadr x) (quote iplus))
                 ;; We don't want to introduce the IF below unless something
                 ;; is "gained", or else we may get into an infinite rewriting loop.
                 (member (caddr x) (iplus-fringe (cadr x))))
            (list (quote if)
                  (list (quote integerp) (caddr x))
                  (list (quote equal)
                        (iplus-tree (delete (caddr x) (iplus-fringe (cadr x))))
                        ''0)
                  (list (quote quote) f))
          (if (and (listp (caddr x))
                   (equal (caaddr x) (quote iplus))
                   (member (cadr x) (iplus-fringe (caddr x))))
              (list (quote if)
                    (list (quote integerp) (cadr x))
                    (list (quote equal)
                          ''0
                          (iplus-tree (delete (cadr x) (iplus-fringe (caddr x)))))
                    (list (quote quote) f))
            x)))
    x))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cancel-iplus} \\  
\=\+{\rm{cancel-iplus}}\,({\it{x\/}})\index{cancel-iplus} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{equal}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{cadr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf if }{\rm{caadr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf if }{\rm{caaddr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{bagint}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{bagint}) \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{bagdiff}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{bagint}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{bagint})\-\index{bagdiff})\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{bagdiff}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{bagint}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{bagint})\-\index{bagdiff})\index{iplus-tree})\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{caddr}}\,({\it{x\/}}) $\in$ {\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{caddr}}\,({\it{x\/}})), \\ 
{\rm{cons}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{cons}}\,(\=\+{\rm{iplus-tree}}\,({\rm{delete}}\,(\=\+{\rm{caddr}}\,({\it{x\/}}), \\ 
{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{delete})\index{iplus-tree}, \\ 
{\tt{'}}{\tt{(}}{\tt{'}}{\tt{0}}{\tt{)}})\-)\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{caddr}}\,({\it{x\/}}) $\in$ {\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{caddr}}\,({\it{x\/}})), \\ 
{\rm{cons}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{cons}}\,(\=\+{\rm{iplus-tree}}\,({\rm{delete}}\,(\=\+{\rm{caddr}}\,({\it{x\/}}), \\ 
{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{delete})\index{iplus-tree}, \\ 
{\tt{'}}{\tt{(}}{\tt{'}}{\tt{0}}{\tt{)}})\-)\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf if }{\rm{caaddr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}} \\ 
{\bf then }\=\+{\bf if }{\rm{cadr}}\,({\it{x\/}}) $\in$ {\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{cadr}}\,({\it{x\/}})), \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\tt{'}}{\tt{'}}{\tt{0}}, \\ 
{\rm{iplus-tree}}\,({\rm{delete}}\,(\=\+{\rm{cadr}}\,({\it{x\/}}), \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{delete})\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf if }{\rm{caaddr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}} \\ 
{\bf then }\=\+{\bf if }{\rm{cadr}}\,({\it{x\/}}) $\in$ {\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{cadr}}\,({\it{x\/}})), \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\tt{'}}{\tt{'}}{\tt{0}}, \\ 
{\rm{iplus-tree}}\,({\rm{delete}}\,(\=\+{\rm{cadr}}\,({\it{x\/}}), \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{delete})\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-cancel-iplus \\ \index{eval\$-cancel-iplus}
\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-iplus}}\,({\it{x\/}})\index{cancel-iplus}, {\it{a\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) $\wedge$ ({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{equal}}) \\ 
{\bf then }\=\+{\bf if }\=\+{\rm{listp}}\,({\rm{cadr}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{caadr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{caaddr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}})\- \\ 
{\bf then }\=\+{\bf let }\=\+{\it{xs\/}}{\bf $\;$ be$\;\;$}{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\it{ys\/}}{\bf $\;$ be$\;\;$}{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe}\- \\ 
{\bf in} \\ 
\=\+{\bf let }\=\+{\it{bagint\/}}{\bf $\;$ be$\;\;$}{\rm{bagint}}\,({\it{xs\/}}, {\it{ys\/}})\index{bagint}\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\rm{listp}}\,({\it{bagint\/}}) \\ 
{\bf then }\=\+{\rm{iplus-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{bagdiff}}\,(\=\+{\it{xs\/}}, \\ 
{\rm{bagint}}\,({\it{xs\/}}, {\it{ys\/}})\index{bagint})\-\index{bagdiff}, \\ 
{\it{a\/}})\-)\index{iplus-list} \\ 
$=$$\;\;\;\;${\rm{iplus-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{bagdiff}}\,(\=\+{\it{ys\/}}, \\ 
{\rm{bagint}}\,(\=\+{\it{xs\/}}, \\ 
{\it{ys\/}})\-\index{bagint})\-\index{bagdiff}, \\ 
{\it{a\/}})\-)\index{iplus-list}\- \\ 
{\bf else }{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}})$\;${\bf  endif}\-$\;${\bf  endlet}\-$\;${\bf  endlet}\- \\ 
{\bf elseif }\=\+{\rm{listp}}\,({\rm{cadr}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{caadr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}}) \\ 
$\wedge$$\;\;\;\;$({\rm{caddr}}\,({\it{x\/}}) $\in$ {\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe})\- \\ 
{\bf then }\=\+{\bf if }{\rm{integerp}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{caddr}}\,({\it{x\/}}), {\it{a\/}}))\index{integerp} \\ 
{\bf then }\=\+{\rm{iplus-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{delete}}\,({\rm{caddr}}\,({\it{x\/}}), {\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe})\index{delete}, \\ 
{\it{a\/}})\-)\index{iplus-list} \\ 
$=$$\;\;\;\;${\tt{0}}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf elseif }\=\+{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{caaddr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}}) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\it{x\/}}) $\in$ {\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\- \\ 
{\bf then }\=\+{\bf if }{\rm{integerp}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{cadr}}\,({\it{x\/}}), {\it{a\/}}))\index{integerp} \\ 
{\bf then }{\tt{0}} $=$ {\rm{iplus-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{delete}}\,(\=\+{\rm{cadr}}\,({\it{x\/}}), \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{delete}, \\ 
{\it{a\/}})\-)\index{iplus-list} \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf else }{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}})$\;${\bf  endif}\- \\ 
{\bf else }{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}})$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable cancel-iplus.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  eval\$-iplus-list-delete \\ \index{eval\$-iplus-list-delete}
\=\+({\it{z\/}} $\in$ {\it{y\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{delete}}\,({\it{z\/}}, {\it{y\/}})\index{delete}, {\it{a\/}}))\index{iplus-list} \\ 
$=$$\;\;\;\;${\rm{idifference}}\,({\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{iplus-list}, {\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}))\index{idifference})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-iplus-list-bagdiff \\ \index{eval\$-iplus-list-bagdiff}
\=\+{\rm{subbagp}}\,({\it{x\/}}, {\it{y\/}})\index{subbagp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{y\/}}, {\it{x\/}})\index{bagdiff}, {\it{a\/}}))\index{iplus-list} \\ 
$=$$\;\;\;\;${\rm{idifference}}\,(\=\+{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{iplus-list}, \\ 
{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{iplus-list})\-\index{idifference})\-\-
\end{tabbing}

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


\noindent{\sc Event}:   Disable iplus-tree.

\addvspace{18pt} \begin{verbatim};; because we want to use EVAL$-IPLUS-TREE for now

\end{verbatim}\begin{tabbing}{\sc Theorem}:  not-integerp-implies-not-equal-iplus \\ \index{not-integerp-implies-not-equal-ip!lus}
($\neg$ {\rm{integerp}}\,({\it{a\/}})\index{integerp}) $\rightarrow$ (({\it{a\/}} $=$ {\rm{iplus}}\,({\it{b\/}}, {\it{c\/}})\index{iplus}) $=$ {\bf{f}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-list-eval\$-fringe \\ \index{iplus-list-eval\$-fringe}
{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{iplus-fringe}}\,({\it{x\/}})\index{iplus-fringe}, {\it{a\/}}))\index{iplus-list} $=$ {\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}))\index{fix-int}
\end{tabbing}

\begin{verbatim};; The following two lemmas aren't needed but they sure do
;; shorten the total proof time!!!

\end{verbatim}\begin{tabbing}{\sc Theorem}:  iplus-ineg5-lemma-1 \\ \index{iplus-ineg5-lemma-1}
\=\+{\rm{integerp}}\,({\it{x\/}})\index{integerp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\it{x\/}} $=$ {\rm{iplus}}\,({\it{y\/}}, {\rm{iplus}}\,({\rm{ineg}}\,({\it{z\/}})\index{ineg}, {\it{w\/}})\index{iplus})\index{iplus}) \\ 
$=$$\;\;\;\;$({\it{x\/}} $=$ {\rm{iplus}}\,({\rm{ineg}}\,({\it{z\/}})\index{ineg}, {\rm{iplus}}\,({\it{y\/}}, {\it{w\/}})\index{iplus})\index{iplus}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-ineg5-lemma-2 \\ \index{iplus-ineg5-lemma-2}
\=\+({\rm{integerp}}\,({\it{x\/}})\index{integerp} $\wedge$ {\rm{integerp}}\,({\it{v\/}})\index{integerp}) \\ 
$\rightarrow$$\;\;\;\;$(({\it{x\/}} $=$ {\rm{iplus}}\,({\rm{ineg}}\,({\it{z\/}})\index{ineg}, {\it{v\/}})\index{iplus}) $=$ ({\rm{iplus}}\,({\it{x\/}}, {\it{z\/}})\index{iplus} $=$ {\it{v\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-ineg5 \\ \index{iplus-ineg5}
\=\+{\rm{integerp}}\,({\it{x\/}})\index{integerp} \\ 
$\rightarrow$$\;\;\;\;$(({\it{x\/}} $=$ {\rm{iplus}}\,({\it{y\/}}, {\rm{iplus}}\,({\rm{ineg}}\,({\it{z\/}})\index{ineg}, {\it{w\/}})\index{iplus})\index{iplus}) $=$ ({\rm{iplus}}\,({\it{x\/}}, {\it{z\/}})\index{iplus} $=$ {\rm{iplus}}\,({\it{y\/}}, {\it{w\/}})\index{iplus}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable iplus-ineg5-lemma-1.

\addvspace{18pt}


\noindent{\sc Event}:   Disable iplus-ineg5-lemma-2.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  iplus-ineg6 \\ \index{iplus-ineg6}
\=\+{\rm{integerp}}\,({\it{x\/}})\index{integerp} \\ 
$\rightarrow$$\;\;\;\;$(({\it{x\/}} $=$ {\rm{iplus}}\,({\it{y\/}}, {\rm{iplus}}\,({\it{w\/}}, {\rm{ineg}}\,({\it{z\/}})\index{ineg})\index{iplus})\index{iplus}) $=$ ({\rm{iplus}}\,({\it{x\/}}, {\it{z\/}})\index{iplus} $=$ {\rm{iplus}}\,({\it{y\/}}, {\it{w\/}})\index{iplus}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-iplus \\ \index{eval\$-iplus}
\=\+({\rm{listp}}\,({\it{x\/}}) $\wedge$ ({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{iplus}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{cadr}}\,({\it{x\/}}), {\it{a\/}}), {\rm{eval\$}}\,({\bf{t}}, {\rm{caddr}}\,({\it{x\/}}), {\it{a\/}}))\index{iplus})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-ineg7 \\ \index{iplus-ineg7}
({\tt{0}} $=$ {\rm{iplus}}\,({\it{x\/}}, {\rm{ineg}}\,({\it{y\/}})\index{ineg})\index{iplus}) $=$ ({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{x\/}})\index{fix-int})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-iplus \\ \index{correctness-of-cancel-iplus}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-iplus}}\,({\it{x\/}})\index{cancel-iplus}, {\it{a\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable iplus-ineg5.

\addvspace{18pt}


\noindent{\sc Event}:   Disable iplus-ineg6.

\addvspace{18pt}

\begin{verbatim}; --------------------------------------------------------------------------------
; Cancel IPLUS from ILESSP
; --------------------------------------------------------------------------------

;; This is similar to the cancellation of IPLUS terms from equalities,
;; handled above, and uses many of the same lemmas.  A small but definite
;; difference however is that for ILESSP we don't have to fix integers.

;; By luck we have that iplus-tree-rec is appropriate here, since
;; the lemma eval$-iplus-tree-rec shows that it (accidentally) behaves
;; properly on the empty list.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ilessp-fix-int-1 \\ \index{ilessp-fix-int-1}
{\rm{ilessp}}\,({\rm{fix-int}}\,({\it{x\/}})\index{fix-int}, {\it{y\/}})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp}
\end{tabbing}

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

\begin{verbatim};; Perhaps the easiest approach is to do everything with respect to the
;; same IPLUS-TREE function that we used before, and then once the
;; supposed meta-lemma is proved, go back and show that we get the
;; same answer if we use a version that doesn't fix-int singleton fringes.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{make-cancel-iplus-inequality-1} \\  
\=\+{\rm{make-cancel-iplus-inequality-1}}\,({\it{x\/}}, {\it{y\/}})\index{make-cancel-iplus-inequality-1} \\ 
$=$$\;\;\;\;${\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{iplus-tree}}\,({\rm{bagdiff}}\,({\it{x\/}}, {\rm{bagint}}\,({\it{x\/}}, {\it{y\/}})\index{bagint})\index{bagdiff})\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{bagdiff}}\,({\it{y\/}}, {\rm{bagint}}\,({\it{x\/}}, {\it{y\/}})\index{bagint})\index{bagdiff})\index{iplus-tree})\-\-
\end{tabbing}

\begin{verbatim}#| The function below has no AND or OR, for efficiency
(defn cancel-iplus-ilessp-1 (x)
  (if (and (listp x)
           (equal (car x) (quote ilessp)))
      (make-cancel-iplus-inequality-1 (iplus-fringe (cadr x))
                                      (iplus-fringe (caddr x)))
    x))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cancel-iplus-ilessp-1} \\  
\=\+{\rm{cancel-iplus-ilessp-1}}\,({\it{x\/}})\index{cancel-iplus-ilessp-1} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{ilessp}} \\ 
{\bf then }{\rm{make-cancel-iplus-inequality-1}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{make-cancel-iplus-inequality-1} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; Notice that IPLUS-TREE-NO-FIX-INT is currently enabled, which is
;; good since we want to use EVAL$-IPLUS-TREE-NO-FIX-INT for now.

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

\begin{tabbing}{\sc Theorem}:  lessp-difference-plus-arg1-commuted \\ \index{lessp-difference-plus-arg1-comm!uted}
({\it{w\/}} $<$ (({\it{y\/}} $+$ {\it{w\/}}) $-$ {\it{x\/}})) $=$ ({\it{x\/}} $<$ {\it{y\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-cancellation-1-for-ilessp \\ \index{iplus-cancellation-1-for-ilessp}
{\rm{ilessp}}\,({\rm{iplus}}\,({\it{a\/}}, {\it{b\/}})\index{iplus}, {\rm{iplus}}\,({\it{a\/}}, {\it{c\/}})\index{iplus})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{b\/}}, {\it{c\/}})\index{ilessp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-cancellation-2-for-ilessp \\ \index{iplus-cancellation-2-for-ilessp}
{\rm{ilessp}}\,({\rm{iplus}}\,({\it{b\/}}, {\it{a\/}})\index{iplus}, {\rm{iplus}}\,({\it{c\/}}, {\it{a\/}})\index{iplus})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{b\/}}, {\it{c\/}})\index{ilessp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-iplus-ilessp-lemma \\ \index{correctness-of-cancel-iplus-ile!ssp-lemma}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-iplus-ilessp-1}}\,({\it{x\/}})\index{cancel-iplus-ilessp-1}, {\it{a\/}})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{iplus-tree-no-fix-int} \\  
\=\+{\rm{iplus-tree-no-fix-int}}\,({\it{l\/}})\index{iplus-tree-no-fix-int} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{l\/}})$\;\;${\bf then }{\rm{iplus-tree-rec}}\,({\it{l\/}})\index{iplus-tree-rec} \\ 
{\bf else }{\tt{'}}{\tt{'}}{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-ilessp-iplus-tree-no-fix-int \\ \index{eval\$-ilessp-iplus-tree-no-fix!-int}
\=\+{\rm{ilessp}}\,(\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{iplus-tree-no-fix-int}}\,({\it{x\/}})\index{iplus-tree-no-fix-int}, {\it{a\/}}), \\ 
{\rm{eval\$}}\,({\bf{t}}, {\rm{iplus-tree-no-fix-int}}\,({\it{y\/}})\index{iplus-tree-no-fix-int}, {\it{a\/}}))\-\index{ilessp} \\ 
$=$$\;\;\;\;${\rm{ilessp}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{iplus-tree}}\,({\it{x\/}})\index{iplus-tree}, {\it{a\/}}), {\rm{eval\$}}\,({\bf{t}}, {\rm{iplus-tree}}\,({\it{y\/}})\index{iplus-tree}, {\it{a\/}}))\index{ilessp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable iplus-tree-no-fix-int.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  make-cancel-iplus-inequality-simplifier \\ \index{make-cancel-iplus-inequality-si!mplifier}
\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{make-cancel-iplus-inequality-1}}\,({\it{x\/}}, {\it{y\/}})\index{make-cancel-iplus-inequality-1}, {\it{a\/}}) \\ 
$=$$\;\;\;\;${\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{iplus-tree-no-fix-int}}\,({\rm{bagdiff}}\,({\it{x\/}}, {\rm{bagint}}\,({\it{x\/}}, {\it{y\/}})\index{bagint})\index{bagdiff})\index{iplus-tree-no-fix-int}, \\ 
{\rm{iplus-tree-no-fix-int}}\,({\rm{bagdiff}}\,({\it{y\/}}, {\rm{bagint}}\,({\it{x\/}}, {\it{y\/}})\index{bagint})\index{bagdiff})\index{iplus-tree-no-fix-int})\-, \\ 
{\it{a\/}})\-\-
\end{tabbing}

\begin{verbatim}#| The function below has no AND or OR, for efficiency
(defn cancel-iplus-ilessp (x)
  (if (and (listp x)
           (equal (car x) (quote ilessp)))
      (let ((x1 (iplus-fringe (cadr x)))
            (y1 (iplus-fringe (caddr x))))
        (let ((bagint (bagint x1 y1)))
          (if (listp bagint)
              ;; I check (listp bagint) only for efficiency
              (list (quote ilessp)
                    (iplus-tree-no-fix-int (bagdiff x1 bagint))
                    (iplus-tree-no-fix-int (bagdiff y1 bagint)))
            x)))
    x))
|#

;; **** Should perhaps check that some argument of the ILESSP has function
;; symbol IPLUS, or else we may wind up dealing with (ILESSP 0 0).  That should
;; be harmless enough, though, even if *1*IPLUS is disabled; we'll just get the
;; same term back, the hard way.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cancel-iplus-ilessp} \\  
\=\+{\rm{cancel-iplus-ilessp}}\,({\it{x\/}})\index{cancel-iplus-ilessp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{ilessp}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{bagint}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{bagint}) \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{iplus-tree-no-fix-int}}\,({\rm{bagdiff}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{bagint}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{bagint})\-\index{bagdiff})\index{iplus-tree-no-fix-int}, \\ 
{\rm{iplus-tree-no-fix-int}}\,({\rm{bagdiff}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{bagint}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{bagint})\-\index{bagdiff})\index{iplus-tree-no-fix-int})\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable make-cancel-iplus-inequality-1.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-iplus-ilessp \\ \index{correctness-of-cancel-iplus-ile!ssp}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-iplus-ilessp}}\,({\it{x\/}})\index{cancel-iplus-ilessp}, {\it{a\/}})
\end{tabbing}

\begin{verbatim}; ---------- Multiplication ----------

\end{verbatim}\begin{tabbing}{\sc Theorem}:  itimes-zero1 \\ \index{itimes-zero1}
({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}) $\rightarrow$ ({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-0-left \\ \index{itimes-0-left}
{\rm{itimes}}\,({\tt{0}}, {\it{y\/}})\index{itimes} $=$ {\tt{0}}
\end{tabbing}

\begin{verbatim};; I don't want the backchaining to slow down the prover.
\end{verbatim}
\noindent{\sc Event}:   Disable itimes-zero1.

\addvspace{18pt}

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

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

\begin{verbatim};; I don't want the backchaining to slow down the prover.
\end{verbatim}
\noindent{\sc Event}:   Disable itimes-zero2.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  itimes-fix-int1 \\ \index{itimes-fix-int1}
{\rm{itimes}}\,({\rm{fix-int}}\,({\it{a\/}})\index{fix-int}, {\it{b\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-fix-int2 \\ \index{itimes-fix-int2}
{\rm{itimes}}\,({\it{a\/}}, {\rm{fix-int}}\,({\it{b\/}})\index{fix-int})\index{itimes} $=$ {\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  commutativity-of-itimes \\ \index{commutativity-of-itimes}
{\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{y\/}}, {\it{x\/}})\index{itimes}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-distributes-over-iplus-proof \\ \index{itimes-distributes-over-iplus-p!roof}
{\rm{itimes}}\,({\it{x\/}}, {\rm{iplus}}\,({\it{y\/}}, {\it{z\/}})\index{iplus})\index{itimes} $=$ {\rm{iplus}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes}, {\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes})\index{iplus}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-distributes-over-iplus \\ \index{itimes-distributes-over-iplus}
\=\+({\rm{itimes}}\,({\it{x\/}}, {\rm{iplus}}\,({\it{y\/}}, {\it{z\/}})\index{iplus})\index{itimes} $=$ {\rm{iplus}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes}, {\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes})\index{iplus}) \\ 
$\wedge$$\;\;\;\;$({\rm{itimes}}\,({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus}, {\it{z\/}})\index{itimes} $=$ {\rm{iplus}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes}, {\rm{itimes}}\,({\it{y\/}}, {\it{z\/}})\index{itimes})\index{iplus})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  commutativity2-of-itimes \\ \index{commutativity2-of-itimes}
{\rm{itimes}}\,({\it{x\/}}, {\rm{itimes}}\,({\it{y\/}}, {\it{z\/}})\index{itimes})\index{itimes} $=$ {\rm{itimes}}\,({\it{y\/}}, {\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes})\index{itimes}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  associativity-of-itimes \\ \index{associativity-of-itimes}
{\rm{itimes}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes}, {\it{z\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{x\/}}, {\rm{itimes}}\,({\it{y\/}}, {\it{z\/}})\index{itimes})\index{itimes}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-itimes-0 \\ \index{equal-itimes-0}
({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes} $=$ {\tt{0}}) $=$ (({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}) $\vee$ ({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $=$ {\tt{0}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-itimes-1 \\ \index{equal-itimes-1}
\=\+({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes} $=$ {\tt{1}}) \\ 
$=$$\;\;\;\;$((({\it{a\/}} $=$ {\tt{1}}) $\wedge$ ({\it{b\/}} $=$ {\tt{1}})) $\vee$ (({\it{a\/}} $=$ {\tt{-1}}) $\wedge$ ({\it{b\/}} $=$ {\tt{-1}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-itimes-minus-1 \\ \index{equal-itimes-minus-1}
\=\+({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes} $=$ {\tt{-1}}) \\ 
$=$$\;\;\;\;$((({\it{a\/}} $=$ {\tt{-1}}) $\wedge$ ({\it{b\/}} $=$ {\tt{1}})) $\vee$ (({\it{a\/}} $=$ {\tt{1}}) $\wedge$ ({\it{b\/}} $=$ {\tt{-1}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-1-arg1 \\ \index{itimes-1-arg1}
{\rm{itimes}}\,({\tt{1}}, {\it{x\/}})\index{itimes} $=$ {\rm{fix-int}}\,({\it{x\/}})\index{fix-int}
\end{tabbing}

\begin{verbatim}; ---------- Division ----------

\end{verbatim}\begin{tabbing}{\sc Theorem}:  quotient-remainder-uniqueness \\ \index{quotient-remainder-uniqueness}
\=\+(({\it{a\/}} $=$ ({\it{r\/}} $+$ ({\it{b\/}} $*$ {\it{q\/}}))) $\wedge$ ({\it{r\/}} $<$ {\it{b\/}})) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{fix}}\,({\it{r\/}}) $=$ ({\it{a\/}} ${}${\bf{mod}}${}$ {\it{b\/}})) $\wedge$ ({\rm{fix}}\,({\it{q\/}}) $=$ ({\it{a\/}} $\div$ {\it{b\/}})))\-
\end{tabbing}


\begin{verbatim}; We want to define IQUOTIENT and IREMAINDER. The standard approach to
; integer division derives from from the following theorem.
;
; Division Theorem:
; For all integers i,j, j not 0, there exist unique integers q and r
; which satisfy  i = jq + r,  0 <= r < |j|.
;
; The functions IQUOTIENT and IREMAINDER are intended to compute q and r.
; Therefore, to be satisfied that we have the right definitions, we must
; prove the above theorem.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  division-theorem-part1 \\ \index{division-theorem-part1}
{\rm{integerp}}\,({\it{i\/}})\index{integerp} $\rightarrow$ ({\rm{iplus}}\,({\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder}, {\rm{itimes}}\,({\it{j\/}}, {\rm{iquotient}}\,({\it{i\/}}, {\it{j\/}})\index{iquotient})\index{itimes})\index{iplus} $=$ {\it{i\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  division-theorem-part2 \\ \index{division-theorem-part2}
({\rm{integerp}}\,({\it{j\/}})\index{integerp} $\wedge$ ({\it{j\/}} $\not=$ {\tt{0}})) $\rightarrow$ ($\neg$ {\rm{ilessp}}\,({\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder}, {\tt{0}})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  division-theorem-part3 \\ \index{division-theorem-part3}
({\rm{integerp}}\,({\it{j\/}})\index{integerp} $\wedge$ ({\it{j\/}} $\not=$ {\tt{0}})) $\rightarrow$ {\rm{ilessp}}\,({\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder}, {\rm{iabs}}\,({\it{j\/}})\index{iabs})\index{ilessp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  division-theorem \\ \index{division-theorem}
\=\+({\rm{integerp}}\,({\it{i\/}})\index{integerp} $\wedge$ {\rm{integerp}}\,({\it{j\/}})\index{integerp} $\wedge$ ({\it{j\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{iplus}}\,({\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder}, {\rm{itimes}}\,({\it{j\/}}, {\rm{iquotient}}\,({\it{i\/}}, {\it{j\/}})\index{iquotient})\index{itimes})\index{iplus} $=$ {\it{i\/}}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ilessp}}\,({\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder}, {\tt{0}})\index{ilessp}) \\ 
$\wedge$$\;\;\;\;${\rm{ilessp}}\,({\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder}, {\rm{iabs}}\,({\it{j\/}})\index{iabs})\index{ilessp})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  quotient-difference-lessp-arg2 \\ \index{quotient-difference-lessp-arg2}
\=\+((({\it{a\/}} ${}${\bf{mod}}${}$ {\it{c\/}}) $=$ {\tt{0}}) $\wedge$ ({\it{b\/}} $<$ {\it{c\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\it{a\/}} $-$ {\it{b\/}}) $\div$ {\it{c\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{b\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\it{a\/}} $\div$ {\it{c\/}} \\ 
{\bf elseif }{\it{b\/}} $<$ {\it{a\/}}$\;\;${\bf then }({\it{a\/}} $\div$ {\it{c\/}}) $-$ ($1\;+$ ({\it{b\/}} $\div$ {\it{c\/}})) \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquotient-iremainder-uniqueness \\ \index{iquotient-iremainder-uniqueness}
\=\+(\=\+{\rm{integerp}}\,({\it{i\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;${\rm{integerp}}\,({\it{j\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;${\rm{integerp}}\,({\it{r\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;${\rm{integerp}}\,({\it{q\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;$({\it{j\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $=$ {\rm{iplus}}\,({\it{r\/}}, {\rm{itimes}}\,({\it{j\/}}, {\it{q\/}})\index{itimes})\index{iplus}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ilessp}}\,({\it{r\/}}, {\tt{0}})\index{ilessp}) \\ 
$\wedge$$\;\;\;\;${\rm{ilessp}}\,({\it{r\/}}, {\rm{iabs}}\,({\it{j\/}})\index{iabs})\index{ilessp})\- \\ 
$\rightarrow$$\;\;\;\;$(({\it{r\/}} $=$ {\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder}) $\wedge$ ({\it{q\/}} $=$ {\rm{iquotient}}\,({\it{i\/}}, {\it{j\/}})\index{iquotient}))\-
\end{tabbing}
 
\begin{verbatim}; It turns out that in computer arithmetic, notions of division other than that
; given by the division theorem are used. Two in particular, called
; "truncate towards negative infinity" and "truncate towards zero" are common.
; We present their definitions here. 

; Division Theorem (truncate towards negative infinity variant):
;
; For all integers i,j, j not 0, there exist unique integers q and r
; which satisfy  
;                i = jq + r,  0 <= r <  j  (j > 0)
;                             j <  r <= 0  (j < 0)
;
; In this version the integer quotient of two integers is the integer floor
; of the real quotient of the integers. The remainder has the sign of the
; divisor. The functions IDIV and IMOD are intended to compute q and r.
; Therefore, to be satisfied that we have the right definitions, we must
; prove the above theorem.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  division-theorem-for-truncate-to-neginf-part1 \\ \index{division-theorem-for-truncate-t!o-neginf-part1}
{\rm{integerp}}\,({\it{i\/}})\index{integerp} $\rightarrow$ ({\rm{iplus}}\,({\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod}, {\rm{itimes}}\,({\it{j\/}}, {\rm{idiv}}\,({\it{i\/}}, {\it{j\/}})\index{idiv})\index{itimes})\index{iplus} $=$ {\it{i\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  division-theorem-for-truncate-to-neginf-part2 \\ \index{division-theorem-for-truncate-t!o-neginf-part2}
{\rm{ilessp}}\,({\tt{0}}, {\it{j\/}})\index{ilessp} $\rightarrow$ (($\neg$ {\rm{ilessp}}\,({\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod}, {\tt{0}})\index{ilessp}) $\wedge$ {\rm{ilessp}}\,({\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod}, {\it{j\/}})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  division-theorem-for-truncate-to-neginf-part3 \\ \index{division-theorem-for-truncate-t!o-neginf-part3}
\=\+({\rm{integerp}}\,({\it{j\/}})\index{integerp} $\wedge$ {\rm{ilessp}}\,({\it{j\/}}, {\tt{0}})\index{ilessp}) \\ 
$\rightarrow$$\;\;\;\;$(($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod})\index{ilessp}) $\wedge$ {\rm{ilessp}}\,({\it{j\/}}, {\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod})\index{ilessp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  division-theorem-for-truncate-to-neginf \\ \index{division-theorem-for-truncate-t!o-neginf}
\=\+({\rm{integerp}}\,({\it{i\/}})\index{integerp} $\wedge$ {\rm{integerp}}\,({\it{j\/}})\index{integerp} $\wedge$ ({\it{j\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{iplus}}\,({\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod}, {\rm{itimes}}\,({\it{j\/}}, {\rm{idiv}}\,({\it{i\/}}, {\it{j\/}})\index{idiv})\index{itimes})\index{iplus} $=$ {\it{i\/}}) \\ 
$\wedge$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\tt{0}}, {\it{j\/}})\index{ilessp} \\ 
{\bf then }($\neg$ {\rm{ilessp}}\,({\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod}, {\tt{0}})\index{ilessp}) $\wedge$ {\rm{ilessp}}\,({\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod}, {\it{j\/}})\index{ilessp} \\ 
{\bf else }\=\+($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod})\index{ilessp}) \\ 
$\wedge$$\;\;\;\;${\rm{ilessp}}\,({\it{j\/}}, {\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod})\index{ilessp}\-$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  idiv-imod-uniqueness \\ \index{idiv-imod-uniqueness}
\=\+(\=\+{\rm{integerp}}\,({\it{i\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;${\rm{integerp}}\,({\it{j\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;${\rm{integerp}}\,({\it{r\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;${\rm{integerp}}\,({\it{q\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;$({\it{j\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $=$ {\rm{iplus}}\,({\it{r\/}}, {\rm{itimes}}\,({\it{j\/}}, {\it{q\/}})\index{itimes})\index{iplus}) \\ 
$\wedge$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\tt{0}}, {\it{j\/}})\index{ilessp}$\;\;${\bf then }($\neg$ {\rm{ilessp}}\,({\it{r\/}}, {\tt{0}})\index{ilessp}) $\wedge$ {\rm{ilessp}}\,({\it{r\/}}, {\it{j\/}})\index{ilessp} \\ 
{\bf else }($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\it{r\/}})\index{ilessp}) $\wedge$ {\rm{ilessp}}\,({\it{j\/}}, {\it{r\/}})\index{ilessp}$\;${\bf  endif}\-)\- \\ 
$\rightarrow$$\;\;\;\;$(({\it{r\/}} $=$ {\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod}) $\wedge$ ({\it{q\/}} $=$ {\rm{idiv}}\,({\it{i\/}}, {\it{j\/}})\index{idiv}))\-
\end{tabbing}

\begin{verbatim}; Division Theorem (truncate towards zero variant):
;
; For all integers i,j, j not 0, there exist unique integers q and r
; which satisfy  
;                i = jq + r,     0 <=  r  <  |j|  (i => 0)
;                             -|j| <   r  <= 0    (i < 0)
;
; In this version (iquo, irem), the integer quotient of two integers is the integer floor
; of the real quotient of the integers, if the real quotient is positive. If the
; real quotient is negative, the integer quotient is the integer ceiling of the
; real quotient. The remainder has the sign of the dividend. The functions IQUO 
; and IREM are intended to compute q and r. Therefore, to be satisfied that we
; have the right definitions, we must prove the above theorem.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  division-theorem-for-truncate-to-zero-part1 \\ \index{division-theorem-for-truncate-t!o-zero-part1}
{\rm{integerp}}\,({\it{i\/}})\index{integerp} $\rightarrow$ ({\rm{iplus}}\,({\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem}, {\rm{itimes}}\,({\it{j\/}}, {\rm{iquo}}\,({\it{i\/}}, {\it{j\/}})\index{iquo})\index{itimes})\index{iplus} $=$ {\it{i\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  division-theorem-for-truncate-to-zero-part2 \\ \index{division-theorem-for-truncate-t!o-zero-part2}
\=\+({\rm{integerp}}\,({\it{i\/}})\index{integerp} $\wedge$ {\rm{integerp}}\,({\it{j\/}})\index{integerp} $\wedge$ ({\it{j\/}} $\not=$ {\tt{0}}) $\wedge$ ($\neg$ {\rm{ilessp}}\,({\it{i\/}}, {\tt{0}})\index{ilessp})) \\ 
$\rightarrow$$\;\;\;\;$(($\neg$ {\rm{ilessp}}\,({\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem}, {\tt{0}})\index{ilessp}) $\wedge$ {\rm{ilessp}}\,({\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem}, {\rm{iabs}}\,({\it{j\/}})\index{iabs})\index{ilessp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  division-theorem-for-truncate-to-zero-part3 \\ \index{division-theorem-for-truncate-t!o-zero-part3}
\=\+({\rm{integerp}}\,({\it{i\/}})\index{integerp} $\wedge$ {\rm{integerp}}\,({\it{j\/}})\index{integerp} $\wedge$ ({\it{j\/}} $\not=$ {\tt{0}}) $\wedge$ {\rm{ilessp}}\,({\it{i\/}}, {\tt{0}})\index{ilessp}) \\ 
$\rightarrow$$\;\;\;\;$(($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem})\index{ilessp}) $\wedge$ {\rm{ilessp}}\,({\rm{ineg}}\,({\rm{iabs}}\,({\it{j\/}})\index{iabs})\index{ineg}, {\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem})\index{ilessp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  division-theorem-for-truncate-to-zero \\ \index{division-theorem-for-truncate-t!o-zero}
\=\+({\rm{integerp}}\,({\it{i\/}})\index{integerp} $\wedge$ {\rm{integerp}}\,({\it{j\/}})\index{integerp} $\wedge$ ({\it{j\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{iplus}}\,({\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem}, {\rm{itimes}}\,({\it{j\/}}, {\rm{iquo}}\,({\it{i\/}}, {\it{j\/}})\index{iquo})\index{itimes})\index{iplus} $=$ {\it{i\/}}) \\ 
$\wedge$$\;\;\;\;$\=\+{\bf if }$\neg$ {\rm{ilessp}}\,({\it{i\/}}, {\tt{0}})\index{ilessp} \\ 
{\bf then }\=\+($\neg$ {\rm{ilessp}}\,({\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem}, {\tt{0}})\index{ilessp}) \\ 
$\wedge$$\;\;\;\;${\rm{ilessp}}\,({\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem}, {\rm{iabs}}\,({\it{j\/}})\index{iabs})\index{ilessp}\- \\ 
{\bf else }\=\+($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem})\index{ilessp}) \\ 
$\wedge$$\;\;\;\;${\rm{ilessp}}\,({\rm{ineg}}\,({\rm{iabs}}\,({\it{j\/}})\index{iabs})\index{ineg}, {\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem})\index{ilessp}\-$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquo-irem-uniqueness \\ \index{iquo-irem-uniqueness}
\=\+(\=\+{\rm{integerp}}\,({\it{i\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;${\rm{integerp}}\,({\it{j\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;${\rm{integerp}}\,({\it{r\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;${\rm{integerp}}\,({\it{q\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;$({\it{j\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\it{i\/}} $=$ {\rm{iplus}}\,({\it{r\/}}, {\rm{itimes}}\,({\it{j\/}}, {\it{q\/}})\index{itimes})\index{iplus}) \\ 
$\wedge$$\;\;\;\;$\=\+{\bf if }$\neg$ {\rm{ilessp}}\,({\it{i\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }($\neg$ {\rm{ilessp}}\,({\it{r\/}}, {\tt{0}})\index{ilessp}) $\wedge$ {\rm{ilessp}}\,({\it{r\/}}, {\rm{iabs}}\,({\it{j\/}})\index{iabs})\index{ilessp} \\ 
{\bf else }($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\it{r\/}})\index{ilessp}) $\wedge$ {\rm{ilessp}}\,({\rm{ineg}}\,({\rm{iabs}}\,({\it{j\/}})\index{iabs})\index{ineg}, {\it{r\/}})\index{ilessp}$\;${\bf  endif}\-)\- \\ 
$\rightarrow$$\;\;\;\;$(({\it{r\/}} $=$ {\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem}) $\wedge$ ({\it{q\/}} $=$ {\rm{iquo}}\,({\it{i\/}}, {\it{j\/}})\index{iquo}))\-
\end{tabbing}

\begin{verbatim}; ---------- Multiplication Facts

\end{verbatim}\begin{tabbing}{\sc Theorem}:  itimes-ineg-1 \\ \index{itimes-ineg-1}
{\rm{itimes}}\,({\rm{ineg}}\,({\it{x\/}})\index{ineg}, {\it{y\/}})\index{itimes} $=$ {\rm{ineg}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes})\index{ineg}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-ineg-2 \\ \index{itimes-ineg-2}
{\rm{itimes}}\,({\it{x\/}}, {\rm{ineg}}\,({\it{y\/}})\index{ineg})\index{itimes} $=$ {\rm{ineg}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes})\index{ineg}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-cancellation-1 \\ \index{itimes-cancellation-1}
\=\+({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{a\/}}, {\it{c\/}})\index{itimes}) \\ 
$=$$\;\;\;\;$(({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $=$ {\tt{0}}) $\vee$ ({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{c\/}})\index{fix-int}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-cancellation-2 \\ \index{itimes-cancellation-2}
\=\+({\rm{itimes}}\,({\it{b\/}}, {\it{a\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{c\/}}, {\it{a\/}})\index{itimes}) \\ 
$=$$\;\;\;\;$(({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $=$ {\tt{0}}) $\vee$ ({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{c\/}})\index{fix-int}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-cancellation-3 \\ \index{itimes-cancellation-3}
\=\+({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{c\/}}, {\it{a\/}})\index{itimes}) \\ 
$=$$\;\;\;\;$(({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $=$ {\tt{0}}) $\vee$ ({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{c\/}})\index{fix-int}))\-
\end{tabbing}

\begin{verbatim}; ---------- Division Facts

\end{verbatim}\begin{tabbing}{\sc Theorem}:  integerp-iquotient \\ \index{integerp-iquotient}
{\rm{integerp}}\,({\rm{iquotient}}\,({\it{i\/}}, {\it{j\/}})\index{iquotient})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  integerp-iremainder \\ \index{integerp-iremainder}
{\rm{integerp}}\,({\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  integerp-idiv \\ \index{integerp-idiv}
{\rm{integerp}}\,({\rm{idiv}}\,({\it{i\/}}, {\it{j\/}})\index{idiv})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  integerp-imod \\ \index{integerp-imod}
{\rm{integerp}}\,({\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  integerp-iquo \\ \index{integerp-iquo}
{\rm{integerp}}\,({\rm{iquo}}\,({\it{i\/}}, {\it{j\/}})\index{iquo})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  integerp-irem \\ \index{integerp-irem}
{\rm{integerp}}\,({\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquotient-fix-int1 \\ \index{iquotient-fix-int1}
{\rm{iquotient}}\,({\rm{fix-int}}\,({\it{i\/}})\index{fix-int}, {\it{j\/}})\index{iquotient} $=$ {\rm{iquotient}}\,({\it{i\/}}, {\it{j\/}})\index{iquotient}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquotient-fix-int2 \\ \index{iquotient-fix-int2}
{\rm{iquotient}}\,({\it{i\/}}, {\rm{fix-int}}\,({\it{j\/}})\index{fix-int})\index{iquotient} $=$ {\rm{iquotient}}\,({\it{i\/}}, {\it{j\/}})\index{iquotient}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iremainder-fix-int1 \\ \index{iremainder-fix-int1}
{\rm{iremainder}}\,({\rm{fix-int}}\,({\it{i\/}})\index{fix-int}, {\it{j\/}})\index{iremainder} $=$ {\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iremainder-fix-int2 \\ \index{iremainder-fix-int2}
{\rm{iremainder}}\,({\it{i\/}}, {\rm{fix-int}}\,({\it{j\/}})\index{fix-int})\index{iremainder} $=$ {\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  idiv-fix-int1 \\ \index{idiv-fix-int1}
{\rm{idiv}}\,({\rm{fix-int}}\,({\it{i\/}})\index{fix-int}, {\it{j\/}})\index{idiv} $=$ {\rm{idiv}}\,({\it{i\/}}, {\it{j\/}})\index{idiv}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  idiv-fix-int2 \\ \index{idiv-fix-int2}
{\rm{idiv}}\,({\it{i\/}}, {\rm{fix-int}}\,({\it{j\/}})\index{fix-int})\index{idiv} $=$ {\rm{idiv}}\,({\it{i\/}}, {\it{j\/}})\index{idiv}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  imod-fix-int1 \\ \index{imod-fix-int1}
{\rm{imod}}\,({\rm{fix-int}}\,({\it{i\/}})\index{fix-int}, {\it{j\/}})\index{imod} $=$ {\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  imod-fix-int2 \\ \index{imod-fix-int2}
{\rm{imod}}\,({\it{i\/}}, {\rm{fix-int}}\,({\it{j\/}})\index{fix-int})\index{imod} $=$ {\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquo-fix-int1 \\ \index{iquo-fix-int1}
{\rm{iquo}}\,({\rm{fix-int}}\,({\it{i\/}})\index{fix-int}, {\it{j\/}})\index{iquo} $=$ {\rm{iquo}}\,({\it{i\/}}, {\it{j\/}})\index{iquo}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquo-fix-int2 \\ \index{iquo-fix-int2}
{\rm{iquo}}\,({\it{i\/}}, {\rm{fix-int}}\,({\it{j\/}})\index{fix-int})\index{iquo} $=$ {\rm{iquo}}\,({\it{i\/}}, {\it{j\/}})\index{iquo}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  irem-fix-int1 \\ \index{irem-fix-int1}
{\rm{irem}}\,({\rm{fix-int}}\,({\it{i\/}})\index{fix-int}, {\it{j\/}})\index{irem} $=$ {\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  irem-fix-int2 \\ \index{irem-fix-int2}
{\rm{irem}}\,({\it{i\/}}, {\rm{fix-int}}\,({\it{j\/}})\index{fix-int})\index{irem} $=$ {\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-int-iquotient \\ \index{fix-int-iquotient}
{\rm{fix-int}}\,({\rm{iquotient}}\,({\it{i\/}}, {\it{j\/}})\index{iquotient})\index{fix-int} $=$ {\rm{iquotient}}\,({\it{i\/}}, {\it{j\/}})\index{iquotient}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-int-iremainder \\ \index{fix-int-iremainder}
{\rm{fix-int}}\,({\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder})\index{fix-int} $=$ {\rm{iremainder}}\,({\it{i\/}}, {\it{j\/}})\index{iremainder}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-int-idiv \\ \index{fix-int-idiv}
{\rm{fix-int}}\,({\rm{idiv}}\,({\it{i\/}}, {\it{j\/}})\index{idiv})\index{fix-int} $=$ {\rm{idiv}}\,({\it{i\/}}, {\it{j\/}})\index{idiv}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-int-imod \\ \index{fix-int-imod}
{\rm{fix-int}}\,({\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod})\index{fix-int} $=$ {\rm{imod}}\,({\it{i\/}}, {\it{j\/}})\index{imod}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-int-iquo \\ \index{fix-int-iquo}
{\rm{fix-int}}\,({\rm{iquo}}\,({\it{i\/}}, {\it{j\/}})\index{iquo})\index{fix-int} $=$ {\rm{iquo}}\,({\it{i\/}}, {\it{j\/}})\index{iquo}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-int-irem \\ \index{fix-int-irem}
{\rm{fix-int}}\,({\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem})\index{fix-int} $=$ {\rm{irem}}\,({\it{i\/}}, {\it{j\/}})\index{irem}
\end{tabbing}


\noindent{\sc Event}:   Disable iquotient.

\addvspace{18pt}

\noindent{\sc Event}:   Disable iremainder.

\addvspace{18pt}

\noindent{\sc Event}:   Disable idiv.

\addvspace{18pt}

\noindent{\sc Event}:   Disable imod.

\addvspace{18pt}

\noindent{\sc Event}:   Disable iquo.

\addvspace{18pt}

\noindent{\sc Event}:   Disable irem.

\addvspace{18pt}

\begin{verbatim}; ---------- Meta lemma for itimes cancellation

;; I tried to adapt this somewhat from corresponding meta lemmas in
;; naturals library, but it seemed to get hairy.  So instead I'll try
;; to parallel the development I gave for IPLUS.  I'll be lazier here
;; about efficiency, so I'll use a completely analogous definition of
;; itimes-tree.  Notice that I've avoided the IZEROP-TREE approach
;; from the naturals version, in that I simply create the appropriate
;; common fringe into a product and say that this product is non-zero
;; when dividing both sides by it.  It can then be up to the user whether
;; or not to enable the (meta or rewrite) rule that says that izerop of a product reduces
;; to the disjunction of izerop of the factors.

#| The function below has no AND or OR, for efficiency
(defn itimes-fringe (x)
  (if (and (listp x)
           (equal (car x)
                  (quote itimes)))
      (append (itimes-fringe (cadr x))
              (itimes-fringe (caddr x)))
      (cons x nil)))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{itimes-fringe} \\  
\=\+{\rm{itimes-fringe}}\,({\it{x\/}})\index{itimes-fringe} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{itimes}} \\ 
{\bf then }{\rm{append}}\,({\rm{itimes-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-fringe}, {\rm{itimes-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-fringe}) \\ 
{\bf else }{\rm{list}}\,({\it{x\/}})$\;${\bf  endif}\- \\ 
{\bf else }{\rm{list}}\,({\it{x\/}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{itimes-tree-rec} \\  
\=\+{\rm{itimes-tree-rec}}\,({\it{l\/}})\index{itimes-tree-rec} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{cdr}}\,({\it{l\/}}) $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\rm{car}}\,({\it{l\/}}) \\ 
{\bf else }{\rm{list}}\,({\tt{'}}{\tt{itimes}}, {\rm{car}}\,({\it{l\/}}), {\rm{itimes-tree-rec}}\,({\rm{cdr}}\,({\it{l\/}}))\index{itimes-tree-rec})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{itimes-tree} \\  
\=\+{\rm{itimes-tree}}\,({\it{l\/}})\index{itimes-tree} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{l\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{l\/}}))$\;\;${\bf then }{\rm{itimes-tree-rec}}\,({\it{l\/}})\index{itimes-tree-rec} \\ 
{\bf else }{\rm{list}}\,({\tt{'}}{\tt{fix-int}}, {\rm{car}}\,({\it{l\/}}))$\;${\bf  endif}\- \\ 
{\bf else }{\tt{'}}{\tt{'}}{\tt{1}}$\;${\bf  endif}\-\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  integerp-itimes-list \\ \index{integerp-itimes-list}
{\rm{integerp}}\,({\rm{itimes-list}}\,({\it{x\/}})\index{itimes-list})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-itimes-tree-rec \\ \index{eval\$-itimes-tree-rec}
\=\+{\rm{listp}}\,({\it{x\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-rec}}\,({\it{x\/}})\index{itimes-tree-rec}, {\it{a\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}}))$\;\;${\bf then }{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list} \\ 
{\bf else }{\rm{eval\$}}\,({\bf{t}}, {\rm{car}}\,({\it{x\/}}), {\it{a\/}})$\;${\bf  endif}\-)\-\-
\end{tabbing}
           
\begin{verbatim};; The following allows us to pretty much ignore itimes-tree forever.  (Notice
;; that it is disabled immediately below.)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  eval\$-itimes-tree \\ \index{eval\$-itimes-tree}
{\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree}}\,({\it{x\/}})\index{itimes-tree}, {\it{a\/}}) $=$ {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list}
\end{tabbing}


\noindent{\sc Event}:   Disable itimes-tree.

\addvspace{18pt} \begin{verbatim};; because we want to use EVAL$-ITIMES-TREE for now

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{make-cancel-itimes-equality} \\  
\=\+{\rm{make-cancel-itimes-equality}}\,({\it{x\/}}, {\it{y\/}}, {\it{in-both\/}})\index{make-cancel-itimes-equality} \\ 
$=$$\;\;\;\;${\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{equal}}, {\rm{itimes-tree}}\,({\it{in-both\/}})\index{itimes-tree}, {\tt{'}}{\tt{'}}{\tt{0}}), \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{t}}), \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{itimes-tree}}\,({\rm{bagdiff}}\,({\it{x\/}}, {\it{in-both\/}})\index{bagdiff})\index{itimes-tree}, \\ 
{\rm{itimes-tree}}\,({\rm{bagdiff}}\,({\it{y\/}}, {\it{in-both\/}})\index{bagdiff})\index{itimes-tree})\-)\-\-
\end{tabbing}

\begin{verbatim}#| The function below has no AND or OR, for efficiency
(defn cancel-itimes (x)
  (if (and (listp x)
           (equal (car x) (quote equal)))
      (if (and (listp (cadr x))
               (equal (caadr x) (quote itimes))
               (listp (caddr x))
               (equal (caaddr x) (quote itimes)))
          (if (listp (bagint (itimes-fringe (cadr x)) (itimes-fringe (caddr x))))
              (make-cancel-itimes-equality (itimes-fringe (cadr x))
                                           (itimes-fringe (caddr x))
                                           (bagint (itimes-fringe (cadr x)) (itimes-fringe (caddr x))))
            x)
        (if (and (listp (cadr x))
                 (equal (caadr x) (quote itimes)))
            ;; We don't want to introduce the IF below unless something
            ;; is "gained", or else we may get into an infinite rewriting loop.
            (if (member (caddr x) (itimes-fringe (cadr x)))
                (list (quote if)
                      (list (quote integerp) (caddr x)) 
                      (make-cancel-itimes-equality (itimes-fringe (cadr x))
                                                   (list (caddr x))
                                                   (list (caddr x)))
                      (list (quote quote) f))
              x)
          (if (and (listp (caddr x))
                   (equal (caaddr x) (quote itimes)))
              (if (member (cadr x) (itimes-fringe (caddr x)))
                  (list (quote if)
                        (list (quote integerp) (cadr x))
                        (make-cancel-itimes-equality (list (cadr x))
                                                     (itimes-fringe (caddr x))
                                                     (list (cadr x)))
                        (list (quote quote) f))
                x)
            x)))
    x))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cancel-itimes} \\  
\=\+{\rm{cancel-itimes}}\,({\it{x\/}})\index{cancel-itimes} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{equal}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{cadr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf if }{\rm{caadr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{itimes}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf if }{\rm{caaddr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{itimes}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{bagint}}\,(\=\+{\rm{itimes-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{itimes-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-fringe})\-\index{bagint}) \\ 
{\bf then }{\rm{make-cancel-itimes-equality}}\,(\=\+{\rm{itimes-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{itimes-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{bagint}}\,(\=\+{\rm{itimes-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{itimes-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-fringe})\-\index{bagint})\-\index{make-cancel-itimes-equality} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{caddr}}\,({\it{x\/}}) $\in$ {\rm{itimes-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-fringe} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{caddr}}\,({\it{x\/}})), \\ 
{\rm{make-cancel-itimes-equality}}\,(\=\+{\rm{itimes-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{list}}\,({\rm{caddr}}\,({\it{x\/}})), \\ 
{\rm{list}}\,({\rm{caddr}}\,({\it{x\/}})))\-\index{make-cancel-itimes-equality}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{caddr}}\,({\it{x\/}}) $\in$ {\rm{itimes-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-fringe} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{caddr}}\,({\it{x\/}})), \\ 
{\rm{make-cancel-itimes-equality}}\,(\=\+{\rm{itimes-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{list}}\,({\rm{caddr}}\,({\it{x\/}})), \\ 
{\rm{list}}\,({\rm{caddr}}\,({\it{x\/}})))\-\index{make-cancel-itimes-equality}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf if }{\rm{caaddr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{itimes}} \\ 
{\bf then }\=\+{\bf if }{\rm{cadr}}\,({\it{x\/}}) $\in$ {\rm{itimes-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-fringe} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{cadr}}\,({\it{x\/}})), \\ 
{\rm{make-cancel-itimes-equality}}\,(\=\+{\rm{list}}\,({\rm{cadr}}\,({\it{x\/}})), \\ 
{\rm{itimes-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{list}}\,({\rm{cadr}}\,({\it{x\/}})))\-\index{make-cancel-itimes-equality}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf if }{\rm{caaddr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{itimes}} \\ 
{\bf then }\=\+{\bf if }{\rm{cadr}}\,({\it{x\/}}) $\in$ {\rm{itimes-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-fringe} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{cadr}}\,({\it{x\/}})), \\ 
{\rm{make-cancel-itimes-equality}}\,(\=\+{\rm{list}}\,({\rm{cadr}}\,({\it{x\/}})), \\ 
{\rm{itimes-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{list}}\,({\rm{cadr}}\,({\it{x\/}})))\-\index{make-cancel-itimes-equality}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  itimes-list-eval\$-fringe \\ \index{itimes-list-eval\$-fringe}
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{itimes-fringe}}\,({\it{x\/}})\index{itimes-fringe}, {\it{a\/}}))\index{itimes-list} $=$ {\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}))\index{fix-int}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  integerp-eval\$-itimes \\ \index{integerp-eval\$-itimes}
({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{itimes}}) $\rightarrow$ {\rm{integerp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}))\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  not-integerp-implies-not-equal-itimes \\ \index{not-integerp-implies-not-equal-iti!mes}
($\neg$ {\rm{integerp}}\,({\it{a\/}})\index{integerp}) $\rightarrow$ (({\it{a\/}} $=$ {\rm{itimes}}\,({\it{b\/}}, {\it{c\/}})\index{itimes}) $=$ {\bf{f}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-list-eval\$-delete \\ \index{itimes-list-eval\$-delete}
\=\+({\it{z\/}} $\in$ {\it{y\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list} \\ 
$=$$\;\;\;\;${\rm{itimes}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}), {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{delete}}\,({\it{z\/}}, {\it{y\/}})\index{delete}, {\it{a\/}}))\index{itimes-list})\index{itimes})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-list-bagdiff \\ \index{itimes-list-bagdiff}
\=\+{\rm{subbagp}}\,({\it{x\/}}, {\it{y\/}})\index{subbagp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list} \\ 
$=$$\;\;\;\;${\rm{itimes}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{y\/}}, {\it{x\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list})\-\index{itimes})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-itimes-list-eval\$-list-delete \\ \index{equal-itimes-list-eval\$-list-de!lete}
\=\+(({\it{c\/}} $\in$ {\it{y\/}}) $\wedge$ ({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{c\/}}, {\it{a\/}}))\index{fix-int} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\it{x\/}} $=$ {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{delete}}\,({\it{c\/}}, {\it{y\/}})\index{delete}, {\it{a\/}}))\index{itimes-list}) \\ 
$=$$\;\;\;\;$(\=\+{\rm{integerp}}\,({\it{x\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{itimes}}\,({\it{x\/}}, {\rm{eval\$}}\,({\bf{t}}, {\it{c\/}}, {\it{a\/}}))\index{itimes} \\ 
$=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list})\-)\-)\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable itimes-list-eval\$-delete.

\addvspace{18pt}

\begin{verbatim};; I had trouble with the clausifier (thanks, J, for pointing that out
;; as the source of my trouble) in the proof of the meta lemma -- it's
;; getting rid of a case split.  So, I'll proceed by reducing
;; cancel-itimes in each case; see lemma eval$-make-cancel-itimes-equality
;; (and its -1 and -2 versions).

\end{verbatim}\begin{tabbing}{\sc Theorem}:  member-append \\ \index{member-append}
({\it{a\/}} $\in$ {\rm{append}}\,({\it{x\/}}, {\it{y\/}})) $=$ (({\it{a\/}} $\in$ {\it{x\/}}) $\vee$ ({\it{a\/}} $\in$ {\it{y\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-izerop-itimes-fringe \\ \index{member-izerop-itimes-fringe}
\=\+(({\it{z\/}} $\in$ {\rm{itimes-fringe}}\,({\it{x\/}})\index{itimes-fringe}) $\wedge$ ({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}))\index{fix-int} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}))\index{fix-int} $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-hack-1 \\ \index{correctness-of-cancel-itimes-ha!ck-1}
\=\+(\=\+({\it{w\/}} $\in$ {\rm{itimes-fringe}}\,({\rm{cons}}\,({\tt{'}}{\tt{itimes}}, {\it{x1\/}}))\index{itimes-fringe}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}}))\index{fix-int} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{car}}\,({\it{x1\/}}), {\it{a\/}}))\index{fix-int} $\not=$ {\tt{0}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{cadr}}\,({\it{x1\/}}), {\it{a\/}}))\index{fix-int} $=$ {\tt{0}})\-
\end{tabbing}


\noindent{\sc Event}:   Enable eval\$-equal.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  eval\$-make-cancel-itimes-equality \\ \index{eval\$-make-cancel-itimes-equalit!y}
\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{make-cancel-itimes-equality}}\,({\it{x\/}}, {\it{y\/}}, {\it{in-both\/}})\index{make-cancel-itimes-equality}, {\it{a\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{eval\$}}\,({\bf{t}}, {\rm{list}}\,({\tt{'}}{\tt{equal}}, {\rm{itimes-tree}}\,({\it{in-both\/}})\index{itimes-tree}, {\tt{'}}{\tt{'}}{\tt{0}}), {\it{a\/}})$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{x\/}}, {\it{in-both\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list} \\ 
$=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{y\/}}, {\it{in-both\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list}\-$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable make-cancel-itimes-equality.

\addvspace{18pt}

\begin{verbatim};; Here's a special case that I hope helps with the clausifier problem.
;; The lemma above seems necessary for its proof.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  eval\$-make-cancel-itimes-equality-1 \\ \index{eval\$-make-cancel-itimes-equalit!y-1}
\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{make-cancel-itimes-equality}}\,({\rm{list}}\,({\it{x\/}}), {\it{y\/}}, {\rm{list}}\,({\it{x\/}}))\index{make-cancel-itimes-equality}, {\it{a\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}))\index{fix-int} $=$ {\tt{0}}$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\tt{1}} $=$ {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{delete}}\,({\it{x\/}}, {\it{y\/}})\index{delete}, {\it{a\/}}))\index{itimes-list}$\;${\bf  endif}\-\-
\end{tabbing}

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

\begin{verbatim};; Here's another special case that I hope helps with the clausifier problem.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  eval\$-make-cancel-itimes-equality-2 \\ \index{eval\$-make-cancel-itimes-equalit!y-2}
\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{make-cancel-itimes-equality}}\,({\it{x\/}}, {\rm{list}}\,({\it{y\/}}), {\rm{list}}\,({\it{y\/}}))\index{make-cancel-itimes-equality}, {\it{a\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{y\/}}, {\it{a\/}}))\index{fix-int} $=$ {\tt{0}}$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\tt{1}} $=$ {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{delete}}\,({\it{y\/}}, {\it{x\/}})\index{delete}, {\it{a\/}}))\index{itimes-list}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-equal-itimes-tree-itimes-fringe-0 \\ \index{eval\$-equal-itimes-tree-itimes!-fringe-0}
\=\+(\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{list}}\,({\tt{'}}{\tt{equal}}, {\rm{itimes-tree}}\,({\rm{itimes-fringe}}\,({\it{x\/}})\index{itimes-fringe})\index{itimes-tree}, {\tt{'}}{\tt{'}}{\tt{0}}), {\it{a\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{itimes}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  izerop-eval-of-member-implies-itimes-list-0 \\ \index{izerop-eval-of-member-implies-iti!mes-list-0}
\=\+(({\it{z\/}} $\in$ {\it{y\/}}) $\wedge$ ({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}))\index{fix-int} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}})\-
\end{tabbing}

\begin{verbatim}#| The function below has no AND or OR, for efficiency
(defn subsetp (x y)
  (if (nlistp x)
      t
    (and (member (car x) y)
         (subsetp (cdr x) y))))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{subsetp} \\  
\=\+{\rm{subsetp}}\,({\it{x\/}}, {\it{y\/}})\index{subsetp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf elseif }{\rm{car}}\,({\it{x\/}}) $\in$ {\it{y\/}}$\;\;${\bf then }{\rm{subsetp}}\,({\rm{cdr}}\,({\it{x\/}}), {\it{y\/}})\index{subsetp} \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subsetp-implies-itimes-list-eval\$-equals-0 \\ \index{subsetp-implies-itimes-list-eva!l\$-equals-0}
\=\+({\rm{subsetp}}\,({\it{x\/}}, {\it{y\/}})\index{subsetp} $\wedge$ ({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subbagp-subsetp \\ \index{subbagp-subsetp}
{\rm{subbagp}}\,({\it{x\/}}, {\it{y\/}})\index{subbagp} $\rightarrow$ {\rm{subsetp}}\,({\it{x\/}}, {\it{y\/}})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-0-itimes-list-eval\$-bagint-1 \\ \index{equal-0-itimes-list-eval\$-bagi!nt-1}
\=\+({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagint}}\,({\it{x\/}}, {\it{y\/}})\index{bagint}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-0-itimes-list-eval\$-bagint-2 \\ \index{equal-0-itimes-list-eval\$-bagi!nt-2}
\=\+({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagint}}\,({\it{x\/}}, {\it{y\/}})\index{bagint}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-hack-2 \\ \index{correctness-of-cancel-itimes-ha!ck-2}
\=\+(\=\+{\rm{listp}}\,({\it{u\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{u\/}}) $=$ {\tt{'}}{\tt{itimes}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{v\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{v\/}}) $=$ {\tt{'}}{\tt{itimes}}) \\ 
$\wedge$$\;\;\;\;$({\rm{eval\$}}\,({\bf{t}}, {\it{u\/}}, {\it{a\/}}) $\not=$ {\rm{eval\$}}\,({\bf{t}}, {\it{v\/}}, {\it{a\/}})))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{bagdiff}}\,(\=\+{\rm{itimes-fringe}}\,({\it{u\/}})\index{itimes-fringe}, \\ 
{\rm{bagint}}\,({\rm{itimes-fringe}}\,({\it{u\/}})\index{itimes-fringe}, {\rm{itimes-fringe}}\,({\it{v\/}})\index{itimes-fringe})\index{bagint})\-\index{bagdiff}, \\ 
{\it{a\/}})\-)\index{itimes-list} \\ 
$\not=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{bagdiff}}\,(\=\+{\rm{itimes-fringe}}\,({\it{v\/}})\index{itimes-fringe}, \\ 
{\rm{bagint}}\,(\=\+{\rm{itimes-fringe}}\,({\it{u\/}})\index{itimes-fringe}, \\ 
{\rm{itimes-fringe}}\,({\it{v\/}})\index{itimes-fringe})\-\index{bagint})\-\index{bagdiff}, \\ 
{\it{a\/}})\-)\index{itimes-list})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-hack-3-lemma \\ \index{correctness-of-cancel-itimes-ha!ck-3-lemma}
\=\+(({\it{u\/}} $=$ {\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes}) $\wedge$ ({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(({\it{u\/}} $=$ {\rm{itimes}}\,({\it{a\/}}, {\it{c\/}})\index{itimes}) $=$ ({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{c\/}})\index{fix-int}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-hack-3 \\ \index{correctness-of-cancel-itimes-ha!ck-3}
\=\+(\=\+{\rm{listp}}\,({\it{u\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{u\/}}) $=$ {\tt{'}}{\tt{itimes}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{v\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{v\/}}) $=$ {\tt{'}}{\tt{itimes}}) \\ 
$\wedge$$\;\;\;\;$({\rm{eval\$}}\,({\bf{t}}, {\it{u\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\it{v\/}}, {\it{a\/}})) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{eval\$}}\,(\=\+{\bf{t}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{itimes-tree}}\,({\rm{bagint}}\,({\rm{itimes-fringe}}\,({\it{u\/}})\index{itimes-fringe}, {\rm{itimes-fringe}}\,({\it{v\/}})\index{itimes-fringe})\index{bagint})\index{itimes-tree}, \\ 
{\tt{'}}{\tt{'}}{\tt{0}})\-, \\ 
{\it{a\/}})\-))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{bagdiff}}\,(\=\+{\rm{itimes-fringe}}\,({\it{u\/}})\index{itimes-fringe}, \\ 
{\rm{bagint}}\,({\rm{itimes-fringe}}\,({\it{u\/}})\index{itimes-fringe}, {\rm{itimes-fringe}}\,({\it{v\/}})\index{itimes-fringe})\index{bagint})\-\index{bagdiff}, \\ 
{\it{a\/}})\-)\index{itimes-list} \\ 
$=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{bagdiff}}\,(\=\+{\rm{itimes-fringe}}\,({\it{v\/}})\index{itimes-fringe}, \\ 
{\rm{bagint}}\,(\=\+{\rm{itimes-fringe}}\,({\it{u\/}})\index{itimes-fringe}, \\ 
{\rm{itimes-fringe}}\,({\it{v\/}})\index{itimes-fringe})\-\index{bagint})\-\index{bagdiff}, \\ 
{\it{a\/}})\-)\index{itimes-list})\- \\ 
$=$$\;\;\;\;${\bf{t}})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-hack-3-lemma.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes \\ \index{correctness-of-cancel-itimes}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-itimes}}\,({\it{x\/}})\index{cancel-itimes}, {\it{a\/}})
\end{tabbing}

\begin{verbatim}; ---------- Meta lemma for itimes cancellation on ilessp terms

;; I'll try to keep this similar to the approach for equalities above,
;; modified as in the iplus case (i.e. no fix-int is necessary).

;; EVAL$-EQUAL is currently enabled, but that's OK.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{itimes-tree-no-fix-int} \\  
\=\+{\rm{itimes-tree-no-fix-int}}\,({\it{l\/}})\index{itimes-tree-no-fix-int} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{l\/}})$\;\;${\bf then }{\rm{itimes-tree-rec}}\,({\it{l\/}})\index{itimes-tree-rec} \\ 
{\bf else }{\tt{'}}{\tt{'}}{\tt{1}}$\;${\bf  endif}\-\-
\end{tabbing}
           
\begin{verbatim};; The following allows us to pretty much ignore
;; itimes-tree-no-fix-int forever.  (Notice that it is disabled
;; immediately below.)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  eval\$-itimes-tree-no-fix-int-1 \\ \index{eval\$-itimes-tree-no-fix-int-1}
\=\+{\rm{ilessp}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-no-fix-int}}\,({\it{x\/}})\index{itimes-tree-no-fix-int}, {\it{a\/}}), {\it{y\/}})\index{ilessp} \\ 
$=$$\;\;\;\;${\rm{ilessp}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree}}\,({\it{x\/}})\index{itimes-tree}, {\it{a\/}}), {\it{y\/}})\index{ilessp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-itimes-tree-no-fix-int-2 \\ \index{eval\$-itimes-tree-no-fix-int-2}
\=\+{\rm{ilessp}}\,({\it{y\/}}, {\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-no-fix-int}}\,({\it{x\/}})\index{itimes-tree-no-fix-int}, {\it{a\/}}))\index{ilessp} \\ 
$=$$\;\;\;\;${\rm{ilessp}}\,({\it{y\/}}, {\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree}}\,({\it{x\/}})\index{itimes-tree}, {\it{a\/}}))\index{ilessp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable itimes-tree-no-fix-int.

\addvspace{18pt}

\begin{verbatim};; We want to use EVAL$-ITIMES-TREE, and ITIMES-TREE is still disabled
;; so we're in good shape.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{make-cancel-itimes-inequality} \\  
\=\+{\rm{make-cancel-itimes-inequality}}\,({\it{x\/}}, {\it{y\/}}, {\it{in-both\/}})\index{make-cancel-itimes-inequality} \\ 
$=$$\;\;\;\;${\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{ilessp}}, {\rm{itimes-tree-no-fix-int}}\,({\it{in-both\/}})\index{itimes-tree-no-fix-int}, {\tt{'}}{\tt{'}}{\tt{0}}), \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{itimes-tree-no-fix-int}}\,({\rm{bagdiff}}\,({\it{y\/}}, {\it{in-both\/}})\index{bagdiff})\index{itimes-tree-no-fix-int}, \\ 
{\rm{itimes-tree-no-fix-int}}\,({\rm{bagdiff}}\,({\it{x\/}}, {\it{in-both\/}})\index{bagdiff})\index{itimes-tree-no-fix-int})\-, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{ilessp}}, {\tt{'}}{\tt{'}}{\tt{0}}, {\rm{itimes-tree-no-fix-int}}\,({\it{in-both\/}})\index{itimes-tree-no-fix-int}), \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{itimes-tree-no-fix-int}}\,({\rm{bagdiff}}\,({\it{x\/}}, {\it{in-both\/}})\index{bagdiff})\index{itimes-tree-no-fix-int}, \\ 
{\rm{itimes-tree-no-fix-int}}\,({\rm{bagdiff}}\,({\it{y\/}}, {\it{in-both\/}})\index{bagdiff})\index{itimes-tree-no-fix-int})\-, \\ 
{\tt{'}}{\tt{(}}{\tt{false}}{\tt{)}})\-)\-\-
\end{tabbing}

\begin{verbatim}#| The function below has no AND or OR, for efficiency
(defn cancel-itimes-ilessp (x)
  (if (and (listp x)
           (equal (car x) (quote ilessp))
           (listp (bagint (itimes-fringe (cadr x)) (itimes-fringe (caddr x)))))
      (make-cancel-itimes-inequality (itimes-fringe (cadr x))
                                     (itimes-fringe (caddr x))
                                     (bagint (itimes-fringe (cadr x))
                                             (itimes-fringe (caddr x))))
    x))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cancel-itimes-ilessp} \\  
\=\+{\rm{cancel-itimes-ilessp}}\,({\it{x\/}})\index{cancel-itimes-ilessp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{ilessp}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{bagint}}\,(\=\+{\rm{itimes-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{itimes-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-fringe})\-\index{bagint}) \\ 
{\bf then }{\rm{make-cancel-itimes-inequality}}\,(\=\+{\rm{itimes-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{itimes-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{bagint}}\,(\=\+{\rm{itimes-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-fringe}, \\ 
{\rm{itimes-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-fringe})\-\index{bagint})\-\index{make-cancel-itimes-inequality} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-make-cancel-itimes-inequality \\ \index{eval\$-make-cancel-itimes-inequ!ality}
\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{make-cancel-itimes-inequality}}\,({\it{x\/}}, {\it{y\/}}, {\it{in-both\/}})\index{make-cancel-itimes-inequality}, {\it{a\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{eval\$}}\,({\bf{t}}, {\rm{list}}\,({\tt{'}}{\tt{ilessp}}, {\rm{itimes-tree-no-fix-int}}\,({\it{in-both\/}})\index{itimes-tree-no-fix-int}, {\tt{'}}{\tt{'}}{\tt{0}}), {\it{a\/}}) \\ 
{\bf then }{\rm{ilessp}}\,(\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-no-fix-int}}\,({\rm{bagdiff}}\,({\it{y\/}}, {\it{in-both\/}})\index{bagdiff})\index{itimes-tree-no-fix-int}, {\it{a\/}}), \\ 
{\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-no-fix-int}}\,({\rm{bagdiff}}\,({\it{x\/}}, {\it{in-both\/}})\index{bagdiff})\index{itimes-tree-no-fix-int}, {\it{a\/}}))\-\index{ilessp} \\ 
{\bf elseif }{\rm{eval\$}}\,({\bf{t}}, {\rm{list}}\,({\tt{'}}{\tt{ilessp}}, {\tt{'}}{\tt{'}}{\tt{0}}, {\rm{itimes-tree-no-fix-int}}\,({\it{in-both\/}})\index{itimes-tree-no-fix-int}), {\it{a\/}}) \\ 
{\bf then }{\rm{ilessp}}\,(\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-no-fix-int}}\,({\rm{bagdiff}}\,({\it{x\/}}, {\it{in-both\/}})\index{bagdiff})\index{itimes-tree-no-fix-int}, {\it{a\/}}), \\ 
{\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-no-fix-int}}\,({\rm{bagdiff}}\,({\it{y\/}}, {\it{in-both\/}})\index{bagdiff})\index{itimes-tree-no-fix-int}, {\it{a\/}}))\-\index{ilessp} \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable make-cancel-itimes-inequality.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  listp-bagint-with-singleton-implies-member \\ \index{listp-bagint-with-singleton-imp!lies-member}
{\rm{listp}}\,({\rm{bagint}}\,({\it{y\/}}, {\rm{list}}\,({\it{z\/}}))\index{bagint}) $\rightarrow$ ({\it{z\/}} $\in$ {\it{y\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-list-eval\$-list-0 \\ \index{itimes-list-eval\$-list-0}
({\tt{0}} $\in$ {\it{x\/}}) $\rightarrow$ ({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-right-positive \\ \index{ilessp-itimes-right-positive}
{\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\rightarrow$ ({\rm{ilessp}}\,({\it{y\/}}, {\it{z\/}})\index{ilessp} $=$ {\rm{ilessp}}\,({\rm{itimes}}\,({\it{y\/}}, {\it{x\/}})\index{itimes}, {\rm{itimes}}\,({\it{z\/}}, {\it{x\/}})\index{itimes})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-ilessp-hack-1 \\ \index{correctness-of-cancel-itimes-ile!ssp-hack-1}
\=\+(\=\+{\rm{subbagp}}\,({\it{bag\/}}, {\it{x\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;${\rm{subbagp}}\,({\it{bag\/}}, {\it{y\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;${\rm{ilessp}}\,({\tt{0}}, {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag\/}}, {\it{a\/}}))\index{itimes-list})\index{ilessp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{x\/}}, {\it{bag\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{y\/}}, {\it{bag\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp} \\ 
$=$$\;\;\;\;${\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-bagint-with-singleton-member \\ \index{listp-bagint-with-singleton-mem!ber}
{\rm{listp}}\,({\rm{bagint}}\,({\it{y\/}}, {\rm{list}}\,({\it{z\/}}))\index{bagint}) $=$ ({\it{z\/}} $\in$ {\it{y\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-ilessp-hack-2-lemma \\ \index{correctness-of-cancel-itimes-ile!ssp-hack-2-lemma}
({\tt{0}} $\in$ {\rm{itimes-fringe}}\,({\it{w\/}})\index{itimes-fringe}) $\rightarrow$ ({\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}}) $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-ilessp-hack-2 \\ \index{correctness-of-cancel-itimes-ile!ssp-hack-2}
({\tt{0}} $\in$ {\rm{itimes-fringe}}\,({\it{w\/}})\index{itimes-fringe}) $\rightarrow$ ($\neg$ {\rm{ilessp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}}), {\tt{0}})\index{ilessp})
\end{tabbing}


\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-ilessp-hack-2-lemma.

\addvspace{18pt}

\begin{verbatim};;; Now hack-3 and hack-4 below are all that's left to prove before the
;;; main result.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ilessp-trichotomy \\ \index{ilessp-trichotomy}
($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp}) $\rightarrow$ ({\rm{ilessp}}\,({\it{y\/}}, {\it{x\/}})\index{ilessp} $=$ ({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $\not=$ {\rm{fix-int}}\,({\it{y\/}})\index{fix-int}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-ilessp-hack-3-lemma-1 \\ \index{correctness-of-cancel-itimes-ile!ssp-hack-3-lemma-1}
\=\+(({\tt{0}} $=$ {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag\/}}, {\it{a\/}}))\index{itimes-list}) $\wedge$ {\rm{subsetp}}\,({\it{bag\/}}, {\it{z\/}})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{z\/}}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-ilessp-hack-3-lemma-2 \\ \index{correctness-of-cancel-itimes-ile!ssp-hack-3-lemma-2}
\=\+(({\tt{0}} $=$ {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag\/}}, {\it{a\/}}))\index{itimes-list}) $\wedge$ {\rm{subsetp}}\,({\it{bag\/}}, {\rm{itimes-fringe}}\,({\it{x\/}})\index{itimes-fringe})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}))\index{fix-int} $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  same-fix-int-implies-not-ilessp \\ \index{same-fix-int-implies-not-ilessp}
({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{y\/}})\index{fix-int}) $\rightarrow$ ($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-ilessp-hack-3 \\ \index{correctness-of-cancel-itimes-ile!ssp-hack-3}
\=\+(\=\+($\neg$ {\rm{ilessp}}\,({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag\/}}, {\it{a\/}}))\index{itimes-list}, {\tt{0}})\index{ilessp}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag\/}}, {\it{a\/}}))\index{itimes-list})\index{ilessp}) \\ 
$\wedge$$\;\;\;\;${\rm{subbagp}}\,({\it{bag\/}}, {\rm{itimes-fringe}}\,({\it{w\/}})\index{itimes-fringe})\index{subbagp} \\ 
$\wedge$$\;\;\;\;${\rm{subbagp}}\,({\it{bag\/}}, {\rm{itimes-fringe}}\,({\it{v\/}})\index{itimes-fringe})\index{subbagp})\- \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{ilessp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}}), {\rm{eval\$}}\,({\bf{t}}, {\it{v\/}}, {\it{a\/}}))\index{ilessp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-right-negative \\ \index{ilessp-itimes-right-negative}
{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} $\rightarrow$ ({\rm{ilessp}}\,({\it{y\/}}, {\it{z\/}})\index{ilessp} $=$ {\rm{ilessp}}\,({\rm{itimes}}\,({\it{z\/}}, {\it{x\/}})\index{itimes}, {\rm{itimes}}\,({\it{y\/}}, {\it{x\/}})\index{itimes})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-ilessp-hack-4 \\ \index{correctness-of-cancel-itimes-ile!ssp-hack-4}
\=\+(\=\+{\rm{subbagp}}\,({\it{bag\/}}, {\it{x\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;${\rm{subbagp}}\,({\it{bag\/}}, {\it{y\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;${\rm{ilessp}}\,({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag\/}}, {\it{a\/}}))\index{itimes-list}, {\tt{0}})\index{ilessp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{x\/}}, {\it{bag\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{y\/}}, {\it{bag\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp} \\ 
$=$$\;\;\;\;${\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable ilessp-trichotomy.

\addvspace{18pt}


\noindent{\sc Event}:   Disable same-fix-int-implies-not-ilessp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-ilessp \\ \index{correctness-of-cancel-itimes-ile!ssp}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-itimes-ilessp}}\,({\it{x\/}})\index{cancel-itimes-ilessp}, {\it{a\/}})
\end{tabbing}

\begin{verbatim};; I think that the following lemma is safe because it won't be
;; called at all during relieve-hyps.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ilessp-strict \\ \index{ilessp-strict}
{\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp} $\rightarrow$ ($\neg$ {\rm{ilessp}}\,({\it{y\/}}, {\it{x\/}})\index{ilessp})
\end{tabbing}


\begin{verbatim}; ---------- Setting up the State ----------

;; I'll close by disabling (or enabling) those rules and definitions
;; whose status as left over from above isn't quite what I'd like.
;; I'm going to leave the eval$ rules on and eval$ off.

\end{verbatim}
\noindent{\sc Event}:   Disable eval\$-cancel-iplus.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-iplus.

\addvspace{18pt}


\noindent{\sc Event}:   Disable lessp-count-listp-cdr.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-iplus-tree-rec.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-iplus-tree.

\addvspace{18pt}
\begin{verbatim};;(disable eval$-list-append) ;; Nice rule -- I'll keep it enabled
\end{verbatim}
\noindent{\sc Event}:   Disable iplus-list-eval\$-fringe.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-iplus-list-bagdiff.

\addvspace{18pt}

\noindent{\sc Event}:   Disable lessp-difference-plus-arg1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable lessp-difference-plus-arg1-commuted.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-iplus-ilessp-lemma.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-ilessp-iplus-tree-no-fix-int.

\addvspace{18pt}

\noindent{\sc Event}:   Disable make-cancel-iplus-inequality-simplifier.

\addvspace{18pt}

\noindent{\sc Event}:   Disable quotient-difference-lessp-arg2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-itimes-tree-rec.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-itimes-tree.

\addvspace{18pt}

\noindent{\sc Event}:   Disable itimes-list-eval\$-fringe.

\addvspace{18pt}

\noindent{\sc Event}:   Disable integerp-eval\$-itimes.

\addvspace{18pt}

\noindent{\sc Event}:   Disable itimes-list-bagdiff.

\addvspace{18pt}

\noindent{\sc Event}:   Disable equal-itimes-list-eval\$-list-delete.

\addvspace{18pt}

\noindent{\sc Event}:   Disable member-izerop-itimes-fringe.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-hack-1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-make-cancel-itimes-equality.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-make-cancel-itimes-equality-1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-make-cancel-itimes-equality-2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-equal-itimes-tree-itimes-fringe-0.

\addvspace{18pt}

\noindent{\sc Event}:   Disable izerop-eval-of-member-implies-itimes-list-0.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subsetp-implies-itimes-list-eval\$-equals-0.

\addvspace{18pt}

\noindent{\sc Event}:   Disable equal-0-itimes-list-eval\$-bagint-1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable equal-0-itimes-list-eval\$-bagint-2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-hack-2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-hack-3-lemma.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-hack-3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-itimes-tree-no-fix-int-1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-itimes-tree-no-fix-int-2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-make-cancel-itimes-inequality.

\addvspace{18pt}

\noindent{\sc Event}:   Disable listp-bagint-with-singleton-implies-member.

\addvspace{18pt}

\noindent{\sc Event}:   Disable itimes-list-eval\$-list-0.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-ilessp-hack-1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable listp-bagint-with-singleton-member.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-ilessp-hack-2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-ilessp-hack-3-lemma-1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-ilessp-hack-3-lemma-2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-ilessp-hack-3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-ilessp-hack-4.

\addvspace{18pt}
\begin{verbatim};; The last one is a tough call, but I think it's OK.
;; (disable ilessp-strict)

;;;;;; ***** EXTRA META STUFF ***** ;;;;;;

;; The next goal is to improve itimes cancellation so that it looks
;; for common factors, and hence works on equations like
;;    x*y + x = x*z
;; and, for that matter,
;; a*x + -b*x = 0.

;; Rather than changing the existing cancel-itimes function, I'll
;; leave that one but disable its metalemma at the end.  Then if the
;; new version, which I'll call cancel-itimes-factors, is found to be
;; too slow, one can always disable its metalemma and re-enable the
;; metalemma for cancel-itimes.

;; Notice, by the way, that the existing cancel-itimes function is
;; useless for something like the following, since there's no special
;; treatment for INEG.  I'll remedy that in this version.

#|
(IMPLIES (AND (NOT (IZEROP X))
              (EQUAL (ITIMES A X) (INEG (ITIMES B X))))
         (EQUAL (FIX-INT A) (INEG B)))
|#

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{itimes-tree-ineg} \\  
\=\+{\rm{itimes-tree-ineg}}\,({\it{l\/}})\index{itimes-tree-ineg} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{l\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{l\/}}) $=$ {\rm{list}}\,({\tt{'}}{\tt{quote}}, {\tt{-1}}) \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{l\/}}))$\;\;${\bf then }{\rm{list}}\,({\tt{'}}{\tt{ineg}}, {\rm{itimes-tree-rec}}\,({\rm{cdr}}\,({\it{l\/}}))\index{itimes-tree-rec}) \\ 
{\bf else }{\rm{car}}\,({\it{l\/}})$\;${\bf  endif}\- \\ 
{\bf else }{\rm{itimes-tree-rec}}\,({\it{l\/}})\index{itimes-tree-rec}$\;${\bf  endif}\- \\ 
{\bf else }{\tt{'}}{\tt{'}}{\tt{1}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{itimes-factors} \\  
\=\+{\rm{itimes-factors}}\,({\it{x\/}})\index{itimes-factors} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{itimes}} \\ 
{\bf then }{\rm{append}}\,({\rm{itimes-factors}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-factors}, {\rm{itimes-factors}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-factors}) \\ 
{\bf elseif }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}} \\ 
{\bf then }\=\+{\bf let }\=\+{\it{bag1\/}}{\bf $\;$ be$\;\;$}{\rm{itimes-factors}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-factors}, \\ 
{\it{bag2\/}}{\bf $\;$ be$\;\;$}{\rm{itimes-factors}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-factors}\- \\ 
{\bf in} \\ 
\=\+{\bf let }\=\+{\it{inboth\/}}{\bf $\;$ be$\;\;$}{\rm{bagint}}\,({\it{bag1\/}}, {\it{bag2\/}})\index{bagint}\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\rm{listp}}\,({\it{inboth\/}}) \\ 
{\bf then }{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\tt{'}}{\tt{iplus}}, \\ 
{\rm{itimes-tree-ineg}}\,({\rm{bagdiff}}\,(\=\+{\it{bag1\/}}, \\ 
{\it{inboth\/}})\-\index{bagdiff})\index{itimes-tree-ineg}, \\ 
{\rm{itimes-tree-ineg}}\,({\rm{bagdiff}}\,(\=\+{\it{bag2\/}}, \\ 
{\it{inboth\/}})\-\index{bagdiff})\index{itimes-tree-ineg})\-, \\ 
{\it{inboth\/}})\- \\ 
{\bf else }{\rm{list}}\,({\it{x\/}})$\;${\bf  endif}\-$\;${\bf  endlet}\-$\;${\bf  endlet}\- \\ 
{\bf elseif }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{ineg}} \\ 
{\bf then }{\rm{cons}}\,({\rm{list}}\,({\tt{'}}{\tt{quote}}, {\tt{-1}}), {\rm{itimes-factors}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-factors}) \\ 
{\bf else }{\rm{list}}\,({\it{x\/}})$\;${\bf  endif}\- \\ 
{\bf else }{\rm{list}}\,({\it{x\/}})$\;${\bf  endif}\-\-
\end{tabbing}

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

\begin{verbatim};; I'll need the following lemma because it's simplest not to deal with
;; e.g. (equal x x), where x is a variable, in the meta thing.  I'll do
;; the one after it too, simply because I'm thinking of it now.
\end{verbatim}\begin{tabbing}{\sc Theorem}:  equal-ineg-ineg \\ \index{equal-ineg-ineg}
({\rm{ineg}}\,({\it{x\/}})\index{ineg} $=$ {\rm{ineg}}\,({\it{y\/}})\index{ineg}) $=$ ({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{y\/}})\index{fix-int})
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  fix-int-eval\$-itimes-tree-rec \\ \index{fix-int-eval\$-itimes-tree-rec}
\=\+{\rm{listp}}\,({\it{x\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-rec}}\,({\it{x\/}})\index{itimes-tree-rec}, {\it{a\/}}))\index{fix-int} \\ 
$=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-itimes-tree-ineg \\ \index{eval\$-itimes-tree-ineg}
{\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-ineg}}\,({\it{x\/}})\index{itimes-tree-ineg}, {\it{a\/}}))\index{fix-int} $=$ {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list}
\end{tabbing}

\begin{verbatim};; Now I want the above lemma to apply, but it doesn't, so the
;; following three lemmas are used instead.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ineg-eval\$-itimes-tree-ineg \\ \index{ineg-eval\$-itimes-tree-ineg}
\=\+{\rm{ineg}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-ineg}}\,({\it{x\/}})\index{itimes-tree-ineg}, {\it{a\/}}))\index{ineg} \\ 
$=$$\;\;\;\;${\rm{ineg}}\,({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list})\index{ineg}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-eval\$-itimes-tree-ineg \\ \index{iplus-eval\$-itimes-tree-ineg}
\=\+(\=\+{\rm{iplus}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-ineg}}\,({\it{x\/}})\index{itimes-tree-ineg}, {\it{a\/}}), {\it{y\/}})\index{iplus} \\ 
$=$$\;\;\;\;${\rm{iplus}}\,({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list}, {\it{y\/}})\index{iplus})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{iplus}}\,({\it{y\/}}, {\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-ineg}}\,({\it{x\/}})\index{itimes-tree-ineg}, {\it{a\/}}))\index{iplus} \\ 
$=$$\;\;\;\;${\rm{iplus}}\,({\it{y\/}}, {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list})\index{iplus})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-eval\$-itimes-tree-ineg \\ \index{itimes-eval\$-itimes-tree-ineg}
\=\+(\=\+{\rm{itimes}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-ineg}}\,({\it{x\/}})\index{itimes-tree-ineg}, {\it{a\/}}), {\it{y\/}})\index{itimes} \\ 
$=$$\;\;\;\;${\rm{itimes}}\,({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list}, {\it{y\/}})\index{itimes})\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{itimes}}\,({\it{y\/}}, {\rm{eval\$}}\,({\bf{t}}, {\rm{itimes-tree-ineg}}\,({\it{x\/}})\index{itimes-tree-ineg}, {\it{a\/}}))\index{itimes} \\ 
$=$$\;\;\;\;${\rm{itimes}}\,({\it{y\/}}, {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list})\index{itimes})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable itimes-tree-ineg.

\addvspace{18pt}

\begin{verbatim}#| ****** The following definitions are for efficient execution of
   metafunctions.  They should probably be applied to all the metafunctions
   with fns arguments AND and OR.

(defmacro nqthm-macroexpand (defn &rest fns)
  `(nqthm-macroexpand-fn ',defn ',fns))

(defun nqthm-macroexpand-fn (defn fns)
  (iterate for fn in fns
           when (not (get fn 'sdefn))
           do (er soft (fn) |Sorry| |,| |but| |there| |is| |no| SDEFN
                  |for| (!ppr fn (quote |.|))))
  (let (name args body)
    (match! defn (defn name args body))
    (let ((arity-alist (cons (cons name (length args)) arity-alist)))
      (list 'defn name args
            (untranslate (normalize-ifs
                          (nqthm-macroexpand-term (translate body) fns)
                          nil nil nil))))))

(defun nqthm-macroexpand-term (term fns)
  (cond
   ((or (variablep term) (fquotep term))
    term)
   ((member-eq (ffn-symb term) fns)
    (let ((sdefn (get (ffn-symb term) 'sdefn)))
      (sub-pair-var (cadr sdefn)
                    (iterate for arg in (fargs term)
                             collect (nqthm-macroexpand-term arg fns))
                    (caddr sdefn))))
   (t (fcons-term (ffn-symb term)
                  (iterate for arg in (fargs term)
                           collect (nqthm-macroexpand-term arg fns))))))

|#

;; I "macroexpand" away the following below, so it's not really needed except
;; for the proof.  That is, I use it in the definition of cancel-itimes-factors,
;; but then get rid of it for cancel-itimes-factors-expanded, and although I
;; reason about the former, I USE the latter, for efficiency.
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{iplus-or-itimes-term} \\  
\=\+{\rm{iplus-or-itimes-term}}\,({\it{x\/}})\index{iplus-or-itimes-term} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf case on }{\rm{car}}\,({\it{x\/}}): \\ 
{\bf case = }{\it{iplus\/}} \\ 
{\bf then }{\bf{t}} \\ 
{\bf case = }{\it{itimes\/}} \\ 
{\bf $\;\;$then }{\bf{t}} \\ 
{\bf case = }{\it{ineg\/}} \\ 
{\bf $\;\;$then }\=\+{\bf if }{\rm{listp}}\,({\rm{cadr}}\,({\it{x\/}}))$\;\;${\bf then }{\rm{car}}\,({\rm{cadr}}\,({\it{x\/}})) $=$ {\tt{'}}{\tt{itimes}} \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\- \\ 
{\bf otherwise }{\bf{f}}$\;${\bf  endcase}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{cancel-itimes-factors} \\  
\=\+{\rm{cancel-itimes-factors}}\,({\it{x\/}})\index{cancel-itimes-factors} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) $\wedge$ ({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{equal}}) \\ 
{\bf then }\=\+{\bf let }\=\+{\it{bagint\/}}{\bf $\;$ be$\;\;$}{\rm{bagint}}\,(\=\+{\rm{itimes-factors}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-factors}, \\ 
{\rm{itimes-factors}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-factors})\-\index{bagint}\- \\ 
{\bf in} \\ 
\=\+{\bf let }\=\+{\it{new-equality\/}}{\bf $\;$ be$\;\;$}{\rm{make-cancel-itimes-equality}}\,(\=\+{\rm{itimes-factors}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-factors}, \\ 
{\rm{itimes-factors}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-factors}, \\ 
{\it{bagint\/}})\-\index{make-cancel-itimes-equality}\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\rm{iplus-or-itimes-term}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-or-itimes-term} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\it{bagint\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{iplus-or-itimes-term}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-or-itimes-term} \\ 
{\bf then }{\it{new-equality\/}} \\ 
{\bf else }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{integerp}}, \\ 
{\rm{caddr}}\,({\it{x\/}}))\-, \\ 
{\it{new-equality\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\-$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{iplus-or-itimes-term}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-or-itimes-term} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\it{bagint\/}}) \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{cadr}}\,({\it{x\/}})), \\ 
{\it{new-equality\/}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-$\;${\bf  endlet}\-$\;${\bf  endlet}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; The following was generated with the nqthm-macroexpand macro defined above.
\end{verbatim}%\item 
\begin{verbatim}


;; The following was generated with the nqthm-macroexpand macro defined above.
(DEFN CANCEL-ITIMES-FACTORS-expanded (X)
  (IF (LISTP X)
      (IF (EQUAL (CAR X) 'EQUAL)
          (COND
           ((LISTP (CADR X))
            (CASE (CAR (CAR (CDR X)))
                  (IPLUS (IF (LISTP (BAGINT (ITIMES-FACTORS (CADR X))
                                            (ITIMES-FACTORS (CADDR X))))
                             (IF (LISTP (CADDR X))
                                 (CASE (CAR (CAR (CDR (CDR X))))
                                       (IPLUS
                                        (MAKE-CANCEL-ITIMES-EQUALITY
                                         (ITIMES-FACTORS (CADR X))
                                         (ITIMES-FACTORS (CADDR X))
                                         (BAGINT (ITIMES-FACTORS (CADR X))
                                                 (ITIMES-FACTORS (CADDR X)))))
                                       (ITIMES
                                        (MAKE-CANCEL-ITIMES-EQUALITY
                                         (ITIMES-FACTORS (CADR X))
                                         (ITIMES-FACTORS (CADDR X))
                                         (BAGINT (ITIMES-FACTORS (CADR X))
                                                 (ITIMES-FACTORS (CADDR X)))))
                                       (INEG
                                        (IF (LISTP (CADADDR X))
                                            (IF (EQUAL (CAADADDR X) 'ITIMES)
                                                (MAKE-CANCEL-ITIMES-EQUALITY
                                                 (ITIMES-FACTORS (CADR X))
                                                 (ITIMES-FACTORS (CADDR X))
                                                 (BAGINT
                                                  (ITIMES-FACTORS (CADR X))
                                                  (ITIMES-FACTORS (CADDR X))))
                                                (LIST 'IF
                                                      (LIST 'INTEGERP (CADDR X))
                                                      (MAKE-CANCEL-ITIMES-EQUALITY
                                                       (ITIMES-FACTORS (CADR X))
                                                       (ITIMES-FACTORS (CADDR X))
                                                       (BAGINT
                                                        (ITIMES-FACTORS (CADR X))
                                                        (ITIMES-FACTORS (CADDR X))))
                                                      (LIST 'QUOTE F)))
                                            (LIST 'IF
                                                  (LIST 'INTEGERP (CADDR X))
                                                  (MAKE-CANCEL-ITIMES-EQUALITY
                                                   (ITIMES-FACTORS (CADR X))
                                                   (ITIMES-FACTORS (CADDR X))
                                                   (BAGINT
                                                    (ITIMES-FACTORS (CADR X))
                                                    (ITIMES-FACTORS (CADDR X))))
                                                  (LIST 'QUOTE F))))
                                       (OTHERWISE
                                        (LIST 'IF
                                              (LIST 'INTEGERP (CADDR X))
                                              (MAKE-CANCEL-ITIMES-EQUALITY
                                               (ITIMES-FACTORS (CADR X))
                                               (ITIMES-FACTORS (CADDR X))
                                               (BAGINT
                                                (ITIMES-FACTORS (CADR X))
                                                (ITIMES-FACTORS (CADDR X))))
                                              (LIST 'QUOTE F))))
                                 (LIST 'IF (LIST 'INTEGERP (CADDR X))
                                       (MAKE-CANCEL-ITIMES-EQUALITY
                                        (ITIMES-FACTORS (CADR X))
                                        (ITIMES-FACTORS (CADDR X))
                                        (BAGINT
                                         (ITIMES-FACTORS (CADR X))
                                         (ITIMES-FACTORS (CADDR X))))
                                       (LIST 'QUOTE F)))
                             X))
                  (ITIMES (IF (LISTP (BAGINT (ITIMES-FACTORS (CADR X))
                                             (ITIMES-FACTORS (CADDR X))))
                              (IF (LISTP (CADDR X))
                                  (CASE (CAR (CAR (CDR (CDR X))))
                                        (IPLUS
                                         (MAKE-CANCEL-ITIMES-EQUALITY
                                          (ITIMES-FACTORS (CADR X))
                                          (ITIMES-FACTORS (CADDR X))
                                          (BAGINT
                                           (ITIMES-FACTORS (CADR X))
                                           (ITIMES-FACTORS (CADDR X)))))
                                        (ITIMES
                                         (MAKE-CANCEL-ITIMES-EQUALITY
                                          (ITIMES-FACTORS (CADR X))
                                          (ITIMES-FACTORS (CADDR X))
                                          (BAGINT
                                           (ITIMES-FACTORS (CADR X))
                                           (ITIMES-FACTORS (CADDR X)))))
                                        (INEG
                                         (IF (LISTP (CADADDR X))
                                             (IF (EQUAL (CAADADDR X) 'ITIMES)
                                                 (MAKE-CANCEL-ITIMES-EQUALITY
                                                  (ITIMES-FACTORS (CADR X))
                                                  (ITIMES-FACTORS (CADDR X))
                                                  (BAGINT
                                                   (ITIMES-FACTORS (CADR X))
                                                   (ITIMES-FACTORS (CADDR X))))
                                                 (LIST 'IF
                                                       (LIST 'INTEGERP (CADDR X))
                                                       (MAKE-CANCEL-ITIMES-EQUALITY
                                                        (ITIMES-FACTORS (CADR X))
                                                        (ITIMES-FACTORS (CADDR X))
                                                        (BAGINT
                                                         (ITIMES-FACTORS (CADR X))
                                                         (ITIMES-FACTORS (CADDR X))))
                                                       (LIST 'QUOTE F)))
                                             (LIST 'IF
                                                   (LIST 'INTEGERP (CADDR X))
                                                   (MAKE-CANCEL-ITIMES-EQUALITY
                                                    (ITIMES-FACTORS (CADR X))
                                                    (ITIMES-FACTORS (CADDR X))
                                                    (BAGINT
                                                     (ITIMES-FACTORS (CADR X))
                                                     (ITIMES-FACTORS (CADDR X))))
                                                   (LIST 'QUOTE F))))
                                        (OTHERWISE
                                         (LIST 'IF
                                               (LIST 'INTEGERP (CADDR X))
                                               (MAKE-CANCEL-ITIMES-EQUALITY
                                                (ITIMES-FACTORS (CADR X))
                                                (ITIMES-FACTORS (CADDR X))
                                                (BAGINT
                                                 (ITIMES-FACTORS (CADR X))
                                                 (ITIMES-FACTORS (CADDR X))))
                                               (LIST 'QUOTE F))))
                                  (LIST 'IF (LIST 'INTEGERP (CADDR X))
                                        (MAKE-CANCEL-ITIMES-EQUALITY
                                         (ITIMES-FACTORS (CADR X))
                                         (ITIMES-FACTORS (CADDR X))
                                         (BAGINT (ITIMES-FACTORS (CADR X))
                                                 (ITIMES-FACTORS (CADDR X))))
                                        (LIST 'QUOTE F)))
                              X))
                  (INEG (COND
                         ((LISTP (CADADR X))
                          (COND
                           ((EQUAL (CAADADR X) 'ITIMES)
                            (IF (LISTP
                                 (BAGINT (ITIMES-FACTORS (CADR X))
                                         (ITIMES-FACTORS (CADDR X))))
                                (IF (LISTP (CADDR X))
                                    (CASE (CAR (CAR (CDR (CDR X))))
                                          (IPLUS
                                           (MAKE-CANCEL-ITIMES-EQUALITY
                                            (ITIMES-FACTORS (CADR X))
                                            (ITIMES-FACTORS (CADDR X))
                                            (BAGINT
                                             (ITIMES-FACTORS (CADR X))
                                             (ITIMES-FACTORS (CADDR X)))))
                                          (ITIMES
                                           (MAKE-CANCEL-ITIMES-EQUALITY
                                            (ITIMES-FACTORS (CADR X))
                                            (ITIMES-FACTORS (CADDR X))
                                            (BAGINT
                                             (ITIMES-FACTORS (CADR X))
                                             (ITIMES-FACTORS (CADDR X)))))
                                          (INEG
                                           (IF (LISTP (CADADDR X))
                                               (IF
                                                (EQUAL (CAADADDR X) 'ITIMES)
                                                (MAKE-CANCEL-ITIMES-EQUALITY
                                                 (ITIMES-FACTORS (CADR X))
                                                 (ITIMES-FACTORS (CADDR X))
                                                 (BAGINT
                                                  (ITIMES-FACTORS (CADR X))
                                                  (ITIMES-FACTORS (CADDR X))))
                                                (LIST 'IF
                                                      (LIST 'INTEGERP (CADDR X))
                                                      (MAKE-CANCEL-ITIMES-EQUALITY
                                                       (ITIMES-FACTORS (CADR X))
                                                       (ITIMES-FACTORS (CADDR X))
                                                       (BAGINT
                                                        (ITIMES-FACTORS (CADR X))
                                                        (ITIMES-FACTORS (CADDR X))))
                                                      (LIST 'QUOTE F)))
                                               (LIST 'IF
                                                     (LIST 'INTEGERP (CADDR X))
                                                     (MAKE-CANCEL-ITIMES-EQUALITY
                                                      (ITIMES-FACTORS (CADR X))
                                                      (ITIMES-FACTORS (CADDR X))
                                                      (BAGINT
                                                       (ITIMES-FACTORS (CADR X))
                                                       (ITIMES-FACTORS (CADDR X))))
                                                     (LIST 'QUOTE F))))
                                          (OTHERWISE
                                           (LIST 'IF
                                                 (LIST 'INTEGERP (CADDR X))
                                                 (MAKE-CANCEL-ITIMES-EQUALITY
                                                  (ITIMES-FACTORS (CADR X))
                                                  (ITIMES-FACTORS (CADDR X))
                                                  (BAGINT
                                                   (ITIMES-FACTORS (CADR X))
                                                   (ITIMES-FACTORS (CADDR X))))
                                                 (LIST 'QUOTE F))))
                                    (LIST 'IF
                                          (LIST 'INTEGERP (CADDR X))
                                          (MAKE-CANCEL-ITIMES-EQUALITY
                                           (ITIMES-FACTORS (CADR X))
                                           (ITIMES-FACTORS (CADDR X))
                                           (BAGINT (ITIMES-FACTORS (CADR X))
                                                   (ITIMES-FACTORS (CADDR X))))
                                          (LIST 'QUOTE F)))
                                X))
                           ((LISTP (CADDR X))
                            (CASE (CAR (CAR (CDR (CDR X))))
                                  (IPLUS (IF
                                          (LISTP
                                           (BAGINT
                                            (ITIMES-FACTORS (CADR X))
                                            (ITIMES-FACTORS (CADDR X))))
                                          (LIST 'IF
                                                (LIST 'INTEGERP (CADR X))
                                                (MAKE-CANCEL-ITIMES-EQUALITY
                                                 (ITIMES-FACTORS (CADR X))
                                                 (ITIMES-FACTORS (CADDR X))
                                                 (BAGINT
                                                  (ITIMES-FACTORS (CADR X))
                                                  (ITIMES-FACTORS (CADDR X))))
                                                (LIST 'QUOTE F))
                                          X))
                                  (ITIMES (IF
                                           (LISTP
                                            (BAGINT
                                             (ITIMES-FACTORS (CADR X))
                                             (ITIMES-FACTORS (CADDR X))))
                                           (LIST 'IF
                                                 (LIST 'INTEGERP (CADR X))
                                                 (MAKE-CANCEL-ITIMES-EQUALITY
                                                  (ITIMES-FACTORS (CADR X))
                                                  (ITIMES-FACTORS (CADDR X))
                                                  (BAGINT
                                                   (ITIMES-FACTORS (CADR X))
                                                   (ITIMES-FACTORS (CADDR X))))
                                                 (LIST 'QUOTE F))
                                           X))
                                  (INEG (IF (LISTP (CADADDR X))
                                            (IF
                                             (EQUAL (CAADADDR X) 'ITIMES)
                                             (IF
                                              (LISTP
                                               (BAGINT
                                                (ITIMES-FACTORS (CADR X))
                                                (ITIMES-FACTORS (CADDR X))))
                                              (LIST 'IF
                                                    (LIST 'INTEGERP (CADR X))
                                                    (MAKE-CANCEL-ITIMES-EQUALITY
                                                     (ITIMES-FACTORS (CADR X))
                                                     (ITIMES-FACTORS (CADDR X))
                                                     (BAGINT
                                                      (ITIMES-FACTORS (CADR X))
                                                      (ITIMES-FACTORS (CADDR X))))
                                                    (LIST 'QUOTE F))
                                              X)
                                             X)
                                            X))
                                  (OTHERWISE X)))
                           (T X)))
                         ((LISTP (CADDR X))
                          (CASE (CAR (CAR (CDR (CDR X))))
                                (IPLUS (IF
                                        (LISTP
                                         (BAGINT
                                          (ITIMES-FACTORS (CADR X))
                                          (ITIMES-FACTORS (CADDR X))))
                                        (LIST 'IF
                                              (LIST 'INTEGERP (CADR X))
                                              (MAKE-CANCEL-ITIMES-EQUALITY
                                               (ITIMES-FACTORS (CADR X))
                                               (ITIMES-FACTORS (CADDR X))
                                               (BAGINT
                                                (ITIMES-FACTORS (CADR X))
                                                (ITIMES-FACTORS (CADDR X))))
                                              (LIST 'QUOTE F))
                                        X))
                                (ITIMES (IF
                                         (LISTP
                                          (BAGINT
                                           (ITIMES-FACTORS (CADR X))
                                           (ITIMES-FACTORS (CADDR X))))
                                         (LIST 'IF
                                               (LIST 'INTEGERP (CADR X))
                                               (MAKE-CANCEL-ITIMES-EQUALITY
                                                (ITIMES-FACTORS (CADR X))
                                                (ITIMES-FACTORS (CADDR X))
                                                (BAGINT
                                                 (ITIMES-FACTORS (CADR X))
                                                 (ITIMES-FACTORS (CADDR X))))
                                               (LIST 'QUOTE F))
                                         X))
                                (INEG (IF (LISTP (CADADDR X))
                                          (IF (EQUAL (CAADADDR X) 'ITIMES)
                                              (IF
                                               (LISTP
                                                (BAGINT
                                                 (ITIMES-FACTORS (CADR X))
                                                 (ITIMES-FACTORS (CADDR X))))
                                               (LIST 'IF
                                                     (LIST 'INTEGERP (CADR X))
                                                     (MAKE-CANCEL-ITIMES-EQUALITY
                                                      (ITIMES-FACTORS (CADR X))
                                                      (ITIMES-FACTORS (CADDR X))
                                                      (BAGINT
                                                       (ITIMES-FACTORS (CADR X))
                                                       (ITIMES-FACTORS (CADDR X))))
                                                     (LIST 'QUOTE F))
                                               X)
                                              X)
                                          X))
                                (OTHERWISE X)))
                         (T X)))
                  (OTHERWISE
                   (IF (LISTP (CADDR X))
                       (CASE (CAR (CAR (CDR (CDR X))))
                             (IPLUS (IF
                                     (LISTP
                                      (BAGINT (ITIMES-FACTORS (CADR X))
                                              (ITIMES-FACTORS (CADDR X))))
                                     (LIST 'IF
                                           (LIST 'INTEGERP (CADR X))
                                           (MAKE-CANCEL-ITIMES-EQUALITY
                                            (ITIMES-FACTORS (CADR X))
                                            (ITIMES-FACTORS (CADDR X))
                                            (BAGINT
                                             (ITIMES-FACTORS (CADR X))
                                             (ITIMES-FACTORS (CADDR X))))
                                           (LIST 'QUOTE F))
                                     X))
                             (ITIMES (IF
                                      (LISTP
                                       (BAGINT
                                        (ITIMES-FACTORS (CADR X))
                                        (ITIMES-FACTORS (CADDR X))))
                                      (LIST 'IF
                                            (LIST 'INTEGERP (CADR X))
                                            (MAKE-CANCEL-ITIMES-EQUALITY
                                             (ITIMES-FACTORS (CADR X))
                                             (ITIMES-FACTORS (CADDR X))
                                             (BAGINT
                                              (ITIMES-FACTORS (CADR X))
                                              (ITIMES-FACTORS (CADDR X))))
                                            (LIST 'QUOTE F))
                                      X))
                             (INEG (IF (LISTP (CADADDR X))
                                       (IF (EQUAL (CAADADDR X) 'ITIMES)
                                           (IF
                                            (LISTP
                                             (BAGINT
                                              (ITIMES-FACTORS (CADR X))
                                              (ITIMES-FACTORS (CADDR X))))
                                            (LIST 'IF
                                                  (LIST 'INTEGERP (CADR X))
                                                  (MAKE-CANCEL-ITIMES-EQUALITY
                                                   (ITIMES-FACTORS (CADR X))
                                                   (ITIMES-FACTORS (CADDR X))
                                                   (BAGINT
                                                    (ITIMES-FACTORS (CADR X))
                                                    (ITIMES-FACTORS (CADDR X))))
                                                  (LIST 'QUOTE F))
                                            X)
                                           X)
                                       X))
                             (OTHERWISE X))
                       X))))
           ((LISTP (CADDR X))
            (CASE (CAR (CAR (CDR (CDR X))))
                  (IPLUS (IF (LISTP (BAGINT (ITIMES-FACTORS (CADR X))
                                            (ITIMES-FACTORS (CADDR X))))
                             (LIST 'IF (LIST 'INTEGERP (CADR X))
                                   (MAKE-CANCEL-ITIMES-EQUALITY
                                    (ITIMES-FACTORS (CADR X))
                                    (ITIMES-FACTORS (CADDR X))
                                    (BAGINT (ITIMES-FACTORS (CADR X))
                                            (ITIMES-FACTORS (CADDR X))))
                                   (LIST 'QUOTE F))
                             X))
                  (ITIMES (IF (LISTP (BAGINT (ITIMES-FACTORS (CADR X))
                                             (ITIMES-FACTORS (CADDR X))))
                              (LIST 'IF (LIST 'INTEGERP (CADR X))
                                    (MAKE-CANCEL-ITIMES-EQUALITY
                                     (ITIMES-FACTORS (CADR X))
                                     (ITIMES-FACTORS (CADDR X))
                                     (BAGINT (ITIMES-FACTORS (CADR X))
                                             (ITIMES-FACTORS (CADDR X))))
                                    (LIST 'QUOTE F))
                              X))
                  (INEG (IF (LISTP (CADADDR X))
                            (IF (EQUAL (CAADADDR X) 'ITIMES)
                                (IF (LISTP
                                     (BAGINT (ITIMES-FACTORS (CADR X))
                                             (ITIMES-FACTORS (CADDR X))))
                                    (LIST 'IF
                                          (LIST 'INTEGERP (CADR X))
                                          (MAKE-CANCEL-ITIMES-EQUALITY
                                           (ITIMES-FACTORS (CADR X))
                                           (ITIMES-FACTORS (CADDR X))
                                           (BAGINT
                                            (ITIMES-FACTORS (CADR X))
                                            (ITIMES-FACTORS (CADDR X))))
                                          (LIST 'QUOTE F))
                                    X)
                                X)
                            X))
                  (OTHERWISE X)))
           (T X))
          X)
      X))
\end{verbatim}


\begin{tabbing}{\sc Theorem}:  cancel-itimes-factors-expanded-cancel-itimes-factors \\ \index{cancel-itimes-factors-expanded-!cancel-itimes-factors}
{\rm{cancel-itimes-factors-expanded}}\,({\it{x\/}})\index{cancel-itimes-factors-expanded} $=$ {\rm{cancel-itimes-factors}}\,({\it{x\/}})\index{cancel-itimes-factors}
\end{tabbing}


\noindent{\sc Event}:   Disable cancel-itimes-factors-expanded.

\addvspace{18pt}


\noindent{\sc Event}:   Disable iplus-or-itimes-term.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  equal-itimes-list-eval\$-list-delete-new-1 \\ \index{equal-itimes-list-eval\$-list-de!lete-new-1}
\=\+({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{elt\/}}, {\it{a\/}}))\index{fix-int} $\not=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\it{x\/}} $=$ {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{delete}}\,({\it{elt\/}}, {\it{bag\/}})\index{delete}, {\it{a\/}}))\index{itimes-list}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{elt\/}} $\in$ {\it{bag\/}} \\ 
{\bf then }\=\+{\rm{integerp}}\,({\it{x\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{itimes}}\,({\it{x\/}}, {\rm{eval\$}}\,({\bf{t}}, {\it{elt\/}}, {\it{a\/}}))\index{itimes} \\ 
$=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag\/}}, {\it{a\/}}))\index{itimes-list})\-\- \\ 
{\bf else }{\it{x\/}} $=$ {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag\/}}, {\it{a\/}}))\index{itimes-list}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-itimes-list-eval\$-list-delete-new-2 \\ \index{equal-itimes-list-eval\$-list-de!lete-new-2}
\=\+({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{elt\/}}, {\it{a\/}}))\index{fix-int} $\not=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{delete}}\,({\it{elt\/}}, {\it{bag\/}})\index{delete}, {\it{a\/}}))\index{itimes-list} $=$ {\it{x\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{elt\/}} $\in$ {\it{bag\/}} \\ 
{\bf then }\=\+{\rm{integerp}}\,({\it{x\/}})\index{integerp} \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{itimes}}\,({\it{x\/}}, {\rm{eval\$}}\,({\bf{t}}, {\it{elt\/}}, {\it{a\/}}))\index{itimes} \\ 
$=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag\/}}, {\it{a\/}}))\index{itimes-list})\-\- \\ 
{\bf else }{\it{x\/}} $=$ {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag\/}}, {\it{a\/}}))\index{itimes-list}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-itimes-list-eval\$-list-delete \\ \index{itimes-itimes-list-eval\$-list-!delete}
\=\+({\it{x\/}} $\in$ {\it{bag\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{itimes}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}), {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{delete}}\,({\it{x\/}}, {\it{bag\/}})\index{delete}, {\it{a\/}}))\index{itimes-list})\index{itimes} \\ 
$=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag\/}}, {\it{a\/}}))\index{itimes-list})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-itimes-list-eval\$-list-bagdiff \\ \index{equal-itimes-list-eval\$-list-b!agdiff}
\=\+(\=\+{\rm{subbagp}}\,({\it{in-both\/}}, {\it{bag1\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;${\rm{subbagp}}\,({\it{in-both\/}}, {\it{bag2\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;$({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{in-both\/}}, {\it{a\/}}))\index{itimes-list} $\not=$ {\tt{0}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{bag1\/}}, {\it{in-both\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list} \\ 
$=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{bag2\/}}, {\it{in-both\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list})\- \\ 
$=$$\;\;\;\;$(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag1\/}}, {\it{a\/}}))\index{itimes-list} \\ 
$=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag2\/}}, {\it{a\/}}))\index{itimes-list})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  membership-of-0-implies-itimes-list-is-0 \\ \index{membership-of-0-implies-itimes-!list-is-0}
({\tt{0}} $\in$ {\it{x\/}}) $\rightarrow$ ({\rm{itimes-list}}\,({\it{x\/}})\index{itimes-list} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-0-eval\$-list \\ \index{member-0-eval\$-list}
({\tt{0}} $\in$ {\it{x\/}}) $\rightarrow$ ({\tt{0}} $\in$ {\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-list-eval\$-factors-lemma \\ \index{itimes-list-eval\$-factors-lemm!a}
\=\+{\rm{itimes}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagint}}\,({\it{bag1\/}}, {\it{bag2\/}})\index{bagint}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{bag2\/}}, {\rm{bagint}}\,({\it{bag1\/}}, {\it{bag2\/}})\index{bagint})\index{bagdiff}, {\it{a\/}}))\index{itimes-list})\-\index{itimes} \\ 
$=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag2\/}}, {\it{a\/}}))\index{itimes-list}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-list-eval\$-factors-lemma-prime \\ \index{itimes-list-eval\$-factors-lemm!a-prime}
\=\+{\rm{itimes}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagint}}\,({\it{bag1\/}}, {\it{bag2\/}})\index{bagint}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{bag1\/}}, {\rm{bagint}}\,({\it{bag1\/}}, {\it{bag2\/}})\index{bagint})\index{bagdiff}, {\it{a\/}}))\index{itimes-list})\-\index{itimes} \\ 
$=$$\;\;\;\;${\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag1\/}}, {\it{a\/}}))\index{itimes-list}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-list-eval\$-factors \\ \index{itimes-list-eval\$-factors}
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{itimes-factors}}\,({\it{x\/}})\index{itimes-factors}, {\it{a\/}}))\index{itimes-list} $=$ {\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}))\index{fix-int}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-or-itimes-term-integerp-eval\$ \\ \index{iplus-or-itimes-term-integerp-ev!al\$}
{\rm{iplus-or-itimes-term}}\,({\it{x\/}})\index{iplus-or-itimes-term} $\rightarrow$ {\rm{integerp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}))\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-list-bagint-0 \\ \index{eval\$-list-bagint-0}
\=\+({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagint}}\,({\it{x\/}}, {\it{y\/}})\index{bagint}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-list-bagint-0-implies-equal \\ \index{eval\$-list-bagint-0-implies-eq!ual}
\=\+(\=\+(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagint}}\,({\rm{itimes-factors}}\,({\it{v\/}})\index{itimes-factors}, {\rm{itimes-factors}}\,({\it{w\/}})\index{itimes-factors})\index{bagint}, {\it{a\/}}))\index{itimes-list} \\ 
$=$$\;\;\;\;${\tt{0}})\- \\ 
$\wedge$$\;\;\;\;${\rm{integerp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{v\/}}, {\it{a\/}}))\index{integerp} \\ 
$\wedge$$\;\;\;\;${\rm{integerp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}}))\index{integerp})\- \\ 
$\rightarrow$$\;\;\;\;$(({\rm{eval\$}}\,({\bf{t}}, {\it{v\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}})) $=$ {\bf{t}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-factors \\ \index{correctness-of-cancel-itimes-fa!ctors}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-itimes-factors-expanded}}\,({\it{x\/}})\index{cancel-itimes-factors-expanded}, {\it{a\/}})
\end{tabbing}

\begin{verbatim};; OK -- now, the lessp case, finally.  Ugh!

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cancel-itimes-ilessp-factors} \\  
\=\+{\rm{cancel-itimes-ilessp-factors}}\,({\it{x\/}})\index{cancel-itimes-ilessp-factors} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{ilessp}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{bagint}}\,(\=\+{\rm{itimes-factors}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-factors}, \\ 
{\rm{itimes-factors}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-factors})\-\index{bagint}) \\ 
{\bf then }{\rm{make-cancel-itimes-inequality}}\,(\=\+{\rm{itimes-factors}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-factors}, \\ 
{\rm{itimes-factors}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-factors}, \\ 
{\rm{bagint}}\,(\=\+{\rm{itimes-factors}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-factors}, \\ 
{\rm{itimes-factors}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-factors})\-\index{bagint})\-\index{make-cancel-itimes-inequality} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bagint-singleton \\ \index{bagint-singleton}
\=\+{\rm{bagint}}\,({\it{x\/}}, {\rm{list}}\,({\it{y\/}}))\index{bagint} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{y\/}} $\in$ {\it{x\/}}$\;\;${\bf then }{\rm{list}}\,({\it{y\/}}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  izerop-ilessp-0-relationship \\ \index{izerop-ilessp-0-relationship}
({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}) $=$ (($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}) $\wedge$ ($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-list-eval\$-list-delete-helper-1 \\ \index{ilessp-itimes-list-eval\$-list-!delete-helper-1}
{\rm{ilessp}}\,({\tt{0}}, {\it{w\/}})\index{ilessp} $\rightarrow$ ({\rm{ilessp}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{w\/}})\index{itimes}, {\rm{itimes}}\,({\it{w\/}}, {\it{u\/}})\index{itimes})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{x\/}}, {\it{u\/}})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-list-eval\$-list-delete-helper-2 \\ \index{ilessp-itimes-list-eval\$-list-!delete-helper-2}
{\rm{ilessp}}\,({\it{w\/}}, {\tt{0}})\index{ilessp} $\rightarrow$ ({\rm{ilessp}}\,({\rm{itimes}}\,({\it{w\/}}, {\it{u\/}})\index{itimes}, {\rm{itimes}}\,({\it{x\/}}, {\it{w\/}})\index{itimes})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{x\/}}, {\it{u\/}})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-list-eval\$-list-delete \\ \index{ilessp-itimes-list-eval\$-list-!delete}
\=\+(({\it{z\/}} $\in$ {\it{y\/}}) $\wedge$ ({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}))\index{fix-int} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{ilessp}}\,({\it{x\/}}, {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{delete}}\,({\it{z\/}}, {\it{y\/}})\index{delete}, {\it{a\/}}))\index{itimes-list})\index{ilessp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\tt{0}}, {\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}))\index{ilessp} \\ 
{\bf then }{\rm{ilessp}}\,(\=\+{\rm{itimes}}\,({\it{x\/}}, {\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}))\index{itimes}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp} \\ 
{\bf elseif }{\rm{ilessp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}), {\tt{0}})\index{ilessp} \\ 
{\bf then }{\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes}}\,({\it{x\/}}, {\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}))\index{itimes})\-\index{ilessp} \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-list-eval\$-list-delete-prime-helper-1 \\ \index{ilessp-itimes-list-eval\$-list-!delete-prime-helper-1}
{\rm{ilessp}}\,({\tt{0}}, {\it{w\/}})\index{ilessp} $\rightarrow$ ({\rm{ilessp}}\,({\rm{itimes}}\,({\it{w\/}}, {\it{u\/}})\index{itimes}, {\rm{itimes}}\,({\it{x\/}}, {\it{w\/}})\index{itimes})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{u\/}}, {\it{x\/}})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-list-eval\$-list-delete-prime-helper-2 \\ \index{ilessp-itimes-list-eval\$-list-!delete-prime-helper-2}
{\rm{ilessp}}\,({\it{w\/}}, {\tt{0}})\index{ilessp} $\rightarrow$ ({\rm{ilessp}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{w\/}})\index{itimes}, {\rm{itimes}}\,({\it{w\/}}, {\it{u\/}})\index{itimes})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{u\/}}, {\it{x\/}})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-list-eval\$-list-delete-prime \\ \index{ilessp-itimes-list-eval\$-list-!delete-prime}
\=\+(({\it{z\/}} $\in$ {\it{y\/}}) $\wedge$ ({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}))\index{fix-int} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{ilessp}}\,({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{delete}}\,({\it{z\/}}, {\it{y\/}})\index{delete}, {\it{a\/}}))\index{itimes-list}, {\it{x\/}})\index{ilessp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\tt{0}}, {\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}))\index{ilessp} \\ 
{\bf then }{\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes}}\,({\it{x\/}}, {\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}))\index{itimes})\-\index{ilessp} \\ 
{\bf elseif }{\rm{ilessp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}), {\tt{0}})\index{ilessp} \\ 
{\bf then }{\rm{ilessp}}\,(\=\+{\rm{itimes}}\,({\it{x\/}}, {\rm{eval\$}}\,({\bf{t}}, {\it{z\/}}, {\it{a\/}}))\index{itimes}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp} \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{verbatim};; **** Do I have anything like the following two lemmas for the equality case?
;; Should I?

;;;***** I should also consider if I've dealt with things like 0 = a*x + b*x, and
;;; simlilarly for ilessp.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ilessp-0-itimes \\ \index{ilessp-0-itimes}
\=\+{\rm{ilessp}}\,({\tt{0}}, {\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes})\index{ilessp} \\ 
$=$$\;\;\;\;$(({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp}) $\vee$ ({\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-0 \\ \index{ilessp-itimes-0}
\=\+{\rm{ilessp}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes}, {\tt{0}})\index{ilessp} \\ 
$=$$\;\;\;\;$(({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}) $\vee$ ({\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-list-eval\$-list-bagdiff \\ \index{ilessp-itimes-list-eval\$-list-!bagdiff}
\=\+(\=\+{\rm{subbagp}}\,({\it{in-both\/}}, {\it{bag1\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;${\rm{subbagp}}\,({\it{in-both\/}}, {\it{bag2\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;$({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{in-both\/}}, {\it{a\/}}))\index{itimes-list} $\not=$ {\tt{0}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{bag1\/}}, {\it{in-both\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{bag2\/}}, {\it{in-both\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\tt{0}}, {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{in-both\/}}, {\it{a\/}}))\index{itimes-list})\index{ilessp} \\ 
{\bf then }{\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag1\/}}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag2\/}}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp} \\ 
{\bf else }{\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag2\/}}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag1\/}}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  zero-ilessp-implies-not-equal \\ \index{zero-ilessp-implies-not-equal}
{\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\rightarrow$ ({\tt{0}} $\not=$ {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-list-eval\$-list-bagdiff-corollary-1 \\ \index{ilessp-itimes-list-eval\$-list-!bagdiff-corollary-1}
\=\+(\=\+{\rm{subbagp}}\,({\it{in-both\/}}, {\it{bag1\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;${\rm{subbagp}}\,({\it{in-both\/}}, {\it{bag2\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;${\rm{ilessp}}\,({\tt{0}}, {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{in-both\/}}, {\it{a\/}}))\index{itimes-list})\index{ilessp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{bag1\/}}, {\it{in-both\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{bag2\/}}, {\it{in-both\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp} \\ 
$=$$\;\;\;\;${\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag1\/}}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag2\/}}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-zero-implies-not-equal \\ \index{ilessp-zero-implies-not-equal}
{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} $\rightarrow$ ({\tt{0}} $\not=$ {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-list-eval\$-list-bagdiff-corollary-2 \\ \index{ilessp-itimes-list-eval\$-list-!bagdiff-corollary-2}
\=\+(\=\+{\rm{subbagp}}\,({\it{in-both\/}}, {\it{bag1\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;${\rm{subbagp}}\,({\it{in-both\/}}, {\it{bag2\/}})\index{subbagp} \\ 
$\wedge$$\;\;\;\;${\rm{ilessp}}\,({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{in-both\/}}, {\it{a\/}}))\index{itimes-list}, {\tt{0}})\index{ilessp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{bag1\/}}, {\it{in-both\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagdiff}}\,({\it{bag2\/}}, {\it{in-both\/}})\index{bagdiff}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp} \\ 
$=$$\;\;\;\;${\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag2\/}}, {\it{a\/}}))\index{itimes-list}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{bag1\/}}, {\it{a\/}}))\index{itimes-list})\-\index{ilessp})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-0-itimes-factors-yields-0 \\ \index{member-0-itimes-factors-yields-!0}
({\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}}) $\not=$ {\tt{0}}) $\rightarrow$ ({\tt{0}} $\not\in$ {\rm{itimes-factors}}\,({\it{w\/}})\index{itimes-factors})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-0-itimes-factors-yields-0-ilessp-consequence-1 \\ \index{member-0-itimes-factors-yields-!0-ilessp-consequence-1}
{\rm{ilessp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}}), {\tt{0}})\index{ilessp} $\rightarrow$ ({\tt{0}} $\not\in$ {\rm{itimes-factors}}\,({\it{w\/}})\index{itimes-factors})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-0-itimes-factors-yields-0-ilessp-consequence-2 \\ \index{member-0-itimes-factors-yields-!0-ilessp-consequence-2}
{\rm{ilessp}}\,({\tt{0}}, {\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}}))\index{ilessp} $\rightarrow$ ({\tt{0}} $\not\in$ {\rm{itimes-factors}}\,({\it{w\/}})\index{itimes-factors})
\end{tabbing}

\begin{verbatim}#|
(prove-lemma eval$-list-bagint-0 nil
  (implies (equal (itimes-list (eval$ 'list (bagint x y) a)) 0)
           (and (equal (itimes-list (eval$ 'list x a)) 0)
                (equal (itimes-list (eval$ 'list y a)) 0)))
  ((use (subsetp-implies-itimes-list-eval$-equals-0
         (x (bagint x y))
         (y x))
        (subsetp-implies-itimes-list-eval$-equals-0
         (x (bagint x y))
         (y y)))))
|#

#|
(prove-lemma eval$-list-bagint-0-implies-equal (rewrite)
  (implies (and (equal (itimes-list (eval$ 'list (bagint (itimes-factors v) (itimes-factors w)) a))
                       0)
                (integerp (eval$ t v a))
                (integerp (eval$ t w a)))
           (equal (equal (eval$ t v a) (eval$ t w a))
                  t))
  ((use (eval$-list-bagint-0 (x (itimes-factors v))
                             (y (itimes-factors w))))))
|#

;; At this point I'm going to switch the states of ilessp-trichotomy and
;; izerop-ilessp-0-relationship, for good (or till I change my mind again!).

\end{verbatim}
\noindent{\sc Event}:   Enable ilessp-trichotomy.

\addvspace{18pt}

\noindent{\sc Event}:   Disable izerop-ilessp-0-relationship.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  eval\$-list-bagint-0-for-ilessp \\ \index{eval\$-list-bagint-0-for-ilessp}
\=\+(\=\+($\neg$ {\rm{ilessp}}\,({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagint}}\,({\it{x\/}}, {\it{y\/}})\index{bagint}, {\it{a\/}}))\index{itimes-list}, {\tt{0}})\index{ilessp}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{bagint}}\,({\it{x\/}}, {\it{y\/}})\index{bagint}, {\it{a\/}}))\index{itimes-list})\index{ilessp}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{fix-int}}\,({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list})\index{fix-int} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{y\/}}, {\it{a\/}}))\index{itimes-list})\index{fix-int} $=$ {\tt{0}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-list-bagint-0-implies-equal-for-ilessp-lemma \\ \index{eval\$-list-bagint-0-implies-eq!ual-for-ilessp-lemma}
\=\+(\=\+($\neg$ {\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{bagint}}\,({\rm{itimes-factors}}\,({\it{v\/}})\index{itimes-factors}, {\rm{itimes-factors}}\,({\it{w\/}})\index{itimes-factors})\index{bagint}, \\ 
{\it{a\/}})\-)\index{itimes-list}, \\ 
{\tt{0}})\-\index{ilessp}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ilessp}}\,(\=\+{\tt{0}}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{bagint}}\,(\=\+{\rm{itimes-factors}}\,({\it{v\/}})\index{itimes-factors}, \\ 
{\rm{itimes-factors}}\,({\it{w\/}})\index{itimes-factors})\-\index{bagint}, \\ 
{\it{a\/}})\-)\index{itimes-list})\-\index{ilessp}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{v\/}}, {\it{a\/}}))\index{fix-int} $=$ {\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}}))\index{fix-int})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-fix-int-to-ilessp \\ \index{equal-fix-int-to-ilessp}
({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{y\/}})\index{fix-int}) $\rightarrow$ ($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-list-bagint-0-implies-equal-for-ilessp \\ \index{eval\$-list-bagint-0-implies-eq!ual-for-ilessp}
\=\+(\=\+($\neg$ {\rm{ilessp}}\,(\=\+{\rm{itimes-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{bagint}}\,({\rm{itimes-factors}}\,({\it{v\/}})\index{itimes-factors}, {\rm{itimes-factors}}\,({\it{w\/}})\index{itimes-factors})\index{bagint}, \\ 
{\it{a\/}})\-)\index{itimes-list}, \\ 
{\tt{0}})\-\index{ilessp}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ilessp}}\,(\=\+{\tt{0}}, \\ 
{\rm{itimes-list}}\,({\rm{eval\$}}\,(\=\+{\tt{'}}{\tt{list}}, \\ 
{\rm{bagint}}\,(\=\+{\rm{itimes-factors}}\,({\it{v\/}})\index{itimes-factors}, \\ 
{\rm{itimes-factors}}\,({\it{w\/}})\index{itimes-factors})\-\index{bagint}, \\ 
{\it{a\/}})\-)\index{itimes-list})\-\index{ilessp}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+($\neg$ {\rm{ilessp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{v\/}}, {\it{a\/}}), {\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}}))\index{ilessp}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ilessp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{w\/}}, {\it{a\/}}), {\rm{eval\$}}\,({\bf{t}}, {\it{v\/}}, {\it{a\/}}))\index{ilessp}))\-\-
\end{tabbing}

\begin{verbatim};; The rewrite rule ILESSP-TRICHOTOMY seemed to mess up the proof of the following,
;; so I'm just going to leave it disabled.
\end{verbatim}
\noindent{\sc Event}:   Disable ilessp-trichotomy.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-itimes-ilessp-factors \\ \index{correctness-of-cancel-itimes-ile!ssp-factors}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-itimes-ilessp-factors}}\,({\it{x\/}})\index{cancel-itimes-ilessp-factors}, {\it{a\/}})
\end{tabbing}

\begin{verbatim};; OK -- now, the zero cases.

\end{verbatim}
\noindent{\sc Event}:   Enable lessp-count-listp-cdr.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{disjoin-equalities-with-0} \\  
\=\+{\rm{disjoin-equalities-with-0}}\,({\it{factors\/}})\index{disjoin-equalities-with-0} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{factors\/}})) \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{or}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{equal}}, {\rm{list}}\,({\tt{'}}{\tt{fix-int}}, {\rm{car}}\,({\it{factors\/}})), {\tt{'}}{\tt{'}}{\tt{0}}), \\ 
{\rm{disjoin-equalities-with-0}}\,({\rm{cdr}}\,({\it{factors\/}}))\index{disjoin-equalities-with-0})\- \\ 
{\bf else }{\rm{list}}\,({\tt{'}}{\tt{equal}}, {\rm{list}}\,({\tt{'}}{\tt{fix-int}}, {\rm{car}}\,({\it{factors\/}})), {\tt{'}}{\tt{'}}{\tt{0}})$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable lessp-count-listp-cdr.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{cancel-factors-0} \\  
\=\+{\rm{cancel-factors-0}}\,({\it{x\/}})\index{cancel-factors-0} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{equal}} \\ 
{\bf then }\=\+{\bf if }{\rm{cadr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{'}}{\tt{0}} \\ 
{\bf then }\=\+{\bf let }\=\+{\it{factors\/}}{\bf $\;$ be$\;\;$}{\rm{itimes-factors}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-factors}\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{factors\/}})) \\ 
{\bf then }{\rm{disjoin-equalities-with-0}}\,({\it{factors\/}})\index{disjoin-equalities-with-0} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-$\;${\bf  endlet}\- \\ 
{\bf elseif }{\rm{caddr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{'}}{\tt{0}} \\ 
{\bf then }\=\+{\bf let }\=\+{\it{factors\/}}{\bf $\;$ be$\;\;$}{\rm{itimes-factors}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-factors}\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{factors\/}})) \\ 
{\bf then }{\rm{disjoin-equalities-with-0}}\,({\it{factors\/}})\index{disjoin-equalities-with-0} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-$\;${\bf  endlet}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{some-eval\$s-to-0} \\  
\=\+{\rm{some-eval\$s-to-0}}\,({\it{x\/}}, {\it{a\/}})\index{some-eval\$s-to-0} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+({\rm{fix-int}}\,({\rm{eval\$}}\,({\bf{t}}, {\rm{car}}\,({\it{x\/}}), {\it{a\/}}))\index{fix-int} $=$ {\tt{0}}) \\ 
$\vee$$\;\;\;\;${\rm{some-eval\$s-to-0}}\,({\rm{cdr}}\,({\it{x\/}}), {\it{a\/}})\index{some-eval\$s-to-0}\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-disjoin-equalities-with-0 \\ \index{eval\$-disjoin-equalities-with-!0}
\=\+{\rm{listp}}\,({\it{lst\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{disjoin-equalities-with-0}}\,({\it{lst\/}})\index{disjoin-equalities-with-0}, {\it{a\/}}) \\ 
$=$$\;\;\;\;${\rm{some-eval\$s-to-0}}\,({\it{lst\/}}, {\it{a\/}})\index{some-eval\$s-to-0})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  some-eval\$s-to-0-append \\ \index{some-eval\$s-to-0-append}
\=\+{\rm{some-eval\$s-to-0}}\,({\rm{append}}\,({\it{x\/}}, {\it{y\/}}), {\it{a\/}})\index{some-eval\$s-to-0} \\ 
$=$$\;\;\;\;$({\rm{some-eval\$s-to-0}}\,({\it{x\/}}, {\it{a\/}})\index{some-eval\$s-to-0} $\vee$ {\rm{some-eval\$s-to-0}}\,({\it{y\/}}, {\it{a\/}})\index{some-eval\$s-to-0})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  some-eval\$s-to-0-eliminator \\ \index{some-eval\$s-to-0-eliminator}
{\rm{some-eval\$s-to-0}}\,({\it{x\/}}, {\it{a\/}})\index{some-eval\$s-to-0} $=$ ({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  listp-cdr-factors-implies-integerp \\ \index{listp-cdr-factors-implies-intege!rp}
{\rm{listp}}\,({\rm{cdr}}\,({\rm{itimes-factors}}\,({\it{v\/}})\index{itimes-factors})) $\rightarrow$ {\rm{integerp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{v\/}}, {\it{a\/}}))\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-factors-0 \\ \index{correctness-of-cancel-factors-0}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-factors-0}}\,({\it{x\/}})\index{cancel-factors-0}, {\it{a\/}})
\end{tabbing}

\begin{verbatim};; and now for inequalities...

\end{verbatim}
\noindent{\sc Event}:   Enable lessp-count-listp-cdr.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{conjoin-inequalities-with-0} \\  
\=\+{\rm{conjoin-inequalities-with-0}}\,({\it{factors\/}}, {\it{parity\/}})\index{conjoin-inequalities-with-0} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{factors\/}})) \\ 
{\bf then }\=\+{\bf if }{\it{parity\/}} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{or}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{and}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{ilessp}}, {\tt{'}}{\tt{'}}{\tt{0}}, {\rm{car}}\,({\it{factors\/}})), \\ 
{\rm{conjoin-inequalities-with-0}}\,({\rm{cdr}}\,({\it{factors\/}}), {\bf{t}})\index{conjoin-inequalities-with-0})\-, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{and}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{ilessp}}, {\rm{car}}\,({\it{factors\/}}), {\tt{'}}{\tt{'}}{\tt{0}}), \\ 
{\rm{conjoin-inequalities-with-0}}\,({\rm{cdr}}\,({\it{factors\/}}), {\bf{f}})\index{conjoin-inequalities-with-0})\-)\- \\ 
{\bf else }{\rm{list}}\,(\=\+{\tt{'}}{\tt{or}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{and}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{ilessp}}, {\rm{car}}\,({\it{factors\/}}), {\tt{'}}{\tt{'}}{\tt{0}}), \\ 
{\rm{conjoin-inequalities-with-0}}\,({\rm{cdr}}\,({\it{factors\/}}), {\bf{t}})\index{conjoin-inequalities-with-0})\-, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{and}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{ilessp}}, {\tt{'}}{\tt{'}}{\tt{0}}, {\rm{car}}\,({\it{factors\/}})), \\ 
{\rm{conjoin-inequalities-with-0}}\,({\rm{cdr}}\,({\it{factors\/}}), {\bf{f}})\index{conjoin-inequalities-with-0})\-)\-$\;${\bf  endif}\- \\ 
{\bf elseif }{\it{parity\/}}$\;\;${\bf then }{\rm{list}}\,({\tt{'}}{\tt{ilessp}}, {\tt{'}}{\tt{'}}{\tt{0}}, {\rm{car}}\,({\it{factors\/}})) \\ 
{\bf else }{\rm{list}}\,({\tt{'}}{\tt{ilessp}}, {\rm{car}}\,({\it{factors\/}}), {\tt{'}}{\tt{'}}{\tt{0}})$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable lessp-count-listp-cdr.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{cancel-factors-ilessp-0} \\  
\=\+{\rm{cancel-factors-ilessp-0}}\,({\it{x\/}})\index{cancel-factors-ilessp-0} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{ilessp}} \\ 
{\bf then }\=\+{\bf if }{\rm{cadr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{'}}{\tt{0}} \\ 
{\bf then }\=\+{\bf let }\=\+{\it{factors\/}}{\bf $\;$ be$\;\;$}{\rm{itimes-factors}}\,({\rm{caddr}}\,({\it{x\/}}))\index{itimes-factors}\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{factors\/}})) \\ 
{\bf then }{\rm{conjoin-inequalities-with-0}}\,({\it{factors\/}}, {\bf{t}})\index{conjoin-inequalities-with-0} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-$\;${\bf  endlet}\- \\ 
{\bf elseif }{\rm{caddr}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{'}}{\tt{0}} \\ 
{\bf then }\=\+{\bf let }\=\+{\it{factors\/}}{\bf $\;$ be$\;\;$}{\rm{itimes-factors}}\,({\rm{cadr}}\,({\it{x\/}}))\index{itimes-factors}\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{factors\/}})) \\ 
{\bf then }{\rm{conjoin-inequalities-with-0}}\,({\it{factors\/}}, {\bf{f}})\index{conjoin-inequalities-with-0} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-$\;${\bf  endlet}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  conjoin-inequalities-with-0-eliminator \\ \index{conjoin-inequalities-with-0-eli!minator}
\=\+{\rm{listp}}\,({\it{x\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{eval\$}}\,({\bf{t}}, {\rm{conjoin-inequalities-with-0}}\,({\it{x\/}}, {\it{parity\/}})\index{conjoin-inequalities-with-0}, {\it{a\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{parity\/}}$\;\;${\bf then }{\rm{ilessp}}\,({\tt{0}}, {\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list})\index{ilessp} \\ 
{\bf else }{\rm{ilessp}}\,({\rm{itimes-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{itimes-list}, {\tt{0}})\index{ilessp}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-factors-ilessp-0 \\ \index{correctness-of-cancel-factors-i!lessp-0}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-factors-ilessp-0}}\,({\it{x\/}})\index{cancel-factors-ilessp-0}, {\it{a\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable equal-itimes-list-eval\$-list-delete-new-1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable equal-itimes-list-eval\$-list-delete-new-2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable itimes-itimes-list-eval\$-list-delete.

\addvspace{18pt}

\noindent{\sc Event}:   Disable equal-itimes-list-eval\$-list-bagdiff.

\addvspace{18pt}

\noindent{\sc Event}:   Disable itimes-list-eval\$-factors-lemma.

\addvspace{18pt}

\noindent{\sc Event}:   Disable itimes-list-eval\$-factors-lemma-prime.

\addvspace{18pt}

\noindent{\sc Event}:   Disable itimes-list-eval\$-factors.

\addvspace{18pt}

\noindent{\sc Event}:   Disable iplus-or-itimes-term-integerp-eval\$.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-list-bagint-0.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-list-bagint-0-implies-equal.

\addvspace{18pt}

\noindent{\sc Event}:   Disable izerop-ilessp-0-relationship.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-itimes-list-eval\$-list-delete-helper-1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-itimes-list-eval\$-list-delete-helper-2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-itimes-list-eval\$-list-delete.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-itimes-list-eval\$-list-delete-prime-helper-1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-itimes-list-eval\$-list-delete-prime-helper-2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-itimes-list-eval\$-list-delete-prime.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-0-itimes.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-itimes-0.

\addvspace{18pt}

\noindent{\sc Event}:   Disable listp-cdr-factors-implies-integerp.

\addvspace{18pt}


\begin{verbatim};; We presumably have better meta-lemmas now, but if we want we
;; can disable those (i.e., correctness-of-cancel-itimes-factors,
;; correctness-of-cancel-itimes-ilessp-factors,
;; correctness-of-cancel-factors-0, and
;; correctness-of-cancel-factors-ilessp-0) and enable the two
;; mentioned below:

\end{verbatim}
\noindent{\sc Event}:   Disable correctness-of-cancel-itimes.

\addvspace{18pt}

\noindent{\sc Event}:   Disable correctness-of-cancel-itimes-ilessp.

\addvspace{18pt}


\begin{verbatim};; I'll disable some rules now, finally, that I'd previously thought
;; would be OK but now fear because of potential nasty backchaining.

\end{verbatim}
\noindent{\sc Event}:   Disable not-integerp-implies-not-equal-iplus.

\addvspace{18pt}

\noindent{\sc Event}:   Disable not-integerp-implies-not-equal-itimes.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subbagp-subsetp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable eval\$-list-bagint-0-implies-equal-for-ilessp.

\addvspace{18pt}

\begin{verbatim}; ---------- Cancel ineg terms from equalities and inequalities ----------

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{split-out-ineg-terms} \\  
\=\+{\rm{split-out-ineg-terms}}\,({\it{x\/}})\index{split-out-ineg-terms} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf let }\=\+{\it{pair\/}}{\bf $\;$ be$\;\;$}{\rm{split-out-ineg-terms}}\,({\rm{cdr}}\,({\it{x\/}}))\index{split-out-ineg-terms}, \\ 
{\it{a\/}}{\bf $\;$ be$\;\;$}{\rm{car}}\,({\it{x\/}})\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\rm{listp}}\,({\it{a\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{a\/}}) $=$ {\tt{'}}{\tt{ineg}} \\ 
{\bf then }{\rm{cons}}\,({\rm{car}}\,({\it{pair\/}}), {\rm{cons}}\,({\rm{cadr}}\,({\it{a\/}}), {\rm{cdr}}\,({\it{pair\/}}))) \\ 
{\bf elseif }\=\+({\rm{car}}\,({\it{a\/}}) $=$ {\tt{'}}{\tt{quote}}) \\ 
$\wedge$$\;\;\;\;${\rm{negativep}}\,({\rm{cadr}}\,({\it{a\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{negative-guts}}\,({\rm{cadr}}\,({\it{a\/}})) $\not=$ {\tt{0}})\- \\ 
{\bf then }{\rm{cons}}\,(\=\+{\rm{car}}\,({\it{pair\/}}), \\ 
{\rm{cons}}\,(\=\+{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\rm{negative-guts}}\,({\rm{cadr}}\,({\it{a\/}}))), \\ 
{\rm{cdr}}\,({\it{pair\/}}))\-)\- \\ 
{\bf else }{\rm{cons}}\,({\rm{cons}}\,({\it{a\/}}, {\rm{car}}\,({\it{pair\/}})), {\rm{cdr}}\,({\it{pair\/}}))$\;${\bf  endif}\- \\ 
{\bf else }{\rm{cons}}\,({\rm{cons}}\,({\it{a\/}}, {\rm{car}}\,({\it{pair\/}})), {\rm{cdr}}\,({\it{pair\/}}))$\;${\bf  endif}\-$\;${\bf  endlet}\- \\ 
{\bf else }{\rm{cons}}\,({\bf{nil}}, {\bf{nil}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{remove-inegs} \\  
\=\+{\rm{remove-inegs}}\,({\it{x\/}}, {\it{y\/}})\index{remove-inegs} \\ 
$=$$\;\;\;\;$\=\+{\bf let }\=\+{\it{xpair\/}}{\bf $\;$ be$\;\;$}{\rm{split-out-ineg-terms}}\,({\it{x\/}})\index{split-out-ineg-terms}, \\ 
{\it{ypair\/}}{\bf $\;$ be$\;\;$}{\rm{split-out-ineg-terms}}\,({\it{y\/}})\index{split-out-ineg-terms}\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\rm{listp}}\,({\rm{cdr}}\,({\it{xpair\/}})) $\vee$ {\rm{listp}}\,({\rm{cdr}}\,({\it{ypair\/}})) \\ 
{\bf then }{\rm{cons}}\,(\=\+{\rm{append}}\,({\rm{cdr}}\,({\it{ypair\/}}), {\rm{car}}\,({\it{xpair\/}})), \\ 
{\rm{append}}\,({\rm{cdr}}\,({\it{xpair\/}}), {\rm{car}}\,({\it{ypair\/}})))\- \\ 
{\bf else }{\bf{f}}$\;${\bf  endif}\-$\;${\bf  endlet}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{iplus-or-ineg-term} \\  
\=\+{\rm{iplus-or-ineg-term}}\,({\it{x\/}})\index{iplus-or-ineg-term} \\ 
$=$$\;\;\;\;$({\rm{listp}}\,({\it{x\/}}) $\wedge$ (({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{ineg}}) $\vee$ ({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{iplus}})))\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{make-cancel-ineg-terms-equality} \\  
\=\+{\rm{make-cancel-ineg-terms-equality}}\,({\it{x\/}})\index{make-cancel-ineg-terms-equality} \\ 
$=$$\;\;\;\;$\=\+{\bf let }\=\+{\it{new-fringes\/}}{\bf $\;$ be$\;\;$}{\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\it{new-fringes\/}} \\ 
{\bf then }\=\+{\bf if }{\rm{iplus-or-ineg-term}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-or-ineg-term} \\ 
{\bf then }\=\+{\bf if }{\rm{iplus-or-ineg-term}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-or-ineg-term} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\it{new-fringes\/}}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\it{new-fringes\/}}))\index{iplus-tree})\- \\ 
{\bf else }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{caddr}}\,({\it{x\/}})), \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\it{new-fringes\/}}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\it{new-fringes\/}}))\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\-$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{iplus-or-ineg-term}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-or-ineg-term} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{cadr}}\,({\it{x\/}})), \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\it{new-fringes\/}}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\it{new-fringes\/}}))\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-$\;${\bf  endlet}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{cancel-ineg-terms-from-equality} \\  
\=\+{\rm{cancel-ineg-terms-from-equality}}\,({\it{x\/}})\index{cancel-ineg-terms-from-equality} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) $\wedge$ ({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{equal}}) \\ 
{\bf then }{\rm{make-cancel-ineg-terms-equality}}\,({\it{x\/}})\index{make-cancel-ineg-terms-equality} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; The following was created from nqthm-macroexpand with arguments
;; and or make-cancel-ineg-terms-equality iplus-or-ineg-term
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cancel-ineg-terms-from-equality!-expanded} \\  
\=\+{\rm{cancel-ineg-terms-from-equality-expanded}}\,({\it{x\/}})\index{cancel-ineg-terms-from-equality!-expanded} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{equal}} \\ 
{\bf then }\=\+{\bf if }{\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{cadr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf case on }{\rm{car}}\,({\rm{car}}\,({\rm{cdr}}\,({\it{x\/}}))): \\ 
{\bf case = }{\it{ineg\/}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf case on }{\rm{car}}\,({\rm{car}}\,({\rm{cdr}}\,({\rm{cdr}}\,({\it{x\/}})))): \\ 
{\bf case = }{\it{ineg\/}} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\- \\ 
{\bf case = }{\it{iplus\/}} \\ 
{\bf $\;\;$then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\- \\ 
{\bf otherwise }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{integerp}}, \\ 
{\rm{caddr}}\,({\it{x\/}}))\-, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\-$\;${\bf  endcase}\- \\ 
{\bf else }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{caddr}}\,({\it{x\/}})), \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\-$\;${\bf  endif}\- \\ 
{\bf case = }{\it{iplus\/}} \\ 
{\bf $\;\;$then }\=\+{\bf if }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf case on }{\rm{car}}\,({\rm{car}}\,({\rm{cdr}}\,({\rm{cdr}}\,({\it{x\/}})))): \\ 
{\bf case = }{\it{ineg\/}} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\- \\ 
{\bf case = }{\it{iplus\/}} \\ 
{\bf $\;\;$then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\- \\ 
{\bf otherwise }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{integerp}}, \\ 
{\rm{caddr}}\,({\it{x\/}}))\-, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\-$\;${\bf  endcase}\- \\ 
{\bf else }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{caddr}}\,({\it{x\/}})), \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\-$\;${\bf  endif}\- \\ 
{\bf otherwise }\=\+{\bf if }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf case on }{\rm{car}}\,({\rm{car}}\,({\rm{cdr}}\,({\rm{cdr}}\,({\it{x\/}})))): \\ 
{\bf case = }{\it{ineg\/}} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{integerp}}, \\ 
{\rm{cadr}}\,({\it{x\/}}))\-, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf case = }{\it{iplus\/}} \\ 
{\bf $\;\;$then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{integerp}}, \\ 
{\rm{cadr}}\,({\it{x\/}}))\-, \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf otherwise }{\it{x\/}}$\;${\bf  endcase}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-$\;${\bf  endcase}\- \\ 
{\bf elseif }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf case on }{\rm{car}}\,({\rm{car}}\,({\rm{cdr}}\,({\rm{cdr}}\,({\it{x\/}})))): \\ 
{\bf case = }{\it{ineg\/}} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{cadr}}\,({\it{x\/}})), \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf case = }{\it{iplus\/}} \\ 
{\bf $\;\;$then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{if}}, \\ 
{\rm{list}}\,({\tt{'}}{\tt{integerp}}, {\rm{cadr}}\,({\it{x\/}})), \\ 
{\rm{list}}\,(\=\+{\tt{'}}{\tt{equal}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\-, \\ 
{\rm{list}}\,({\tt{'}}{\tt{quote}}, {\bf{f}}))\- \\ 
{\bf otherwise }{\it{x\/}}$\;${\bf  endcase}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cancel-ineg-terms-from-equality-cancel-ineg-terms-from-equality-expanded \\ \index{cancel-ineg-terms-from-equality!-cancel-ineg-terms-from-equality-expanded}
\=\+{\rm{cancel-ineg-terms-from-equality-expanded}}\,({\it{x\/}})\index{cancel-ineg-terms-from-equality!-expanded} \\ 
$=$$\;\;\;\;${\rm{cancel-ineg-terms-from-equality}}\,({\it{x\/}})\index{cancel-ineg-terms-from-equality}\-
\end{tabbing}


\noindent{\sc Event}:   Disable cancel-ineg-terms-from-equality-expanded.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  integerp-eval\$-iplus-or-ineg-term \\ \index{integerp-eval\$-iplus-or-ineg-te!rm}
{\rm{iplus-or-ineg-term}}\,({\it{x\/}})\index{iplus-or-ineg-term} $\rightarrow$ {\rm{integerp}}\,({\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}))\index{integerp}
\end{tabbing}


\noindent{\sc Event}:   Disable iplus-or-ineg-term.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  eval\$-iplus-list-car-remove-inegs \\ \index{eval\$-iplus-list-car-remove-ine!gs}
\=\+{\rm{remove-inegs}}\,({\it{x\/}}, {\it{y\/}})\index{remove-inegs} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{car}}\,({\rm{remove-inegs}}\,({\it{x\/}}, {\it{y\/}})\index{remove-inegs}), {\it{a\/}}))\index{iplus-list} \\ 
$=$$\;\;\;\;${\rm{iplus}}\,(\=\+{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{car}}\,({\rm{split-out-ineg-terms}}\,({\it{x\/}})\index{split-out-ineg-terms}), {\it{a\/}}))\index{iplus-list}, \\ 
{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{cdr}}\,({\rm{split-out-ineg-terms}}\,({\it{y\/}})\index{split-out-ineg-terms}), {\it{a\/}}))\index{iplus-list})\-\index{iplus})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  eval\$-iplus-list-cdr-remove-inegs \\ \index{eval\$-iplus-list-cdr-remove-ine!gs}
\=\+{\rm{remove-inegs}}\,({\it{x\/}}, {\it{y\/}})\index{remove-inegs} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{cdr}}\,({\rm{remove-inegs}}\,({\it{x\/}}, {\it{y\/}})\index{remove-inegs}), {\it{a\/}}))\index{iplus-list} \\ 
$=$$\;\;\;\;${\rm{iplus}}\,(\=\+{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{car}}\,({\rm{split-out-ineg-terms}}\,({\it{y\/}})\index{split-out-ineg-terms}), {\it{a\/}}))\index{iplus-list}, \\ 
{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{cdr}}\,({\rm{split-out-ineg-terms}}\,({\it{x\/}})\index{split-out-ineg-terms}), {\it{a\/}}))\index{iplus-list})\-\index{iplus})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  minus-ineg \\ \index{minus-ineg}
(({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{x\/}} $\not=$ {\tt{0}})) $\rightarrow$ (($-$ {\it{x\/}}) $=$ {\rm{ineg}}\,({\it{x\/}})\index{ineg})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-list-eval\$-car-split-out-ineg-terms \\ \index{iplus-list-eval\$-car-split-out!-ineg-terms}
\=\+{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{car}}\,({\rm{split-out-ineg-terms}}\,({\it{x\/}})\index{split-out-ineg-terms}), {\it{a\/}}))\index{iplus-list} \\ 
$=$$\;\;\;\;${\rm{iplus}}\,(\=\+{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\it{x\/}}, {\it{a\/}}))\index{iplus-list}, \\ 
{\rm{iplus-list}}\,({\rm{eval\$}}\,({\tt{'}}{\tt{list}}, {\rm{cdr}}\,({\rm{split-out-ineg-terms}}\,({\it{x\/}})\index{split-out-ineg-terms}), {\it{a\/}}))\index{iplus-list})\-\index{iplus}\-
\end{tabbing}


\noindent{\sc Event}:   Disable remove-inegs.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-ineg-terms-from-equality \\ \index{correctness-of-cancel-ineg-term!s-from-equality}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-ineg-terms-from-equality-expanded}}\,({\it{x\/}})\index{cancel-ineg-terms-from-equality!-expanded}, {\it{a\/}})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{make-cancel-ineg-terms-inequalit!y} \\  
\=\+{\rm{make-cancel-ineg-terms-inequality}}\,({\it{x\/}})\index{make-cancel-ineg-terms-inequalit!y} \\ 
$=$$\;\;\;\;$\=\+{\bf let }\=\+{\it{new-fringes\/}}{\bf $\;$ be$\;\;$}{\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}\- \\ 
{\bf in} \\ 
\=\+{\bf if }{\it{new-fringes\/}} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\it{new-fringes\/}}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\it{new-fringes\/}}))\index{iplus-tree})\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-$\;${\bf  endlet}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{cancel-ineg-terms-from-inequalit!y} \\  
\=\+{\rm{cancel-ineg-terms-from-inequality}}\,({\it{x\/}})\index{cancel-ineg-terms-from-inequalit!y} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) $\wedge$ ({\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{ilessp}}) \\ 
{\bf then }\=\+{\bf if }{\rm{iplus-or-ineg-term}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-or-ineg-term} \\ 
{\bf then }{\rm{make-cancel-ineg-terms-inequality}}\,({\it{x\/}})\index{make-cancel-ineg-terms-inequalit!y} \\ 
{\bf elseif }{\rm{iplus-or-ineg-term}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-or-ineg-term} \\ 
{\bf then }{\rm{make-cancel-ineg-terms-inequality}}\,({\it{x\/}})\index{make-cancel-ineg-terms-inequalit!y} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; The following was created from nqthm-macroexpand with arguments
;; and or make-cancel-ineg-terms-inequality iplus-or-ineg-term

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{cancel-ineg-terms-from-inequalit!y-expanded} \\  
\=\+{\rm{cancel-ineg-terms-from-inequality-expanded}}\,({\it{x\/}})\index{cancel-ineg-terms-from-inequalit!y-expanded} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{x\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{x\/}}) $=$ {\tt{'}}{\tt{ilessp}} \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\rm{cadr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf case on }{\rm{car}}\,({\rm{car}}\,({\rm{cdr}}\,({\it{x\/}}))): \\ 
{\bf case = }{\it{ineg\/}} \\ 
{\bf then }\=\+{\bf if }{\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf case = }{\it{iplus\/}} \\ 
{\bf $\;\;$then }\=\+{\bf if }{\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf otherwise }\=\+{\bf if }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf case on }{\rm{car}}\,({\rm{car}}\,({\rm{cdr}}\,({\rm{cdr}}\,({\it{x\/}})))): \\ 
{\bf case = }{\it{ineg\/}} \\ 
{\bf then }\=\+{\bf if }{\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf case = }{\it{iplus\/}} \\ 
{\bf $\;\;$then }\=\+{\bf if }{\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf otherwise }{\it{x\/}}$\;${\bf  endcase}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-$\;${\bf  endcase}\- \\ 
{\bf elseif }{\rm{listp}}\,({\rm{caddr}}\,({\it{x\/}})) \\ 
{\bf then }\=\+{\bf case on }{\rm{car}}\,({\rm{car}}\,({\rm{cdr}}\,({\rm{cdr}}\,({\it{x\/}})))): \\ 
{\bf case = }{\it{ineg\/}} \\ 
{\bf then }\=\+{\bf if }{\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf case = }{\it{iplus\/}} \\ 
{\bf $\;\;$then }\=\+{\bf if }{\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs} \\ 
{\bf then }{\rm{list}}\,(\=\+{\tt{'}}{\tt{ilessp}}, \\ 
{\rm{iplus-tree}}\,({\rm{car}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree}, \\ 
{\rm{iplus-tree}}\,({\rm{cdr}}\,({\rm{remove-inegs}}\,(\=\+{\rm{iplus-fringe}}\,({\rm{cadr}}\,({\it{x\/}}))\index{iplus-fringe}, \\ 
{\rm{iplus-fringe}}\,({\rm{caddr}}\,({\it{x\/}}))\index{iplus-fringe})\-\index{remove-inegs}))\index{iplus-tree})\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf otherwise }{\it{x\/}}$\;${\bf  endcase}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\- \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cancel-ineg-terms-from-inequality-cancel-ineg-terms-from-inequality-expanded \\ \index{cancel-ineg-terms-from-inequalit!y-cancel-ineg-terms-from-inequality-expanded}
\=\+{\rm{cancel-ineg-terms-from-inequality-expanded}}\,({\it{x\/}})\index{cancel-ineg-terms-from-inequalit!y-expanded} \\ 
$=$$\;\;\;\;${\rm{cancel-ineg-terms-from-inequality}}\,({\it{x\/}})\index{cancel-ineg-terms-from-inequalit!y}\-
\end{tabbing}


\noindent{\sc Event}:   Disable cancel-ineg-terms-from-inequality-expanded.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  correctness-of-cancel-ineg-terms-from-inequality \\ \index{correctness-of-cancel-ineg-term!s-from-inequality}
{\rm{eval\$}}\,({\bf{t}}, {\it{x\/}}, {\it{a\/}}) $=$ {\rm{eval\$}}\,({\bf{t}}, {\rm{cancel-ineg-terms-from-inequality-expanded}}\,({\it{x\/}})\index{cancel-ineg-terms-from-inequalit!y-expanded}, {\it{a\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable minus-ineg.

\addvspace{18pt}

\noindent{\sc Event}:   Disable integerp-eval\$-iplus-or-ineg-term.

\addvspace{18pt}

\begin{verbatim}; ---------- Eliminating constants ----------

;; We want to combine in terms like (iplus 3 (iplus x 7)).  Also, when
;; two iplus terms are equated or in-equated, there should only be a
;; natural number summand on at most one side.  Finally, if one adds 1
;; to the right side of a strict inequality, a stronger inequality (in
;; a certain sense) is obtained by removing the 1 and making a non-strict
;; inequality in the other direction.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  plus-iplus \\ \index{plus-iplus}
(({\it{i\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{j\/}} $\in\;${\bf{N}}${}$)) $\rightarrow$ (({\it{i\/}} $+$ {\it{j\/}}) $=$ {\rm{iplus}}\,({\it{i\/}}, {\it{j\/}})\index{iplus})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-constants \\ \index{iplus-constants}
{\rm{iplus}}\,($1\;+$ {\it{i\/}}, {\rm{iplus}}\,($1\;+$ {\it{j\/}}, {\it{x\/}})\index{iplus})\index{iplus} $=$ {\rm{iplus}}\,(($1\;+$ {\it{i\/}}) $+$ ($1\;+$ {\it{j\/}}), {\it{x\/}})\index{iplus}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  numberp-is-integerp \\ \index{numberp-is-integerp}
({\it{w\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ {\rm{integerp}}\,({\it{w\/}})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  difference-idifference \\ \index{difference-idifference}
(({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{y\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{x\/}} $\leq$ {\it{y\/}})) $\rightarrow$ (({\it{y\/}} $-$ {\it{x\/}}) $=$ {\rm{idifference}}\,({\it{y\/}}, {\it{x\/}})\index{idifference})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cancel-constants-equal-lemma \\ \index{cancel-constants-equal-lemma}
\=\+(({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{iplus}}\,({\it{m\/}}, {\it{x\/}})\index{iplus} $=$ {\rm{iplus}}\,({\it{n\/}}, {\it{y\/}})\index{iplus}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{m\/}} $<$ {\it{n\/}}$\;\;${\bf then }{\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\rm{iplus}}\,({\it{n\/}} $-$ {\it{m\/}}, {\it{y\/}})\index{iplus} \\ 
{\bf else }{\rm{iplus}}\,({\it{m\/}} $-$ {\it{n\/}}, {\it{x\/}})\index{iplus} $=$ {\rm{fix-int}}\,({\it{y\/}})\index{fix-int}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cancel-constants-equal \\ \index{cancel-constants-equal}
\=\+({\rm{iplus}}\,($1\;+$ {\it{i\/}}, {\it{x\/}})\index{iplus} $=$ {\rm{iplus}}\,($1\;+$ {\it{j\/}}, {\it{y\/}})\index{iplus}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\it{j\/}}$\;\;${\bf then }{\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\rm{iplus}}\,({\it{j\/}} $-$ {\it{i\/}}, {\it{y\/}})\index{iplus} \\ 
{\bf else }{\rm{iplus}}\,({\it{i\/}} $-$ {\it{j\/}}, {\it{x\/}})\index{iplus} $=$ {\rm{fix-int}}\,({\it{y\/}})\index{fix-int}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-add1 \\ \index{ilessp-add1}
({\it{y\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{ilessp}}\,({\it{x\/}}, $1\;+$ {\it{y\/}})\index{ilessp} $=$ ($\neg$ {\rm{ilessp}}\,({\it{y\/}}, {\it{x\/}})\index{ilessp}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-add1-iplus \\ \index{ilessp-add1-iplus}
({\it{y\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{ilessp}}\,({\it{x\/}}, {\rm{iplus}}\,($1\;+$ {\it{y\/}}, {\it{z\/}})\index{iplus})\index{ilessp} $=$ ($\neg$ {\rm{ilessp}}\,({\rm{iplus}}\,({\it{y\/}}, {\it{z\/}})\index{iplus}, {\it{x\/}})\index{ilessp}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cancel-constants-ilessp-lemma-1 \\ \index{cancel-constants-ilessp-lemma-1}
\=\+(({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{ilessp}}\,({\rm{iplus}}\,({\it{m\/}}, {\it{x\/}})\index{iplus}, {\rm{iplus}}\,({\it{n\/}}, {\it{y\/}})\index{iplus})\index{ilessp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{m\/}} $<$ {\it{n\/}}$\;\;${\bf then }{\rm{ilessp}}\,({\it{x\/}}, {\rm{iplus}}\,({\it{n\/}} $-$ {\it{m\/}}, {\it{y\/}})\index{iplus})\index{ilessp} \\ 
{\bf else }{\rm{ilessp}}\,({\rm{iplus}}\,({\it{m\/}} $-$ {\it{n\/}}, {\it{x\/}})\index{iplus}, {\it{y\/}})\index{ilessp}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cancel-constants-ilessp-lemma-2 \\ \index{cancel-constants-ilessp-lemma-2}
\=\+(({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{ilessp}}\,({\rm{iplus}}\,({\it{m\/}}, {\it{x\/}})\index{iplus}, {\rm{iplus}}\,({\it{n\/}}, {\it{y\/}})\index{iplus})\index{ilessp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{m\/}} $<$ {\it{n\/}}$\;\;${\bf then }$\neg$ {\rm{ilessp}}\,({\rm{iplus}}\,(({\it{n\/}} $-$ {\it{m\/}}) $-\;1$, {\it{y\/}})\index{iplus}, {\it{x\/}})\index{ilessp} \\ 
{\bf else }{\rm{ilessp}}\,({\rm{iplus}}\,({\it{m\/}} $-$ {\it{n\/}}, {\it{x\/}})\index{iplus}, {\it{y\/}})\index{ilessp}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cancel-constants-ilessp \\ \index{cancel-constants-ilessp}
\=\+{\rm{ilessp}}\,({\rm{iplus}}\,($1\;+$ {\it{i\/}}, {\it{x\/}})\index{iplus}, {\rm{iplus}}\,($1\;+$ {\it{j\/}}, {\it{y\/}})\index{iplus})\index{ilessp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{i\/}} $<$ {\it{j\/}}$\;\;${\bf then }$\neg$ {\rm{ilessp}}\,({\rm{iplus}}\,(({\it{j\/}} $-$ {\it{i\/}}) $-\;1$, {\it{y\/}})\index{iplus}, {\it{x\/}})\index{ilessp} \\ 
{\bf else }{\rm{ilessp}}\,({\rm{iplus}}\,({\it{i\/}} $-$ {\it{j\/}}, {\it{x\/}})\index{iplus}, {\it{y\/}})\index{ilessp}$\;${\bf  endif}\-\-
\end{tabbing}


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

\addvspace{18pt}

\noindent{\sc Event}:   Disable numberp-is-integerp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable difference-idifference.

\addvspace{18pt}

\begin{verbatim};; new stuff about integers from rationals developement

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ilessp-irem \\ \index{ilessp-irem}
{\rm{ilessp}}\,({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem}, {\it{y\/}})\index{ilessp} $=$ ({\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp} $\vee$ ({\rm{izerop}}\,({\it{y\/}})\index{izerop} $\wedge$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}))
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  irem-noop \\ \index{irem-noop}
{\rm{ilessp}}\,({\rm{iabs}}\,({\it{a\/}})\index{iabs}, {\rm{iabs}}\,({\it{b\/}})\index{iabs})\index{ilessp} $\rightarrow$ ({\rm{irem}}\,({\it{a\/}}, {\it{b\/}})\index{irem} $=$ {\rm{fix-int}}\,({\it{a\/}})\index{fix-int})
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  irem-of-0 \\ \index{irem-of-0}
\=\+(({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $=$ {\tt{0}}) $\rightarrow$ ({\rm{irem}}\,({\it{a\/}}, {\it{x\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\wedge$$\;\;\;\;$(({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $=$ {\tt{0}}) $\rightarrow$ ({\rm{irem}}\,({\it{x\/}}, {\it{a\/}})\index{irem} $=$ {\rm{fix-int}}\,({\it{x\/}})\index{fix-int}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iplus-irem-itimes-iquo \\ \index{iplus-irem-itimes-iquo}
{\rm{iplus}}\,({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem}, {\rm{itimes}}\,({\it{y\/}}, {\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo})\index{itimes})\index{iplus} $=$ {\rm{fix-int}}\,({\it{x\/}})\index{fix-int}
\end{tabbing}



\noindent{\sc Event}:   Disable iplus-irem-itimes-iquo.

\addvspace{18pt}
         

\begin{tabbing}{\sc Theorem}:  irem-iquo-elim \\ \index{irem-iquo-elim}
{\rm{integerp}}\,({\it{x\/}})\index{integerp} $\rightarrow$ ({\rm{iplus}}\,({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem}, {\rm{itimes}}\,({\it{y\/}}, {\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo})\index{itimes})\index{iplus} $=$ {\it{x\/}})
\end{tabbing}

\begin{verbatim};; irem has a tough-to-deal-with definition.  Here's a better
;; one.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{my-irem} \\  
\=\+{\rm{my-irem}}\,({\it{x\/}}, {\it{y\/}})\index{my-irem} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\rm{negativep}}\,({\it{x\/}})$\;\;${\bf then }{\rm{ineg}}\,({\rm{negative-guts}}\,({\it{x\/}}) ${}${\bf{mod}}${}$ {\rm{iabs}}\,({\it{y\/}})\index{iabs})\index{ineg} \\ 
{\bf else }{\it{x\/}} ${}${\bf{mod}}${}$ {\rm{iabs}}\,({\it{y\/}})\index{iabs}$\;${\bf  endif}\-\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  irem-iplus-0-proof \\ \index{irem-iplus-0-proof}
({\rm{irem}}\,({\it{b\/}}, {\it{c\/}})\index{irem} $=$ {\tt{0}}) $\rightarrow$ (({\rm{irem}}\,({\rm{iplus}}\,({\it{a\/}}, {\it{b\/}})\index{iplus}, {\it{c\/}})\index{irem} $=$ {\tt{0}}) $=$ ({\rm{irem}}\,({\it{a\/}}, {\it{c\/}})\index{irem} $=$ {\tt{0}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  irem-iplus-0 \\ \index{irem-iplus-0}
\=\+({\rm{irem}}\,({\it{b\/}}, {\it{c\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\rm{irem}}\,({\rm{iplus}}\,({\it{a\/}}, {\it{b\/}})\index{iplus}, {\it{c\/}})\index{irem} $=$ {\tt{0}}) $=$ ({\rm{irem}}\,({\it{a\/}}, {\it{c\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\wedge$$\;\;\;\;$(({\rm{irem}}\,({\rm{iplus}}\,({\it{b\/}}, {\it{a\/}})\index{iplus}, {\it{c\/}})\index{irem} $=$ {\tt{0}}) $=$ ({\rm{irem}}\,({\it{a\/}}, {\it{c\/}})\index{irem} $=$ {\tt{0}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{igcd}$\;\;$
{\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd} $=$ {\rm{gcd}}\,({\rm{iabs}}\,({\it{x\/}})\index{iabs}, {\rm{iabs}}\,({\it{y\/}})\index{iabs})\index{gcd}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  integerp-igcd \\ \index{integerp-igcd}
{\rm{integerp}}\,({\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})\index{integerp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  commutativity-of-igcd \\ \index{commutativity-of-igcd}
{\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd} $=$ {\rm{igcd}}\,({\it{y\/}}, {\it{x\/}})\index{igcd}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  igcd-0 \\ \index{igcd-0}
({\rm{igcd}}\,({\tt{0}}, {\it{x\/}})\index{igcd} $=$ {\rm{iabs}}\,({\it{x\/}})\index{iabs}) $\wedge$ ({\rm{igcd}}\,({\it{x\/}}, {\tt{0}})\index{igcd} $=$ {\rm{iabs}}\,({\it{x\/}})\index{iabs})
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  equal-igcd-0 \\ \index{equal-igcd-0}
({\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd} $=$ {\tt{0}}) $=$ (({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $=$ {\tt{0}}) $\wedge$ ({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\tt{0}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  igcd-non-negative \\ \index{igcd-non-negative}
$\neg$ {\rm{ilessp}}\,({\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd}, {\tt{0}})\index{ilessp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-igcd \\ \index{ilessp-igcd}
\=\+(\=\+{\rm{ilessp}}\,({\it{b\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\index{ilessp} \\ 
$=$$\;\;\;\;$({\rm{ilessp}}\,({\it{b\/}}, {\tt{0}})\index{ilessp} $\vee$ (({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $\not=$ {\tt{0}}) $\wedge$ ({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\tt{0}}))))\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{ilessp}}\,({\it{b\/}}, {\rm{igcd}}\,({\it{b\/}}, {\it{a\/}})\index{igcd})\index{ilessp} \\ 
$=$$\;\;\;\;$({\rm{ilessp}}\,({\it{b\/}}, {\tt{0}})\index{ilessp} $\vee$ (({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $\not=$ {\tt{0}}) $\wedge$ ({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\tt{0}}))))\-\-
\end{tabbing}
        
\begin{tabbing}{\sc Theorem}:  igcd-iplus-instance-proof \\ \index{igcd-iplus-instance-proof}
\=\+(({\rm{ilessp}}\,({\it{a\/}}, {\tt{0}})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{b\/}}, {\tt{0}})\index{ilessp}) $\vee$ ($\neg$ {\rm{ilessp}}\,({\rm{iabs}}\,({\it{b\/}})\index{iabs}, {\rm{iabs}}\,({\it{a\/}})\index{iabs})\index{ilessp})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{igcd}}\,({\it{a\/}}, {\rm{iplus}}\,({\it{a\/}}, {\it{b\/}})\index{iplus})\index{igcd} $=$ {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  igcd-iplus \\ \index{igcd-iplus}
\=\+(({\rm{ilessp}}\,({\it{a\/}}, {\tt{0}})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{b\/}}, {\tt{0}})\index{ilessp}) $\vee$ ($\neg$ {\rm{ilessp}}\,({\rm{iabs}}\,({\it{b\/}})\index{iabs}, {\rm{iabs}}\,({\it{a\/}})\index{iabs})\index{ilessp})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{igcd}}\,({\it{a\/}}, {\rm{iplus}}\,({\it{a\/}}, {\it{b\/}})\index{iplus})\index{igcd} $=$ {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd}) \\ 
$\wedge$$\;\;\;\;$({\rm{igcd}}\,({\it{a\/}}, {\rm{iplus}}\,({\it{b\/}}, {\it{a\/}})\index{iplus})\index{igcd} $=$ {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd}))\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable igcd.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  irem-igcd \\ \index{irem-igcd}
({\rm{irem}}\,({\it{a\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{b\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\index{irem} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  distributivity-of-itimes-over-igcd-proof \\ \index{distributivity-of-itimes-over-i!gcd-proof}
{\rm{igcd}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes}, {\rm{itimes}}\,({\it{y\/}}, {\it{z\/}})\index{itimes})\index{igcd} $=$ {\rm{itimes}}\,({\rm{iabs}}\,({\it{z\/}})\index{iabs}, {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})\index{itimes}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  distributivity-of-itimes-over-igcd \\ \index{distributivity-of-itimes-over-i!gcd}
\=\+({\rm{igcd}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes}, {\rm{itimes}}\,({\it{y\/}}, {\it{z\/}})\index{itimes})\index{igcd} $=$ {\rm{itimes}}\,({\rm{iabs}}\,({\it{z\/}})\index{iabs}, {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})\index{itimes}) \\ 
$\wedge$$\;\;\;\;$({\rm{igcd}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes}, {\rm{itimes}}\,({\it{z\/}}, {\it{y\/}})\index{itimes})\index{igcd} $=$ {\rm{itimes}}\,({\rm{iabs}}\,({\it{z\/}})\index{iabs}, {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})\index{itimes}) \\ 
$\wedge$$\;\;\;\;$({\rm{igcd}}\,({\rm{itimes}}\,({\it{z\/}}, {\it{x\/}})\index{itimes}, {\rm{itimes}}\,({\it{y\/}}, {\it{z\/}})\index{itimes})\index{igcd} $=$ {\rm{itimes}}\,({\rm{iabs}}\,({\it{z\/}})\index{iabs}, {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})\index{itimes}) \\ 
$\wedge$$\;\;\;\;$({\rm{igcd}}\,({\rm{itimes}}\,({\it{z\/}}, {\it{x\/}})\index{itimes}, {\rm{itimes}}\,({\it{z\/}}, {\it{y\/}})\index{itimes})\index{igcd} $=$ {\rm{itimes}}\,({\rm{iabs}}\,({\it{z\/}})\index{iabs}, {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})\index{itimes})\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  common-divisor-divides-igcd \\ \index{common-divisor-divides-igcd}
(({\rm{irem}}\,({\it{x\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{y\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}})) $\rightarrow$ ({\rm{irem}}\,({\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd}, {\it{z\/}})\index{irem} $=$ {\tt{0}})
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  associativity-of-igcd \\ \index{associativity-of-igcd}
{\rm{igcd}}\,({\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd}, {\it{z\/}})\index{igcd} $=$ {\rm{igcd}}\,({\it{x\/}}, {\rm{igcd}}\,({\it{y\/}}, {\it{z\/}})\index{igcd})\index{igcd}
\end{tabbing}

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

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


\begin{tabbing}{\sc Theorem}:  igcd-idempotence \\ \index{igcd-idempotence}
({\rm{igcd}}\,({\it{x\/}}, {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})\index{igcd} $=$ {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd}) $\wedge$ ({\rm{igcd}}\,({\it{y\/}}, {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})\index{igcd} $=$ {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquo-0 \\ \index{iquo-0}
({\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo} $=$ {\tt{0}}) $=$ (({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $=$ {\tt{0}}) $\vee$ {\rm{ilessp}}\,({\rm{iabs}}\,({\it{x\/}})\index{iabs}, {\rm{iabs}}\,({\it{y\/}})\index{iabs})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-0-iquo \\ \index{ilessp-0-iquo}
\=\+{\rm{ilessp}}\,({\tt{0}}, {\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo})\index{ilessp} \\ 
$=$$\;\;\;\;$(\=\+({\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ilessp}}\,({\rm{iabs}}\,({\it{x\/}})\index{iabs}, {\rm{iabs}}\,({\it{y\/}})\index{iabs})\index{ilessp}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iabs-simplify \\ \index{iabs-simplify}
($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}) $\rightarrow$ ({\rm{iabs}}\,({\it{x\/}})\index{iabs} $=$ {\rm{fix-int}}\,({\it{x\/}})\index{fix-int})
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  ilessp-iquo-0 \\ \index{ilessp-iquo-0}
\=\+{\rm{ilessp}}\,({\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo}, {\tt{0}})\index{ilessp} \\ 
$=$$\;\;\;\;$(\=\+({\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} $\not=$ {\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ilessp}}\,({\rm{iabs}}\,({\it{x\/}})\index{iabs}, {\rm{iabs}}\,({\it{y\/}})\index{iabs})\index{ilessp}))\-\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  ilessp-0-igcd \\ \index{ilessp-0-igcd}
{\rm{ilessp}}\,({\tt{0}}, {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})\index{ilessp} $=$ (($\neg$ {\rm{izerop}}\,({\it{x\/}})\index{izerop}) $\vee$ ($\neg$ {\rm{izerop}}\,({\it{y\/}})\index{izerop}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  igcd-minus \\ \index{igcd-minus}
\=\+($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{igcd}}\,($-$ {\it{x\/}}, {\it{y\/}})\index{igcd} $=$ {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd}) $\wedge$ ({\rm{igcd}}\,({\it{y\/}}, $-$ {\it{x\/}})\index{igcd} $=$ {\rm{igcd}}\,({\it{y\/}}, {\it{x\/}})\index{igcd}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquo-0-arg \\ \index{iquo-0-arg}
({\rm{iquo}}\,({\tt{0}}, {\it{x\/}})\index{iquo} $=$ {\tt{0}}) $\wedge$ ({\rm{iquo}}\,({\it{x\/}}, {\tt{0}})\index{iquo} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-iquo \\ \index{itimes-iquo}
({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}}) $\rightarrow$ ({\rm{itimes}}\,({\it{y\/}}, {\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo})\index{itimes} $=$ {\rm{fix-int}}\,({\it{x\/}})\index{fix-int})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-hack1-1 \\ \index{itimes-hack1-1}
\=\+({\rm{integerp}}\,({\it{a\/}})\index{integerp} $\wedge$ {\rm{integerp}}\,({\it{b\/}})\index{integerp} $\wedge$ ({\rm{irem}}\,({\it{a\/}}, {\it{ad\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{b\/}}, {\it{cb\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{ad\/}}, {\rm{itimes}}\,({\it{cb\/}}, {\rm{itimes}}\,({\rm{iquo}}\,({\it{a\/}}, {\it{ad\/}})\index{iquo}, {\rm{iquo}}\,({\it{b\/}}, {\it{cb\/}})\index{iquo})\index{itimes})\index{itimes})\index{itimes})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-hack1-1-1 \\ \index{itimes-hack1-1-1}
\=\+(\=\+(($\neg$ {\rm{integerp}}\,({\it{a\/}})\index{integerp}) $\vee$ ($\neg$ {\rm{integerp}}\,({\it{b\/}})\index{integerp})) \\ 
$\wedge$$\;\;\;\;$({\rm{irem}}\,({\it{a\/}}, {\it{ad\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{irem}}\,({\it{b\/}}, {\it{cb\/}})\index{irem} $=$ {\tt{0}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{ad\/}}, {\rm{itimes}}\,({\it{cb\/}}, {\rm{itimes}}\,({\rm{iquo}}\,({\it{a\/}}, {\it{ad\/}})\index{iquo}, {\rm{iquo}}\,({\it{b\/}}, {\it{cb\/}})\index{iquo})\index{itimes})\index{itimes})\index{itimes})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-hack1-2 \\ \index{itimes-hack1-2}
\=\+({\rm{integerp}}\,({\it{c\/}})\index{integerp} $\wedge$ {\rm{integerp}}\,({\it{d\/}})\index{integerp} $\wedge$ ({\rm{irem}}\,({\it{c\/}}, {\it{cb\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{d\/}}, {\it{ad\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{itimes}}\,({\it{c\/}}, {\it{d\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{ad\/}}, {\rm{itimes}}\,({\it{cb\/}}, {\rm{itimes}}\,({\rm{iquo}}\,({\it{c\/}}, {\it{cb\/}})\index{iquo}, {\rm{iquo}}\,({\it{d\/}}, {\it{ad\/}})\index{iquo})\index{itimes})\index{itimes})\index{itimes})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-hack1-2-1 \\ \index{itimes-hack1-2-1}
\=\+(\=\+(($\neg$ {\rm{integerp}}\,({\it{c\/}})\index{integerp}) $\vee$ ($\neg$ {\rm{integerp}}\,({\it{d\/}})\index{integerp})) \\ 
$\wedge$$\;\;\;\;$({\rm{irem}}\,({\it{c\/}}, {\it{cb\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{irem}}\,({\it{d\/}}, {\it{ad\/}})\index{irem} $=$ {\tt{0}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{itimes}}\,({\it{c\/}}, {\it{d\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{ad\/}}, {\rm{itimes}}\,({\it{cb\/}}, {\rm{itimes}}\,({\rm{iquo}}\,({\it{c\/}}, {\it{cb\/}})\index{iquo}, {\rm{iquo}}\,({\it{d\/}}, {\it{ad\/}})\index{iquo})\index{itimes})\index{itimes})\index{itimes})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-hack1 \\ \index{itimes-hack1}
\=\+(\=\+({\rm{irem}}\,({\it{a\/}}, {\it{ad\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{irem}}\,({\it{b\/}}, {\it{cb\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{irem}}\,({\it{c\/}}, {\it{cb\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{irem}}\,({\it{d\/}}, {\it{ad\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{a\/}}, {\it{ad\/}})\index{iquo} $=$ {\rm{iquo}}\,({\it{c\/}}, {\it{cb\/}})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{d\/}}, {\it{ad\/}})\index{iquo} $=$ {\rm{iquo}}\,({\it{b\/}}, {\it{cb\/}})\index{iquo}))\- \\ 
$\rightarrow$$\;\;\;\;$(({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{c\/}}, {\it{d\/}})\index{itimes}) $=$ {\bf{t}})\-
\end{tabbing}

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


\begin{tabbing}{\sc Theorem}:  iquo-0-arg-better \\ \index{iquo-0-arg-better}
({\rm{fix-int}}\,({\it{z\/}})\index{fix-int} $=$ {\tt{0}}) $\rightarrow$ (({\rm{iquo}}\,({\it{z\/}}, {\it{x\/}})\index{iquo} $=$ {\tt{0}}) $\wedge$ ({\rm{iquo}}\,({\it{x\/}}, {\it{z\/}})\index{iquo} $=$ {\tt{0}}))
\end{tabbing}



\begin{tabbing}{\sc Theorem}:  itimes-hack2 \\ \index{itimes-hack2}
\=\+(\=\+({\rm{iquo}}\,({\it{a\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{d\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{c\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{b\/}})\index{igcd})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{d\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{d\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{b\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{b\/}})\index{igcd})\index{iquo}))\- \\ 
$\rightarrow$$\;\;\;\;$(({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{c\/}}, {\it{d\/}})\index{itimes}) $=$ {\bf{t}})\-
\end{tabbing}

\begin{verbatim};;;;;;
;;;;; Following until gcd-remainder-times-fact1-proof based on something
;;;;; originally suggested by matt kaufmann
;;;;;;
\end{verbatim}\begin{tabbing}{\sc Theorem}:  gcd-factors-accept \\ \index{gcd-factors-accept}
\=\+{\rm{ordinalp}}\,({\rm{cons}}\,($1\;+$ {\it{x\/}}, {\rm{fix}}\,({\it{y\/}}))) \\ 
$\wedge$$\;\;\;\;$(\=\+(({\it{x\/}} $\not\simeq {\tt{0}}$) $\wedge$ ({\it{y\/}} $\not\simeq {\tt{0}}$) $\wedge$ ({\it{x\/}} $<$ {\it{y\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{cons}}\,($1\;+$ {\it{x\/}}, {\rm{fix}}\,({\it{y\/}} $-$ {\it{x\/}})), {\rm{cons}}\,($1\;+$ {\it{x\/}}, {\rm{fix}}\,({\it{y\/}}))))\- \\ 
$\wedge$$\;\;\;\;$(\=\+(({\it{x\/}} $\not\simeq {\tt{0}}$) $\wedge$ ({\it{y\/}} $\not\simeq {\tt{0}}$) $\wedge$ ({\it{x\/}} $\not<$ {\it{y\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{cons}}\,($1\;+$ ({\it{x\/}} $-$ {\it{y\/}}), {\rm{fix}}\,({\it{y\/}})), {\rm{cons}}\,($1\;+$ {\it{x\/}}, {\rm{fix}}\,({\it{y\/}}))))\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{gcd-factors} \\  
\=\+{\rm{gcd-factors}}\,({\it{x\/}}, {\it{y\/}})\index{gcd-factors} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\rm{cons}}\,({\tt{0}}, {\tt{1}}) \\ 
{\bf elseif }{\it{y\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\rm{cons}}\,({\tt{1}}, {\tt{0}}) \\ 
{\bf elseif }{\it{x\/}} $<$ {\it{y\/}} \\ 
{\bf then }\=\+{\bf let }\=\+{\it{factors\/}}{\bf $\;$ be$\;\;$}{\rm{gcd-factors}}\,({\it{x\/}}, {\it{y\/}} $-$ {\it{x\/}})\index{gcd-factors}\- \\ 
{\bf in} \\ 
{\rm{cons}}\,({\rm{idifference}}\,({\rm{car}}\,({\it{factors\/}}), {\rm{cdr}}\,({\it{factors\/}}))\index{idifference}, {\rm{cdr}}\,({\it{factors\/}}))$\;${\bf  endlet}\- \\ 
{\bf else }\=\+{\bf let }\=\+{\it{factors\/}}{\bf $\;$ be$\;\;$}{\rm{gcd-factors}}\,({\it{x\/}} $-$ {\it{y\/}}, {\it{y\/}})\index{gcd-factors}\- \\ 
{\bf in} \\ 
{\rm{cons}}\,(\=\+{\rm{car}}\,({\it{factors\/}}), \\ 
{\rm{idifference}}\,({\rm{cdr}}\,({\it{factors\/}}), {\rm{car}}\,({\it{factors\/}}))\index{idifference})\-$\;${\bf  endlet}\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  gcd-factors-gives-linear-combination \\ \index{gcd-factors-gives-linear-combin!ation}
\=\+{\bf let }\=\+{\it{factors\/}}{\bf $\;$ be$\;\;$}{\rm{gcd-factors}}\,({\it{x\/}}, {\it{y\/}})\index{gcd-factors}\- \\ 
{\bf in} \\ 
\=\+{\bf let }\=\+{\it{a\/}}{\bf $\;$ be$\;\;$}{\rm{car}}\,({\it{factors\/}}), \\ 
{\it{b\/}}{\bf $\;$ be$\;\;$}{\rm{cdr}}\,({\it{factors\/}})\- \\ 
{\bf in} \\ 
\=\+(({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{y\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{iplus}}\,({\rm{itimes}}\,({\it{a\/}}, {\it{x\/}})\index{itimes}, {\rm{itimes}}\,({\it{b\/}}, {\it{y\/}})\index{itimes})\index{iplus} $=$ {\rm{gcd}}\,({\it{x\/}}, {\it{y\/}})\index{gcd})\-$\;${\bf  endlet}\-$\;${\bf  endlet}\-
\end{tabbing}



\begin{tabbing}{\sc Theorem}:  gcd-factors-gives-linear-combination-rewrite \\ \index{gcd-factors-gives-linear-combin!ation-rewrite}
\=\+{\bf let }\=\+{\it{factors\/}}{\bf $\;$ be$\;\;$}{\rm{gcd-factors}}\,({\it{x\/}}, {\it{y\/}})\index{gcd-factors}\- \\ 
{\bf in} \\ 
\=\+{\bf let }\=\+{\it{a\/}}{\bf $\;$ be$\;\;$}{\rm{car}}\,({\it{factors\/}}), \\ 
{\it{b\/}}{\bf $\;$ be$\;\;$}{\rm{cdr}}\,({\it{factors\/}})\- \\ 
{\bf in} \\ 
\=\+(({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{y\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{gcd}}\,({\it{x\/}}, {\it{y\/}})\index{gcd} $=$ {\rm{iplus}}\,({\rm{itimes}}\,({\it{a\/}}, {\it{x\/}})\index{itimes}, {\rm{itimes}}\,({\it{b\/}}, {\it{y\/}})\index{itimes})\index{iplus})\-$\;${\bf  endlet}\-$\;${\bf  endlet}\-
\end{tabbing}



\begin{tabbing}{\sc Theorem}:  remainder-0-sufficiency \\ \index{remainder-0-sufficiency}
\=\+(({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{itimes}}\,({\it{x\/}}, {\it{p\/}})\index{itimes} $=$ {\it{c\/}})) \\ 
$\rightarrow$$\;\;\;\;$((({\it{c\/}} ${}${\bf{mod}}${}$ {\it{x\/}}) $=$ {\tt{0}}) $=$ {\bf{t}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-iquotient \\ \index{itimes-iquotient}
({\rm{iremainder}}\,({\it{a\/}}, {\it{x\/}})\index{iremainder} $=$ {\tt{0}}) $\rightarrow$ ({\rm{itimes}}\,({\it{x\/}}, {\rm{iquotient}}\,({\it{a\/}}, {\it{x\/}})\index{iquotient})\index{itimes} $=$ {\rm{fix-int}}\,({\it{a\/}})\index{fix-int})
\end{tabbing}

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

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

\begin{tabbing}{\sc Theorem}:  itimes-iplus-hack \\ \index{itimes-iplus-hack}
\=\+(({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{y\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{iremainder}}\,({\rm{itimes}}\,({\it{c\/}}, {\it{y\/}})\index{itimes}, {\it{x\/}})\index{iremainder} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{itimes}}\,({\it{x\/}}, {\rm{iplus}}\,({\rm{itimes}}\,({\it{c\/}}, {\it{a\/}})\index{itimes}, {\rm{itimes}}\,({\it{b\/}}, {\rm{iquotient}}\,({\rm{itimes}}\,({\it{c\/}}, {\it{y\/}})\index{itimes}, {\it{x\/}})\index{iquotient})\index{itimes})\index{iplus})\index{itimes} \\ 
$=$$\;\;\;\;${\rm{itimes}}\,({\it{c\/}}, {\rm{iplus}}\,({\rm{itimes}}\,({\it{a\/}}, {\it{x\/}})\index{itimes}, {\rm{itimes}}\,({\it{b\/}}, {\it{y\/}})\index{itimes})\index{iplus})\index{itimes})\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  irem-0-iremainder-0-help1 \\ \index{irem-0-iremainder-0-help1}
({\rm{iremainder}}\,({\it{x\/}}, {\it{y\/}})\index{iremainder} $=$ {\tt{0}}) $\rightarrow$ ({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  irem-0-iremainder-0-help2 \\ \index{irem-0-iremainder-0-help2}
({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}}) $\rightarrow$ ({\rm{iremainder}}\,({\it{x\/}}, {\it{y\/}})\index{iremainder} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  irem-0-iremainder-0 \\ \index{irem-0-iremainder-0}
({\rm{iremainder}}\,({\it{x\/}}, {\it{y\/}})\index{iremainder} $=$ {\tt{0}}) $=$ ({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-itimes-x-x \\ \index{equal-itimes-x-x}
\=\+(({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes} $=$ {\it{x\/}}) $=$ (({\rm{integerp}}\,({\it{x\/}})\index{integerp} $\wedge$ ({\it{y\/}} $=$ {\tt{1}})) $\vee$ ({\it{x\/}} $=$ {\tt{0}}))) \\ 
$\wedge$$\;\;\;\;$(({\rm{itimes}}\,({\it{y\/}}, {\it{x\/}})\index{itimes} $=$ {\it{x\/}}) $=$ (({\rm{integerp}}\,({\it{x\/}})\index{integerp} $\wedge$ ({\it{y\/}} $=$ {\tt{1}})) $\vee$ ({\it{x\/}} $=$ {\tt{0}})))\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  divides-product-reduction-helper-1 \\ \index{divides-product-reduction-helpe!r-1}
\=\+(({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{y\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ((({\it{c\/}} $*$ {\it{y\/}}) ${}${\bf{mod}}${}$ {\it{x\/}}) $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{iremainder}}\,({\rm{itimes}}\,({\it{c\/}}, {\it{y\/}})\index{itimes}, {\it{x\/}})\index{iremainder} $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  divides-product-reduction-helper \\ \index{divides-product-reduction-helpe!r}
\=\+(({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{y\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{gcd}}\,({\it{x\/}}, {\it{y\/}})\index{gcd} $=$ {\tt{1}}) $\wedge$ (({\it{c\/}} ${}${\bf{mod}}${}$ {\it{x\/}}) $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$((({\it{c\/}} $*$ {\it{y\/}}) ${}${\bf{mod}}${}$ {\it{x\/}}) $\not=$ {\tt{0}})\-
\end{tabbing}


\noindent{\sc Event}:   Disable divides-product-reduction-helper-1.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  divides-product-reduction \\ \index{divides-product-reduction}
\=\+(({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{y\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{gcd}}\,({\it{x\/}}, {\it{y\/}})\index{gcd} $=$ {\tt{1}}) $\wedge$ (({\it{c\/}} ${}${\bf{mod}}${}$ {\it{x\/}}) $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(((({\it{c\/}} $*$ {\it{y\/}}) ${}${\bf{mod}}${}$ {\it{x\/}}) $\not=$ {\tt{0}}) $\wedge$ ((({\it{y\/}} $*$ {\it{c\/}}) ${}${\bf{mod}}${}$ {\it{x\/}}) $\not=$ {\tt{0}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  gcd-remainder-times-fact1-proof-non-numberp-case \\ \index{gcd-remainder-times-fact1-proof!-non-numberp-case}
\=\+((({\it{a\/}} $\not\in\;${\bf{N}}${}$) $\vee$ ({\it{b\/}} $\not\in\;${\bf{N}}${}$) $\vee$ ({\it{c\/}} $\not\in\;${\bf{N}}${}$)) $\wedge$ ({\rm{gcd}}\,({\it{a\/}}, {\it{b\/}})\index{gcd} $=$ {\tt{1}})) \\ 
$\rightarrow$$\;\;\;\;$(((({\it{b\/}} $*$ {\it{c\/}}) ${}${\bf{mod}}${}$ {\it{a\/}}) $=$ {\tt{0}}) $=$ (({\it{c\/}} ${}${\bf{mod}}${}$ {\it{a\/}}) $=$ {\tt{0}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  gcd-remainder-times-fact1-proof-numberp-case \\ \index{gcd-remainder-times-fact1-proof!-numberp-case}
\=\+(({\it{a\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{b\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{gcd}}\,({\it{a\/}}, {\it{b\/}})\index{gcd} $=$ {\tt{1}})) \\ 
$\rightarrow$$\;\;\;\;$(((({\it{b\/}} $*$ {\it{c\/}}) ${}${\bf{mod}}${}$ {\it{a\/}}) $=$ {\tt{0}}) $=$ (({\it{c\/}} ${}${\bf{mod}}${}$ {\it{a\/}}) $=$ {\tt{0}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  gcd-remainder-times-fact1-proof \\ \index{gcd-remainder-times-fact1-proof}
({\rm{gcd}}\,({\it{a\/}}, {\it{b\/}})\index{gcd} $=$ {\tt{1}}) $\rightarrow$ (((({\it{b\/}} $*$ {\it{c\/}}) ${}${\bf{mod}}${}$ {\it{a\/}}) $=$ {\tt{0}}) $=$ (({\it{c\/}} ${}${\bf{mod}}${}$ {\it{a\/}}) $=$ {\tt{0}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  divides-each-equality \\ \index{divides-each-equality}
((({\it{a\/}} ${}${\bf{mod}}${}$ {\it{b\/}}) $=$ {\tt{0}}) $\wedge$ (({\it{b\/}} ${}${\bf{mod}}${}$ {\it{a\/}}) $=$ {\tt{0}})) $=$ ({\rm{fix}}\,({\it{a\/}}) $=$ {\rm{fix}}\,({\it{b\/}}))
\end{tabbing}

\begin{verbatim};;; Before we go on, prove, disable, and set up theory about
;;; naturals --> integers

\end{verbatim}\begin{tabbing}{\sc Theorem}:  times-to-itimes \\ \index{times-to-itimes}
\=\+({\it{a\/}} $*$ {\it{b\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{a\/}}, {\tt{0}})\index{ilessp} $\vee$ {\rm{ilessp}}\,({\it{b\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable times-to-itimes.

\addvspace{18pt}
                      
\begin{tabbing}{\sc Theorem}:  quotient-to-iquo \\ \index{quotient-to-iquo}
\=\+({\it{a\/}} $\div$ {\it{b\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{a\/}}, {\tt{0}})\index{ilessp} $\vee$ {\rm{ilessp}}\,({\it{b\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{iquo}}\,({\it{a\/}}, {\it{b\/}})\index{iquo}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable quotient-to-iquo.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  zerop-izerop \\ \index{zerop-izerop}
\=\+({\it{a\/}} $\simeq {\tt{0}}$) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{a\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{izerop}}\,({\it{a\/}})\index{izerop}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable zerop-izerop.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  fix-to-fix-int \\ \index{fix-to-fix-int}
\=\+{\rm{fix}}\,({\it{a\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{a\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{fix-int}}\,({\it{a\/}})\index{fix-int}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable fix-to-fix-int.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  plus-iplus2 \\ \index{plus-iplus2}
\=\+({\it{x\/}} $+$ {\it{y\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} \\ 
{\bf then }\=\+{\bf if }{\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{fix-int}}\,({\it{y\/}})\index{fix-int}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\rm{fix-int}}\,({\it{x\/}})\index{fix-int} \\ 
{\bf else }{\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus}$\;${\bf  endif}\-\-
\end{tabbing}


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

\addvspace{18pt}
                  
\begin{tabbing}{\sc Theorem}:  ilessp-lessp \\ \index{ilessp-lessp}
\=\+({\it{x\/}} $<$ {\it{y\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} \\ 
{\bf then }\=\+{\bf if }{\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\bf{f}} \\ 
{\bf else }{\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp}$\;${\bf  endif}\- \\ 
{\bf else }{\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable ilessp-lessp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  numberp-ilessp \\ \index{numberp-ilessp}
({\it{x\/}} $\in\;${\bf{N}}${}$) $=$ (({\it{x\/}} $=$ {\tt{0}}) $\vee$ {\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp})
\end{tabbing}



\noindent{\sc Event}:   Disable numberp-ilessp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  gcd-is-igcd \\ \index{gcd-is-igcd}
\=\+{\rm{gcd}}\,({\it{x\/}}, {\it{y\/}})\index{gcd} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} \\ 
{\bf then }\=\+{\bf if }{\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{fix-int}}\,({\it{y\/}})\index{fix-int}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\rm{fix-int}}\,({\it{x\/}})\index{fix-int} \\ 
{\bf else }{\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable gcd-is-igcd.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  negativep-ilessp \\ \index{negativep-ilessp}
{\rm{integerp}}\,({\it{x\/}})\index{integerp} $\rightarrow$ ({\rm{negativep}}\,({\it{x\/}}) $=$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp})
\end{tabbing}



\noindent{\sc Event}:   Disable negativep-ilessp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  remainder-to-irem \\ \index{remainder-to-irem}
\=\+({\it{x\/}} ${}${\bf{mod}}${}$ {\it{y\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\rm{fix}}\,({\it{x\/}}) \\ 
{\bf else }{\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable remainder-to-irem.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  difference-idifference2 \\ \index{difference-idifference2}
\=\+({\it{x\/}} $-$ {\it{y\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\rm{fix-int}}\,({\it{x\/}})\index{fix-int} \\ 
{\bf elseif }{\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{idifference}}\,({\it{x\/}}, {\it{y\/}})\index{idifference}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable difference-idifference2.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  add1-iplus \\ \index{add1-iplus}
\=\+($1\;+$ {\it{x\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\in\;${\bf{N}}${}$$\;\;${\bf then }{\rm{iplus}}\,({\tt{1}}, {\it{x\/}})\index{iplus} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\-\-
\end{tabbing}




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

\addvspace{18pt}


\noindent{\sc Event}:   Let us define the theory {\it{nats-to-ints}} to consist of the following events: add1-iplus,
difference-idifference2,
remainder-to-irem,
negativep-ilessp,
gcd-is-igcd,
numberp-ilessp,
ilessp-lessp,
plus-iplus2,
fix-to-fix-int,
fix-to-fix-int,
zerop-izerop,
quotient-to-iquo,
times-to-itimes.\index{nats-to-ints}

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  times-gcd-fact-proof-1 \\ \index{times-gcd-fact-proof-1}
\=\+(({\rm{gcd}}\,({\it{a\/}}, {\it{c\/}})\index{gcd} $=$ {\tt{1}}) $\wedge$ ({\rm{gcd}}\,({\it{b\/}}, {\it{d\/}})\index{gcd} $=$ {\tt{1}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\rm{fix}}\,({\it{a\/}}) $=$ {\rm{fix}}\,({\it{d\/}})) $\wedge$ ({\rm{fix}}\,({\it{b\/}}) $=$ {\rm{fix}}\,({\it{c\/}}))) \\ 
$\rightarrow$$\;\;\;\;$(({\it{a\/}} $*$ {\it{b\/}}) $=$ ({\it{c\/}} $*$ {\it{d\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  times-gcd-fact-proof-2-1 \\ \index{times-gcd-fact-proof-2-1}
\=\+(({\rm{gcd}}\,({\it{a\/}}, {\it{c\/}})\index{gcd} $=$ {\tt{1}}) $\wedge$ ({\rm{gcd}}\,({\it{b\/}}, {\it{d\/}})\index{gcd} $=$ {\tt{1}}) $\wedge$ (({\it{d\/}} ${}${\bf{mod}}${}$ {\it{a\/}}) $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\it{a\/}} $*$ {\it{b\/}}) $=$ ({\it{c\/}} $*$ {\it{d\/}})) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{fix}}\,({\it{a\/}}) $=$ {\rm{fix}}\,({\it{d\/}})) $\wedge$ ({\rm{fix}}\,({\it{b\/}}) $=$ {\rm{fix}}\,({\it{c\/}}))))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  times-gcd-fact-proof-2-2 \\ \index{times-gcd-fact-proof-2-2}
(({\it{a\/}} $*$ {\it{b\/}}) $=$ ({\it{c\/}} $*$ {\it{d\/}})) $\rightarrow$ ((({\it{c\/}} $*$ {\it{d\/}}) ${}${\bf{mod}}${}$ {\it{a\/}}) $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  times-gcd-fact-proof-2-3 \\ \index{times-gcd-fact-proof-2-3}
(({\rm{gcd}}\,({\it{a\/}}, {\it{c\/}})\index{gcd} $=$ {\tt{1}}) $\wedge$ ((({\it{c\/}} $*$ {\it{d\/}}) ${}${\bf{mod}}${}$ {\it{a\/}}) $=$ {\tt{0}})) $\rightarrow$ (({\it{d\/}} ${}${\bf{mod}}${}$ {\it{a\/}}) $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  times-gcd-fact-proof-2 \\ \index{times-gcd-fact-proof-2}
\=\+(({\rm{gcd}}\,({\it{a\/}}, {\it{c\/}})\index{gcd} $=$ {\tt{1}}) $\wedge$ ({\rm{gcd}}\,({\it{b\/}}, {\it{d\/}})\index{gcd} $=$ {\tt{1}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\it{a\/}} $*$ {\it{b\/}}) $=$ ({\it{c\/}} $*$ {\it{d\/}})) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{fix}}\,({\it{a\/}}) $=$ {\rm{fix}}\,({\it{d\/}})) $\wedge$ ({\rm{fix}}\,({\it{b\/}}) $=$ {\rm{fix}}\,({\it{c\/}}))))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  times-gcd-fact-proof \\ \index{times-gcd-fact-proof}
\=\+(({\rm{gcd}}\,({\it{a\/}}, {\it{c\/}})\index{gcd} $=$ {\tt{1}}) $\wedge$ ({\rm{gcd}}\,({\it{b\/}}, {\it{d\/}})\index{gcd} $=$ {\tt{1}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\it{a\/}} $*$ {\it{b\/}}) $=$ ({\it{c\/}} $*$ {\it{d\/}})) \\ 
$=$$\;\;\;\;$(({\rm{fix}}\,({\it{a\/}}) $=$ {\rm{fix}}\,({\it{d\/}})) $\wedge$ ({\rm{fix}}\,({\it{b\/}}) $=$ {\rm{fix}}\,({\it{c\/}}))))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  times-gcd-fact \\ \index{times-gcd-fact}
\=\+(({\rm{gcd}}\,({\it{a\/}}, {\it{c\/}})\index{gcd} $=$ {\tt{1}}) $\wedge$ ({\rm{gcd}}\,({\it{b\/}}, {\it{d\/}})\index{gcd} $=$ {\tt{1}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+(({\it{a\/}} $*$ {\it{b\/}}) $=$ ({\it{c\/}} $*$ {\it{d\/}})) \\ 
$=$$\;\;\;\;$(({\rm{fix}}\,({\it{a\/}}) $=$ {\rm{fix}}\,({\it{d\/}})) $\wedge$ ({\rm{fix}}\,({\it{b\/}}) $=$ {\rm{fix}}\,({\it{c\/}}))))\- \\ 
$\wedge$$\;\;\;\;$(\=\+(({\it{b\/}} $*$ {\it{a\/}}) $=$ ({\it{c\/}} $*$ {\it{d\/}})) \\ 
$=$$\;\;\;\;$(({\rm{fix}}\,({\it{a\/}}) $=$ {\rm{fix}}\,({\it{d\/}})) $\wedge$ ({\rm{fix}}\,({\it{b\/}}) $=$ {\rm{fix}}\,({\it{c\/}}))))\-)\-\-
\end{tabbing}

\begin{verbatim};; poor choice of symbols a/c and d/b
\end{verbatim}\begin{tabbing}{\sc Theorem}:  itimes-igcd-fact-proof \\ \index{itimes-igcd-fact-proof}
\=\+(({\rm{igcd}}\,({\it{a\/}}, {\it{c\/}})\index{igcd} $=$ {\tt{1}}) $\wedge$ ({\rm{igcd}}\,({\it{b\/}}, {\it{d\/}})\index{igcd} $=$ {\tt{1}}) $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{b\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{c\/}})\index{ilessp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{c\/}}, {\it{d\/}})\index{itimes}) \\ 
$=$$\;\;\;\;$(({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{d\/}})\index{fix-int}) $\wedge$ ({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{c\/}})\index{fix-int})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  itimes-igcd-fact \\ \index{itimes-igcd-fact}
\=\+(({\rm{igcd}}\,({\it{a\/}}, {\it{c\/}})\index{igcd} $=$ {\tt{1}}) $\wedge$ ({\rm{igcd}}\,({\it{b\/}}, {\it{d\/}})\index{igcd} $=$ {\tt{1}}) $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{b\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{c\/}})\index{ilessp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{c\/}}, {\it{d\/}})\index{itimes}) \\ 
$=$$\;\;\;\;$(({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{d\/}})\index{fix-int}) $\wedge$ ({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{c\/}})\index{fix-int})))\- \\ 
$\wedge$$\;\;\;\;$(\=\+({\rm{itimes}}\,({\it{b\/}}, {\it{a\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{c\/}}, {\it{d\/}})\index{itimes}) \\ 
$=$$\;\;\;\;$(\=\+({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{d\/}})\index{fix-int}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{c\/}})\index{fix-int}))\-)\- \\ 
$\wedge$$\;\;\;\;$(\=\+({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{d\/}}, {\it{c\/}})\index{itimes}) \\ 
$=$$\;\;\;\;$(\=\+({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{d\/}})\index{fix-int}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{c\/}})\index{fix-int}))\-)\- \\ 
$\wedge$$\;\;\;\;$(\=\+({\rm{itimes}}\,({\it{b\/}}, {\it{a\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{d\/}}, {\it{c\/}})\index{itimes}) \\ 
$=$$\;\;\;\;$(\=\+({\rm{fix-int}}\,({\it{a\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{d\/}})\index{fix-int}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\it{b\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{c\/}})\index{fix-int}))\-)\-)\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  itimes-iquo-general \\ \index{itimes-iquo-general}
\=\+({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{itimes}}\,({\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo}, {\it{z\/}})\index{itimes} $=$ {\rm{iquo}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes}, {\it{y\/}})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{itimes}}\,({\it{z\/}}, {\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo})\index{itimes} $=$ {\rm{iquo}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes}, {\it{y\/}})\index{iquo}))\-\-
\end{tabbing}

\begin{verbatim}; another copy so that itimes-iquo-general doesn't get fired first
\end{verbatim}\begin{tabbing}{\sc Theorem}:  itimes-iquo-copy \\ \index{itimes-iquo-copy}
({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}}) $\rightarrow$ ({\rm{itimes}}\,({\it{y\/}}, {\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo})\index{itimes} $=$ {\rm{fix-int}}\,({\it{x\/}})\index{fix-int})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-iquo-iquo \\ \index{equal-iquo-iquo}
\=\+(({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{z\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo} $=$ {\rm{iquo}}\,({\it{z\/}}, {\it{y\/}})\index{iquo}) $=$ ({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{z\/}})\index{fix-int}))\-
\end{tabbing}

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

        
\begin{tabbing}{\sc Theorem}:  irem-iquo-itimes-proof \\ \index{irem-iquo-itimes-proof}
\=\+(({\rm{irem}}\,({\it{a\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{b\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{irem}}\,({\rm{iquo}}\,({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes}, {\it{y\/}})\index{iquo}, {\it{z\/}})\index{irem} $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  irem-iquo-itimes \\ \index{irem-iquo-itimes}
\=\+(({\rm{irem}}\,({\it{a\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{b\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{irem}}\,({\rm{iquo}}\,({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes}, {\it{y\/}})\index{iquo}, {\it{z\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{irem}}\,({\rm{iquo}}\,({\rm{itimes}}\,({\it{b\/}}, {\it{a\/}})\index{itimes}, {\it{y\/}})\index{iquo}, {\it{z\/}})\index{irem} $=$ {\tt{0}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-irem-itimes-0 \\ \index{equal-irem-itimes-0}
(({\rm{irem}}\,({\it{x\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}}) $\vee$ ({\rm{irem}}\,({\it{y\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}})) $\rightarrow$ ({\rm{irem}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes}, {\it{z\/}})\index{irem} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  commutativity-of-iquo \\ \index{commutativity-of-iquo}
({\rm{irem}}\,({\it{a\/}}, {\rm{itimes}}\,({\it{b\/}}, {\it{c\/}})\index{itimes})\index{irem} $=$ {\tt{0}}) $\rightarrow$ ({\rm{iquo}}\,({\rm{iquo}}\,({\it{a\/}}, {\it{c\/}})\index{iquo}, {\it{b\/}})\index{iquo} $=$ {\rm{iquo}}\,({\rm{iquo}}\,({\it{a\/}}, {\it{b\/}})\index{iquo}, {\it{c\/}})\index{iquo})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  irem-itimes \\ \index{irem-itimes}
\=\+(({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo}, {\it{z\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{irem}}\,({\it{x\/}}, {\rm{itimes}}\,({\it{y\/}}, {\it{z\/}})\index{itimes})\index{irem} $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquo-igcd-itimes-proof1 \\ \index{iquo-igcd-itimes-proof1}
\=\+({\rm{ilessp}}\,({\tt{0}}, {\it{b\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{d\/}})\index{ilessp} $\wedge$ ({\rm{itimes}}\,({\it{a\/}}, {\it{d\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{b\/}}, {\it{c\/}})\index{itimes})) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{iquo}}\,({\it{a\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{c\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}) $=$ {\bf{t}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquo-igcd-itimes-proof2 \\ \index{iquo-igcd-itimes-proof2}
\=\+({\rm{ilessp}}\,({\tt{0}}, {\it{b\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{d\/}})\index{ilessp} $\wedge$ ({\rm{itimes}}\,({\it{a\/}}, {\it{d\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{b\/}}, {\it{c\/}})\index{itimes})) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{iquo}}\,({\it{b\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{d\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}) $=$ {\bf{t}})\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  iquo-igcd-itimes1 \\ \index{iquo-igcd-itimes1}
\=\+({\rm{ilessp}}\,({\tt{0}}, {\it{b\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{d\/}})\index{ilessp} $\wedge$ ({\rm{itimes}}\,({\it{a\/}}, {\it{d\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{b\/}}, {\it{c\/}})\index{itimes})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{iquo}}\,({\it{a\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{c\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{b\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{d\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{a\/}}, {\rm{igcd}}\,({\it{b\/}}, {\it{a\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{c\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{b\/}}, {\rm{igcd}}\,({\it{b\/}}, {\it{a\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{d\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}))\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  iquo-igcd-itimes2 \\ \index{iquo-igcd-itimes2}
\=\+({\rm{ilessp}}\,({\tt{0}}, {\it{b\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{d\/}})\index{ilessp} $\wedge$ ({\rm{itimes}}\,({\it{d\/}}, {\it{a\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{b\/}}, {\it{c\/}})\index{itimes})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{iquo}}\,({\it{a\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{c\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{b\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{d\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{a\/}}, {\rm{igcd}}\,({\it{b\/}}, {\it{a\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{c\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{b\/}}, {\rm{igcd}}\,({\it{b\/}}, {\it{a\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{d\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}))\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  iquo-igcd-itimes3 \\ \index{iquo-igcd-itimes3}
\=\+({\rm{ilessp}}\,({\tt{0}}, {\it{b\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{d\/}})\index{ilessp} $\wedge$ ({\rm{itimes}}\,({\it{a\/}}, {\it{d\/}})\index{itimes} $=$ {\rm{itimes}}\,({\it{c\/}}, {\it{b\/}})\index{itimes})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{iquo}}\,({\it{a\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{c\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{b\/}}, {\rm{igcd}}\,({\it{a\/}}, {\it{b\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{d\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{a\/}}, {\rm{igcd}}\,({\it{b\/}}, {\it{a\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{c\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}) \\ 
$\wedge$$\;\;\;\;$({\rm{iquo}}\,({\it{b\/}}, {\rm{igcd}}\,({\it{b\/}}, {\it{a\/}})\index{igcd})\index{iquo} $=$ {\rm{iquo}}\,({\it{d\/}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{iquo}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-iquo-1 \\ \index{equal-iquo-1}
\=\+({\rm{irem}}\,({\it{x\/}}, {\it{y\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo} $=$ {\tt{1}}) \\ 
$=$$\;\;\;\;$(\=\+({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\rm{fix-int}}\,({\it{y\/}})\index{fix-int}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $\not=$ {\tt{0}}))\-)\-\-
\end{tabbing}

\begin{verbatim}#| replaced by below
(prove-lemma equal-x-gcd-x-y (rewrite)
       (implies
        (numberp y)
       (equal
        (equal x (gcd x y))
        (and
         (numberp x)
         (equal (remainder y x) 0))))
       ((enable-theory naturals)))
|#

\end{verbatim}\begin{tabbing}{\sc Theorem}:  equal-x-igcd-x-y-proof \\ \index{equal-x-igcd-x-y-proof}
\=\+({\it{x\/}} $=$ {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd}) \\ 
$=$$\;\;\;\;$(($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}) $\wedge$ {\rm{integerp}}\,({\it{x\/}})\index{integerp} $\wedge$ ({\rm{irem}}\,({\it{y\/}}, {\it{x\/}})\index{irem} $=$ {\tt{0}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-x-igcd-x-y \\ \index{equal-x-igcd-x-y}
\=\+(\=\+({\it{x\/}} $=$ {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd}) \\ 
$=$$\;\;\;\;$(($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}) $\wedge$ {\rm{integerp}}\,({\it{x\/}})\index{integerp} $\wedge$ ({\rm{irem}}\,({\it{y\/}}, {\it{x\/}})\index{irem} $=$ {\tt{0}})))\- \\ 
$\wedge$$\;\;\;\;$(\=\+({\it{x\/}} $=$ {\rm{igcd}}\,({\it{y\/}}, {\it{x\/}})\index{igcd}) \\ 
$=$$\;\;\;\;$(($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}) $\wedge$ {\rm{integerp}}\,({\it{x\/}})\index{integerp} $\wedge$ ({\rm{irem}}\,({\it{y\/}}, {\it{x\/}})\index{irem} $=$ {\tt{0}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-iplus-igcd \\ \index{ilessp-iplus-igcd}
\=\+(\=\+{\rm{ilessp}}\,({\tt{0}}, {\rm{iplus}}\,({\it{x\/}}, {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})\index{iplus})\index{ilessp} \\ 
$=$$\;\;\;\;$({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\vee$ (({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}) $\wedge$ ({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $\not=$ {\tt{0}}))))\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{ilessp}}\,({\tt{0}}, {\rm{iplus}}\,({\it{x\/}}, {\rm{igcd}}\,({\it{y\/}}, {\it{x\/}})\index{igcd})\index{iplus})\index{ilessp} \\ 
$=$$\;\;\;\;$({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\vee$ (({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}) $\wedge$ ({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $\not=$ {\tt{0}}))))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-iabs-arg1 \\ \index{ilessp-iabs-arg1}
{\rm{ilessp}}\,({\rm{iabs}}\,({\it{x\/}})\index{iabs}, {\it{y\/}})\index{ilessp} $=$ ({\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\rm{ineg}}\,({\it{x\/}})\index{ineg}, {\it{y\/}})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-iabs-arg2 \\ \index{ilessp-iabs-arg2}
{\rm{ilessp}}\,({\it{x\/}}, {\rm{iabs}}\,({\it{y\/}})\index{iabs})\index{ilessp} $=$ ({\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp} $\vee$ {\rm{ilessp}}\,({\it{x\/}}, {\rm{ineg}}\,({\it{y\/}})\index{ineg})\index{ilessp})
\end{tabbing}

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

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

\begin{tabbing}{\sc Theorem}:  iplus-iquo-iquo \\ \index{iplus-iquo-iquo}
\=\+(({\rm{irem}}\,({\it{x\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{y\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{iplus}}\,({\rm{iquo}}\,({\it{x\/}}, {\it{z\/}})\index{iquo}, {\rm{iquo}}\,({\it{y\/}}, {\it{z\/}})\index{iquo})\index{iplus} $=$ {\rm{iquo}}\,({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus}, {\it{z\/}})\index{iquo})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  igcd-iquo-iquo \\ \index{igcd-iquo-iquo}
\=\+(({\rm{irem}}\,({\it{x\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{y\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{igcd}}\,({\rm{iquo}}\,({\it{x\/}}, {\it{z\/}})\index{iquo}, {\rm{iquo}}\,({\it{y\/}}, {\it{z\/}})\index{iquo})\index{igcd} $=$ {\rm{iquo}}\,({\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd}, {\rm{iabs}}\,({\it{z\/}})\index{iabs})\index{iquo})\-
\end{tabbing}
       

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

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

\begin{tabbing}{\sc Theorem}:  igcd-ineg \\ \index{igcd-ineg}
({\rm{igcd}}\,({\rm{ineg}}\,({\it{x\/}})\index{ineg}, {\it{y\/}})\index{igcd} $=$ {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd}) $\wedge$ ({\rm{igcd}}\,({\it{x\/}}, {\rm{ineg}}\,({\it{y\/}})\index{ineg})\index{igcd} $=$ {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  igcd-0-better \\ \index{igcd-0-better}
\=\+({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd} $=$ {\rm{iabs}}\,({\it{y\/}})\index{iabs}) $\wedge$ ({\rm{igcd}}\,({\it{y\/}}, {\it{x\/}})\index{igcd} $=$ {\rm{iabs}}\,({\it{y\/}})\index{iabs}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  not-integerp-means \\ \index{not-integerp-means}
($\neg$ {\rm{integerp}}\,({\it{x\/}})\index{integerp}) $\rightarrow$ ({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  fix-int-on-non-0 \\ \index{fix-int-on-non-0}
({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\vee$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}) $\rightarrow$ ({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\it{x\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable fix-int-on-non-0.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-igcd-hack \\ \index{ilessp-itimes-igcd-hack}
\=\+{\rm{ilessp}}\,({\rm{itimes}}\,({\it{y\/}}, {\it{x\/}})\index{itimes}, {\rm{igcd}}\,({\it{x\/}}, {\it{z\/}})\index{igcd})\index{ilessp} \\ 
$=$$\;\;\;\;$(\=\+(({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}) $\wedge$ ({\rm{fix-int}}\,({\it{z\/}})\index{fix-int} $\not=$ {\tt{0}})) \\ 
$\vee$$\;\;\;\;$(\=\+({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$(({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $\not=$ {\tt{0}}) $\vee$ ({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $\not=$ {\tt{0}})))\- \\ 
$\vee$$\;\;\;\;$({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}) \\ 
$\vee$$\;\;\;\;$({\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}))\-\-
\end{tabbing}

\begin{verbatim};;;; a few rules to reduce terms like (irem (itimes ...) (itimes ...))
;;;; note that itimes commutativity rules makes our life simpler

\end{verbatim}\begin{tabbing}{\sc Theorem}:  irem-0-backchain \\ \index{irem-0-backchain}
({\rm{irem}}\,({\it{b\/}}, {\it{c\/}})\index{irem} $=$ {\tt{0}}) $\rightarrow$ ({\rm{irem}}\,({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes}, {\it{c\/}})\index{irem} $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  irem-itimes-cancel \\ \index{irem-itimes-cancel}
{\rm{irem}}\,({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes}, {\rm{itimes}}\,({\it{a\/}}, {\it{c\/}})\index{itimes})\index{irem} $=$ {\rm{itimes}}\,({\it{a\/}}, {\rm{irem}}\,({\it{b\/}}, {\it{c\/}})\index{irem})\index{itimes}
\end{tabbing}
       
\begin{tabbing}{\sc Theorem}:  irem-itimes-base \\ \index{irem-itimes-base}
({\rm{irem}}\,({\rm{itimes}}\,({\it{a\/}}, {\it{b\/}})\index{itimes}, {\it{a\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\rm{itimes}}\,({\it{b\/}}, {\it{a\/}})\index{itimes}, {\it{a\/}})\index{irem} $=$ {\tt{0}})
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  fix-int-minus \\ \index{fix-int-minus}
\=\+{\rm{fix-int}}\,($-$ {\it{x\/}})\index{fix-int} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }$-$ {\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquo-iplus \\ \index{iquo-iplus}
\=\+(({\rm{irem}}\,({\it{x\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{y\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{iquo}}\,({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus}, {\it{z\/}})\index{iquo} $=$ {\rm{iplus}}\,({\rm{iquo}}\,({\it{x\/}}, {\it{z\/}})\index{iquo}, {\rm{iquo}}\,({\it{y\/}}, {\it{z\/}})\index{iquo})\index{iplus})\-
\end{tabbing}


\noindent{\sc Event}:   Disable iplus-iquo-iquo.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  ilessp-0-iplus-open \\ \index{ilessp-0-iplus-open}
\=\+{\rm{ilessp}}\,({\tt{0}}, {\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus})\index{ilessp} \\ 
$=$$\;\;\;\;$(\=\+({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp}) \\ 
$\vee$$\;\;\;\;$({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\rm{iabs}}\,({\it{y\/}})\index{iabs}, {\it{x\/}})\index{ilessp}) \\ 
$\vee$$\;\;\;\;$({\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\rm{iabs}}\,({\it{x\/}})\index{iabs}, {\it{y\/}})\index{ilessp}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-iquo-0 \\ \index{equal-iquo-0}
({\rm{iquo}}\,({\it{x\/}}, {\it{y\/}})\index{iquo} $=$ {\tt{0}}) $=$ ({\rm{izerop}}\,({\it{y\/}})\index{izerop} $\vee$ {\rm{ilessp}}\,({\rm{iabs}}\,({\it{x\/}})\index{iabs}, {\rm{iabs}}\,({\it{y\/}})\index{iabs})\index{ilessp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iabs-open-as-integers \\ \index{iabs-open-as-integers}
\=\+{\rm{iabs}}\,({\it{x\/}})\index{iabs} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\rm{ineg}}\,({\it{x\/}})\index{ineg} \\ 
{\bf else }{\rm{fix-int}}\,({\it{x\/}})\index{fix-int}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; doesn't work with correctness-of-cancel-ineg-terms-from-inequality!
\end{verbatim}
\noindent{\sc Event}:   Disable iabs-open-as-integers.

\addvspace{18pt}


\begin{tabbing}{\sc Theorem}:  ilessp-itimes-igcd-hack2 \\ \index{ilessp-itimes-igcd-hack2}
\=\+{\rm{ilessp}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes}, {\rm{igcd}}\,({\it{x\/}}, {\it{z\/}})\index{igcd})\index{ilessp} \\ 
$=$$\;\;\;\;$(\=\+(({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}) $\wedge$ ({\rm{fix-int}}\,({\it{z\/}})\index{fix-int} $\not=$ {\tt{0}})) \\ 
$\vee$$\;\;\;\;$(\=\+({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$(({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $\not=$ {\tt{0}}) $\vee$ ({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $\not=$ {\tt{0}})))\- \\ 
$\vee$$\;\;\;\;$({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}) \\ 
$\vee$$\;\;\;\;$({\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-ineg-igcd-hack \\ \index{ilessp-ineg-igcd-hack}
\=\+{\rm{ilessp}}\,({\rm{ineg}}\,({\rm{itimes}}\,({\it{c\/}}, {\it{y\/}})\index{itimes})\index{ineg}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{ilessp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ilessp}}\,({\tt{0}}, {\rm{itimes}}\,({\it{c\/}}, {\it{y\/}})\index{itimes})\index{ilessp} \\ 
$\vee$$\;\;\;\;$(({\rm{itimes}}\,({\it{c\/}}, {\it{y\/}})\index{itimes} $=$ {\tt{0}}) $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\rm{igcd}}\,({\it{c\/}}, {\it{d\/}})\index{igcd})\index{ilessp}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-iquo \\ \index{ilessp-iquo}
\=\+({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\wedge$ ({\rm{irem}}\,({\it{y\/}}, {\it{x\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{z\/}}, {\it{x\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{ilessp}}\,({\rm{iquo}}\,({\it{y\/}}, {\it{x\/}})\index{iquo}, {\rm{iquo}}\,({\it{z\/}}, {\it{x\/}})\index{iquo})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{y\/}}, {\it{z\/}})\index{ilessp})\-
\end{tabbing}


\noindent{\sc Event}:   Disable ilessp-0-iplus-open.

\addvspace{18pt}

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

\begin{tabbing}{\sc Theorem}:  equal-fix-int-y \\ \index{equal-fix-int-y}
\=\+({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $\not=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\it{y\/}}) $=$ ({\it{x\/}} $=$ {\it{y\/}})) \\ 
$\wedge$$\;\;\;\;$(({\it{y\/}} $=$ {\rm{fix-int}}\,({\it{x\/}})\index{fix-int}) $=$ ({\it{y\/}} $=$ {\it{x\/}})))\-\-
\end{tabbing}


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

\begin{tabbing}{\sc Theorem}:  equal-x-iabs-x \\ \index{equal-x-iabs-x}
({\it{x\/}} $=$ {\rm{iabs}}\,({\it{x\/}})\index{iabs}) $=$ ({\rm{integerp}}\,({\it{x\/}})\index{integerp} $\wedge$ ($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  equal-fix-int-iabs \\ \index{equal-fix-int-iabs}
({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\rm{iabs}}\,({\it{x\/}})\index{iabs}) $=$ ($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp})
\end{tabbing}

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

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

\begin{tabbing}{\sc Theorem}:  not-integerp \\ \index{not-integerp}
(({\it{x\/}} $\not\in\;${\bf{N}}${}$) $\wedge$ ($\neg$ {\rm{negativep}}\,({\it{x\/}}))) $\rightarrow$ ($\neg$ {\rm{integerp}}\,({\it{x\/}})\index{integerp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  igcd-iplus-ineg \\ \index{igcd-iplus-ineg}
\=\+({\rm{igcd}}\,({\rm{iplus}}\,({\it{x\/}}, {\rm{ineg}}\,({\it{y\/}})\index{ineg})\index{iplus}, {\it{z\/}})\index{igcd} $=$ {\rm{igcd}}\,({\rm{iplus}}\,({\it{y\/}}, {\rm{ineg}}\,({\it{x\/}})\index{ineg})\index{iplus}, {\it{z\/}})\index{igcd}) \\ 
$\wedge$$\;\;\;\;$({\rm{igcd}}\,({\it{z\/}}, {\rm{iplus}}\,({\it{x\/}}, {\rm{ineg}}\,({\it{y\/}})\index{ineg})\index{iplus})\index{igcd} $=$ {\rm{igcd}}\,({\it{z\/}}, {\rm{iplus}}\,({\it{y\/}}, {\rm{ineg}}\,({\it{x\/}})\index{ineg})\index{iplus})\index{igcd})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  negativep-iplus-ineg \\ \index{negativep-iplus-ineg}
\=\+($\neg$ {\rm{negativep}}\,({\rm{iplus}}\,({\it{x\/}}, {\rm{ineg}}\,({\it{y\/}})\index{ineg})\index{iplus})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{negativep}}\,({\rm{iplus}}\,({\it{y\/}}, {\rm{ineg}}\,({\it{x\/}})\index{ineg})\index{iplus}) $=$ ({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $\not=$ {\rm{fix-int}}\,({\it{y\/}})\index{fix-int}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  negativep-iplus-ineg2 \\ \index{negativep-iplus-ineg2}
{\rm{negativep}}\,({\rm{iplus}}\,({\it{x\/}}, {\rm{ineg}}\,({\it{y\/}})\index{ineg})\index{iplus}) $\rightarrow$ ($\neg$ {\rm{negativep}}\,({\rm{iplus}}\,({\it{y\/}}, {\rm{ineg}}\,({\it{x\/}})\index{ineg})\index{iplus}))
\end{tabbing}

\begin{verbatim};;; some integer facts needed to prove the rational facts needed
;;; in Bill Young's challenge

\end{verbatim}\begin{tabbing}{\sc Theorem}:  igcd-iplus-itimes-hack \\ \index{igcd-iplus-itimes-hack}
\=\+{\rm{igcd}}\,({\rm{iplus}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes}, {\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes})\index{iplus}, {\rm{itimes}}\,({\it{x\/}}, {\it{p\/}})\index{itimes})\index{igcd} \\ 
$=$$\;\;\;\;${\rm{itimes}}\,({\rm{iabs}}\,({\it{x\/}})\index{iabs}, {\rm{igcd}}\,({\rm{iplus}}\,({\it{y\/}}, {\it{z\/}})\index{iplus}, {\it{p\/}})\index{igcd})\index{itimes}\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  iquo-itimes-iabs \\ \index{iquo-itimes-iabs}
\=\+({\rm{irem}}\,({\it{y\/}}, {\it{z\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{iquo}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes}, {\rm{itimes}}\,({\rm{iabs}}\,({\it{x\/}})\index{iabs}, {\it{z\/}})\index{itimes})\index{iquo} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\rm{ineg}}\,({\rm{iquo}}\,({\it{y\/}}, {\it{z\/}})\index{iquo})\index{ineg} \\ 
{\bf elseif }{\rm{izerop}}\,({\it{x\/}})\index{izerop}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{iquo}}\,({\it{y\/}}, {\it{z\/}})\index{iquo}$\;${\bf  endif}\-)\-\-
\end{tabbing}
               
\begin{tabbing}{\sc Theorem}:  itimes-2 \\ \index{itimes-2}
{\rm{itimes}}\,({\tt{2}}, {\it{x\/}})\index{itimes} $=$ {\rm{iplus}}\,({\it{x\/}}, {\it{x\/}})\index{iplus}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  iquo-iplus-itimes-iabs-hack \\ \index{iquo-iplus-itimes-iabs-hack}
\=\+({\rm{irem}}\,({\rm{iplus}}\,({\it{y\/}}, {\it{z\/}})\index{iplus}, {\it{p\/}})\index{irem} $=$ {\tt{0}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{iquo}}\,({\rm{iplus}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{y\/}})\index{itimes}, {\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes})\index{iplus}, {\rm{itimes}}\,({\rm{iabs}}\,({\it{x\/}})\index{iabs}, {\it{p\/}})\index{itimes})\index{iquo} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\rm{ineg}}\,({\rm{iquo}}\,({\rm{iplus}}\,({\it{y\/}}, {\it{z\/}})\index{iplus}, {\it{p\/}})\index{iquo})\index{ineg} \\ 
{\bf elseif }{\rm{izerop}}\,({\it{x\/}})\index{izerop}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{iquo}}\,({\rm{iplus}}\,({\it{y\/}}, {\it{z\/}})\index{iplus}, {\it{p\/}})\index{iquo}$\;${\bf  endif}\-)\-\-
\end{tabbing}


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

        
\begin{tabbing}{\sc Theorem}:  ilessp-0-iabs \\ \index{ilessp-0-iabs}
{\rm{ilessp}}\,({\tt{0}}, {\rm{iabs}}\,({\it{x\/}})\index{iabs})\index{ilessp} $=$ ({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\vee$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp})
\end{tabbing}

\begin{verbatim};; stupid rule
;;(lemma ilessp-neg-pos (rewrite)
;;       (and
;;      (implies
;;       (and
;;        (ilessp 0 x)
;;        (not (ilessp 0 y)))
;;       (ilessp y x))
;;      (implies
;;       (and
;;        (not (ilessp x 0))
;;        (ilessp y 0))
;;       (ilessp y x))
;;      (implies
;;       (and
;;        (not (ilessp x 0))
;;        (not (ilessp 0 y)))
;;       (not (ilessp x y))))
;;       ((enable-theory integer-defns naturals)))

;; should include ilessp-iplus-hacks2 below
\end{verbatim}\begin{tabbing}{\sc Theorem}:  ilessp-iplus-hacks \\ \index{ilessp-iplus-hacks}
\=\+((($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp}) $\wedge$ ($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp})) $\rightarrow$ ($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus})\index{ilessp})) \\ 
$\wedge$$\;\;\;\;$(\=\+(($\neg$ {\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}) $\wedge$ {\rm{ilessp}}\,({\it{x\/}}, {\it{z\/}})\index{ilessp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{ilessp}}\,({\it{x\/}}, {\rm{iplus}}\,({\it{y\/}}, {\it{z\/}})\index{iplus})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\it{x\/}}, {\rm{iplus}}\,({\it{z\/}}, {\it{y\/}})\index{iplus})\index{ilessp}))\- \\ 
$\wedge$$\;\;\;\;$(\=\+(($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}) $\wedge$ ($\neg$ {\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{ilessp}}\,({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus}, {\tt{0}})\index{ilessp}))\- \\ 
$\wedge$$\;\;\;\;$(\=\+({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\wedge$ ($\neg$ {\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{ilessp}}\,({\tt{0}}, {\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\rm{iplus}}\,({\it{y\/}}, {\it{x\/}})\index{iplus})\index{ilessp}))\- \\ 
$\wedge$$\;\;\;\;$(\=\+(($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}) $\wedge$ ($\neg$ {\rm{ilessp}}\,({\it{y\/}}, {\it{z\/}})\index{ilessp})) \\ 
$\rightarrow$$\;\;\;\;$(($\neg$ {\rm{ilessp}}\,({\rm{iplus}}\,({\it{y\/}}, {\it{x\/}})\index{iplus}, {\it{z\/}})\index{ilessp}) $\wedge$ ($\neg$ {\rm{ilessp}}\,({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus}, {\it{z\/}})\index{ilessp})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-iplus-hacks2 \\ \index{ilessp-iplus-hacks2}
\=\+({\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} $\wedge$ ($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{ilessp}}\,({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus}, {\tt{0}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\rm{iplus}}\,({\it{y\/}}, {\it{x\/}})\index{iplus}, {\tt{0}})\index{ilessp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-iplus-hacks3 \\ \index{ilessp-iplus-hacks3}
\=\+(\=\+({\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} $\wedge$ ($\neg$ {\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{ilessp}}\,({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus}, {\tt{0}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\rm{iplus}}\,({\it{y\/}}, {\it{x\/}})\index{iplus}, {\tt{0}})\index{ilessp}))\- \\ 
$\wedge$$\;\;\;\;$(\=\+({\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp} $\wedge$ ($\neg$ {\rm{ilessp}}\,({\it{y\/}}, {\it{x\/}})\index{ilessp})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{ilessp}}\,({\tt{0}}, {\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\rm{iplus}}\,({\it{y\/}}, {\it{x\/}})\index{iplus})\index{ilessp}))\- \\ 
$\wedge$$\;\;\;\;$(\=\+({\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp} $\wedge$ ($\neg$ {\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{ilessp}}\,({\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus}, {\tt{0}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\rm{iplus}}\,({\it{y\/}}, {\it{x\/}})\index{iplus}, {\tt{0}})\index{ilessp}))\- \\ 
$\wedge$$\;\;\;\;$(\=\+({\rm{ilessp}}\,({\it{y\/}}, {\it{x\/}})\index{ilessp} $\wedge$ ($\neg$ {\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{ilessp}}\,({\tt{0}}, {\rm{iplus}}\,({\it{x\/}}, {\it{y\/}})\index{iplus})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\tt{0}}, {\rm{iplus}}\,({\it{y\/}}, {\it{x\/}})\index{iplus})\index{ilessp}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-itimes-itimes-instance \\ \index{ilessp-itimes-itimes-instance}
\=\+{\rm{ilessp}}\,({\rm{itimes}}\,({\it{x\/}}, {\it{z\/}})\index{itimes}, {\rm{itimes}}\,({\it{y\/}}, {\it{z\/}})\index{itimes})\index{ilessp} \\ 
$=$$\;\;\;\;$(({\rm{ilessp}}\,({\tt{0}}, {\it{z\/}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp}) $\vee$ ({\rm{ilessp}}\,({\it{z\/}}, {\tt{0}})\index{ilessp} $\wedge$ {\rm{ilessp}}\,({\it{y\/}}, {\it{x\/}})\index{ilessp}))\-
\end{tabbing}

\begin{verbatim}; doesn't work yet (needed below?)
;(prove-lemma ilessp-itimes-iquo (rewrite)
;            (implies
;             (and
;              (equal (irem w vw) 0)
;              (equal (irem v vw) 0))
;            (equal 
;             (ilessp (itimes d (iquo w vw))
;                     (itimes c (iquo v vw)))
;             (and
;              (not (equal (fix-int vw) 0))
;              (if (ilessp vw 0)
;                  (ilessp (itimes c v) (itimes d w))
;                (ilessp (itimes d w) (itimes c v))))))
;            ((disable ilessp-0-iplus irem-is-my-irem
;                      CORRECTNESS-OF-CANCEL-ITIMES-ILESSP-FACTORS
;                      CORRECTNESS-OF-CANCEL-ITIMES-ILESSP
;                      CORRECTNESS-OF-CANCEL-ITIMES-FACTORS)
;             (enable-theory integers)
;             (enable ilessp-trichotomy *1*fix-int iquo-0-arg-better
;                     itimes-iquo)
;             (use (ilessp-itimes-itimes-instance
;                   (z vw) (x (itimes d (iquo w vw)))
;                   (y (itimes c (iquo v vw)))))))
;
;; not working yet
;(prove-lemma rlessp-simple-rplus-reduce-proof (rewrite)
;       (equal
;       (rlessp x (simple-rplus (reduce y) z))
;       (rlessp x (simple-rplus y z)))
;       ((enable-theory rational-defns integers naturals)
;       (enable *1*itimes *1*ilessp *1*iplus *1*integerp
;               *1*fix-int *1*ilessp *1*integerp igcd-non-negative
;               ilessp-0-iquo ilessp-0-igcd iabs-igcd iabs-simplify
;               ilessp-igcd ilessp-trichotomy fix-int-igcd
;               equal-igcd-0
;               izerop negativep-ilessp fix-to-fix-int)
;       (disable ilessp-0-iplus)))
;             

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ilessp-0-iplus-x-x \\ \index{ilessp-0-iplus-x-x}
{\rm{ilessp}}\,({\tt{0}}, {\rm{iplus}}\,({\it{x\/}}, {\it{x\/}})\index{iplus})\index{ilessp} $=$ {\rm{ilessp}}\,({\tt{0}}, {\it{x\/}})\index{ilessp}
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  iquo-x-iabs-x \\ \index{iquo-x-iabs-x}
\=\+(\=\+{\rm{iquo}}\,({\it{x\/}}, {\rm{iabs}}\,({\it{x\/}})\index{iabs})\index{iquo} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\tt{-1}} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\-)\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{iquo}}\,({\rm{iabs}}\,({\it{x\/}})\index{iabs}, {\it{x\/}})\index{iquo} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp}$\;\;${\bf then }{\tt{-1}} \\ 
{\bf else }{\tt{1}}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nintegerp-ilessp \\ \index{nintegerp-ilessp}
\=\+($\neg$ {\rm{integerp}}\,({\it{x\/}})\index{integerp}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{ilessp}}\,({\it{x\/}}, {\it{y\/}})\index{ilessp} $=$ {\rm{ilessp}}\,({\tt{0}}, {\it{y\/}})\index{ilessp}) $\wedge$ ({\rm{ilessp}}\,({\it{y\/}}, {\it{x\/}})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{y\/}}, {\tt{0}})\index{ilessp}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-x-igcd-x \\ \index{ilessp-x-igcd-x}
\=\+(\=\+{\rm{ilessp}}\,({\it{x\/}}, {\rm{igcd}}\,({\it{x\/}}, {\it{y\/}})\index{igcd})\index{ilessp} \\ 
$=$$\;\;\;\;$({\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} $\vee$ (({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}) $\wedge$ ({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $\not=$ {\tt{0}}))))\- \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{ilessp}}\,({\it{x\/}}, {\rm{igcd}}\,({\it{y\/}}, {\it{x\/}})\index{igcd})\index{ilessp} \\ 
$=$$\;\;\;\;$({\rm{ilessp}}\,({\it{x\/}}, {\tt{0}})\index{ilessp} $\vee$ (({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}}) $\wedge$ ({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $\not=$ {\tt{0}}))))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ilessp-trans-hack \\ \index{ilessp-trans-hack}
\=\+({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\it{y\/}}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{ilessp}}\,({\it{x\/}}, {\it{z\/}})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{y\/}}, {\it{z\/}})\index{ilessp}) $\wedge$ ({\rm{ilessp}}\,({\it{z\/}}, {\it{x\/}})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{z\/}}, {\it{y\/}})\index{ilessp}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  commutativity-of-itimes-iquo \\ \index{commutativity-of-itimes-iquo}
\=\+(({\rm{irem}}\,({\it{w\/}}, {\it{x\/}})\index{irem} $=$ {\tt{0}}) $\wedge$ ({\rm{irem}}\,({\it{d\/}}, {\it{x\/}})\index{irem} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{itimes}}\,({\it{d\/}}, {\rm{iquo}}\,({\it{w\/}}, {\it{x\/}})\index{iquo})\index{itimes} $=$ {\rm{itimes}}\,({\it{w\/}}, {\rm{iquo}}\,({\it{d\/}}, {\it{x\/}})\index{iquo})\index{itimes})\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  ilessp-equal-trans-special-case \\ \index{ilessp-equal-trans-special-case}
\=\+(({\rm{fix-int}}\,({\it{y\/}})\index{fix-int} $=$ {\it{x\/}}) $\wedge$ ({\rm{fix-int}}\,({\it{x\/}})\index{fix-int} $=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{ilessp}}\,({\it{y\/}}, {\it{z\/}})\index{ilessp} $=$ {\rm{ilessp}}\,({\tt{0}}, {\it{z\/}})\index{ilessp}) $\wedge$ ({\rm{ilessp}}\,({\it{z\/}}, {\it{y\/}})\index{ilessp} $=$ {\rm{ilessp}}\,({\it{z\/}}, {\tt{0}})\index{ilessp}))\-
\end{tabbing}

\begin{verbatim}; ---------- Final DEFTHEORY event ----------

;; I'll go ahead and include iplus-list and itimes-list and lemmas
;; about them that were developed.

;; I've left out ILESSP-TRICHOTOMY because I'm scared it will slow
;; things down too much.  But it certainly represents useful
;; information.

;; MMW put ILESSP-TRICHOTOMY back because his experience with 
;; rationals suggests that it gets used all the time. 1-10-91
;; We'll see how it goes.

\end{verbatim}
\noindent{\sc Event}:   Let us define the theory {\it{integers}} to consist of the following events: ileq,
idifference,
integerp-fix-int,
integerp-iplus,
integerp-idifference,
integerp-ineg,
integerp-iabs,
integerp-itimes,
fix-int-remover,
fix-int-fix-int,
fix-int-iplus,
fix-int-idifference,
fix-int-ineg,
fix-int-iabs,
fix-int-itimes,
ineg-iplus,
ineg-ineg,
ineg-fix-int,
ineg-of-non-integerp,
ineg-0,
iplus-left-id,
iplus-right-id,
iplus-0-left,
iplus-0-right,
commutativity2-of-iplus,
commutativity-of-iplus,
associativity-of-iplus,
iplus-cancellation-1,
iplus-cancellation-2,
iplus-ineg1,
iplus-ineg2,
iplus-fix-int1,
iplus-fix-int2,
idifference-fix-int1,
idifference-fix-int2,
iplus-list,
eval\$-list-append,
iplus-list-append,
iplus-ineg3,
iplus-ineg4,
correctness-of-cancel-iplus,
ilessp-fix-int-1,
ilessp-fix-int-2,
iplus-cancellation-1-for-ilessp,
iplus-cancellation-2-for-ilessp,
correctness-of-cancel-iplus-ilessp,
itimes-0-left,
itimes-0-right,
itimes-fix-int1,
itimes-fix-int2,
commutativity-of-itimes,
itimes-distributes-over-iplus-proof,
itimes-distributes-over-iplus,
commutativity2-of-itimes,
associativity-of-itimes,
equal-itimes-0,
equal-itimes-1,
equal-itimes-minus-1,
itimes-1-arg1,
quotient-remainder-uniqueness,
division-theorem,
itimes-ineg-1,
itimes-ineg-2,
itimes-cancellation-1,
itimes-cancellation-2,
itimes-cancellation-3,
integerp-iquotient,
integerp-iremainder,
integerp-idiv,
integerp-imod,
integerp-iquo,
integerp-irem,
iquotient-fix-int1,
iquotient-fix-int2,
iremainder-fix-int1,
iremainder-fix-int2,
idiv-fix-int1,
idiv-fix-int2,
imod-fix-int1,
imod-fix-int2,
iquo-fix-int1,
iquo-fix-int2,
irem-fix-int1,
irem-fix-int2,
fix-int-iquotient,
fix-int-iremainder,
fix-int-idiv,
fix-int-imod,
fix-int-iquo,
fix-int-irem,
itimes-list,
itimes-list-append,
member-append,
equal-fix-int,
subsetp,
correctness-of-cancel-itimes,
ilessp-trichotomy,
correctness-of-cancel-itimes-ilessp,
ilessp-strict,
eval\$-list-cons,
eval\$-list-nlistp,
eval\$-litatom,
eval\$-quote,
eval\$-other,
iplus-x-y-ineg-x,
correctness-of-cancel-ineg,
integerp-iplus-list,
eval\$-iplus-list-delete,
eval\$-iplus-list-bagdiff,
itimes-tree-ineg,
itimes-factors,
itimes--1,
equal-ineg-ineg,
ilessp-ineg-ineg,
fix-int-eval\$-itimes-tree-rec,
eval\$-itimes-tree-ineg,
ineg-eval\$-itimes-tree-ineg,
iplus-eval\$-itimes-tree-ineg,
itimes-eval\$-itimes-tree-ineg,
iplus-or-itimes-term,
cancel-itimes-factors,
cancel-itimes-factors-expanded,
cancel-itimes-factors-expanded-cancel-itimes-factors,
membership-of-0-implies-itimes-list-is-0,
member-0-eval\$-list,
correctness-of-cancel-itimes-factors,
cancel-itimes-ilessp-factors,
bagint-singleton,
ilessp-itimes-list-eval\$-list-bagdiff,
ilessp-itimes-list-eval\$-list-bagdiff-corollary-1,
member-0-itimes-factors-yields-0,
member-0-itimes-factors-yields-0-ilessp-consequence-1,
member-0-itimes-factors-yields-0-ilessp-consequence-2,
ilessp-itimes-list-eval\$-list-bagdiff-corollary-2,
correctness-of-cancel-itimes-ilessp-factors,
disjoin-equalities-with-0,
cancel-factors-0,
some-eval\$s-to-0,
eval\$-disjoin-equalities-with-0,
some-eval\$s-to-0-append,
some-eval\$s-to-0-eliminator,
correctness-of-cancel-factors-0,
correctness-of-cancel-factors-ilessp-0,
conjoin-inequalities-with-0,
split-out-ineg-terms,
correctness-of-cancel-ineg-terms-from-equality,
correctness-of-cancel-ineg-terms-from-inequality,
iplus-constants,
cancel-constants-equal,
ilessp-add1,
ilessp-add1-iplus,
cancel-constants-ilessp,
ilessp-irem,
irem-noop,
irem-of-0,
irem-iquo-elim,
irem-iplus-0,
integerp-igcd,
commutativity-of-igcd,
igcd-0,
igcd-1,
equal-igcd-0,
igcd-non-negative,
ilessp-igcd,
igcd-iplus,
irem-igcd,
distributivity-of-itimes-over-igcd,
common-divisor-divides-igcd,
iabs-igcd,
associativity-of-igcd,
commutativity2-of-igcd,
igcd-x-x,
igcd-idempotence,
iquo-0,
ilessp-0-iquo,
iabs-simplify,
igcd-iquo-igcd-proof,
ilessp-iquo-0,
iquo-1,
ilessp-0-igcd,
igcd-minus,
itimes-iquo,
iquo-x-x,
iquo-0-arg-better,
itimes-iquotient,
iquotient-0,
iremainder-0,
irem-0-iremainder-0,
equal-itimes-x-x,
itimes-igcd-fact,
itimes-iquo-general,
itimes-iquo-copy,
equal-iquo-iquo,
idifference-x-x,
irem-iquo-itimes,
equal-irem-itimes-0,
commutativity-of-iquo,
irem-itimes,
iquo-igcd-itimes1,
iquo-igcd-itimes2,
iquo-igcd-itimes3,
equal-iquo-1,
equal-x-igcd-x-y,
ilessp-iplus-igcd,
ilessp-iabs-arg1,
ilessp-iabs-arg2,
igcd-fix-int,
iquo-iquo,
igcd-iquo-iquo,
iabs-ineg,
iquo-ineg,
igcd-ineg,
igcd-0-better,
not-integerp-means,
ilessp-itimes-igcd-hack,
irem-0-backchain,
irem-itimes-cancel,
irem-itimes-base,
fix-int-minus,
iquo-iplus,
equal-iquo-0,
ilessp-iquo,
ilessp-minus-0,
equal-fix-int-y,
iabs-fix-int,
equal-x-iabs-x,
equal-fix-int-iabs,
iabs-iabs,
fix-int-igcd,
not-integerp,
igcd-iplus-ineg,
negativep-iplus-ineg,
negativep-iplus-ineg2,
igcd-iplus-itimes-hack,
iquo-itimes-iabs,
itimes-2,
iquo-iplus-itimes-iabs-hack,
iabs-0,
ilessp-0-iabs,
ilessp-iplus-hacks,
ilessp-iplus-hacks2,
ilessp-iplus-hacks3,
ilessp-0-iplus-x-x,
ilessp-iplus-x-x-0,
iquo-x-iabs-x,
nintegerp-ilessp,
ilessp-x-igcd-x,
commutativity-of-itimes-iquo,
izerop,
*1*integerp,
*1*fix-int,
*1*ilessp,
*1*iplus,
*1*ineg,
*1*iabs,
*1*itimes,
*1*iquotient,
*1*iremainder,
*1*idiv,
*1*imod,
*1*iquo,
*1*irem,
*1*ileq,
*1*idifference,
*1*izerop,
*1*igcd.\index{integers}

\addvspace{18pt}



\noindent{\sc Event}:   Disable iplus-irem-itimes-iquo.

\addvspace{18pt}

\noindent{\sc Event}:   Disable irem-is-my-irem.

\addvspace{18pt}

\noindent{\sc Event}:   Disable iquo-0-arg.

\addvspace{18pt}

\noindent{\sc Event}:   Disable itimes-hack1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable itimes-hack2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable gcd-factors-gives-linear-combination.

\addvspace{18pt}

\noindent{\sc Event}:   Disable gcd-factors-gives-linear-combination-rewrite.

\addvspace{18pt}

\noindent{\sc Event}:   Disable remainder-0-sufficiency.

\addvspace{18pt}

\noindent{\sc Event}:   Disable itimes-iplus-hack.

\addvspace{18pt}

\noindent{\sc Event}:   Disable irem-0-iremainder-0-help1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable irem-0-iremainder-0-help2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable divides-product-reduction-helper.

\addvspace{18pt}

\noindent{\sc Event}:   Disable divides-product-reduction.

\addvspace{18pt}

\noindent{\sc Event}:   Disable divides-each-equality.

\addvspace{18pt}

\noindent{\sc Event}:   Disable times-gcd-fact.

\addvspace{18pt}

\noindent{\sc Event}:   Disable iplus-iquo-iquo.

\addvspace{18pt}

\noindent{\sc Event}:   Disable fix-int-on-non-0.

\addvspace{18pt}

\noindent{\sc Event}:   Disable iabs-open-as-integers.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-itimes-igcd-hack2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-ineg-igcd-hack.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-itimes-itimes-instance.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-trans-hack.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ilessp-equal-trans-special-case.

\addvspace{18pt}

\noindent{\sc Event}:   Enable izerop.

\addvspace{18pt}


\noindent{\sc Event}:   Make the library {\tt{"integers"}} and compile it.

\addvspace{18pt}

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