\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) 1995 by Ken Kunen.  All Rights Reserved.

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

; NO WARRANTY

; Ken Kunen 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 Ken Kunen 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.


; This is a proof of the Paris-Harrington Ramsey theorem, 
; and some related results.
; The proof is described in our paper, "A Ramsey Theorem
; in Boyer-Moore Logic".

; The following takes [ 79.1 1561.9 92.8 ]  on a DECstation 5000/125


\end{verbatim}
\noindent{\sc Event}:   Start with the initial {\bf nqthm} theory.

\addvspace{18pt}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                        BASIC ARITHMETIC                                ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


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

\begin{tabbing}{\sc Theorem}:  distributivity \\ \index{distributivity}
(({\it{u\/}} $*$ {\it{y\/}}) $+$ ({\it{a\/}} $*$ {\it{y\/}})) $=$ (({\it{u\/}} $+$ {\it{a\/}}) $*$ {\it{y\/}})
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  addition-of-exponents \\ \index{addition-of-exponents}
{\rm{expt}}\,({\it{m\/}}, {\it{a\/}} $+$ {\it{b\/}})\index{expt} $=$ ({\rm{expt}}\,({\it{m\/}}, {\it{a\/}})\index{expt} $*$ {\rm{expt}}\,({\it{m\/}}, {\it{b\/}})\index{expt})
\end{tabbing} 

\begin{verbatim}; consider the exponenial b^e -- it's monotonic as a function
; of b and of e separately

; as a function of b
\end{verbatim}\begin{tabbing}{\sc Theorem}:  monoton-of-exp-1 \\ \index{monoton-of-exp-1}
({\it{b1\/}} $\leq$ {\it{b2\/}}) $\rightarrow$ ({\rm{expt}}\,({\it{b1\/}}, {\it{e\/}})\index{expt} $\leq$ {\rm{expt}}\,({\it{b2\/}}, {\it{e\/}})\index{expt})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  plus-difference \\ \index{plus-difference}
(({\it{e1\/}} $\leq$ {\it{e2\/}}) $\wedge$ ({\it{e1\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{e2\/}} $\in\;${\bf{N}}${}$)) $\rightarrow$ (({\it{e1\/}} $+$ ({\it{e2\/}} $-$ {\it{e1\/}})) $=$ {\it{e2\/}})
\end{tabbing}
	
\begin{verbatim}; as a function of e:  
\end{verbatim}\begin{tabbing}{\sc Theorem}:  monoton-of-exp-aux1 \\ \index{monoton-of-exp-aux1}
\=\+(({\it{e1\/}} $\leq$ {\it{e2\/}}) $\wedge$ ({\it{e1\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{e2\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{expt}}\,({\it{b\/}}, {\it{e2\/}})\index{expt} $=$ ({\rm{expt}}\,({\it{b\/}}, {\it{e1\/}})\index{expt} $*$ {\rm{expt}}\,({\it{b\/}}, {\it{e2\/}} $-$ {\it{e1\/}})\index{expt}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  expt-is-positive \\ \index{expt-is-positive}
({\it{b\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ ({\tt{0}} $<$ {\rm{expt}}\,({\it{b\/}}, {\it{e\/}})\index{expt})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monoton-of-exp-aux2 \\ \index{monoton-of-exp-aux2}
({\it{b\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ ({\it{x\/}} $\leq$ ({\it{x\/}} $*$ {\rm{expt}}\,({\it{b\/}}, {\it{e\/}})\index{expt}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monoton-of-exp-2 \\ \index{monoton-of-exp-2}
\=\+(({\it{e1\/}} $\leq$ {\it{e2\/}}) $\wedge$ ({\it{e1\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{e2\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{b\/}} $\not\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{expt}}\,({\it{b\/}}, {\it{e1\/}})\index{expt} $\leq$ {\rm{expt}}\,({\it{b\/}}, {\it{e2\/}})\index{expt})\-
\end{tabbing}
\begin{verbatim}; 0 is an exception because 0^0 = 1 but 0^1 = 0

\end{verbatim}
\noindent{\sc Event}:   Disable monoton-of-exp-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monoton-of-exp-aux2.

\addvspace{18pt}

\begin{verbatim}; (magic s) is the function g(s) which "magically" makes the
; Ramsey proof work out.  Here we just prove some basic arithmetic properties
; of it

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{magic} \\  
{\rm{magic}}\,({\it{s\/}})\index{magic} $=$ ((({\tt{3}} $*$ {\it{s\/}}) $+$ {\tt{3}}) $*$ {\rm{expt}}\,({\it{s\/}} $+$ {\tt{2}}, {\it{s\/}} $+$ {\tt{2}})\index{expt})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-is-a-number \\ \index{magic-is-a-number}
{\rm{magic}}\,({\it{n\/}})\index{magic} $\in\;${\bf{N}}${}$
\end{tabbing}

\begin{verbatim}; now, we have to prove that magic is monotonic

\end{verbatim}\begin{tabbing}{\sc Theorem}:  magic-is-monotonic-aux1 \\ \index{magic-is-monotonic-aux1}
({\it{m\/}} $<$ {\it{n\/}}) $\rightarrow$ ((({\tt{3}} $*$ {\it{m\/}}) $+$ {\tt{3}}) $<$ (({\tt{3}} $*$ {\it{n\/}}) $+$ {\tt{3}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-is-monotonic-aux2 \\ \index{magic-is-monotonic-aux2}
({\it{m\/}} $<$ {\it{n\/}}) $\rightarrow$ ({\rm{expt}}\,({\it{m\/}} $+$ {\tt{2}}, {\it{m\/}} $+$ {\tt{2}})\index{expt} $\leq$ {\rm{expt}}\,({\it{n\/}} $+$ {\tt{2}}, {\it{n\/}} $+$ {\tt{2}})\index{expt})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-is-monotonic-aux3 \\ \index{magic-is-monotonic-aux3}
{\tt{0}} $<$ {\rm{expt}}\,({\it{s\/}} $+$ {\tt{2}}, {\it{s\/}} $+$ {\tt{2}})\index{expt}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-is-monotonic-aux4 \\ \index{magic-is-monotonic-aux4}
\=\+(({\it{x\/}} $<$ {\it{y\/}}) $\wedge$ ({\it{a\/}} $\leq$ {\it{b\/}}) $\wedge$ ({\tt{0}} $<$ {\it{a\/}}) $\wedge$ ({\tt{0}} $<$ {\it{b\/}})) \\ 
$\rightarrow$$\;\;\;\;$(({\it{x\/}} $*$ {\it{a\/}}) $<$ ({\it{y\/}} $*$ {\it{b\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-is-monotonic \\ \index{magic-is-monotonic}
({\it{m\/}} $<$ {\it{n\/}}) $\rightarrow$ ({\rm{magic}}\,({\it{m\/}})\index{magic} $<$ {\rm{magic}}\,({\it{n\/}})\index{magic})
\end{tabbing}



\noindent{\sc Event}:   Disable magic-is-monotonic-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable magic-is-monotonic-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable magic-is-monotonic-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable magic-is-monotonic-aux4.

\addvspace{18pt}


\noindent{\sc Event}:   Disable magic.

\addvspace{18pt}
\begin{verbatim}; we need that (magic n) >= n ; this should follow just by monotonicity

\end{verbatim}\begin{tabbing}{\sc Theorem}:  magic-is-bigger-aux1 \\ \index{magic-is-bigger-aux1}
(({\it{n\/}} $\not=$ {\tt{0}}) $\wedge$ ({\rm{magic}}\,({\it{n\/}})\index{magic} $=$ {\tt{0}})) $\rightarrow$ ({\it{n\/}} $\not\in\;${\bf{N}}${}$)
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-is-bigger-aux2 \\ \index{magic-is-bigger-aux2}
(({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{magic}}\,({\it{n\/}} $-\;1$)\index{magic} $\not<$ ({\it{n\/}} $-\;1$))) $\rightarrow$ ({\rm{magic}}\,({\it{n\/}})\index{magic} $\not<$ {\it{n\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-is-bigger \\ \index{magic-is-bigger}
({\it{n\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{magic}}\,({\it{n\/}})\index{magic} $\not<$ {\it{n\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable magic-is-bigger-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable magic-is-bigger-aux2.

\addvspace{18pt}

\begin{verbatim}; the above is sufficient for all the basic theory of {alpha}(n)
; and alpha-large sets.
; BUT, we need some further arithmetic properties of magic which
; get used in the Ramsey theorem

; first, let's prove that * is monotonic; + will be handled
; by built-in linear arithmetic

\end{verbatim}\begin{tabbing}{\sc Theorem}:  times-is-monotonic \\ \index{times-is-monotonic}
(({\it{x\/}} $\leq$ {\it{y\/}}) $\wedge$ ({\it{a\/}} $\leq$ {\it{b\/}})) $\rightarrow$ (({\it{x\/}} $*$ {\it{a\/}}) $\leq$ ({\it{y\/}} $*$ {\it{b\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  times-right-ident \\ \index{times-right-ident}
({\it{x\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ (({\it{x\/}} $*$ {\tt{1}}) $=$ {\it{x\/}})
\end{tabbing}
\begin{tabbing}{\sc Theorem}:  times-left-ident \\ \index{times-left-ident}
({\it{x\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ (({\tt{1}} $*$ {\it{x\/}}) $=$ {\it{x\/}})
\end{tabbing}

\begin{verbatim}; now, just a chain of uninteresting inequalities culminating
; in exactly what we need about magic(s)
; call these magic-1, magic-2, ...
; they won't be rewrite rules, so we don't need to disable them later

\end{verbatim}
\noindent{\sc Event}:   Enable magic.

\addvspace{18pt}  \begin{verbatim}; we need its defn for some other properties

\end{verbatim}\begin{tabbing}{\sc Theorem}:  magic-1 \\ \index{magic-1}
(({\tt{2}} $*$ {\it{s\/}}) $+$ {\tt{3}}) $\leq$ {\rm{magic}}\,({\it{s\/}})\index{magic}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-2 \\ \index{magic-2}
({\it{s\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{expt}}\,({\it{s\/}}, {\it{s\/}})\index{expt} $\leq$ {\rm{expt}}\,({\it{s\/}} $+$ {\tt{2}}, {\it{s\/}} $+$ {\tt{2}})\index{expt})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-3 \\ \index{magic-3}
({\it{r\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ((({\tt{3}} $*$ {\it{r\/}}) $*$ {\rm{expt}}\,({\it{r\/}}, {\it{r\/}})\index{expt}) $\leq$ {\rm{magic}}\,({\it{r\/}})\index{magic})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-4 \\ \index{magic-4}
({\it{s\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{expt}}\,({\tt{2}}, {\it{s\/}})\index{expt} $\leq$ {\rm{expt}}\,({\it{s\/}} $+$ {\tt{2}}, {\it{s\/}} $+$ {\tt{2}})\index{expt})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-5 \\ \index{magic-5}
({\it{s\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{expt}}\,({\tt{2}}, {\it{s\/}})\index{expt} $\leq$ {\rm{magic}}\,({\it{s\/}})\index{magic})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-6 \\ \index{magic-6}
({\it{s\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{expt}}\,({\it{s\/}}, {\rm{expt}}\,({\tt{2}}, {\it{s\/}})\index{expt})\index{expt} $\leq$ {\rm{expt}}\,({\rm{magic}}\,({\it{s\/}})\index{magic}, {\rm{magic}}\,({\it{s\/}})\index{magic})\index{expt})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-7 \\ \index{magic-7}
\=\+({\it{s\/}} $\in\;${\bf{N}}${}$) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\tt{3}} $*$ {\rm{magic}}\,({\it{s\/}})\index{magic}) $*$ {\rm{expt}}\,({\it{s\/}}, {\rm{expt}}\,({\tt{2}}, {\it{s\/}})\index{expt})\index{expt}) \\ 
$\leq$$\;\;\;\;$(({\tt{3}} $*$ {\rm{magic}}\,({\it{s\/}})\index{magic}) $*$ {\rm{expt}}\,({\rm{magic}}\,({\it{s\/}})\index{magic}, {\rm{magic}}\,({\it{s\/}})\index{magic})\index{expt}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-8 \\ \index{magic-8}
({\it{s\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ((({\tt{3}} $*$ {\rm{magic}}\,({\it{s\/}})\index{magic}) $*$ {\rm{expt}}\,({\it{s\/}}, {\rm{expt}}\,({\tt{2}}, {\it{s\/}})\index{expt})\index{expt}) $\leq$ {\rm{magic}}\,({\rm{magic}}\,({\it{s\/}})\index{magic})\index{magic})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-9 \\ \index{magic-9}
(({\tt{2}} $*$ {\it{s\/}}) $+$ {\tt{3}} $+$ ({\tt{2}} $*$ {\rm{magic}}\,({\it{s\/}})\index{magic})) $\leq$ ({\tt{3}} $*$ {\rm{magic}}\,({\it{s\/}})\index{magic})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-10 \\ \index{magic-10}
\=\+({\it{s\/}} $\in\;${\bf{N}}${}$) \\ 
$\rightarrow$$\;\;\;\;$(\=\+((({\tt{2}} $*$ {\it{s\/}}) $+$ {\tt{3}} $+$ ({\tt{2}} $*$ {\rm{magic}}\,({\it{s\/}})\index{magic})) $*$ {\rm{expt}}\,({\it{s\/}}, {\rm{expt}}\,({\tt{2}}, {\it{s\/}})\index{expt})\index{expt}) \\ 
$\leq$$\;\;\;\;${\rm{magic}}\,({\rm{magic}}\,({\it{s\/}})\index{magic})\index{magic})\-\-
\end{tabbing}

\begin{verbatim}; now, let's throw in some more parameters.  We have
; a = the norm of some ordinal;
; d = a + c ; s = z + d, q >= magic(z + d), c > 0
; we want to conclude
;(leq 
;	(times 
;		(plus (times 2 a) (times 2 (magic z)) 3 c)
;		(expt c (expt 2 z)) )
;	(magic q) )
; 1. show (leq   (plus (times 2 a) (times 2 (magic z)) 3 c)
;                (plus (times 2 s) 3 (times 2 (magic s))))
; 2. show (leq (expt c (expt 2 z)) (expt s (expt 2 s)))
; then apply magic-10

; step 1

\end{verbatim}\begin{tabbing}{\sc Theorem}:  magic-11 \\ \index{magic-11}
\=\+(({\it{d\/}} $=$ ({\it{a\/}} $+$ {\it{c\/}})) $\wedge$ ({\it{s\/}} $=$ ({\it{z\/}} $+$ {\it{d\/}})) $\wedge$ ({\it{c\/}} $\not\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\tt{2}} $*$ {\it{a\/}}) $+$ ({\tt{2}} $*$ {\rm{magic}}\,({\it{z\/}})\index{magic}) $+$ {\tt{3}} $+$ {\it{c\/}}) \\ 
$\leq$$\;\;\;\;$(({\tt{2}} $*$ {\it{s\/}}) $+$ {\tt{3}} $+$ ({\tt{2}} $*$ {\rm{magic}}\,({\it{s\/}})\index{magic})))\-\-
\end{tabbing}

\begin{verbatim}; step 2

\end{verbatim}\begin{tabbing}{\sc Theorem}:  magic-12 \\ \index{magic-12}
(({\it{d\/}} $=$ ({\it{a\/}} $+$ {\it{c\/}})) $\wedge$ ({\it{s\/}} $=$ ({\it{z\/}} $+$ {\it{d\/}}))) $\rightarrow$ ({\rm{expt}}\,({\tt{2}}, {\it{z\/}})\index{expt} $\leq$ {\rm{expt}}\,({\tt{2}}, {\it{s\/}})\index{expt})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-13 \\ \index{magic-13}
\=\+(({\it{d\/}} $=$ ({\it{a\/}} $+$ {\it{c\/}})) $\wedge$ ({\it{s\/}} $=$ ({\it{z\/}} $+$ {\it{d\/}}))) \\ 
$\rightarrow$$\;\;\;\;$({\rm{expt}}\,({\it{c\/}}, {\rm{expt}}\,({\tt{2}}, {\it{z\/}})\index{expt})\index{expt} $\leq$ {\rm{expt}}\,({\it{s\/}}, {\rm{expt}}\,({\tt{2}}, {\it{s\/}})\index{expt})\index{expt})\-
\end{tabbing}

\begin{verbatim}; putting the two steps together:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  magic-14 \\ \index{magic-14}
\=\+(({\it{d\/}} $=$ ({\it{a\/}} $+$ {\it{c\/}})) $\wedge$ ({\it{s\/}} $=$ ({\it{z\/}} $+$ {\it{d\/}})) $\wedge$ ({\it{c\/}} $\not\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+(({\tt{2}} $*$ {\it{a\/}}) $+$ ({\tt{2}} $*$ {\rm{magic}}\,({\it{z\/}})\index{magic}) $+$ {\tt{3}} $+$ {\it{c\/}}) \\ 
$*$$\;\;\;\;${\rm{expt}}\,({\it{c\/}}, {\rm{expt}}\,({\tt{2}}, {\it{z\/}})\index{expt})\index{expt})\- \\ 
$\leq$$\;\;\;\;$(\=\+(({\tt{2}} $*$ {\it{s\/}}) $+$ {\tt{3}} $+$ ({\tt{2}} $*$ {\rm{magic}}\,({\it{s\/}})\index{magic})) \\ 
$*$$\;\;\;\;${\rm{expt}}\,({\it{s\/}}, {\rm{expt}}\,({\tt{2}}, {\it{s\/}})\index{expt})\index{expt})\-)\-\-
\end{tabbing}

\begin{verbatim}; now, adding magic-10
\end{verbatim}\begin{tabbing}{\sc Theorem}:  magic-15 \\ \index{magic-15}
\=\+(({\it{d\/}} $=$ ({\it{a\/}} $+$ {\it{c\/}})) $\wedge$ ({\it{s\/}} $=$ ({\it{z\/}} $+$ {\it{d\/}})) $\wedge$ ({\it{c\/}} $\not\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+(({\tt{2}} $*$ {\it{a\/}}) $+$ ({\tt{2}} $*$ {\rm{magic}}\,({\it{z\/}})\index{magic}) $+$ {\tt{3}} $+$ {\it{c\/}}) \\ 
$*$$\;\;\;\;${\rm{expt}}\,({\it{c\/}}, {\rm{expt}}\,({\tt{2}}, {\it{z\/}})\index{expt})\index{expt})\- \\ 
$\leq$$\;\;\;\;${\rm{magic}}\,({\rm{magic}}\,({\it{s\/}})\index{magic})\index{magic})\-\-
\end{tabbing}

\begin{verbatim}; now, the final result doesn't mention s at all -- rather,
; it's in terms of q >= magic(z + d)  (where s is z+d)

; first, isolate the monotnicity of magic
\end{verbatim}\begin{tabbing}{\sc Theorem}:  magic-16-aux1 \\ \index{magic-16-aux1}
({\it{v\/}} $\not\in\;${\bf{N}}${}$) $\rightarrow$ (({\it{w\/}} $*$ {\it{v\/}}) $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-16 \\ \index{magic-16}
({\it{v\/}} $\not\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{magic}}\,({\it{v\/}})\index{magic} $=$ {\tt{12}})
\end{tabbing}

\noindent{\sc Event}:   Disable magic-16-aux1.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  magic-17 \\ \index{magic-17}
({\it{v\/}} $\leq$ {\it{w\/}}) $\rightarrow$ ({\rm{magic}}\,({\it{v\/}})\index{magic} $\leq$ {\rm{magic}}\,({\it{w\/}})\index{magic})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  magic-18 \\ \index{magic-18}
\=\+(({\it{d\/}} $=$ ({\it{a\/}} $+$ {\it{c\/}})) $\wedge$ ({\rm{magic}}\,({\it{z\/}} $+$ {\it{d\/}})\index{magic} $\leq$ {\it{q\/}}) $\wedge$ ({\it{c\/}} $\not\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(\=\+(({\tt{2}} $*$ {\it{a\/}}) $+$ ({\tt{2}} $*$ {\rm{magic}}\,({\it{z\/}})\index{magic}) $+$ {\tt{3}} $+$ {\it{c\/}}) \\ 
$*$$\;\;\;\;${\rm{expt}}\,({\it{c\/}}, {\rm{expt}}\,({\tt{2}}, {\it{z\/}})\index{expt})\index{expt})\- \\ 
$\leq$$\;\;\;\;${\rm{magic}}\,({\it{q\/}})\index{magic})\-\-
\end{tabbing}

\begin{verbatim}; this concludes all the arithmetic facts about magic that we need

\end{verbatim}
\noindent{\sc Event}:   Disable magic.

\addvspace{18pt}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                      PROPERTIES OF LISTS                               ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


; append is build-in, but the following simple lemmas aren't

\end{verbatim}\begin{tabbing}{\sc Theorem}:  append-works-left \\ \index{append-works-left}
({\it{x\/}} $\in$ {\it{lst1\/}}) $\rightarrow$ ({\it{x\/}} $\in$ {\rm{append}}\,({\it{lst1\/}}, {\it{lst2\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  append-works-right \\ \index{append-works-right}
({\it{y\/}} $\in$ {\it{lst2\/}}) $\rightarrow$ ({\it{y\/}} $\in$ {\rm{append}}\,({\it{lst1\/}}, {\it{lst2\/}}))
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  length-of-append \\ \index{length-of-append}
{\rm{length}}\,({\rm{append}}\,({\it{lst1\/}}, {\it{lst2\/}}))\index{length} $=$ ({\rm{length}}\,({\it{lst1\/}})\index{length} $+$ {\rm{length}}\,({\it{lst2\/}})\index{length})
\end{tabbing}


\begin{verbatim};;;;;;;;;;  product of two lists

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

\begin{tabbing}{\sc Definition}:\index{product} \\  
\=\+{\rm{product}}\,({\it{lst1\/}}, {\it{lst2\/}})\index{product} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{lst1\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{append}}\,({\rm{cons-all}}\,({\rm{car}}\,({\it{lst1\/}}), {\it{lst2\/}})\index{cons-all}, {\rm{product}}\,({\rm{cdr}}\,({\it{lst1\/}}), {\it{lst2\/}})\index{product})$\;${\bf  endif}\-\-
\end{tabbing}
\begin{verbatim}; (product '(1 2) '(3 4 5) ) -->
; ((1 . 3) (1 . 4) (1 . 5) (2 . 3) (2 . 4) (2 . 5))

; we need to prove this contains all pairs
; first, for cons-all

\end{verbatim}\begin{tabbing}{\sc Theorem}:  all-pairs-in-cons-all \\ \index{all-pairs-in-cons-all}
({\it{y\/}} $\in$ {\it{lst\/}}) $\rightarrow$ ({\rm{cons}}\,({\it{item\/}}, {\it{y\/}}) $\in$ {\rm{cons-all}}\,({\it{item\/}}, {\it{lst\/}})\index{cons-all})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-pairs \\ \index{all-pairs}
(({\it{x\/}} $\in$ {\it{lst1\/}}) $\wedge$ ({\it{y\/}} $\in$ {\it{lst2\/}})) $\rightarrow$ ({\rm{cons}}\,({\it{x\/}}, {\it{y\/}}) $\in$ {\rm{product}}\,({\it{lst1\/}}, {\it{lst2\/}})\index{product})
\end{tabbing}

\begin{verbatim}; We never need the other direction -- that the product
; contains only such pairs

\end{verbatim}
\noindent{\sc Event}:   Disable product.

\addvspace{18pt}


\begin{verbatim}; there are two notions of "sublist" for lists
; 1: (subsetp s1 s2) means that every member of s1 is a member of s2
; 2: (sublistp lst1 lst2) means that lst1 is a consecutive 
;     sublist of lst2 -- so, a list of length n always
;     has exactly 2^n sublists.
; For our intended representation of sets as increasing
; lists of natural numbers, (1) and (2) are equivalent.
; In general, (2) implies (1).
; in both cases, for non-nil-terminated lists -- e.g.
; (A1 A2 A3 . B), we ignore the B

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{subsetp} \\  
\=\+{\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{s1\/}})$\;\;${\bf then }({\rm{car}}\,({\it{s1\/}}) $\in$ {\it{s2\/}}) $\wedge$ {\rm{subsetp}}\,({\rm{cdr}}\,({\it{s1\/}}), {\it{s2\/}})\index{subsetp} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing} 

\begin{verbatim}; there are two fundamental properties of subsetp 
; 1. If (subsetp s1 s2) and (member x s1) then (member x s2)
; 2. If (not (subsetp s1 s2)), then there is an x such
;    that (member x s1) and (not (member x s2))
;    Call this object (memb-of-dif s1 s2)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  subsetp-works-1 \\ \index{subsetp-works-1}
({\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp} $\wedge$ {\it{and\/}} $\wedge$ ({\it{x\/}} $\in$ {\it{s1\/}})) $\rightarrow$ ({\it{x\/}} $\in$ {\it{s2\/}})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{memb-of-dif} \\  
\=\+{\rm{memb-of-dif}}\,({\it{s1\/}}, {\it{s2\/}})\index{memb-of-dif} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{s1\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{car}}\,({\it{s1\/}}) $\in$ {\it{s2\/}}$\;\;${\bf then }{\rm{memb-of-dif}}\,({\rm{cdr}}\,({\it{s1\/}}), {\it{s2\/}})\index{memb-of-dif} \\ 
{\bf else }{\rm{car}}\,({\it{s1\/}})$\;${\bf  endif}\- \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subsetp-works-2 \\ \index{subsetp-works-2}
\=\+($\neg$ {\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{memb-of-dif}}\,({\it{s1\/}}, {\it{s2\/}})\index{memb-of-dif} $\in$ {\it{s1\/}}) $\wedge$ ({\rm{memb-of-dif}}\,({\it{s1\/}}, {\it{s2\/}})\index{memb-of-dif} $\not\in$ {\it{s2\/}}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable memb-of-dif.

\addvspace{18pt}
\begin{verbatim}; It's really just a Skolem function for (not (subsetp s1 s2))
; We should never need its definition

; the following facts may also be useful:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  subset-of-empty-set \\ \index{subset-of-empty-set}
{\rm{listp}}\,({\it{s\/}}) $\rightarrow$ ($\neg$ {\rm{subsetp}}\,({\it{s\/}}, {\bf{nil}})\index{subsetp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  transitivity-of-subset \\ \index{transitivity-of-subset}
({\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp} $\wedge$ {\rm{subsetp}}\,({\it{s2\/}}, {\it{s3\/}})\index{subsetp}) $\rightarrow$ {\rm{subsetp}}\,({\it{s1\/}}, {\it{s3\/}})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-is-subset-aux1 \\ \index{cdr-is-subset-aux1}
({\it{x\/}} $\in$ {\rm{cdr}}\,({\it{s\/}})) $\rightarrow$ ({\it{x\/}} $\in$ {\it{s\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-is-subset \\ \index{cdr-is-subset}
{\rm{subsetp}}\,({\rm{cdr}}\,({\it{s\/}}), {\it{s\/}})\index{subsetp}
\end{tabbing}


\noindent{\sc Event}:   Disable cdr-is-subset-aux1.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  cdr-of-subset \\ \index{cdr-of-subset}
({\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp} $\wedge$ {\rm{listp}}\,({\it{s1\/}})) $\rightarrow$ {\rm{subsetp}}\,({\rm{cdr}}\,({\it{s1\/}}), {\it{s2\/}})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nil-is-subset \\ \index{nil-is-subset}
{\rm{subsetp}}\,({\bf{nil}}, {\it{s\/}})\index{subsetp}
\end{tabbing}

\begin{verbatim}; the following might useful in proving consequences
; of (subsetp s1 s2) by induction -- reducing to
; (subsetp s1 (cdr s2))
\end{verbatim}\begin{tabbing}{\sc Theorem}:  subset-of-cdr \\ \index{subset-of-cdr}
({\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp} $\wedge$ ({\rm{car}}\,({\it{s2\/}}) $\not\in$ {\it{s1\/}})) $\rightarrow$ {\rm{subsetp}}\,({\it{s1\/}}, {\rm{cdr}}\,({\it{s2\/}}))\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  non-empty-subset \\ \index{non-empty-subset}
({\rm{subsetp}}\,({\it{lst1\/}}, {\it{lst2\/}})\index{subsetp} $\wedge$ {\rm{listp}}\,({\it{lst1\/}})) $\rightarrow$ {\rm{listp}}\,({\it{lst2\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-of-subset \\ \index{car-of-subset}
({\rm{subsetp}}\,({\it{lst1\/}}, {\it{lst2\/}})\index{subsetp} $\wedge$ {\rm{listp}}\,({\it{lst1\/}})) $\rightarrow$ ({\rm{car}}\,({\it{lst1\/}}) $\in$ {\it{lst2\/}})
\end{tabbing}

\begin{verbatim}; now, consider sub-lists

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{sublistp} \\  
\=\+{\rm{sublistp}}\,({\it{lst1\/}}, {\it{lst2\/}})\index{sublistp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{lst2\/}}) \\ 
{\bf then }\=\+{\rm{sublistp}}\,({\it{lst1\/}}, {\rm{cdr}}\,({\it{lst2\/}}))\index{sublistp} \\ 
$\vee$$\;\;\;\;$(\=\+{\rm{listp}}\,({\it{lst1\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{lst1\/}}) $=$ {\rm{car}}\,({\it{lst2\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\rm{cdr}}\,({\it{lst1\/}}), {\rm{cdr}}\,({\it{lst2\/}}))\index{sublistp})\-\- \\ 
{\bf else }$\neg$ {\rm{listp}}\,({\it{lst1\/}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sublist-implies-subset \\ \index{sublist-implies-subset}
{\rm{sublistp}}\,({\it{lst1\/}}, {\it{lst2\/}})\index{sublistp} $\rightarrow$ {\rm{subsetp}}\,({\it{lst1\/}}, {\it{lst2\/}})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  transitivity-of-sublist \\ \index{transitivity-of-sublist}
({\rm{sublistp}}\,({\it{s1\/}}, {\it{s2\/}})\index{sublistp} $\wedge$ {\rm{sublistp}}\,({\it{s2\/}}, {\it{s3\/}})\index{sublistp}) $\rightarrow$ {\rm{sublistp}}\,({\it{s1\/}}, {\it{s3\/}})\index{sublistp}
\end{tabbing}

\begin{verbatim}; (power-set S) will actually be the set of all 
; (nil-terminated)
; sublists of S -- but this will be all subsets
; in our intended "standard" representation of sets

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

\begin{verbatim}; this has 2^(length elements)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  size-of-cons-all \\ \index{size-of-cons-all}
{\rm{length}}\,({\rm{cons-all}}\,({\it{item\/}}, {\it{lst\/}})\index{cons-all})\index{length} $=$ {\rm{length}}\,({\it{lst\/}})\index{length}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  size-of-power-set \\ \index{size-of-power-set}
{\rm{length}}\,({\rm{power-set}}\,({\it{set\/}})\index{power-set})\index{length} $=$ {\rm{expt}}\,({\tt{2}}, {\rm{length}}\,({\it{set\/}})\index{length})\index{expt}
\end{tabbing}

\begin{verbatim}; now, we prove that the power-set contains all sublists,
; and only sublists -- of course, the power set is only
; collecting proper lists

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

\begin{tabbing}{\sc Theorem}:  cons-preserves-proper \\ \index{cons-preserves-proper}
{\rm{properp}}\,({\it{lst\/}})\index{properp} $\rightarrow$ {\rm{properp}}\,({\rm{cons}}\,({\it{item\/}}, {\it{lst\/}}))\index{properp}
\end{tabbing}
	
\begin{tabbing}{\sc Definition}:\index{members-all-properp} \\  
\=\+{\rm{members-all-properp}}\,({\it{biglst\/}})\index{members-all-properp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{biglst\/}}) \\ 
{\bf then }{\rm{properp}}\,({\rm{car}}\,({\it{biglst\/}}))\index{properp} $\wedge$ {\rm{members-all-properp}}\,({\rm{cdr}}\,({\it{biglst\/}}))\index{members-all-properp} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  append-preserves-members-all-properp \\ \index{append-preserves-members-all-pr!operp}
\=\+({\rm{members-all-properp}}\,({\it{biglst1\/}})\index{members-all-properp} $\wedge$ {\rm{members-all-properp}}\,({\it{biglst2\/}})\index{members-all-properp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{members-all-properp}}\,({\rm{append}}\,({\it{biglst1\/}}, {\it{biglst2\/}}))\index{members-all-properp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cons-all-preserves-members-all-properp \\ \index{cons-all-preserves-members-all-p!roperp}
{\rm{members-all-properp}}\,({\it{biglst\/}})\index{members-all-properp} $\rightarrow$ {\rm{members-all-properp}}\,({\rm{cons-all}}\,({\it{item\/}}, {\it{biglst\/}})\index{cons-all})\index{members-all-properp}
\end{tabbing}

\begin{verbatim}; of coure, we chould check the defining property:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  members-all-properp-works \\ \index{members-all-properp-works}
(({\it{lst\/}} $\in$ {\it{biglst\/}}) $\wedge$ {\rm{members-all-properp}}\,({\it{biglst\/}})\index{members-all-properp}) $\rightarrow$ {\rm{properp}}\,({\it{lst\/}})\index{properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  only-proper-aux1 \\ \index{only-proper-aux1}
{\rm{members-all-properp}}\,({\rm{power-set}}\,({\it{lst\/}})\index{power-set})\index{members-all-properp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  only-proper \\ \index{only-proper}
({\it{lst\/}} $\in$ {\rm{power-set}}\,({\it{set\/}})\index{power-set}) $\rightarrow$ {\rm{properp}}\,({\it{lst\/}})\index{properp}
\end{tabbing}


\noindent{\sc Event}:   Disable only-proper-aux1.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{members-all-sublistp} \\  
\=\+{\rm{members-all-sublistp}}\,({\it{biglst\/}}, {\it{set\/}})\index{members-all-sublistp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{biglst\/}}) \\ 
{\bf then }\=\+{\rm{sublistp}}\,({\rm{car}}\,({\it{biglst\/}}), {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{members-all-sublistp}}\,({\rm{cdr}}\,({\it{biglst\/}}), {\it{set\/}})\index{members-all-sublistp}\- \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  append-preserves-members-all-sublistp \\ \index{append-preserves-members-all-su!blistp}
\=\+({\rm{members-all-sublistp}}\,({\it{biglst1\/}}, {\it{set\/}})\index{members-all-sublistp} $\wedge$ {\rm{members-all-sublistp}}\,({\it{biglst2\/}}, {\it{set\/}})\index{members-all-sublistp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{members-all-sublistp}}\,({\rm{append}}\,({\it{biglst1\/}}, {\it{biglst2\/}}), {\it{set\/}})\index{members-all-sublistp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cons-all-preserves-members-all-sublistp \\ \index{cons-all-preserves-members-all-!sublistp}
\=\+{\rm{members-all-sublistp}}\,({\it{biglst\/}}, {\it{set\/}})\index{members-all-sublistp} \\ 
$\rightarrow$$\;\;\;\;${\rm{members-all-sublistp}}\,({\rm{cons-all}}\,({\it{item\/}}, {\it{biglst\/}})\index{cons-all}, {\rm{cons}}\,({\it{item\/}}, {\it{set\/}}))\index{members-all-sublistp}\-
\end{tabbing}

\begin{verbatim}; of coure, we chould check the defining property:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  members-all-sublistp-works \\ \index{members-all-sublistp-works}
\=\+(({\it{lst\/}} $\in$ {\it{biglst\/}}) $\wedge$ {\rm{members-all-sublistp}}\,({\it{biglst\/}}, {\it{set\/}})\index{members-all-sublistp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{sublistp}}\,({\it{lst\/}}, {\it{set\/}})\index{sublistp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  only-sublists-aux1 \\ \index{only-sublists-aux1}
{\rm{members-all-sublistp}}\,({\rm{power-set}}\,({\it{set\/}})\index{power-set}, {\it{set\/}})\index{members-all-sublistp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  only-sublists \\ \index{only-sublists}
({\it{lst\/}} $\in$ {\rm{power-set}}\,({\it{set\/}})\index{power-set}) $\rightarrow$ {\rm{sublistp}}\,({\it{lst\/}}, {\it{set\/}})\index{sublistp}
\end{tabbing}

\begin{verbatim}; also, we get all sublists

\end{verbatim}\begin{tabbing}{\sc Theorem}:  all-sublists \\ \index{all-sublists}
({\rm{sublistp}}\,({\it{lst\/}}, {\it{set\/}})\index{sublistp} $\wedge$ {\rm{properp}}\,({\it{lst\/}})\index{properp}) $\rightarrow$ ({\it{lst\/}} $\in$ {\rm{power-set}}\,({\it{set\/}})\index{power-set})
\end{tabbing}


\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                           STANDARD SETS                                ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; These standard lists of numbers in strictly increasing order.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{setp} \\  
\=\+{\rm{setp}}\,({\it{s\/}})\index{setp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{s\/}}) \\ 
{\bf then }\=\+({\rm{car}}\,({\it{s\/}}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{cdr}}\,({\it{s\/}}))\index{setp} \\ 
$\wedge$$\;\;\;\;$(({\rm{cdr}}\,({\it{s\/}}) $=$ {\bf{nil}}) $\vee$ ({\rm{car}}\,({\it{s\/}}) $<$ {\rm{cadr}}\,({\it{s\/}})))\- \\ 
{\bf else }{\it{s\/}} $=$ {\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{verbatim};;;;; large, in Paris-Harrington sense:
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{largep} \\  
{\rm{largep}}\,({\it{set\/}})\index{largep} $=$ ({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{set\/}}) $\wedge$ ({\rm{length}}\,({\it{set\/}})\index{length} $\not<$ {\rm{car}}\,({\it{set\/}})))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  empty-is-nil \\ \index{empty-is-nil}
({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ ($\neg$ {\rm{listp}}\,({\it{s\/}}))) $\rightarrow$ (({\it{s\/}} $=$ {\bf{nil}}) $=$ {\bf{t}})
\end{tabbing}
	\begin{verbatim}; so it can be a rewrite rule -- can't rewrite a var

\end{verbatim}\begin{tabbing}{\sc Theorem}:  increasing \\ \index{increasing}
({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ ({\it{x\/}} $\in$ {\rm{cdr}}\,({\it{s\/}}))) $\rightarrow$ ({\rm{car}}\,({\it{s\/}}) $<$ {\it{x\/}})
\end{tabbing}

\begin{verbatim}; Since the order is increasing, the members don't occur twice
\end{verbatim}\begin{tabbing}{\sc Theorem}:  not-again \\ \index{not-again}
{\rm{setp}}\,({\it{s\/}})\index{setp} $\rightarrow$ ({\rm{car}}\,({\it{s\/}}) $\not\in$ {\rm{cdr}}\,({\it{s\/}}))
\end{tabbing}

\begin{verbatim}; the min of a set is its first element
\end{verbatim}\begin{tabbing}{\sc Theorem}:  min-is-first \\ \index{min-is-first}
({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ ({\it{x\/}} $<$ {\rm{car}}\,({\it{s\/}}))) $\rightarrow$ ({\it{x\/}} $\not\in$ {\it{s\/}})
\end{tabbing}
	
\begin{verbatim}; the max of a set is its last element

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

\begin{verbatim}; the tail of a set is a set
\end{verbatim}\begin{tabbing}{\sc Theorem}:  tail-of-a-set \\ \index{tail-of-a-set}
({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{s\/}})) $\rightarrow$ {\rm{setp}}\,({\rm{cdr}}\,({\it{s\/}}))\index{setp}
\end{tabbing}
\begin{verbatim}; this is useful in inductive proofs about sets


\end{verbatim}\begin{tabbing}{\sc Theorem}:  first-before-last \\ \index{first-before-last}
({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\rm{cdr}}\,({\it{s\/}}))) $\rightarrow$ ({\rm{car}}\,({\it{s\/}}) $<$ {\rm{last}}\,({\it{s\/}})\index{last})
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  max-is-last \\ \index{max-is-last}
({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ ({\rm{last}}\,({\it{s\/}})\index{last} $<$ {\it{x\/}})) $\rightarrow$ ({\it{x\/}} $\not\in$ {\it{s\/}})
\end{tabbing}

\begin{verbatim}; sets are proper lists:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  sets-are-proper \\ \index{sets-are-proper}
{\rm{setp}}\,({\it{s\/}})\index{setp} $\rightarrow$ {\rm{properp}}\,({\it{s\/}})\index{properp}
\end{tabbing}

\begin{verbatim};; now, a few lemmas about the first elements of subsets

\end{verbatim}\begin{tabbing}{\sc Theorem}:  compare-first-elts \\ \index{compare-first-elts}
\=\+({\rm{setp}}\,({\it{s1\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{s2\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{s1\/}}) $\wedge$ {\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\it{s1\/}}) $\not<$ {\rm{car}}\,({\it{s2\/}}))\-
\end{tabbing}

\begin{verbatim}; now, if (subsetp s1 s2) -- there are two cases
; the cars are the same, or (car s2) is smaller

\end{verbatim}\begin{tabbing}{\sc Theorem}:  smaller-cars-in-subset \\ \index{smaller-cars-in-subset}
\=\+(\=\+{\rm{setp}}\,({\it{s1\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s2\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s1\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{s2\/}}) $<$ {\rm{car}}\,({\it{s1\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{subsetp}}\,({\it{s1\/}}, {\rm{cdr}}\,({\it{s2\/}}))\index{subsetp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  same-cars-in-subset-aux1 \\ \index{same-cars-in-subset-aux1}
({\rm{setp}}\,({\it{s1\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{s1\/}}) $\wedge$ {\rm{listp}}\,({\rm{cdr}}\,({\it{s1\/}}))) $\rightarrow$ ({\rm{car}}\,({\it{s1\/}}) $<$ {\rm{cadr}}\,({\it{s1\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  same-cars-in-subset-aux2 \\ \index{same-cars-in-subset-aux2}
\=\+(\=\+{\rm{setp}}\,({\it{s1\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s2\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s1\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{cdr}}\,({\it{s1\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{s2\/}}) $=$ {\rm{car}}\,({\it{s1\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{subsetp}}\,({\rm{cdr}}\,({\it{s1\/}}), {\rm{cdr}}\,({\it{s2\/}}))\index{subsetp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  same-cars-in-subset \\ \index{same-cars-in-subset}
\=\+(\=\+{\rm{setp}}\,({\it{s1\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s2\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s1\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{s2\/}}) $=$ {\rm{car}}\,({\it{s1\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{subsetp}}\,({\rm{cdr}}\,({\it{s1\/}}), {\rm{cdr}}\,({\it{s2\/}}))\index{subsetp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable same-cars-in-subset-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable same-cars-in-subset-aux2.

\addvspace{18pt}

\begin{verbatim}; now, we want to prove that subset implies sublist for sets

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-subset-implies-sublist} \\  
\=\+{\rm{bad-for-subset-implies-sublist}}\,({\it{set1\/}}, {\it{set2\/}})\index{bad-for-subset-implies-sublist} \\ 
$=$$\;\;\;\;$(\=\+{\rm{subsetp}}\,({\it{set1\/}}, {\it{set2\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{set1\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{set2\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{sublistp}}\,({\it{set1\/}}, {\it{set2\/}})\index{sublistp}))\-\-
\end{tabbing} 

\begin{tabbing}{\sc Theorem}:  subset-implies-sublist-aux1 \\ \index{subset-implies-sublist-aux1}
($\neg$ {\rm{listp}}\,({\it{set1\/}})) $\rightarrow$ ($\neg$ {\rm{bad-for-subset-implies-sublist}}\,({\it{set1\/}}, {\it{set2\/}})\index{bad-for-subset-implies-sublist})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subset-implies-sublist-aux2 \\ \index{subset-implies-sublist-aux2}
($\neg$ {\rm{listp}}\,({\it{set2\/}})) $\rightarrow$ ($\neg$ {\rm{bad-for-subset-implies-sublist}}\,({\it{set1\/}}, {\it{set2\/}})\index{bad-for-subset-implies-sublist})
\end{tabbing}

\begin{verbatim}; now, we do induction-- if (subsetp set1 set2) and the cars are the
; same, and the cdrs are subsets

\end{verbatim}\begin{tabbing}{\sc Theorem}:  subset-implies-sublist-aux3 \\ \index{subset-implies-sublist-aux3}
\=\+(\=\+{\rm{listp}}\,({\it{set1\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{set2\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{set2\/}}) $=$ {\rm{car}}\,({\it{set1\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\rm{cdr}}\,({\it{set1\/}}), {\rm{cdr}}\,({\it{set2\/}}))\index{sublistp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{sublistp}}\,({\it{set1\/}}, {\it{set2\/}})\index{sublistp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subset-implies-sublist-aux4 \\ \index{subset-implies-sublist-aux4}
\=\+(\=\+{\rm{listp}}\,({\it{set1\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{set2\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{set2\/}}) $=$ {\rm{car}}\,({\it{set1\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{bad-for-subset-implies-sublist}}\,({\it{set1\/}}, {\it{set2\/}})\index{bad-for-subset-implies-sublist})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-subset-implies-sublist}}\,({\rm{cdr}}\,({\it{set1\/}}), {\rm{cdr}}\,({\it{set2\/}}))\index{bad-for-subset-implies-sublist}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subset-implies-sublist-aux5 \\ \index{subset-implies-sublist-aux5}
\=\+(\=\+{\rm{listp}}\,({\it{set1\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{set2\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{set2\/}}) $<$ {\rm{car}}\,({\it{set1\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{bad-for-subset-implies-sublist}}\,({\it{set1\/}}, {\it{set2\/}})\index{bad-for-subset-implies-sublist})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-subset-implies-sublist}}\,({\it{set1\/}}, {\rm{cdr}}\,({\it{set2\/}}))\index{bad-for-subset-implies-sublist}\-
\end{tabbing}

\begin{verbatim}; Now, use the fact that (car set2) <= (car set1)
\end{verbatim}\begin{tabbing}{\sc Theorem}:  subset-implies-sublist-aux6 \\ \index{subset-implies-sublist-aux6}
\=\+({\rm{listp}}\,({\it{set1\/}}) $\wedge$ {\rm{listp}}\,({\it{set2\/}}) $\wedge$ {\rm{bad-for-subset-implies-sublist}}\,({\it{set1\/}}, {\it{set2\/}})\index{bad-for-subset-implies-sublist}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{car}}\,({\it{set2\/}}) $<$ {\rm{car}}\,({\it{set1\/}})) $\vee$ ({\rm{car}}\,({\it{set2\/}}) $=$ {\rm{car}}\,({\it{set1\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subset-implies-sublist-aux7 \\ \index{subset-implies-sublist-aux7}
\=\+({\rm{listp}}\,({\it{set1\/}}) $\wedge$ {\rm{listp}}\,({\it{set2\/}}) $\wedge$ {\rm{bad-for-subset-implies-sublist}}\,({\it{set1\/}}, {\it{set2\/}})\index{bad-for-subset-implies-sublist}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{bad-for-subset-implies-sublist}}\,({\it{set1\/}}, {\rm{cdr}}\,({\it{set2\/}}))\index{bad-for-subset-implies-sublist} \\ 
$\vee$$\;\;\;\;${\rm{bad-for-subset-implies-sublist}}\,({\rm{cdr}}\,({\it{set1\/}}), {\rm{cdr}}\,({\it{set2\/}}))\index{bad-for-subset-implies-sublist})\-\-
\end{tabbing}

\begin{verbatim}; so there are no bad pairs, by induction -- we have to force the
; correct induction

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{subset-implies-sublist-kludge} \\  
\=\+{\rm{subset-implies-sublist-kludge}}\,({\it{set1\/}}, {\it{set2\/}})\index{subset-implies-sublist-kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{set1\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\it{set2\/}}) \\ 
{\bf then }\=\+{\rm{subset-implies-sublist-kludge}}\,({\rm{cdr}}\,({\it{set1\/}}), {\rm{cdr}}\,({\it{set2\/}}))\index{subset-implies-sublist-kludge} \\ 
$+$$\;\;\;\;${\rm{subset-implies-sublist-kludge}}\,({\it{set1\/}}, {\rm{cdr}}\,({\it{set2\/}}))\index{subset-implies-sublist-kludge}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subset-implies-sublist-aux8 \\ \index{subset-implies-sublist-aux8}
$\neg$ {\rm{bad-for-subset-implies-sublist}}\,({\it{set1\/}}, {\it{set2\/}})\index{bad-for-subset-implies-sublist}
\end{tabbing}


\noindent{\sc Event}:   Disable subset-implies-sublist-kludge.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subset-implies-sublist-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subset-implies-sublist-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subset-implies-sublist-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subset-implies-sublist-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subset-implies-sublist-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subset-implies-sublist-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subset-implies-sublist-aux7.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  subset-implies-sublist \\ \index{subset-implies-sublist}
({\rm{subsetp}}\,({\it{set1\/}}, {\it{set2\/}})\index{subsetp} $\wedge$ {\rm{setp}}\,({\it{set1\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{set2\/}})\index{setp}) $\rightarrow$ {\rm{sublistp}}\,({\it{set1\/}}, {\it{set2\/}})\index{sublistp}
\end{tabbing} 


\noindent{\sc Event}:   Disable subset-implies-sublist-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bad-for-subset-implies-sublist.

\addvspace{18pt}

\begin{verbatim};;;;;;;;;;
; now,, we prove that every subset of set is in the power-set

\end{verbatim}\begin{tabbing}{\sc Theorem}:  all-subsets \\ \index{all-subsets}
({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{x\/}})\index{setp} $\wedge$ {\rm{subsetp}}\,({\it{x\/}}, {\it{set\/}})\index{subsetp}) $\rightarrow$ ({\it{x\/}} $\in$ {\rm{power-set}}\,({\it{set\/}})\index{power-set})
\end{tabbing}


\begin{verbatim};;;;;;;;;;;;;;;;;;;  extensionality
; Two standard sets, s1, s2, are equal if they have the same members:
;  (implies
;      (and (setp s1) (setp s2) (subsetp s1 s2) (subsetp s2 s1))
;      (equal s1 s2) )
;  The proof is "by induction", but it requires a bunch of auxilliaries,
;  which we intruduce, and then disable after the proof

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-ext} \\  
\=\+{\rm{bad-for-ext}}\,({\it{s1\/}}, {\it{s2\/}})\index{bad-for-ext} \\ 
$=$$\;\;\;\;$(\=\+{\rm{setp}}\,({\it{s1\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s2\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{s2\/}}, {\it{s1\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;$({\it{s1\/}} $\not=$ {\it{s2\/}}))\-\-
\end{tabbing}

\begin{verbatim}; so, we want to show, by induction, that this can't happen.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  extensionality-aux1 \\ \index{extensionality-aux1}
($\neg$ {\rm{listp}}\,({\it{s1\/}})) $\rightarrow$ ($\neg$ {\rm{bad-for-ext}}\,({\it{s1\/}}, {\it{s2\/}})\index{bad-for-ext})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  extensionality-aux2 \\ \index{extensionality-aux2}
($\neg$ {\rm{listp}}\,({\it{s2\/}})) $\rightarrow$ ($\neg$ {\rm{bad-for-ext}}\,({\it{s1\/}}, {\it{s2\/}})\index{bad-for-ext})
\end{tabbing}


\begin{verbatim}; now, (bad-for-ext s1 s2) implies that s1, s2 aren't empty, and we can
; look at their first element.  By (subsetp s1 s2) (subsetp s2 s1)
; the first elements are the same.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  extensionality-aux3 \\ \index{extensionality-aux3}
\=\+(\=\+{\rm{setp}}\,({\it{s1\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s2\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s1\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s2\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{s2\/}}, {\it{s1\/}})\index{subsetp})\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\it{s1\/}}) $=$ {\rm{car}}\,({\it{s2\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  extensionality-aux4 \\ \index{extensionality-aux4}
({\rm{listp}}\,({\it{s1\/}}) $\wedge$ {\rm{listp}}\,({\it{s2\/}}) $\wedge$ {\rm{bad-for-ext}}\,({\it{s1\/}}, {\it{s2\/}})\index{bad-for-ext}) $\rightarrow$ ({\rm{car}}\,({\it{s1\/}}) $=$ {\rm{car}}\,({\it{s2\/}}))
\end{tabbing}


\noindent{\sc Event}:   Disable extensionality-aux3.

\addvspace{18pt}

\begin{verbatim}; now, we should get that the cdrs are bad

\end{verbatim}\begin{tabbing}{\sc Theorem}:  extensionality-aux5 \\ \index{extensionality-aux5}
\=\+({\rm{listp}}\,({\it{s1\/}}) $\wedge$ {\rm{listp}}\,({\it{s2\/}}) $\wedge$ {\rm{bad-for-ext}}\,({\it{s1\/}}, {\it{s2\/}})\index{bad-for-ext}) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-ext}}\,({\rm{cdr}}\,({\it{s1\/}}), {\rm{cdr}}\,({\it{s2\/}}))\index{bad-for-ext}\-
\end{tabbing}


\noindent{\sc Event}:   Disable extensionality-aux4.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{extensionality-kludge} \\  
\=\+{\rm{extensionality-kludge}}\,({\it{s1\/}}, {\it{s2\/}})\index{extensionality-kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }$\neg$ {\rm{listp}}\,({\it{s1\/}})$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }$\neg$ {\rm{listp}}\,({\it{s2\/}})$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{extensionality-kludge}}\,({\rm{cdr}}\,({\it{s1\/}}), {\rm{cdr}}\,({\it{s2\/}}))\index{extensionality-kludge}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  extensionality-aux6 \\ \index{extensionality-aux6}
$\neg$ {\rm{bad-for-ext}}\,({\it{s1\/}}, {\it{s2\/}})\index{bad-for-ext}
\end{tabbing}


\noindent{\sc Event}:   Disable extensionality-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable extensionality-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable extensionality-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable extensionality-aux6.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  extensionality \\ \index{extensionality}
\=\+({\rm{setp}}\,({\it{s1\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{s2\/}})\index{setp} $\wedge$ {\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp} $\wedge$ {\rm{subsetp}}\,({\it{s2\/}}, {\it{s1\/}})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;$({\it{s1\/}} $=$ {\it{s2\/}})\-
\end{tabbing}


\noindent{\sc Event}:   Disable extensionality-kludge.

\addvspace{18pt}


\begin{verbatim};;;;;;;;;;  segments

; (segment 3 6) is (3 4 5 6)
; These are special kinds of sets.  More on them will appear
; below; here we just put the defn and a few basic facts.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{segment} \\  
\=\+{\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment} \\ 
$=$$\;\;\;\;$\=\+{\bf if }({\it{m\/}} $\leq$ {\it{n\/}}) $\wedge$ ({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)$\;\;${\bf then }{\rm{cons}}\,({\it{m\/}}, {\rm{segment}}\,($1\;+$ {\it{m\/}}, {\it{n\/}})\index{segment}) \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  size-of-segment \\ \index{size-of-segment}
\=\+(({\it{m\/}} $\leq$ {\it{n\/}}) $\wedge$ ({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{length}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment})\index{length} $=$ (($1\;+$ {\it{n\/}}) $-$ {\it{m\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  members-of-segment \\ \index{members-of-segment}
\=\+(({\it{m\/}} $\leq$ {\it{n\/}}) $\wedge$ ({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$(({\it{x\/}} $\in$ {\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment}) $=$ (({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{x\/}} $\leq$ {\it{n\/}}) $\wedge$ ({\it{m\/}} $\leq$ {\it{x\/}})))\-
\end{tabbing}


\noindent{\sc Event}:   Disable segment.

\addvspace{18pt}   \begin{verbatim}; for now


; some lemmas about length:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  length-of-sublist \\ \index{length-of-sublist}
{\rm{sublistp}}\,({\it{lst1\/}}, {\it{lst2\/}})\index{sublistp} $\rightarrow$ ({\rm{length}}\,({\it{lst2\/}})\index{length} $\not<$ {\rm{length}}\,({\it{lst1\/}})\index{length})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-of-subset \\ \index{length-of-subset}
({\rm{setp}}\,({\it{x\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{y\/}})\index{setp} $\wedge$ {\rm{subsetp}}\,({\it{x\/}}, {\it{y\/}})\index{subsetp}) $\rightarrow$ ({\rm{length}}\,({\it{y\/}})\index{length} $\not<$ {\rm{length}}\,({\it{x\/}})\index{length})
\end{tabbing}


\begin{verbatim}; a few more set facts

\end{verbatim}\begin{tabbing}{\sc Theorem}:  empty-subset \\ \index{empty-subset}
($\neg$ {\rm{listp}}\,({\it{s1\/}})) $\rightarrow$ {\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-before-cadr \\ \index{car-before-cadr}
({\rm{listp}}\,({\rm{cdr}}\,({\it{s\/}})) $\wedge$ {\rm{setp}}\,({\it{s\/}})\index{setp}) $\rightarrow$ ({\rm{car}}\,({\it{s\/}}) $<$ {\rm{cadr}}\,({\it{s\/}}))
\end{tabbing}

\begin{verbatim}; now, we prove that (and (setp s1) (setp s2) (listp s1) (subsetp s1 s2))
; implies (subsetp (cdr s1) (cdr s2))
; this is by examination of cases:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  cdr-cdr-subset-aux1 \\ \index{cdr-cdr-subset-aux1}
\=\+({\rm{setp}}\,({\it{s1\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{s2\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{s1\/}}) $\wedge$ {\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{car}}\,({\it{s2\/}}) $=$ {\rm{car}}\,({\it{s1\/}})) $\vee$ ({\rm{car}}\,({\it{s2\/}}) $<$ {\rm{car}}\,({\it{s1\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-cdr-subset \\ \index{cdr-cdr-subset}
\=\+({\rm{setp}}\,({\it{s1\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{s2\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{s1\/}}) $\wedge$ {\rm{subsetp}}\,({\it{s1\/}}, {\it{s2\/}})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{subsetp}}\,({\rm{cdr}}\,({\it{s1\/}}), {\rm{cdr}}\,({\it{s2\/}}))\index{subsetp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable cdr-cdr-subset-aux1.

\addvspace{18pt}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                              ORDINALS                                  ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


; ordinalp (the property of representing an ordinal < epsilon_0)
; and ord-lessp (the < on the ordinals) are built-in
; we define all the basic function so that they do the right thing
; on legal notations for ordinals; we don't care what they do on non-ordinals

; Ordinals are represented as:
; The natural number n represents itself.
; (alpha beta gamma . n) represents omega^alpha + omega^beta + omega^gamma + n
; For this to be legal, alpha >= beta >= gamma -- this ensures
;  that each ordinal has a unique representation


; temporarily disable some set stuff
\end{verbatim}
\noindent{\sc Event}:   Disable subsetp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable setp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable max-is-last.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-of-a-set.

\addvspace{18pt}

\noindent{\sc Event}:   Disable increasing.

\addvspace{18pt}

\noindent{\sc Event}:   Disable compare-first-elts.

\addvspace{18pt}


\begin{verbatim};;;;;;;  some basic properties of order on the ordinals

\end{verbatim}\begin{tabbing}{\sc Theorem}:  irreflex \\ \index{irreflex}
$\neg$ {\rm{ord-lessp}}\,({\it{x\/}}, {\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nocycle \\ \index{nocycle}
$\neg$ ({\rm{ord-lessp}}\,({\it{x\/}}, {\it{y\/}}) $\wedge$ {\rm{ord-lessp}}\,({\it{y\/}}, {\it{x\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  no-cycle-alt \\ \index{no-cycle-alt}
{\rm{ord-lessp}}\,({\it{y\/}}, {\it{x\/}}) $\rightarrow$ ($\neg$ {\rm{ord-lessp}}\,({\it{x\/}}, {\it{y\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  trichotomy \\ \index{trichotomy}
\=\+({\rm{ordinalp}}\,({\it{sigma\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{tau\/}})) \\ 
$\rightarrow$$\;\;\;\;$(({\it{sigma\/}} $=$ {\it{tau\/}}) $\vee$ {\rm{ord-lessp}}\,({\it{sigma\/}}, {\it{tau\/}}) $\vee$ {\rm{ord-lessp}}\,({\it{tau\/}}, {\it{sigma\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  transitivity \\ \index{transitivity}
\=\+({\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}}) $\wedge$ {\rm{ord-lessp}}\,({\it{beta\/}}, {\it{gamma\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{gamma\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  transitivity-alt \\ \index{transitivity-alt}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{gamma\/}}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ord-lessp}}\,({\it{beta\/}}, {\it{alpha\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{beta\/}}, {\it{gamma\/}}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{gamma\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ords-below-2 \\ \index{ords-below-2}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ($\neg$ {\rm{ord-lessp}}\,({\tt{1}}, {\it{alpha\/}}))) \\ 
$\rightarrow$$\;\;\;\;$(({\it{alpha\/}} $=$ {\tt{0}}) $\vee$ ({\it{alpha\/}} $=$ {\tt{1}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  postive-ord-lessp \\ \index{postive-ord-lessp}
\=\+({\rm{ordinalp}}\,({\it{gamma\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{delta\/}}) $\wedge$ {\rm{ord-lessp}}\,({\it{gamma\/}}, {\it{delta\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{delta\/}})\-
\end{tabbing}


\begin{verbatim};;;;;;;  successors and limit ordinals

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

\begin{tabbing}{\sc Definition}:\index{limitp} \\  
{\rm{limitp}}\,({\it{alpha\/}})\index{limitp} $=$ ({\rm{listp}}\,({\it{alpha\/}}) $\wedge$ ($\neg$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  successors-are-positive \\ \index{successors-are-positive}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}) $\rightarrow$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  three-kinds \\ \index{three-kinds}
\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{limitp}}\,({\it{alpha\/}})\index{limitp} $\vee$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp} $\vee$ ({\it{alpha\/}} $=$ {\tt{0}}))\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{successor} \\  
\=\+{\rm{successor}}\,({\it{alpha\/}})\index{successor} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{alpha\/}})$\;\;${\bf then }{\rm{cons}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{successor}}\,({\rm{cdr}}\,({\it{alpha\/}}))\index{successor}) \\ 
{\bf else }$1\;+$ {\it{alpha\/}}$\;${\bf  endif}\-\-
\end{tabbing}
\begin{verbatim}; the successor of 8 is 9
; the successor of (alpha beta . 8) is (alpha beta . 9)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  successor-is-an-ordinal \\ \index{successor-is-an-ordinal}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ {\rm{ordinalp}}\,({\rm{successor}}\,({\it{alpha\/}})\index{successor})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  successor-is-a-successor \\ \index{successor-is-a-successor}
{\rm{successorp}}\,({\rm{successor}}\,({\it{alpha\/}})\index{successor})\index{successorp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  successor-is-bigger \\ \index{successor-is-bigger}
{\rm{ord-lessp}}\,({\it{alpha\/}}, {\rm{successor}}\,({\it{alpha\/}})\index{successor})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  succ-preserves-order \\ \index{succ-preserves-order}
{\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}}) $\rightarrow$ {\rm{ord-lessp}}\,({\rm{successor}}\,({\it{alpha\/}})\index{successor}, {\rm{successor}}\,({\it{beta\/}})\index{successor})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nothing-between \\ \index{nothing-between}
$\neg$ ({\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}}) $\wedge$ {\rm{ord-lessp}}\,({\it{beta\/}}, {\rm{successor}}\,({\it{alpha\/}})\index{successor}))
\end{tabbing}

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

\begin{verbatim}; these are inverses of each other

\end{verbatim}\begin{tabbing}{\sc Theorem}:  predecessor-suc \\ \index{predecessor-suc}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ ({\rm{predecessor}}\,({\rm{successor}}\,({\it{alpha\/}})\index{successor})\index{predecessor} $=$ {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  suc-predecessor \\ \index{suc-predecessor}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{successor}}\,({\rm{predecessor}}\,({\it{alpha\/}})\index{predecessor})\index{successor} $=$ {\it{alpha\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  predecessor-is-an-ordinal \\ \index{predecessor-is-an-ordinal}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ {\rm{ordinalp}}\,({\rm{predecessor}}\,({\it{alpha\/}})\index{predecessor})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  predecessor-is-smaller \\ \index{predecessor-is-smaller}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{predecessor}}\,({\it{alpha\/}})\index{predecessor}, {\it{alpha\/}})\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  predecessor-of-limit \\ \index{predecessor-of-limit}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{limitp}}\,({\it{alpha\/}})\index{limitp}) $\rightarrow$ ({\rm{predecessor}}\,({\it{alpha\/}})\index{predecessor} $=$ {\it{alpha\/}})
\end{tabbing}


\begin{verbatim};;;;;;;;;;  ord-leq :  a <= on ordinals

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{ord-leq}$\;\;$
{\rm{ord-leq}}\,({\it{alpha\/}}, {\it{beta\/}})\index{ord-leq} $=$ ($\neg$ {\rm{ord-lessp}}\,({\it{beta\/}}, {\it{alpha\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  leq-as-an-or \\ \index{leq-as-an-or}
\=\+({\rm{ordinalp}}\,({\it{rho\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{sigma\/}}) $\wedge$ {\rm{ord-leq}}\,({\it{rho\/}}, {\it{sigma\/}})\index{ord-leq}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{ord-lessp}}\,({\it{rho\/}}, {\it{sigma\/}}) $\vee$ ({\it{rho\/}} $=$ {\it{sigma\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  leq-0 \\ \index{leq-0}
({\rm{ordinalp}}\,({\it{delta\/}}) $\wedge$ {\rm{ord-leq}}\,({\it{delta\/}}, {\tt{0}})\index{ord-leq}) $\rightarrow$ (({\it{delta\/}} $=$ {\tt{0}}) $=$ {\bf{t}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cars-go-down \\ \index{cars-go-down}
{\rm{ordinalp}}\,({\it{beta\/}}) $\rightarrow$ {\rm{ord-leq}}\,({\rm{cadr}}\,({\it{beta\/}}), {\rm{car}}\,({\it{beta\/}}))\index{ord-leq}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ord-leq-is-transitive \\ \index{ord-leq-is-transitive}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{gamma\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\it{alpha\/}}, {\it{beta\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\it{beta\/}}, {\it{gamma\/}})\index{ord-leq})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\it{alpha\/}}, {\it{gamma\/}})\index{ord-leq}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ord-leq-zero \\ \index{ord-leq-zero}
({\rm{ordinalp}}\,({\it{delta\/}}) $\wedge$ {\rm{ord-leq}}\,({\it{delta\/}}, {\tt{0}})\index{ord-leq}) $\rightarrow$ (({\it{delta\/}} $=$ {\tt{0}}) $=$ {\bf{t}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cars-are-ordinals \\ \index{cars-are-ordinals}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ {\rm{ordinalp}}\,({\rm{car}}\,({\it{alpha\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdrs-are-ordinals \\ \index{cdrs-are-ordinals}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ {\rm{ordinalp}}\,({\rm{cdr}}\,({\it{alpha\/}}))
\end{tabbing}


\begin{verbatim}; Now, we want to prove that (cdr alpha) < alpha
; this should be trivial but seems to require help

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-cdrs-are-smaller} \\  
\=\+{\rm{bad-for-cdrs-are-smaller}}\,({\it{alpha\/}})\index{bad-for-cdrs-are-smaller} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ord-lessp}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\it{alpha\/}})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdrs-are-smaller-aux1 \\ \index{cdrs-are-smaller-aux1}
({\it{alpha\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ ($\neg$ {\rm{bad-for-cdrs-are-smaller}}\,({\it{alpha\/}})\index{bad-for-cdrs-are-smaller})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdrs-are-smaller-aux2 \\ \index{cdrs-are-smaller-aux2}
({\rm{cdr}}\,({\it{alpha\/}}) $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ ($\neg$ {\rm{bad-for-cdrs-are-smaller}}\,({\it{alpha\/}})\index{bad-for-cdrs-are-smaller})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdrs-are-smaller-aux3 \\ \index{cdrs-are-smaller-aux3}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{cdr}}\,({\it{alpha\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{alpha\/}}) $=$ {\rm{cadr}}\,({\it{alpha\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{cddr}}\,({\it{alpha\/}}), {\rm{cdr}}\,({\it{alpha\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\it{alpha\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdrs-are-smaller-aux4 \\ \index{cdrs-are-smaller-aux4}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{listp}}\,({\rm{cdr}}\,({\it{alpha\/}})) $\wedge$ {\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{cadr}}\,({\it{alpha\/}}))) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\it{alpha\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdrs-are-smaller-aux5 \\ \index{cdrs-are-smaller-aux5}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{listp}}\,({\rm{cdr}}\,({\it{alpha\/}}))) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{car}}\,({\it{alpha\/}}) $=$ {\rm{cadr}}\,({\it{alpha\/}})) $\vee$ {\rm{ord-lessp}}\,({\rm{cadr}}\,({\it{alpha\/}}), {\rm{car}}\,({\it{alpha\/}})))\-
\end{tabbing}


\noindent{\sc Event}:   Disable cdrs-are-smaller-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdrs-are-smaller-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdrs-are-smaller-aux5.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  cdrs-are-smaller-aux6 \\ \index{cdrs-are-smaller-aux6}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{listp}}\,({\rm{cdr}}\,({\it{alpha\/}})) $\wedge$ {\rm{ord-lessp}}\,({\rm{cddr}}\,({\it{alpha\/}}), {\rm{cdr}}\,({\it{alpha\/}}))) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\it{alpha\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdrs-are-smaller-aux7 \\ \index{cdrs-are-smaller-aux7}
\=\+({\rm{listp}}\,({\rm{cdr}}\,({\it{alpha\/}})) $\wedge$ {\rm{bad-for-cdrs-are-smaller}}\,({\it{alpha\/}})\index{bad-for-cdrs-are-smaller}) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-cdrs-are-smaller}}\,({\rm{cdr}}\,({\it{alpha\/}}))\index{bad-for-cdrs-are-smaller}\-
\end{tabbing}


\noindent{\sc Event}:   Disable cdrs-are-smaller-aux2.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  cdrs-are-smaller-aux8 \\ \index{cdrs-are-smaller-aux8}
{\rm{bad-for-cdrs-are-smaller}}\,({\it{alpha\/}})\index{bad-for-cdrs-are-smaller} $\rightarrow$ {\rm{bad-for-cdrs-are-smaller}}\,({\rm{cdr}}\,({\it{alpha\/}}))\index{bad-for-cdrs-are-smaller}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdrs-are-smaller-aux9 \\ \index{cdrs-are-smaller-aux9}
$\neg$ {\rm{bad-for-cdrs-are-smaller}}\,({\it{alpha\/}})\index{bad-for-cdrs-are-smaller}
\end{tabbing}


\noindent{\sc Event}:   Disable cdrs-are-smaller-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdrs-are-smaller-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdrs-are-smaller-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdrs-are-smaller-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdrs-are-smaller-aux9.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  cdrs-are-smaller \\ \index{cdrs-are-smaller}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{listp}}\,({\it{alpha\/}})) $\rightarrow$ {\rm{ord-lessp}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\it{alpha\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable bad-for-cdrs-are-smaller.

\addvspace{18pt}


\begin{tabbing}{\sc Theorem}:  cars-of-smaller-ordinals \\ \index{cars-of-smaller-ordinals}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ {\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{car}}\,({\it{beta\/}})) $\vee$ ({\rm{car}}\,({\it{alpha\/}}) $=$ {\rm{car}}\,({\it{beta\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  limit-not-succ \\ \index{limit-not-succ}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{delta\/}}) $\wedge$ {\rm{limitp}}\,({\it{alpha\/}})\index{limitp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{successor}}\,({\it{delta\/}})\index{successor} $\not=$ {\it{alpha\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  succ-below-limit \\ \index{succ-below-limit}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{delta\/}}, {\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{limitp}}\,({\it{alpha\/}})\index{limitp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{successor}}\,({\it{delta\/}})\index{successor}, {\it{alpha\/}})\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  irreflex-of-ord-leq \\ \index{irreflex-of-ord-leq}
\=\+(\=\+{\rm{ordinalp}}\,({\it{sigma\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{tau\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\it{sigma\/}}, {\it{tau\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\it{tau\/}}, {\it{sigma\/}})\index{ord-leq})\- \\ 
$\rightarrow$$\;\;\;\;$(({\it{sigma\/}} $=$ {\it{tau\/}}) $=$ {\bf{t}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  transitivity-alt2 \\ \index{transitivity-alt2}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{gamma\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\it{beta\/}}, {\it{gamma\/}})\index{ord-leq})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{gamma\/}})\-
\end{tabbing}


\begin{verbatim};;;;;;;;;;;;;;;;;;;;  multiplicities
; (mult delta alpha) is the coefficient of omega^delta in the
; Cantor normal form of alpha.  We want to define this, and
; prove that alpha is determined by its multiplicities
; This is slightly messy, since delta = 0 is a special case
; in the Boyer-Moore notation -- let's do that separately
; (mult 0 alpha) will be (number-part alpha)

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{number-part} \\  
\=\+{\rm{number-part}}\,({\it{alpha\/}})\index{number-part} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{alpha\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\it{alpha\/}} \\ 
{\bf else }{\rm{number-part}}\,({\rm{cdr}}\,({\it{alpha\/}}))\index{number-part}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  number-part-is-a-number \\ \index{number-part-is-a-number}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ ({\rm{number-part}}\,({\it{alpha\/}})\index{number-part} $\in\;${\bf{N}}${}$)
\end{tabbing}

\begin{verbatim}; for delta > 0, (mult delta alpha) = (pos-mult delta alpha)

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

\begin{tabbing}{\sc Theorem}:  pos-mult-is-a-number \\ \index{pos-mult-is-a-number}
{\rm{pos-mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{pos-mult} $\in\;${\bf{N}}${}$
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{mult} \\  
\=\+{\rm{mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{mult} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{delta\/}} $=$ {\tt{0}}$\;\;${\bf then }{\rm{number-part}}\,({\it{alpha\/}})\index{number-part} \\ 
{\bf else }{\rm{pos-mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{pos-mult}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-is-a-number \\ \index{mult-is-a-number}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ ({\rm{mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{mult} $\in\;${\bf{N}}${}$)
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-in-a-number \\ \index{mult-in-a-number}
(({\it{alpha\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{delta\/}} $\not=$ {\tt{0}})) $\rightarrow$ ({\rm{mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{mult} $=$ {\tt{0}})
\end{tabbing}

\begin{verbatim}; now, we prove if delta > (car alpha), (mult delta alpha) = 0
; this is true for numbers alpha because the car of a non-list = 0
; Prover needs help to find the correct induction

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-bound-on-mult} \\  
\=\+{\rm{bad-for-bound-on-mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{bad-for-bound-on-mult} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{mult} $\not=$ {\tt{0}}))\-\-
\end{tabbing}

\begin{verbatim}; we want to show this can't happen

\end{verbatim}\begin{tabbing}{\sc Theorem}:  bound-on-mult-aux1 \\ \index{bound-on-mult-aux1}
({\it{alpha\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ ($\neg$ {\rm{bad-for-bound-on-mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{bad-for-bound-on-mult})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-mult-aux2 \\ \index{bound-on-mult-aux2}
\=\+({\rm{listp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{cadr}}\,({\it{alpha\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-mult-aux3 \\ \index{bound-on-mult-aux3}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ {\rm{ordinalp}}\,({\rm{car}}\,({\it{alpha\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-mult-aux4 \\ \index{bound-on-mult-aux4}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ {\rm{ordinalp}}\,({\rm{cadr}}\,({\it{alpha\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-mult-aux5 \\ \index{bound-on-mult-aux5}
\=\+(\=\+{\rm{listp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\it{delta\/}}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{cadr}}\,({\it{alpha\/}}), {\it{delta\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-mult-aux6 \\ \index{bound-on-mult-aux6}
\=\+({\rm{listp}}\,({\it{alpha\/}}) $\wedge$ {\rm{bad-for-bound-on-mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{bad-for-bound-on-mult}) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-bound-on-mult}}\,({\it{delta\/}}, {\rm{cdr}}\,({\it{alpha\/}}))\index{bad-for-bound-on-mult}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bound-on-mult-kludge} \\  
\=\+{\rm{bound-on-mult-kludge}}\,({\it{alpha\/}})\index{bound-on-mult-kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{alpha\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{bound-on-mult-kludge}}\,({\rm{cdr}}\,({\it{alpha\/}}))\index{bound-on-mult-kludge}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-mult-aux7 \\ \index{bound-on-mult-aux7}
$\neg$ {\rm{bad-for-bound-on-mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{bad-for-bound-on-mult}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-mult \\ \index{bound-on-mult}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{delta\/}}) $\wedge$ {\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\it{delta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{mult} $=$ {\tt{0}})\-
\end{tabbing}


\noindent{\sc Event}:   Disable bound-on-mult-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bound-on-mult-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bound-on-mult-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bound-on-mult-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bound-on-mult-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bound-on-mult-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bound-on-mult-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bad-for-bound-on-mult.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bound-on-mult-kludge.

\addvspace{18pt}

\begin{verbatim}; now, (different-mult alpha beta) returns a delta
; such that (mult delta alpha) != (mult delta beta)

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{different-mult} \\  
\=\+{\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{car}}\,({\it{alpha\/}}) $=$ {\rm{car}}\,({\it{beta\/}}) \\ 
{\bf then }\=\+{\bf if }{\rm{listp}}\,({\it{alpha\/}})$\;\;${\bf then }{\rm{different-mult}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\rm{cdr}}\,({\it{beta\/}}))\index{different-mult} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\- \\ 
{\bf elseif }{\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{car}}\,({\it{beta\/}}))$\;\;${\bf then }{\rm{car}}\,({\it{beta\/}}) \\ 
{\bf else }{\rm{car}}\,({\it{alpha\/}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; summarize the features of the definition

\end{verbatim}\begin{tabbing}{\sc Theorem}:  different-mult-is-ord \\ \index{different-mult-is-ord}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ordinalp}}\,({\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-for-numbers \\ \index{different-mult-for-numbers}
(({\it{alpha\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{beta\/}} $\in\;${\bf{N}}${}$)) $\rightarrow$ ({\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult} $=$ {\tt{0}})
\end{tabbing}

\begin{verbatim};;;;;;;;;;  The following is causing us a lot of trouble:
\end{verbatim}
\noindent{\sc Event}:   Disable transitivity-alt.

\addvspace{18pt}

\noindent{\sc Event}:   Disable irreflex-of-ord-leq.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  different-mult-number-list \\ \index{different-mult-number-list}
\=\+(({\it{alpha\/}} $\in\;${\bf{N}}${}$) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ {\rm{listp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult} $=$ {\rm{car}}\,({\it{beta\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-list-number \\ \index{different-mult-list-number}
\=\+(({\it{beta\/}} $\in\;${\bf{N}}${}$) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{listp}}\,({\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult} $=$ {\rm{car}}\,({\it{alpha\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-for-lists-same-car \\ \index{different-mult-for-lists-same-c!ar}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{alpha\/}}) $=$ {\rm{car}}\,({\it{beta\/}})))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult} $=$ {\rm{different-mult}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\rm{cdr}}\,({\it{beta\/}}))\index{different-mult})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-for-smaller-car \\ \index{different-mult-for-smaller-car}
\=\+{\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{car}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult} $=$ {\rm{car}}\,({\it{beta\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-for-larger-car \\ \index{different-mult-for-larger-car}
\=\+{\rm{ord-lessp}}\,({\rm{car}}\,({\it{beta\/}}), {\rm{car}}\,({\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult} $=$ {\rm{car}}\,({\it{alpha\/}}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable different-mult.

\addvspace{18pt}

\begin{verbatim}; now, we have to prove that it works
; this needs some help

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-different-mult-works} \\  
\=\+{\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{alpha\/}} $\not=$ {\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{mult}}\,({\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult}, {\it{alpha\/}})\index{mult} \\ 
$=$$\;\;\;\;${\rm{mult}}\,({\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult}, {\it{beta\/}})\index{mult})\-)\-\-
\end{tabbing}

\begin{verbatim}; if they have different cars, this should follow
; by "bound-on-mult"

\end{verbatim}\begin{tabbing}{\sc Theorem}:  different-mult-works-aux1 \\ \index{different-mult-works-aux1}
\=\+({\rm{ordinalp}}\,({\it{sigma\/}}) $\wedge$ ({\rm{car}}\,({\it{sigma\/}}) $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{mult}}\,({\rm{car}}\,({\it{sigma\/}}), {\it{sigma\/}})\index{mult} $\not=$ {\tt{0}})\-
\end{tabbing}

\begin{verbatim}; the following is causing us a lot of trouble
\end{verbatim}
\noindent{\sc Event}:   Disable no-cycle-alt.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ord-leq-is-transitive.

\addvspace{18pt}


\begin{tabbing}{\sc Theorem}:  different-mult-works-aux2 \\ \index{different-mult-works-aux2}
\=\+{\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{car}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-works-aux3 \\ \index{different-mult-works-aux3}
\=\+{\rm{ord-lessp}}\,({\rm{car}}\,({\it{beta\/}}), {\rm{car}}\,({\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-works-aux4 \\ \index{different-mult-works-aux4}
\=\+(({\it{alpha\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{beta\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-works-aux5 \\ \index{different-mult-works-aux5}
\=\+(({\it{alpha\/}} $\in\;${\bf{N}}${}$) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ {\rm{listp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{car}}\,({\it{beta\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-works-aux6 \\ \index{different-mult-works-aux6}
\=\+(({\it{alpha\/}} $\simeq\;${{\bf{nil}}}${}$) $\wedge$ {\rm{listp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-works-aux7 \\ \index{different-mult-works-aux7}
\=\+({\rm{listp}}\,({\it{alpha\/}}) $\wedge$ ({\it{beta\/}} $\simeq\;${{\bf{nil}}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-works-aux8 \\ \index{different-mult-works-aux8}
\=\+(({\it{alpha\/}} $\simeq\;${{\bf{nil}}}${}$) $\wedge$ ({\it{beta\/}} $\simeq\;${{\bf{nil}}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works})\-
\end{tabbing}


\noindent{\sc Event}:   Disable different-mult-works-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable different-mult-works-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable different-mult-works-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable different-mult-works-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable different-mult-works-aux8.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  different-mult-works-aux9 \\ \index{different-mult-works-aux9}
\=\+(({\it{alpha\/}} $\simeq\;${{\bf{nil}}}${}$) $\vee$ ({\it{beta\/}} $\simeq\;${{\bf{nil}}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works})\-
\end{tabbing}

\begin{verbatim}; so, they are both compound

\end{verbatim}
\noindent{\sc Event}:   Disable different-mult-works-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable different-mult-works-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable different-mult-works-aux3.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  different-mult-works-aux10 \\ \index{different-mult-works-aux10}
\=\+({\rm{car}}\,({\it{beta\/}}) $\not=$ {\rm{car}}\,({\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works})\-
\end{tabbing}


\begin{verbatim}; so, if they are bad,  they are both compound and their cars
; are the same

\end{verbatim}\begin{tabbing}{\sc Theorem}:  same-mult-for-cdr \\ \index{same-mult-for-cdr}
\=\+(\=\+{\rm{listp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{alpha\/}}) $=$ {\rm{car}}\,({\it{beta\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{mult} $=$ {\rm{mult}}\,({\it{delta\/}}, {\it{beta\/}})\index{mult}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{mult}}\,({\it{delta\/}}, {\rm{cdr}}\,({\it{alpha\/}}))\index{mult} $=$ {\rm{mult}}\,({\it{delta\/}}, {\rm{cdr}}\,({\it{beta\/}}))\index{mult})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-works-aux11 \\ \index{different-mult-works-aux11}
\=\+(\=\+{\rm{listp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{alpha\/}}) $=$ {\rm{car}}\,({\it{beta\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-different-mult-works}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\rm{cdr}}\,({\it{beta\/}}))\index{bad-for-different-mult-works}\-
\end{tabbing}


\noindent{\sc Event}:   Disable different-mult-works-aux10.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  different-mult-works-aux12 \\ \index{different-mult-works-aux12}
\=\+({\rm{listp}}\,({\it{alpha\/}}) $\wedge$ {\rm{listp}}\,({\it{beta\/}}) $\wedge$ {\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works}) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-different-mult-works}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\rm{cdr}}\,({\it{beta\/}}))\index{bad-for-different-mult-works}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{different-mult-works-kludge} \\  
\=\+{\rm{different-mult-works-kludge}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult-works-kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{alpha\/}}) $\wedge$ {\rm{listp}}\,({\it{beta\/}}) \\ 
{\bf then }{\rm{different-mult-works-kludge}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\rm{cdr}}\,({\it{beta\/}}))\index{different-mult-works-kludge} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  different-mult-works-aux13 \\ \index{different-mult-works-aux13}
$\neg$ {\rm{bad-for-different-mult-works}}\,({\it{alpha\/}}, {\it{beta\/}})\index{bad-for-different-mult-works}
\end{tabbing}


\noindent{\sc Event}:   Disable different-mult-works-kludge.

\addvspace{18pt}

\noindent{\sc Event}:   Disable different-mult-works-aux9.

\addvspace{18pt}

\noindent{\sc Event}:   Disable different-mult-works-aux11.

\addvspace{18pt}

\noindent{\sc Event}:   Disable different-mult-works-aux12.

\addvspace{18pt}

\noindent{\sc Event}:   Disable different-mult-works-aux13.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  different-mult-works \\ \index{different-mult-works}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ ({\it{alpha\/}} $\not=$ {\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{mult}}\,({\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult}, {\it{alpha\/}})\index{mult} \\ 
$\not=$$\;\;\;\;${\rm{mult}}\,({\rm{different-mult}}\,({\it{alpha\/}}, {\it{beta\/}})\index{different-mult}, {\it{beta\/}})\index{mult})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable bad-for-different-mult-works.

\addvspace{18pt}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                          NATURAL SUM                                   ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;  alpha # lambda
; this is defined by merging the Cantor Normal Forms
; as with the above, there are two cases because
; of the special treatment of numbers

; we must verify 5 things:
; 0. this is an ordinal
; 1. bound-below:  alpha # lambda > lambda  if alpha != 0
; 2. bound above:  car(alpha # lambda) is the larger of the two cars
; 3. monotonic:  alpha < beta --> alpha # lambda < beta # lambda
; 4. mult-is-additive:  mult(delta, alpha # lambda) = 
;     mult(delta, alpha) + mult(delta, lambda)
;   this will easily imply that # is assoc and commutative

; we do this for lambda in omega and lambda = (sigma . 0) 
;  and then put them together

; first alpha # n when n is a number

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{num-sharp} \\  
\=\+{\rm{num-sharp}}\,({\it{alpha\/}}, {\it{n\/}})\index{num-sharp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{alpha\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\it{alpha\/}} $+$ {\it{n\/}} \\ 
{\bf else }{\rm{cons}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{num-sharp}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\it{n\/}})\index{num-sharp})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  num-sharp-is-an-ordinal \\ \index{num-sharp-is-an-ordinal}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) $\rightarrow$ {\rm{ordinalp}}\,({\rm{num-sharp}}\,({\it{alpha\/}}, {\it{n\/}})\index{num-sharp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  num-sharp-and-zero \\ \index{num-sharp-and-zero}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ ({\rm{num-sharp}}\,({\it{alpha\/}}, {\tt{0}})\index{num-sharp} $=$ {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  num-sharp-and-successor \\ \index{num-sharp-and-successor}
{\rm{num-sharp}}\,({\it{alpha\/}}, {\tt{1}})\index{num-sharp} $=$ {\rm{successor}}\,({\it{alpha\/}})\index{successor}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  num-sharp-gets-bigger \\ \index{num-sharp-gets-bigger}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\rm{num-sharp}}\,({\it{alpha\/}}, {\it{n\/}})\index{num-sharp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-of-num-sharp \\ \index{car-of-num-sharp}
({\it{n\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{car}}\,({\rm{num-sharp}}\,({\it{alpha\/}}, {\it{n\/}})\index{num-sharp}) $=$ {\rm{car}}\,({\it{alpha\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  num-sharp-is-monotonic \\ \index{num-sharp-is-monotonic}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ {\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{num-sharp}}\,({\it{alpha\/}}, {\it{n\/}})\index{num-sharp}, {\rm{num-sharp}}\,({\it{beta\/}}, {\it{n\/}})\index{num-sharp})\-
\end{tabbing}


\begin{verbatim}; check out multiplicities

\end{verbatim}\begin{tabbing}{\sc Theorem}:  number-part-of-num-sharp \\ \index{number-part-of-num-sharp}
{\rm{number-part}}\,({\rm{num-sharp}}\,({\it{alpha\/}}, {\it{n\/}})\index{num-sharp})\index{number-part} $=$ ({\rm{number-part}}\,({\it{alpha\/}})\index{number-part} $+$ {\it{n\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pos-mult-of-num-sharp \\ \index{pos-mult-of-num-sharp}
{\rm{pos-mult}}\,({\it{delta\/}}, {\rm{num-sharp}}\,({\it{alpha\/}}, {\it{n\/}})\index{num-sharp})\index{pos-mult} $=$ {\rm{pos-mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{pos-mult}
\end{tabbing} 

\begin{tabbing}{\sc Theorem}:  mult-of-num-sharp \\ \index{mult-of-num-sharp}
\=\+(({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ {\rm{ordinalp}}\,({\it{delta\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{mult}}\,({\it{delta\/}}, {\rm{num-sharp}}\,({\it{alpha\/}}, {\it{n\/}})\index{num-sharp})\index{mult} \\ 
$=$$\;\;\;\;$({\rm{mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{mult} $+$ {\rm{mult}}\,({\it{delta\/}}, {\it{n\/}})\index{mult}))\-\-
\end{tabbing}

\begin{verbatim}; now, alpha # omega^delta where delta > 0
; this is (insert delta alpha) -- we insert delta in the CNF of alpha

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{insert} \\  
\=\+{\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{alpha\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\rm{cons}}\,({\it{delta\/}}, {\it{alpha\/}}) \\ 
{\bf elseif }{\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{alpha\/}})) \\ 
{\bf then }{\rm{cons}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{insert}}\,({\it{delta\/}}, {\rm{cdr}}\,({\it{alpha\/}}))\index{insert}) \\ 
{\bf else }{\rm{cons}}\,({\it{delta\/}}, {\it{alpha\/}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; the car is the larger of the two cars

\end{verbatim}\begin{tabbing}{\sc Theorem}:  car-of-insert-a \\ \index{car-of-insert-a}
\=\+({\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{alpha\/}})) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert}) $=$ {\rm{car}}\,({\it{alpha\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-of-insert-b \\ \index{car-of-insert-b}
($\neg$ {\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{alpha\/}}))) $\rightarrow$ ({\rm{car}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert}) $=$ {\it{delta\/}})
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  insert-is-an-ordinal \\ \index{insert-is-an-ordinal}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{delta\/}}) $\wedge$ ({\it{delta\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ordinalp}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert})\-
\end{tabbing}


\begin{verbatim}; now, we want to show that alpha < (insert delta alpha)
; this need some help

\end{verbatim}\begin{tabbing}{\sc Theorem}:  insert-is-cons \\ \index{insert-is-cons}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{delta\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{alpha\/}}))))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert} $=$ {\rm{cons}}\,({\it{delta\/}}, {\it{alpha\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  insert-is-bigger-aux1 \\ \index{insert-is-bigger-aux1}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{delta\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{alpha\/}}))))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert})\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bad-for-insert-is-bigger} \\  
\=\+{\rm{bad-for-insert-is-bigger}}\,({\it{alpha\/}}, {\it{delta\/}})\index{bad-for-insert-is-bigger} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{delta\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ord-lessp}}\,({\it{alpha\/}}, {\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  insert-is-bigger-aux2 \\ \index{insert-is-bigger-aux2}
({\it{alpha\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ ($\neg$ {\rm{bad-for-insert-is-bigger}}\,({\it{alpha\/}}, {\it{delta\/}})\index{bad-for-insert-is-bigger})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  insert-is-bigger-aux3 \\ \index{insert-is-bigger-aux3}
\=\+({\rm{listp}}\,({\it{alpha\/}}) $\wedge$ ($\neg$ {\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{alpha\/}})))) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-insert-is-bigger}}\,({\it{alpha\/}}, {\it{delta\/}})\index{bad-for-insert-is-bigger})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  insert-small-ordinal \\ \index{insert-small-ordinal}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{listp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{alpha\/}}))) \\ 
$\rightarrow$$\;\;\;\;$({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert} $=$ {\rm{cons}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{insert}}\,({\it{delta\/}}, {\rm{cdr}}\,({\it{alpha\/}}))\index{insert}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  insert-is-bigger-aux4 \\ \index{insert-is-bigger-aux4}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{alpha\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\rm{insert}}\,({\it{delta\/}}, {\rm{cdr}}\,({\it{alpha\/}}))\index{insert}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  insert-is-bigger-aux5 \\ \index{insert-is-bigger-aux5}
\=\+(\=\+{\rm{listp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{alpha\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{bad-for-insert-is-bigger}}\,({\it{alpha\/}}, {\it{delta\/}})\index{bad-for-insert-is-bigger})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-insert-is-bigger}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\it{delta\/}})\index{bad-for-insert-is-bigger}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  insert-is-bigger-aux6 \\ \index{insert-is-bigger-aux6}
\=\+({\rm{listp}}\,({\it{alpha\/}}) $\wedge$ {\rm{bad-for-insert-is-bigger}}\,({\it{alpha\/}}, {\it{delta\/}})\index{bad-for-insert-is-bigger}) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-insert-is-bigger}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\it{delta\/}})\index{bad-for-insert-is-bigger}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  insert-is-bigger-aux7 \\ \index{insert-is-bigger-aux7}
$\neg$ {\rm{bad-for-insert-is-bigger}}\,({\it{alpha\/}}, {\it{delta\/}})\index{bad-for-insert-is-bigger}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  insert-is-bigger \\ \index{insert-is-bigger}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{delta\/}}) $\wedge$ ({\it{delta\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert})\-
\end{tabbing}


\noindent{\sc Event}:   Disable insert-is-bigger-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable insert-is-bigger-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable insert-is-bigger-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable insert-is-bigger-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable insert-is-bigger-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable insert-is-bigger-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable insert-is-bigger-aux7.

\addvspace{18pt}


\begin{verbatim};;;; now --  check out multiplicities

\end{verbatim}\begin{tabbing}{\sc Theorem}:  number-part-of-insert \\ \index{number-part-of-insert}
{\rm{number-part}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert})\index{number-part} $=$ {\rm{number-part}}\,({\it{alpha\/}})\index{number-part}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pos-mult-same \\ \index{pos-mult-same}
{\rm{pos-mult}}\,({\it{delta\/}}, {\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert})\index{pos-mult} $=$ ($1\;+$ {\rm{pos-mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{pos-mult})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pos-mult-different \\ \index{pos-mult-different}
({\it{x\/}} $\not=$ {\it{delta\/}}) $\rightarrow$ ({\rm{pos-mult}}\,({\it{x\/}}, {\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert})\index{pos-mult} $=$ {\rm{pos-mult}}\,({\it{x\/}}, {\it{alpha\/}})\index{pos-mult})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-insert-a \\ \index{mult-of-insert-a}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{sigma\/}} $\not=$ {\it{delta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{mult}}\,({\it{sigma\/}}, {\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert})\index{mult} $=$ {\rm{mult}}\,({\it{sigma\/}}, {\it{alpha\/}})\index{mult})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-insert-b \\ \index{mult-of-insert-b}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{delta\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{mult}}\,({\it{delta\/}}, {\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert})\index{mult} $=$ ($1\;+$ {\rm{mult}}\,({\it{delta\/}}, {\it{alpha\/}})\index{mult}))\-
\end{tabbing}

\begin{verbatim}; we still have to check monotonicity --
; but first, define #  and prove it's assoc and commut
; just to make sure we've got it right.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{sharp} \\  
\=\+{\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{beta\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\rm{num-sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{num-sharp} \\ 
{\bf else }{\rm{insert}}\,({\rm{car}}\,({\it{beta\/}}), {\rm{sharp}}\,({\it{alpha\/}}, {\rm{cdr}}\,({\it{beta\/}}))\index{sharp})\index{insert}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sharp-is-an-ordinal \\ \index{sharp-is-an-ordinal}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}})) $\rightarrow$ {\rm{ordinalp}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sharp-with-0 \\ \index{sharp-with-0}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ ({\rm{sharp}}\,({\it{alpha\/}}, {\tt{0}})\index{sharp} $=$ {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sharp-gets-bigger \\ \index{sharp-gets-bigger}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ ({\it{beta\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\-
\end{tabbing}


\begin{verbatim}; now we prove that (car (sharp alpha beta)) =  (car alpha)
; in the case that (car alpha) >= (car beta) -- the other way
; around will follow once we prove # is commutative

\end{verbatim}\begin{tabbing}{\sc Theorem}:  car-of-insert-aux1 \\ \index{car-of-insert-aux1}
\=\+(({\it{delta\/}} $=$ {\rm{car}}\,({\it{alpha\/}})) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{delta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert}) $=$ {\rm{car}}\,({\it{alpha\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-of-insert-c \\ \index{car-of-insert-c}
\=\+({\rm{ord-leq}}\,({\it{delta\/}}, {\rm{car}}\,({\it{alpha\/}}))\index{ord-leq} $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{delta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert}) $=$ {\rm{car}}\,({\it{alpha\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-of-sharp-aux1 \\ \index{car-of-sharp-aux1}
\=\+(($\neg$ {\rm{listp}}\,({\it{beta\/}})) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp}) $=$ {\rm{car}}\,({\it{alpha\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-of-sharp-aux2 \\ \index{car-of-sharp-aux2}
\=\+({\rm{ord-leq}}\,({\rm{car}}\,({\it{beta\/}}), {\rm{car}}\,({\it{alpha\/}}))\index{ord-leq} $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\rm{cadr}}\,({\it{beta\/}}), {\rm{car}}\,({\it{alpha\/}}))\index{ord-leq}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-of-sharp-a \\ \index{car-of-sharp-a}
\=\+({\rm{ord-leq}}\,({\rm{car}}\,({\it{beta\/}}), {\rm{car}}\,({\it{alpha\/}}))\index{ord-leq} $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp}) $=$ {\rm{car}}\,({\it{alpha\/}}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable car-of-sharp-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable car-of-sharp-aux2.

\addvspace{18pt}

\begin{verbatim}; now, check out that multiplicities are additive

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-mult-of-sharp} \\  
\=\+{\rm{bad-for-mult-of-sharp}}\,({\it{sigma\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-mult-of-sharp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{sigma\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{mult}}\,({\it{sigma\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{mult} \\ 
$\not=$$\;\;\;\;$({\rm{mult}}\,({\it{sigma\/}}, {\it{alpha\/}})\index{mult} $+$ {\rm{mult}}\,({\it{sigma\/}}, {\it{beta\/}})\index{mult}))\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-sharp-aux1 \\ \index{mult-of-sharp-aux1}
({\it{beta\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ ($\neg$ {\rm{bad-for-mult-of-sharp}}\,({\it{sigma\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-mult-of-sharp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-sharp-aux2 \\ \index{mult-of-sharp-aux2}
({\rm{listp}}\,({\it{beta\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}})) $\rightarrow$ ({\rm{car}}\,({\it{beta\/}}) $\not=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-sharp-aux3 \\ \index{mult-of-sharp-aux3}
\=\+(\=\+{\rm{listp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{sigma\/}} $\not=$ {\rm{car}}\,({\it{beta\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{sigma\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{mult}}\,({\it{sigma\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\rm{cdr}}\,({\it{beta\/}}))\index{sharp})\index{mult} $=$ {\rm{mult}}\,({\it{sigma\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{mult})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-sharp-aux4 \\ \index{mult-of-sharp-aux4}
\=\+({\rm{listp}}\,({\it{beta\/}}) $\wedge$ ({\it{sigma\/}} $\not=$ {\rm{car}}\,({\it{beta\/}}))) \\ 
$\rightarrow$$\;\;\;\;$({\rm{mult}}\,({\it{sigma\/}}, {\rm{cdr}}\,({\it{beta\/}}))\index{mult} $=$ {\rm{mult}}\,({\it{sigma\/}}, {\it{beta\/}})\index{mult})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-sharp-aux5 \\ \index{mult-of-sharp-aux5}
\=\+(\=\+{\rm{listp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{bad-for-mult-of-sharp}}\,({\it{sigma\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-mult-of-sharp} \\ 
$\wedge$$\;\;\;\;$({\it{sigma\/}} $\not=$ {\rm{car}}\,({\it{beta\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-mult-of-sharp}}\,({\it{sigma\/}}, {\it{alpha\/}}, {\rm{cdr}}\,({\it{beta\/}}))\index{bad-for-mult-of-sharp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-sharp-aux6 \\ \index{mult-of-sharp-aux6}
\=\+({\rm{listp}}\,({\it{beta\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{mult}}\,({\rm{car}}\,({\it{beta\/}}), {\it{beta\/}})\index{mult} $=$ ($1\;+$ {\rm{mult}}\,({\rm{car}}\,({\it{beta\/}}), {\rm{cdr}}\,({\it{beta\/}}))\index{mult}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-sharp-aux7 \\ \index{mult-of-sharp-aux7}
\=\+({\rm{listp}}\,({\it{beta\/}}) $\wedge$ {\rm{bad-for-mult-of-sharp}}\,({\rm{car}}\,({\it{beta\/}}), {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-mult-of-sharp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-mult-of-sharp}}\,({\rm{car}}\,({\it{beta\/}}), {\it{alpha\/}}, {\rm{cdr}}\,({\it{beta\/}}))\index{bad-for-mult-of-sharp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-sharp-aux8 \\ \index{mult-of-sharp-aux8}
\=\+({\rm{listp}}\,({\it{beta\/}}) $\wedge$ {\rm{bad-for-mult-of-sharp}}\,({\it{sigma\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-mult-of-sharp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-mult-of-sharp}}\,({\it{sigma\/}}, {\it{alpha\/}}, {\rm{cdr}}\,({\it{beta\/}}))\index{bad-for-mult-of-sharp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-sharp-aux9 \\ \index{mult-of-sharp-aux9}
$\neg$ {\rm{bad-for-mult-of-sharp}}\,({\it{sigma\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-mult-of-sharp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mult-of-sharp \\ \index{mult-of-sharp}
\=\+({\rm{ordinalp}}\,({\it{sigma\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{mult}}\,({\it{sigma\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{mult} \\ 
$=$$\;\;\;\;$({\rm{mult}}\,({\it{sigma\/}}, {\it{alpha\/}})\index{mult} $+$ {\rm{mult}}\,({\it{sigma\/}}, {\it{beta\/}})\index{mult}))\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable bad-for-mult-of-sharp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable mult-of-sharp-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable mult-of-sharp-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable mult-of-sharp-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable mult-of-sharp-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable mult-of-sharp-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable mult-of-sharp-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable mult-of-sharp-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable mult-of-sharp-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable mult-of-sharp-aux9.

\addvspace{18pt}


\begin{verbatim}; now, we should show that sharp is commutative and associative

\end{verbatim}\begin{tabbing}{\sc Theorem}:  commut-of-sharp \\ \index{commut-of-sharp}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp} $=$ {\rm{sharp}}\,({\it{beta\/}}, {\it{alpha\/}})\index{sharp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  assoc-of-sharp \\ \index{assoc-of-sharp}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{gamma\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{sharp}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp}, {\it{gamma\/}})\index{sharp} $=$ {\rm{sharp}}\,({\it{alpha\/}}, {\rm{sharp}}\,({\it{beta\/}}, {\it{gamma\/}})\index{sharp})\index{sharp})\-
\end{tabbing}

\begin{verbatim};;; now, we can finish the discussion of the car of a #

\end{verbatim}\begin{tabbing}{\sc Theorem}:  car-of-sharp-b \\ \index{car-of-sharp-b}
\=\+({\rm{ord-leq}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{car}}\,({\it{beta\/}}))\index{ord-leq} $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp}) $=$ {\rm{car}}\,({\it{beta\/}}))\-
\end{tabbing}


\begin{verbatim}; now, turn to monotonicity:  alpha < beta --> alpha # lambda < beta # lambda
; this should follow by induction if we can do monotonicty of insert

; first, do it in the case that delta >= (car beta)

\end{verbatim}
\noindent{\sc Event}:   Disable car-of-insert-aux1.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  monotonicity-of-insert-aux1 \\ \index{monotonicity-of-insert-aux1}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{beta\/}}))) \\ 
$\wedge$$\;\;\;\;$({\it{delta\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert}, {\rm{insert}}\,({\it{delta\/}}, {\it{beta\/}})\index{insert})\-
\end{tabbing}

\begin{verbatim}; now, consider case that delta < (car beta)

; first, suppose also (car alpha) < (car beta)
; Then (car (insert delta alpha)) < (car beta)
; so (insert delta alpha) < beta < (insert delta beta)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  monotonicity-of-insert-aux2 \\ \index{monotonicity-of-insert-aux2}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{sigma\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{delta\/}}, {\it{sigma\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\it{sigma\/}}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{car}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert}), {\it{sigma\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monotonicity-of-insert-aux3 \\ \index{monotonicity-of-insert-aux3}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{beta\/}})) \\ 
$\wedge$$\;\;\;\;$({\it{delta\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{car}}\,({\it{beta\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert}, {\it{beta\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monotonicity-of-insert-aux4 \\ \index{monotonicity-of-insert-aux4}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{beta\/}})) \\ 
$\wedge$$\;\;\;\;$({\it{delta\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{car}}\,({\it{beta\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert}, {\rm{insert}}\,({\it{delta\/}}, {\it{beta\/}})\index{insert})\-
\end{tabbing}

\begin{verbatim}; this concludes the case that delta < (car beta) and (car alpha) < (car beta)
; the remaining case is that delta < (car beta) and (car alpha) = (car beta)
; this should proceed by induction

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-monotonicity-of-insert} \\  
\=\+{\rm{bad-for-monotonicity-of-insert}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{delta\/}})\index{bad-for-monotonicity-of-insert} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{delta\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{ord-lessp}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert}, {\rm{insert}}\,({\it{delta\/}}, {\it{beta\/}})\index{insert})))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monotonicity-of-insert-aux5 \\ \index{monotonicity-of-insert-aux5}
\=\+{\rm{bad-for-monotonicity-of-insert}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{delta\/}})\index{bad-for-monotonicity-of-insert} \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\it{delta\/}}, {\rm{car}}\,({\it{beta\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monotonicity-of-insert-aux6 \\ \index{monotonicity-of-insert-aux6}
\=\+{\rm{bad-for-monotonicity-of-insert}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{delta\/}})\index{bad-for-monotonicity-of-insert} \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{ord-lessp}}\,({\rm{car}}\,({\it{alpha\/}}), {\rm{car}}\,({\it{beta\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monotonicity-of-insert-aux7 \\ \index{monotonicity-of-insert-aux7}
\=\+{\rm{bad-for-monotonicity-of-insert}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{delta\/}})\index{bad-for-monotonicity-of-insert} \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\it{alpha\/}}) $=$ {\rm{car}}\,({\it{beta\/}}))\-
\end{tabbing}

\begin{verbatim}; now we know that any counter-example satisfies
; delta  car alpha = car beta
; so, the insert's start off with delta, and we can use induction

; check that alpha and beta are not numbers

\end{verbatim}\begin{tabbing}{\sc Theorem}:  monotonicity-of-insert-aux8 \\ \index{monotonicity-of-insert-aux8}
\=\+{\rm{bad-for-monotonicity-of-insert}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{delta\/}})\index{bad-for-monotonicity-of-insert} \\ 
$\rightarrow$$\;\;\;\;$({\rm{listp}}\,({\it{alpha\/}}) $\wedge$ {\rm{listp}}\,({\it{beta\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monotonicity-of-insert-aux9 \\ \index{monotonicity-of-insert-aux9}
\=\+{\rm{bad-for-monotonicity-of-insert}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{delta\/}})\index{bad-for-monotonicity-of-insert} \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-monotonicity-of-insert}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\rm{cdr}}\,({\it{beta\/}}), {\it{delta\/}})\index{bad-for-monotonicity-of-insert}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{monotonicity-of-insert-kludge} \\  
\=\+{\rm{monotonicity-of-insert-kludge}}\,({\it{alpha\/}}, {\it{beta\/}})\index{monotonicity-of-insert-kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{alpha\/}}) $\wedge$ {\rm{listp}}\,({\it{beta\/}}) \\ 
{\bf then }{\rm{monotonicity-of-insert-kludge}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\rm{cdr}}\,({\it{beta\/}}))\index{monotonicity-of-insert-kludge} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monotonicity-of-insert-aux10 \\ \index{monotonicity-of-insert-aux10}
$\neg$ {\rm{bad-for-monotonicity-of-insert}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{delta\/}})\index{bad-for-monotonicity-of-insert}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monotonicity-of-insert \\ \index{monotonicity-of-insert}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{delta\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{delta\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert}, {\rm{insert}}\,({\it{delta\/}}, {\it{beta\/}})\index{insert})\-
\end{tabbing}


\noindent{\sc Event}:   Disable monotonicity-of-insert-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monotonicity-of-insert-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monotonicity-of-insert-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monotonicity-of-insert-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monotonicity-of-insert-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monotonicity-of-insert-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monotonicity-of-insert-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monotonicity-of-insert-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monotonicity-of-insert-aux9.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monotonicity-of-insert-aux10.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monotonicity-of-insert-kludge.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bad-for-monotonicity-of-insert.

\addvspace{18pt}

\begin{verbatim}; now, we can prove monotonicity of sharp

\end{verbatim}\begin{tabbing}{\sc Theorem}:  monotonicity-of-sharp \\ \index{monotonicity-of-sharp}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{lambda\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{lambda\/}})\index{sharp}, {\rm{sharp}}\,({\it{beta\/}}, {\it{lambda\/}})\index{sharp})\-
\end{tabbing}


\begin{verbatim};;;;;;;  disable a bunch of stuff --  these are causing
;;;; a lot of trouble by firing when we don't want them to:
\end{verbatim}
\noindent{\sc Event}:   Disable ord-lessp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ord-leq.

\addvspace{18pt}

\noindent{\sc Event}:   Disable leq-0.

\addvspace{18pt}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                          NORMS AND PRED                                ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;   norms = count ; 
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{norm}$\;\;$
{\rm{norm}}\,({\it{x\/}})\index{norm} $=$ {\rm{count}}\,({\it{x\/}})
\end{tabbing}
\begin{verbatim}; This defn is just so that we can disable norm without disabling count

\end{verbatim}\begin{tabbing}{\sc Theorem}:  norm-is-a-number \\ \index{norm-is-a-number}
{\rm{norm}}\,({\it{x\/}})\index{norm} $\in\;${\bf{N}}${}$
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-a-number \\ \index{norm-of-a-number}
({\it{n\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{norm}}\,({\it{n\/}})\index{norm} $=$ {\it{n\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-successor \\ \index{norm-of-successor}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ ({\rm{norm}}\,({\rm{successor}}\,({\it{alpha\/}})\index{successor})\index{norm} $=$ ($1\;+$ {\rm{norm}}\,({\it{alpha\/}})\index{norm}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-predecessor \\ \index{norm-of-predecessor}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{predecessor}}\,({\it{alpha\/}})\index{predecessor})\index{norm} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $-\;1$))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-cons \\ \index{norm-of-cons}
\=\+{\rm{listp}}\,({\it{alpha\/}}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\it{alpha\/}})\index{norm} $=$ ($1\;+$ ({\rm{norm}}\,({\rm{car}}\,({\it{alpha\/}}))\index{norm} $+$ {\rm{norm}}\,({\rm{cdr}}\,({\it{alpha\/}}))\index{norm})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-non-zero \\ \index{norm-non-zero}
{\rm{listp}}\,({\it{alpha\/}}) $\rightarrow$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $\not=$ {\tt{0}})
\end{tabbing}


\noindent{\sc Event}:   Disable norm.

\addvspace{18pt}

\begin{verbatim}; now, (norm-up-to n) will contain all ordinals with
; norm n or below, plus a lot of other stuff

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{norm-up-to} \\  
\=\+{\rm{norm-up-to}}\,({\it{n\/}})\index{norm-up-to} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\rm{list}}\,({\tt{0}}) \\ 
{\bf else }{\rm{append}}\,(\=\+{\rm{segment}}\,({\tt{0}}, {\it{n\/}})\index{segment}, \\ 
{\rm{product}}\,({\rm{norm-up-to}}\,({\it{n\/}} $-\;1$)\index{norm-up-to}, {\rm{norm-up-to}}\,({\it{n\/}} $-\;1$)\index{norm-up-to})\index{product})\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-up-to-big-enuf-aux1 \\ \index{norm-up-to-big-enuf-aux1}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $\leq$ {\it{n\/}}) $\wedge$ ({\it{alpha\/}} $\simeq\;${{\bf{nil}}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\it{alpha\/}} $\in$ {\rm{norm-up-to}}\,({\it{n\/}})\index{norm-up-to})\-
\end{tabbing}

\begin{verbatim}; now, we just consider (listp alpha)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  norm-up-to-big-enuf-aux2 \\ \index{norm-up-to-big-enuf-aux2}
({\rm{listp}}\,({\it{alpha\/}}) $\wedge$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $\leq$ {\it{n\/}})) $\rightarrow$ ({\it{n\/}} $\not\simeq {\tt{0}}$)
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-up-to-big-enuf-aux3 \\ \index{norm-up-to-big-enuf-aux3}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $\leq$ {\it{n\/}}) $\wedge$ ({\it{n\/}} $\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$({\it{alpha\/}} $\in$ {\rm{norm-up-to}}\,({\it{n\/}})\index{norm-up-to})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-up-to-big-enuf-aux4 \\ \index{norm-up-to-big-enuf-aux4}
\=\+(({\it{x\/}} $\in$ {\rm{norm-up-to}}\,({\it{n\/}})\index{norm-up-to}) $\wedge$ ({\it{y\/}} $\in$ {\rm{norm-up-to}}\,({\it{n\/}})\index{norm-up-to})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{cons}}\,({\it{x\/}}, {\it{y\/}}) $\in$ {\rm{norm-up-to}}\,($1\;+$ {\it{n\/}})\index{norm-up-to})\-
\end{tabbing}


\noindent{\sc Event}:   Disable norm-up-to.

\addvspace{18pt}


\noindent{\sc Event}:   Disable norm-of-cons.

\addvspace{18pt}   \begin{verbatim}; needed for next defn to work
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{norm-up-to-big-enuf-kludge} \\  
\=\+{\rm{norm-up-to-big-enuf-kludge}}\,({\it{alpha\/}}, {\it{n\/}})\index{norm-up-to-big-enuf-kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{alpha\/}}) $\wedge$ ({\it{n\/}} $\not\simeq {\tt{0}}$) \\ 
{\bf then }\=\+{\rm{norm-up-to-big-enuf-kludge}}\,({\rm{car}}\,({\it{alpha\/}}), {\it{n\/}} $-\;1$)\index{norm-up-to-big-enuf-kludge} \\ 
$+$$\;\;\;\;${\rm{norm-up-to-big-enuf-kludge}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\it{n\/}} $-\;1$)\index{norm-up-to-big-enuf-kludge}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\noindent{\sc Event}:   Enable norm-of-cons.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{bad-for-norm-up-to-big-enuf} \\  
\=\+{\rm{bad-for-norm-up-to-big-enuf}}\,({\it{alpha\/}}, {\it{n\/}})\index{bad-for-norm-up-to-big-enuf} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{norm}}\,({\it{alpha\/}})\index{norm} $\leq$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{alpha\/}} $\not\in$ {\rm{norm-up-to}}\,({\it{n\/}})\index{norm-up-to}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-up-to-big-enuf-aux5 \\ \index{norm-up-to-big-enuf-aux5}
{\rm{bad-for-norm-up-to-big-enuf}}\,({\it{alpha\/}}, {\it{n\/}})\index{bad-for-norm-up-to-big-enuf} $\rightarrow$ ({\rm{listp}}\,({\it{alpha\/}}) $\wedge$ ({\it{n\/}} $\not\simeq {\tt{0}}$))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-up-to-big-enuf-aux6 \\ \index{norm-up-to-big-enuf-aux6}
\=\+(\=\+{\rm{listp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{bad-for-norm-up-to-big-enuf}}\,({\rm{car}}\,({\it{alpha\/}}), {\it{n\/}} $-\;1$)\index{bad-for-norm-up-to-big-enuf}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{bad-for-norm-up-to-big-enuf}}\,({\rm{cdr}}\,({\it{alpha\/}}), {\it{n\/}} $-\;1$)\index{bad-for-norm-up-to-big-enuf}))\- \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-norm-up-to-big-enuf}}\,({\it{alpha\/}}, {\it{n\/}})\index{bad-for-norm-up-to-big-enuf})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-up-to-big-enuf-aux7 \\ \index{norm-up-to-big-enuf-aux7}
$\neg$ {\rm{bad-for-norm-up-to-big-enuf}}\,({\it{alpha\/}}, {\it{n\/}})\index{bad-for-norm-up-to-big-enuf}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-up-to-big-enuf \\ \index{norm-up-to-big-enuf}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $\leq$ {\it{n\/}})) $\rightarrow$ ({\it{alpha\/}} $\in$ {\rm{norm-up-to}}\,({\it{n\/}})\index{norm-up-to})
\end{tabbing}


\noindent{\sc Event}:   Disable norm-up-to-big-enuf-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-up-to-big-enuf-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-up-to-big-enuf-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-up-to-big-enuf-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-up-to-big-enuf-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-up-to-big-enuf-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-up-to-big-enuf-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-up-to-big-enuf-kludge.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bad-for-norm-up-to-big-enuf.

\addvspace{18pt}

\begin{verbatim};;;; norm of sharp
; prove that the norm of alpha # beta is the sum of the norms

\end{verbatim}\begin{tabbing}{\sc Theorem}:  norm-of-num-sharp \\ \index{norm-of-num-sharp}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{num-sharp}}\,({\it{alpha\/}}, {\it{n\/}})\index{num-sharp})\index{norm} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{norm}}\,({\it{n\/}})\index{norm}))\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  norm-of-insert \\ \index{norm-of-insert}
\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{insert}}\,({\it{delta\/}}, {\it{alpha\/}})\index{insert})\index{norm} $=$ ($1\;+$ ({\rm{norm}}\,({\it{delta\/}})\index{norm} $+$ {\rm{norm}}\,({\it{alpha\/}})\index{norm})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-sharp \\ \index{norm-of-sharp}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{norm} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{norm}}\,({\it{beta\/}})\index{norm}))\-
\end{tabbing}

\begin{verbatim};;;;;;;;;;;;;;;;;;  (pred alpha n)  = {alpha}(n)
; this is 0 if alpha = 0   ; otherwise, it's the largest ordinal
;   beta < alpha such that (norm beta) <= (norm alpha) + magic(n)

; first, define (max-below alpha lst) to be the largest ordinal in lst
; of norm <= n
; which is less than alpha.  Define it to be 0 in the default cases.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{max-below} \\  
\=\+{\rm{max-below}}\,({\it{alpha\/}}, {\it{lst\/}}, {\it{n\/}})\index{max-below} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{listp}}\,({\it{lst\/}}) \\ 
{\bf then }\=\+{\bf if }\=\+{\rm{ordinalp}}\,({\rm{car}}\,({\it{lst\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{norm}}\,({\rm{car}}\,({\it{lst\/}}))\index{norm} $\leq$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{max-below}}\,({\it{alpha\/}}, {\rm{cdr}}\,({\it{lst\/}}), {\it{n\/}})\index{max-below}, {\rm{car}}\,({\it{lst\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{car}}\,({\it{lst\/}}), {\it{alpha\/}})\-$\;\;${\bf then }{\rm{car}}\,({\it{lst\/}}) \\ 
{\bf else }{\rm{max-below}}\,({\it{alpha\/}}, {\rm{cdr}}\,({\it{lst\/}}), {\it{n\/}})\index{max-below}$\;${\bf  endif}\- \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; let's prove the basic properties of this and then disable it

\end{verbatim}\begin{tabbing}{\sc Theorem}:  max-below-is-an-ordinal \\ \index{max-below-is-an-ordinal}
{\rm{ordinalp}}\,({\rm{max-below}}\,({\it{alpha\/}}, {\it{lst\/}}, {\it{n\/}})\index{max-below})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  max-below-is-below \\ \index{max-below-is-below}
{\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}}) $\rightarrow$ {\rm{ord-lessp}}\,({\rm{max-below}}\,({\it{alpha\/}}, {\it{lst\/}}, {\it{n\/}})\index{max-below}, {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  max-below-is-max \\ \index{max-below-is-max}
\=\+(\=\+{\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{norm}}\,({\it{beta\/}})\index{norm} $\leq$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{beta\/}} $\in$ {\it{lst\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{beta\/}}, {\it{alpha\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{ord-lessp}}\,({\rm{max-below}}\,({\it{alpha\/}}, {\it{lst\/}}, {\it{n\/}})\index{max-below}, {\it{beta\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-max-below \\ \index{norm-of-max-below}
{\rm{norm}}\,({\rm{max-below}}\,({\it{alpha\/}}, {\it{lst\/}}, {\it{n\/}})\index{max-below})\index{norm} $\leq$ {\it{n\/}}
\end{tabbing}


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

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  max-below-of-0 \\ \index{max-below-of-0}
{\rm{max-below}}\,({\tt{0}}, {\it{lst\/}}, {\it{n\/}})\index{max-below} $=$ {\tt{0}}
\end{tabbing}

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

\addvspace{18pt}


\noindent{\sc Event}:   Disable max-below.

\addvspace{18pt}  \begin{verbatim}; we just need its properties

; now, we want to define {alpha}(n) = the largest
; ordinal < alpha with norm <= norm(alpha) + magic(n)
; The basic properties of magic have been derived in the 
; beginning arithmetic section

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{pred} \\  
\=\+{\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred} \\ 
$=$$\;\;\;\;${\rm{max-below}}\,(\=\+{\it{alpha\/}}, \\ 
{\rm{norm-up-to}}\,({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic})\index{norm-up-to}, \\ 
{\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic})\-\index{max-below}\-
\end{tabbing}

\begin{verbatim}; let's prove the basic properties of this and then disable it
; that is -- (pred 0 n) = 0
; if alpha > 0, then (pred alpha n) < alpha and is the largest
; ordinal < alpha whose norm <= (norm alpha) + magic(n)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pred-of-0 \\ \index{pred-of-0}
{\rm{pred}}\,({\tt{0}}, {\it{n\/}})\index{pred} $=$ {\tt{0}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-is-below \\ \index{pred-is-below}
{\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}}) $\rightarrow$ {\rm{ord-lessp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred}, {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-is-an-ordinal \\ \index{pred-is-an-ordinal}
{\rm{ordinalp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  upper-bound-on-norm-of-pred \\ \index{upper-bound-on-norm-of-pred}
{\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{norm} $\leq$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-is-largest \\ \index{pred-is-largest}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{norm}}\,({\it{beta\/}})\index{norm} $\leq$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic})) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{beta\/}}, {\it{alpha\/}}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\it{beta\/}}, {\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{ord-leq}\-
\end{tabbing}


\noindent{\sc Event}:   Disable pred.

\addvspace{18pt}

\begin{verbatim}; let's compute the norm of (pred alpha n) when alpha is a limit.

\end{verbatim}
\noindent{\sc Event}:   Enable ord-lessp.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  pred-below-limit \\ \index{pred-below-limit}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{limitp}}\,({\it{alpha\/}})\index{limitp}) $\rightarrow$ {\rm{ord-lessp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred}, {\it{alpha\/}})
\end{tabbing}

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

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  norm-of-pred-of-limit-aux1 \\ \index{norm-of-pred-of-limit-aux1}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{limitp}}\,({\it{alpha\/}})\index{limitp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{successor}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{successor}, {\it{alpha\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-pred-of-limit-aux2 \\ \index{norm-of-pred-of-limit-aux2}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{limitp}}\,({\it{alpha\/}})\index{limitp}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic}) $<$ {\rm{norm}}\,({\rm{successor}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{successor})\index{norm})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-pred-of-limit-aux3 \\ \index{norm-of-pred-of-limit-aux3}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{limitp}}\,({\it{alpha\/}})\index{limitp}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic}) $<$ ($1\;+$ {\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{norm}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-pred-of-limit \\ \index{norm-of-pred-of-limit}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{limitp}}\,({\it{alpha\/}})\index{limitp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{norm} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable norm-of-pred-of-limit-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-of-pred-of-limit-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-of-pred-of-limit-aux3.

\addvspace{18pt}

\begin{verbatim}; now, consider (pred alpha n) for successor alpha

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pred-of-succ-aux1 \\ \index{pred-of-succ-aux1}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}) $\rightarrow$ {\rm{ord-lessp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred}, {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-of-succ-aux2 \\ \index{pred-of-succ-aux2}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred}, {\rm{predecessor}}\,({\it{alpha\/}})\index{predecessor})\index{ord-leq}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-of-succ-aux3 \\ \index{pred-of-succ-aux3}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{predecessor}}\,({\it{alpha\/}})\index{predecessor})\index{norm} $\leq$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-of-succ-aux4 \\ \index{pred-of-succ-aux4}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\rm{predecessor}}\,({\it{alpha\/}})\index{predecessor}, {\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{ord-leq}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-of-succ \\ \index{pred-of-succ}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred} $=$ {\rm{predecessor}}\,({\it{alpha\/}})\index{predecessor})\-
\end{tabbing}


\noindent{\sc Event}:   Disable pred-of-succ-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pred-of-succ-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pred-of-succ-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pred-of-succ-aux4.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  norm-of-pred-of-succ \\ \index{norm-of-pred-of-succ}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{norm} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $-\;1$))\-
\end{tabbing}

\begin{verbatim}; now, by cases {alpha}(n) has norm at least ||alpha||-1 for all alpha

\end{verbatim}\begin{tabbing}{\sc Theorem}:  lower-bound-on-norm-of-pred \\ \index{lower-bound-on-norm-of-pred}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ ({\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{norm} $\not<$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $-\;1$))
\end{tabbing}


\begin{verbatim};;;;;;;;; pred of a sharp

; if beta > 0,
; we show:  alpha # {beta}(n) <= {alpha # beta}(n)
; the proof is
; 1.  alpha # {beta}(n) < alpha # beta by monotonicity of #
; 2.  norm(alpha # {beta}(n)) <= norm(alpha # beta) + magic(n)
; 3. Result follows by lemma "pred-is-largest"

; step 1

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pred-sharp-below \\ \index{pred-sharp-below}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\it{n\/}})\index{pred})\index{sharp}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\-
\end{tabbing}

\begin{verbatim}; step 2

\end{verbatim}\begin{tabbing}{\sc Theorem}:  norm-of-pred-sharp \\ \index{norm-of-pred-sharp}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{norm}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\it{n\/}})\index{pred})\index{sharp})\index{norm} \\ 
$\leq$$\;\;\;\;$({\rm{norm}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{norm} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic}))\-\-
\end{tabbing}

\begin{verbatim}; step 3

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pred-sharp \\ \index{pred-sharp}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\it{n\/}})\index{pred})\index{sharp}, {\rm{pred}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp}, {\it{n\/}})\index{pred})\index{ord-leq}\-
\end{tabbing}


\begin{verbatim};;;;;;;;  monotonicity of pred

; {alpha}(n) is a monotonic function of n

; first, a trivial fact about ord-leq

\end{verbatim}
\noindent{\sc Event}:   Enable ord-leq.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  ord-leq-is-idempotent \\ \index{ord-leq-is-idempotent}
{\rm{ord-leq}}\,({\it{x\/}}, {\it{x\/}})\index{ord-leq}
\end{tabbing}

\noindent{\sc Event}:   Disable ord-leq.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  monot-of-pred-aux1 \\ \index{monot-of-pred-aux1}
\=\+(\=\+{\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\leq$ {\it{n\/}}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{m\/}})\index{pred}, {\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{ord-leq}\-
\end{tabbing}
		
\begin{tabbing}{\sc Theorem}:  monot-of-pred-aux2 \\ \index{monot-of-pred-aux2}
\=\+(\=\+($\neg$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\leq$ {\it{n\/}}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{m\/}})\index{pred}, {\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{ord-leq}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monot-of-pred \\ \index{monot-of-pred}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{m\/}} $\leq$ {\it{n\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{m\/}})\index{pred}, {\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{ord-leq}\-
\end{tabbing}


\noindent{\sc Event}:   Disable monot-of-pred-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monot-of-pred-aux2.

\addvspace{18pt}

\begin{verbatim}; the norm of pred is also monotonic
; we can prove this by cases -- successor, limit, 0

\end{verbatim}\begin{tabbing}{\sc Theorem}:  monot-of-norm-of-pred-aux1 \\ \index{monot-of-norm-of-pred-aux1}
\=\+(({\it{alpha\/}} $=$ {\tt{0}}) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{m\/}} $\leq$ {\it{n\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{norm} $\not<$ {\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{m\/}})\index{pred})\index{norm})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monot-of-norm-of-pred-aux2 \\ \index{monot-of-norm-of-pred-aux2}
\=\+({\rm{limitp}}\,({\it{alpha\/}})\index{limitp} $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{m\/}} $\leq$ {\it{n\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{norm} $\not<$ {\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{m\/}})\index{pred})\index{norm})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monot-of-norm-of-pred-aux3 \\ \index{monot-of-norm-of-pred-aux3}
\=\+({\rm{successorp}}\,({\it{alpha\/}})\index{successorp} $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{m\/}} $\leq$ {\it{n\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{norm} $\not<$ {\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{m\/}})\index{pred})\index{norm})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  monot-of-norm-of-pred \\ \index{monot-of-norm-of-pred}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{m\/}} $\leq$ {\it{n\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{norm} $\not<$ {\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{m\/}})\index{pred})\index{norm})\-
\end{tabbing}


\noindent{\sc Event}:   Disable monot-of-norm-of-pred-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monot-of-norm-of-pred-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable monot-of-norm-of-pred-aux3.

\addvspace{18pt}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                           O-LARGE SETS                                 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; We define the notion :  X is alpha-large
; It is intended that X is a set in standard form, so the car is the min
; Largep was the Paris-Harrington defn of large; 
; o-largep is ordinal version

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{o-largep} \\  
\=\+{\rm{o-largep}}\,({\it{set\/}}, {\it{alpha\/}})\index{o-largep} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{alpha\/}} $=$ {\tt{0}}$\;\;${\bf then }{\bf{t}} \\ 
{\bf elseif }{\it{set\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{f}} \\ 
{\bf else }{\rm{o-largep}}\,({\rm{cdr}}\,({\it{set\/}}), {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{set\/}}))\index{pred})\index{o-largep}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; prove the basic properties and then disable the defn

; base cases

\end{verbatim}\begin{tabbing}{\sc Theorem}:  all-zero-large \\ \index{all-zero-large}
{\rm{o-largep}}\,({\it{set\/}}, {\tt{0}})\index{o-largep}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  empty-not-large \\ \index{empty-not-large}
(({\it{alpha\/}} $\not=$ {\tt{0}}) $\wedge$ ({\it{set\/}} $\simeq\;${{\bf{nil}}}${}$)) $\rightarrow$ ($\neg$ {\rm{o-largep}}\,({\it{set\/}}, {\it{alpha\/}})\index{o-largep})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  recursive-case-for-large \\ \index{recursive-case-for-large}
\=\+({\rm{listp}}\,({\it{set\/}}) $\wedge$ ({\it{alpha\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{o-largep}}\,({\it{set\/}}, {\it{alpha\/}})\index{o-largep} $=$ {\rm{o-largep}}\,({\rm{cdr}}\,({\it{set\/}}), {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{set\/}}))\index{pred})\index{o-largep})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  positive-large \\ \index{positive-large}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ($\neg$ {\rm{o-largep}}\,({\it{set\/}}, {\it{alpha\/}})\index{o-largep})) $\rightarrow$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable o-largep.

\addvspace{18pt}


\begin{verbatim}; lookat alpha-large when alpha is a successor ordinal

\end{verbatim}\begin{tabbing}{\sc Theorem}:  successor-large-non-empty \\ \index{successor-large-non-empty}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp} $\wedge$ ($\neg$ {\rm{listp}}\,({\it{set\/}}))) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\it{set\/}}, {\it{alpha\/}})\index{o-largep})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  successor-large \\ \index{successor-large}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{successorp}}\,({\it{alpha\/}})\index{successorp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{o-largep}}\,({\it{set\/}}, {\it{alpha\/}})\index{o-largep} \\ 
$=$$\;\;\;\;$({\rm{listp}}\,({\it{set\/}}) $\wedge$ {\rm{o-largep}}\,({\rm{cdr}}\,({\it{set\/}}), {\rm{predecessor}}\,({\it{alpha\/}})\index{predecessor})\index{o-largep}))\-\-
\end{tabbing}

\begin{verbatim}; lookat n-large for numbers n

\end{verbatim}\begin{tabbing}{\sc Theorem}:  number-large \\ \index{number-large}
({\it{n\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{o-largep}}\,({\it{set\/}}, {\it{n\/}})\index{o-largep} $=$ ({\it{n\/}} $\leq$ {\rm{length}}\,({\it{set\/}})\index{length}))
\end{tabbing}

\begin{verbatim};;;;;;;;;;;;  omega
; more on omega = '(1 . 0)
; we want to discuss  omega-large -- but first
; we need to discuss {omega}(n) = magic(n) + 2

\end{verbatim}\begin{tabbing}{\sc Theorem}:  omega-is-a-limit \\ \index{omega-is-a-limit}
{\rm{limitp}}\,({\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}})\index{limitp}
\end{tabbing}


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

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  numbers-below-omega \\ \index{numbers-below-omega}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-lessp}}\,({\it{alpha\/}}, {\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}})) $\rightarrow$ ({\it{alpha\/}} $\in\;${\bf{N}}${}$)
\end{tabbing}

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

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  pred-of-omega-aux1 \\ \index{pred-of-omega-aux1}
{\rm{pred}}\,({\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}}, {\it{n\/}})\index{pred} $\in\;${\bf{N}}${}$
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-of-omega-aux2 \\ \index{pred-of-omega-aux2}
({\it{n\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{norm}}\,({\rm{pred}}\,({\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}}, {\it{n\/}})\index{pred})\index{norm} $=$ ({\rm{magic}}\,({\it{n\/}})\index{magic} $+$ {\tt{2}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-of-omega \\ \index{pred-of-omega}
({\it{n\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{pred}}\,({\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}}, {\it{n\/}})\index{pred} $=$ ({\rm{magic}}\,({\it{n\/}})\index{magic} $+$ {\tt{2}}))
\end{tabbing}


\noindent{\sc Event}:   Disable pred-of-omega-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pred-of-omega-aux2.

\addvspace{18pt}

\begin{verbatim}; now, consider omega-large -- here
; we use (setp set) -- so we know that (car set) is a number

\end{verbatim}
\noindent{\sc Event}:   Enable setp.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  car-of-a-set \\ \index{car-of-a-set}
{\rm{setp}}\,({\rm{cons}}\,({\it{x\/}}, {\it{tail\/}}))\index{setp} $\rightarrow$ ({\it{x\/}} $\in\;${\bf{N}}${}$)
\end{tabbing}

\noindent{\sc Event}:   Disable setp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  omega-large \\ \index{omega-large}
\=\+({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{set\/}}, {\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}})\index{o-largep}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{listp}}\,({\it{set\/}}) $\wedge$ (({\rm{magic}}\,({\rm{car}}\,({\it{set\/}}))\index{magic} $+$ {\tt{3}}) $\leq$ {\rm{length}}\,({\it{set\/}})\index{length}))\-
\end{tabbing} 

\begin{verbatim}; in particular, omega-large implies large in the Paris-Harrington sense:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  omega-large-implies-large \\ \index{omega-large-implies-large}
({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{set\/}}, {\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}})\index{o-largep}) $\rightarrow$ {\rm{largep}}\,({\it{set\/}})\index{largep}
\end{tabbing}


\begin{verbatim};;;;;;;;; let's see what it means for a singleton to be alpha-large
; this can only happen for alpha = 0 or 1
; First, note that {alpha}(n) = 0 implies alpha is 0 or 1

\end{verbatim}\begin{tabbing}{\sc Theorem}:  norm-above-1-aux1 \\ \index{norm-above-1-aux1}
\=\+(({\it{alpha\/}} $\in\;${\bf{N}}${}$) $\wedge$ {\rm{ord-lessp}}\,({\tt{1}}, {\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\tt{1}} $<$ {\rm{norm}}\,({\it{alpha\/}})\index{norm})\-
\end{tabbing}


\noindent{\sc Event}:   Enable norm.

\addvspace{18pt}

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

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  norm-above-1-aux2 \\ \index{norm-above-1-aux2}
\=\+(({\it{alpha\/}} $\not\in\;${\bf{N}}${}$) $\wedge$ {\rm{ord-lessp}}\,({\tt{1}}, {\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\tt{1}} $<$ {\rm{norm}}\,({\it{alpha\/}})\index{norm})\-
\end{tabbing}

\noindent{\sc Event}:   Disable norm.

\addvspace{18pt}

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

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  norm-above-1 \\ \index{norm-above-1}
({\rm{ord-lessp}}\,({\tt{1}}, {\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}})) $\rightarrow$ ({\tt{1}} $<$ {\rm{norm}}\,({\it{alpha\/}})\index{norm})
\end{tabbing}


\noindent{\sc Event}:   Disable norm-above-1-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-above-1-aux2.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  pred-not-0 \\ \index{pred-not-0}
({\rm{ord-lessp}}\,({\tt{1}}, {\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}})) $\rightarrow$ {\rm{ord-leq}}\,({\tt{1}}, {\rm{pred}}\,({\it{alpha\/}}, {\it{n\/}})\index{pred})\index{ord-leq}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  singletons-not-large \\ \index{singletons-not-large}
\=\+({\rm{o-largep}}\,({\it{set\/}}, {\it{alpha\/}})\index{o-largep} $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-lessp}}\,({\tt{1}}, {\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{listp}}\,({\rm{cdr}}\,({\it{set\/}}))\-
\end{tabbing}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                      O-LARGE AND SUBSETS                               ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; The main fact here is:  Let x = min(X) = car(X).
; If X is beta-large, alpha <= beta, X is a subset of Y
; and norm(alpha) <= norm(beta) + magic(x),
; then Y is alpha-large.
; This is true even if X is empty, since then beta = alpha = 0
; (and x = car(nil) = 0)

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-large-superset-ord} \\  
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{y\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{x\/}}, {\it{y\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\it{beta\/}})\index{o-largep} \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\it{alpha\/}}, {\it{beta\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\rm{norm}}\,({\it{alpha\/}})\index{norm} $\leq$ ({\rm{norm}}\,({\it{beta\/}})\index{norm} $+$ {\rm{magic}}\,({\rm{car}}\,({\it{x\/}}))\index{magic})) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\it{y\/}}, {\it{alpha\/}})\index{o-largep}))\-\-
\end{tabbing}

\begin{verbatim}; we want to show this can't happen.  
; first, some base cases

\end{verbatim}\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux1 \\ \index{large-superset-ord-aux1}
{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\rightarrow$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux2 \\ \index{large-superset-ord-aux2}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\it{alpha\/}}, {\it{beta\/}})\index{ord-leq})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux3 \\ \index{large-superset-ord-aux3}
{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\rightarrow$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}})
\end{tabbing}

\begin{verbatim}; so, alpha and beta are larger than 0
; next, check that can't have alpha = beta = 1

\end{verbatim}\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux4 \\ \index{large-superset-ord-aux4}
$\neg$ {\rm{bad-for-large-superset-ord}}\,({\tt{1}}, {\tt{1}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord}
\end{tabbing}

\begin{verbatim}; now,  show X can't be a singleton, and alpha > 1

\end{verbatim}\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux5 \\ \index{large-superset-ord-aux5}
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\rightarrow$$\;\;\;\;$({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}))\-
\end{tabbing}
	
\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux6 \\ \index{large-superset-ord-aux6}
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\rightarrow$$\;\;\;\;$({\rm{ord-lessp}}\,({\tt{1}}, {\it{alpha\/}}) $\vee$ {\rm{ord-lessp}}\,({\tt{1}}, {\it{beta\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux7 \\ \index{large-superset-ord-aux7}
{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\rightarrow$ {\rm{ord-leq}}\,({\it{alpha\/}}, {\it{beta\/}})\index{ord-leq}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux8 \\ \index{large-superset-ord-aux8}
{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\rightarrow$ {\rm{ord-lessp}}\,({\tt{1}}, {\it{beta\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux9 \\ \index{large-superset-ord-aux9}
{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\rightarrow$ {\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}}))
\end{tabbing}

\begin{verbatim}; now, we want to show that
; (bad-for-large-superset-ord alpha beta X Y) is always false
; we know it implies alpha > 0, beta > 1, and X, Y are lists (i.e., not empty)
; the induction splits into two cases:

; Case 1:  alpha = beta
; we show (bad-for-large-superset-ord
;        (pred alpha (car Y)) (pred alpha (car X)) (cdr X)  (cdr Y) )
; Case 2: alpha < beta
; we show (bad-for-large-superset-ord
;        alpha (pred beta (car X)) (cdr X)   Y )

; BEGIN Case 1  alpha = beta
; we check the various clauses in bad for
;        (pred alpha (car Y))  (pred alpha (car X)) (cdr X)  (cdr Y) 
; as much as possible, we keep alpha, beta separate
; so the work can be used in Case 2

\end{verbatim}\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux10 \\ \index{large-superset-ord-aux10}
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\rightarrow$$\;\;\;\;$({\rm{ordinalp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{y\/}}))\index{pred}) $\wedge$ {\rm{ordinalp}}\,({\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux11 \\ \index{large-superset-ord-aux11}
{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\rightarrow$ ({\rm{listp}}\,({\it{x\/}}) $\wedge$ {\rm{listp}}\,({\it{y\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux12 \\ \index{large-superset-ord-aux12}
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\rightarrow$$\;\;\;\;$({\rm{setp}}\,({\rm{cdr}}\,({\it{x\/}}))\index{setp} $\wedge$ {\rm{setp}}\,({\rm{cdr}}\,({\it{y\/}}))\index{setp})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux13 \\ \index{large-superset-ord-aux13}
{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\rightarrow$ {\rm{subsetp}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{cdr}}\,({\it{y\/}}))\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux14 \\ \index{large-superset-ord-aux14}
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred})\index{o-largep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux15 \\ \index{large-superset-ord-aux15}
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{alpha\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{y\/}}))\index{pred}, {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred})\index{ord-leq}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux16 \\ \index{large-superset-ord-aux16}
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{alpha\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{y\/}}))\index{pred})\index{norm} \\ 
$\leq$$\;\;\;\;$({\rm{norm}}\,({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred})\index{norm} $+$ {\rm{magic}}\,({\rm{car}}\,({\rm{cdr}}\,({\it{x\/}})))\index{magic}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux17 \\ \index{large-superset-ord-aux17}
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{alpha\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{cdr}}\,({\it{y\/}}), {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{y\/}}))\index{pred})\index{o-largep})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux18 \\ \index{large-superset-ord-aux18}
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{alpha\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-large-superset-ord}}\,(\=\+{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{y\/}}))\index{pred}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred}, \\ 
{\rm{cdr}}\,({\it{x\/}}), \\ 
{\rm{cdr}}\,({\it{y\/}}))\-\index{bad-for-large-superset-ord}\-
\end{tabbing}

\begin{verbatim}; END Case 1

; BEGIN  Case 2: alpha < beta
; we check the various requrements for
;  (bad-for-large-superset-ord alpha (pred beta (car X)) (cdr X)   Y)
; alpha and (pred beta (car X)) are ordinals by  the defn of bad and aux10
; (cdr X) and Y are sets by the defn of bad and aux12
; (o-largep (cdr X) (pred beta (car X)))  by aux14
; (not (o-largep Y alpha))  by defn of bad
; next 

\end{verbatim}\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux19 \\ \index{large-superset-ord-aux19}
\=\+({\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\wedge$ {\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred})\index{ord-leq}\-
\end{tabbing}


\begin{verbatim}; finally, we have to use (car X) < (cadr X) with the
; following simple ordinal fact:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux20 \\ \index{large-superset-ord-aux20}
\=\+({\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ ({\it{v\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{z\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{v\/}} $<$ {\it{z\/}})) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{norm}}\,({\it{beta\/}})\index{norm} $+$ {\rm{magic}}\,({\it{v\/}})\index{magic}) $\leq$ ({\rm{norm}}\,({\rm{pred}}\,({\it{beta\/}}, {\it{z\/}})\index{pred})\index{norm} $+$ {\rm{magic}}\,({\it{z\/}})\index{magic}))\-
\end{tabbing}
\begin{verbatim}; we use this with v = (car X) and z = (cadr X)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux21 \\ \index{large-superset-ord-aux21}
{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\rightarrow$ ({\rm{car}}\,({\it{x\/}}) $<$ {\rm{cadr}}\,({\it{x\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux22 \\ \index{large-superset-ord-aux22}
\=\+({\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\wedge$ {\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\it{alpha\/}})\index{norm} $\leq$ ({\rm{norm}}\,({\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred})\index{norm} $+$ {\rm{magic}}\,({\rm{car}}\,({\rm{cdr}}\,({\it{x\/}})))\index{magic}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux23 \\ \index{large-superset-ord-aux23}
{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\rightarrow$ {\rm{subsetp}}\,({\rm{cdr}}\,({\it{x\/}}), {\it{y\/}})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux24 \\ \index{large-superset-ord-aux24}
\=\+({\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\wedge$ {\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred}, {\rm{cdr}}\,({\it{x\/}}), {\it{y\/}})\index{bad-for-large-superset-ord}\-
\end{tabbing}

\begin{verbatim}; END Case 2

; now, we should show that case 1 or case 2 holds

\end{verbatim}\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux25 \\ \index{large-superset-ord-aux25}
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\rightarrow$$\;\;\;\;$({\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}}) $\vee$ ({\it{alpha\/}} $=$ {\it{beta\/}}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable large-superset-ord-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux9.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux10.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux11.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux12.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux13.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux14.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux15.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux16.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux17.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux18.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux19.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux21.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux22.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux23.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux24.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux25.

\addvspace{18pt}

\begin{verbatim}; summarizing

\end{verbatim}\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux26 \\ \index{large-superset-ord-aux26}
\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred}, {\rm{cdr}}\,({\it{x\/}}), {\it{y\/}})\index{bad-for-large-superset-ord} \\ 
$\vee$$\;\;\;\;${\rm{bad-for-large-superset-ord}}\,(\=\+{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{y\/}}))\index{pred}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred}, \\ 
{\rm{cdr}}\,({\it{x\/}}), \\ 
{\rm{cdr}}\,({\it{y\/}}))\-\index{bad-for-large-superset-ord})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux27 \\ \index{large-superset-ord-aux27}
{\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord} $\rightarrow$ {\rm{listp}}\,({\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{large-superset-ord-kludge} \\  
\=\+{\rm{large-superset-ord-kludge}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{large-superset-ord-kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }\=\+{\rm{large-superset-ord-kludge}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred}, {\rm{cdr}}\,({\it{x\/}}), {\it{y\/}})\index{large-superset-ord-kludge} \\ 
$+$$\;\;\;\;${\rm{large-superset-ord-kludge}}\,(\=\+{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{y\/}}))\index{pred}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred}, \\ 
{\rm{cdr}}\,({\it{x\/}}), \\ 
{\rm{cdr}}\,({\it{y\/}}))\-\index{large-superset-ord-kludge}\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux28 \\ \index{large-superset-ord-aux28}
\=\+(\=\+($\neg$ {\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred}, {\rm{cdr}}\,({\it{x\/}}), {\it{y\/}})\index{bad-for-large-superset-ord}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{bad-for-large-superset-ord}}\,(\=\+{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{y\/}}))\index{pred}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{x\/}}))\index{pred}, \\ 
{\rm{cdr}}\,({\it{x\/}}), \\ 
{\rm{cdr}}\,({\it{y\/}}))\-\index{bad-for-large-superset-ord}))\- \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord-aux29 \\ \index{large-superset-ord-aux29}
$\neg$ {\rm{bad-for-large-superset-ord}}\,({\it{alpha\/}}, {\it{beta\/}}, {\it{x\/}}, {\it{y\/}})\index{bad-for-large-superset-ord}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-superset-ord \\ \index{large-superset-ord}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{y\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{x\/}}, {\it{y\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\it{beta\/}})\index{o-largep} \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\it{alpha\/}}, {\it{beta\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\rm{norm}}\,({\it{alpha\/}})\index{norm} $\leq$ ({\rm{norm}}\,({\it{beta\/}})\index{norm} $+$ {\rm{magic}}\,({\rm{car}}\,({\it{x\/}}))\index{magic})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\it{y\/}}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}


\noindent{\sc Event}:   Disable large-superset-ord-aux26.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux27.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux28.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-aux29.

\addvspace{18pt}

\noindent{\sc Event}:   Disable large-superset-ord-kludge.

\addvspace{18pt}


\begin{verbatim};;;;;;;; two important special cases

; Special case 1 -- alpha = beta

\end{verbatim}\begin{tabbing}{\sc Theorem}:  large-goes-up \\ \index{large-goes-up}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{y\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{x\/}}, {\it{y\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\it{alpha\/}})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\it{y\/}}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}

\begin{verbatim}; Special case 2 -- X = Y

\end{verbatim}\begin{tabbing}{\sc Theorem}:  subsetp-is-idempotent \\ \index{subsetp-is-idempotent}
{\rm{subsetp}}\,({\it{s\/}}, {\it{s\/}})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  large-with-smaller-ord \\ \index{large-with-smaller-ord}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\it{beta\/}})\index{o-largep} \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\it{alpha\/}}, {\it{beta\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\rm{norm}}\,({\it{alpha\/}})\index{norm} $\leq$ ({\rm{norm}}\,({\it{beta\/}})\index{norm} $+$ {\rm{magic}}\,({\rm{car}}\,({\it{x\/}}))\index{magic})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                              PIGEON-2                                  ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; this is the two-set pigeon-hole principle:
; if X is a subset of A union B, and X is alpha # beta-large
; then A is alpha-large or B is beta-large

;;;;;; covers
; Rather than define union, we just define what it means
; for A union B to cover X

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{covers} \\  
\=\+{\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }\=\+{\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{covers} \\ 
$\wedge$$\;\;\;\;$(({\rm{car}}\,({\it{x\/}}) $\in$ {\it{a\/}}) $\vee$ ({\rm{car}}\,({\it{x\/}}) $\in$ {\it{b\/}}))\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; some basic lemmas expressing the recursion

\end{verbatim}\begin{tabbing}{\sc Theorem}:  covers-empty \\ \index{covers-empty}
({\it{x\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  covers-negative \\ \index{covers-negative}
({\rm{listp}}\,({\it{x\/}}) $\wedge$ ({\rm{car}}\,({\it{x\/}}) $\not\in$ {\it{a\/}}) $\wedge$ ({\rm{car}}\,({\it{x\/}}) $\not\in$ {\it{b\/}})) $\rightarrow$ ($\neg$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  covers-positive-a \\ \index{covers-positive-a}
({\rm{listp}}\,({\it{x\/}}) $\wedge$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{covers} $\wedge$ ({\rm{car}}\,({\it{x\/}}) $\in$ {\it{a\/}})) $\rightarrow$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  covers-positive-b \\ \index{covers-positive-b}
({\rm{listp}}\,({\it{x\/}}) $\wedge$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{covers} $\wedge$ ({\rm{car}}\,({\it{x\/}}) $\in$ {\it{b\/}})) $\rightarrow$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-of-covered-set \\ \index{member-of-covered-set}
(({\it{u\/}} $\in$ {\it{x\/}}) $\wedge$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers}) $\rightarrow$ (({\it{u\/}} $\in$ {\it{a\/}}) $\vee$ ({\it{u\/}} $\in$ {\it{b\/}}))
\end{tabbing}

\begin{verbatim}; if A,B don't cover X, we can compute an element of X which is not covered

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{uncovered} \\  
\=\+{\rm{uncovered}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{uncovered} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }{\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{covers}$\;\;${\bf then }{\rm{car}}\,({\it{x\/}}) \\ 
{\bf else }{\rm{uncovered}}\,({\it{a\/}}, {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{uncovered}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  uncovered-isnt-covered \\ \index{uncovered-isnt-covered}
\=\+($\neg$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{uncovered}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{uncovered} $\in$ {\it{x\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{uncovered}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{uncovered} $\not\in$ {\it{a\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{uncovered}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{uncovered} $\not\in$ {\it{b\/}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-is-covered \\ \index{cdr-is-covered}
{\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} $\rightarrow$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{covers}
\end{tabbing}

\begin{verbatim}; we probably don't need the defn of covers any more

\end{verbatim}
\noindent{\sc Event}:   Disable covers.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  covers-is-symmetric \\ \index{covers-is-symmetric}
{\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} $\rightarrow$ {\rm{covers}}\,({\it{b\/}}, {\it{a\/}}, {\it{x\/}})\index{covers}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  discard-the-car-a \\ \index{discard-the-car-a}
({\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} $\wedge$ {\rm{listp}}\,({\it{a\/}}) $\wedge$ ({\rm{car}}\,({\it{a\/}}) $\not\in$ {\it{x\/}})) $\rightarrow$ {\rm{covers}}\,({\rm{cdr}}\,({\it{a\/}}), {\it{b\/}}, {\it{x\/}})\index{covers}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  discard-the-car-b \\ \index{discard-the-car-b}
({\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} $\wedge$ {\rm{listp}}\,({\it{b\/}}) $\wedge$ ({\rm{car}}\,({\it{b\/}}) $\not\in$ {\it{x\/}})) $\rightarrow$ {\rm{covers}}\,({\it{a\/}}, {\rm{cdr}}\,({\it{b\/}}), {\it{x\/}})\index{covers}
\end{tabbing}

\begin{verbatim};;;;  for sets
; special facts, for standard sets, using min-is-first

\end{verbatim}\begin{tabbing}{\sc Theorem}:  discard-the-car-set-a \\ \index{discard-the-car-set-a}
\=\+({\rm{setp}}\,({\it{a\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{a\/}}) $\wedge$ {\rm{setp}}\,({\it{x\/}})\index{setp} $\wedge$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} $\wedge$ ({\rm{car}}\,({\it{a\/}}) $<$ {\rm{car}}\,({\it{x\/}}))) \\ 
$\rightarrow$$\;\;\;\;${\rm{covers}}\,({\rm{cdr}}\,({\it{a\/}}), {\it{b\/}}, {\it{x\/}})\index{covers}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  discard-the-car-set-b \\ \index{discard-the-car-set-b}
\=\+({\rm{setp}}\,({\it{b\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{b\/}}) $\wedge$ {\rm{setp}}\,({\it{x\/}})\index{setp} $\wedge$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} $\wedge$ ({\rm{car}}\,({\it{b\/}}) $<$ {\rm{car}}\,({\it{x\/}}))) \\ 
$\rightarrow$$\;\;\;\;${\rm{covers}}\,({\it{a\/}}, {\rm{cdr}}\,({\it{b\/}}), {\it{x\/}})\index{covers}\-
\end{tabbing}

\begin{verbatim}; now if X is non-empty and covered by A union B --
; there are two cases
; 1.  A is non-empty and its min is <= min X
; 2.  B is non-empty and its min is <= min X
; in case 1, (cdr X) is covered by (cdr A) union B
; likewise in case 2

; the two cases
\end{verbatim}\begin{tabbing}{\sc Theorem}:  smaller-car-when-covered \\ \index{smaller-car-when-covered}
\=\+({\rm{setp}}\,({\it{a\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{b\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{x\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{x\/}}) $\wedge$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{listp}}\,({\it{a\/}}) $\wedge$ ({\rm{car}}\,({\it{a\/}}) $\leq$ {\rm{car}}\,({\it{x\/}}))) \\ 
$\vee$$\;\;\;\;$({\rm{listp}}\,({\it{b\/}}) $\wedge$ ({\rm{car}}\,({\it{b\/}}) $\leq$ {\rm{car}}\,({\it{x\/}}))))\-\-
\end{tabbing}

\begin{verbatim}; now, consider case 1
; as auxiliaries, we consider sub-cases depending on whether
; (cdr X) is empty or not

; first, if (cdr X) is non-empty
\end{verbatim}\begin{tabbing}{\sc Theorem}:  cdr-is-covered-set-a-aux1 \\ \index{cdr-is-covered-set-a-aux1}
\=\+(\=\+{\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{a\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{b\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{a\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{a\/}}) $\leq$ {\rm{car}}\,({\it{x\/}})))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\it{a\/}}) $<$ {\rm{cadr}}\,({\it{x\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-is-covered-set-a-aux2 \\ \index{cdr-is-covered-set-a-aux2}
\=\+(\=\+{\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{a\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{b\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{a\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{a\/}}) $\leq$ {\rm{car}}\,({\it{x\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{covers}}\,({\rm{cdr}}\,({\it{a\/}}), {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{covers}\-
\end{tabbing}

\begin{verbatim}; now, if cdr X is empty, it's trivial, so

\end{verbatim}\begin{tabbing}{\sc Theorem}:  cdr-is-covered-set-a \\ \index{cdr-is-covered-set-a}
\=\+(\=\+{\rm{setp}}\,({\it{a\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{b\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{a\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{a\/}}) $\leq$ {\rm{car}}\,({\it{x\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{covers}}\,({\rm{cdr}}\,({\it{a\/}}), {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{covers}\-
\end{tabbing}


\noindent{\sc Event}:   Disable cdr-is-covered-set-a-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-is-covered-set-a-aux2.

\addvspace{18pt}

\begin{verbatim}; now, by symmetry:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  cdr-is-covered-set-b \\ \index{cdr-is-covered-set-b}
\=\+(\=\+{\rm{setp}}\,({\it{a\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{b\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{b\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{b\/}}) $\leq$ {\rm{car}}\,({\it{x\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{covers}}\,({\it{a\/}}, {\rm{cdr}}\,({\it{b\/}}), {\rm{cdr}}\,({\it{x\/}}))\index{covers}\-
\end{tabbing}


\begin{verbatim};;;;;;;;;; sharp-and-cdr
; before going to pigeon-hole, we need a lemma that
; if X is alpha # beta - large, beta > 0, and m <= (car X) then
; (cdr X) is alpha # {beta}(m) -- large
; Also, by symmetry, the same holds for alpha/beta reversed
; X must be non-empty, since (cdr nil) = 0 -- not a set

; first observe that (cdr X) is {alpha # beta}(x) -- large

\end{verbatim}
\noindent{\sc Event}:   Enable o-largep.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-aux1 \\ \index{sharp-and-cdr-aux1}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{pred}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp}, {\rm{car}}\,({\it{x\/}}))\index{pred})\index{o-largep}\-
\end{tabbing}

\begin{verbatim}; now note that if (cdr X) is empty, {alpha # beta}(x) = 0
; this should be the "trivial" case

\end{verbatim}\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-aux2 \\ \index{sharp-and-cdr-aux2}
\=\+(\=\+({\rm{cdr}}\,({\it{x\/}}) $\simeq\;${{\bf{nil}}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{pred}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp}, {\rm{car}}\,({\it{x\/}}))\index{pred} $=$ {\tt{0}})\-
\end{tabbing}


\noindent{\sc Event}:   Disable o-largep.

\addvspace{18pt}

\begin{verbatim}; now, if m <= (car X) then alpha # {beta}(m) <= {alpha # beta}(car X)
; proof:  alpha # {beta}(m) <= {alpha # beta}(m) <= {alpha # beta}(car X)
; the first <= is by pred-sharp, the second by monoton of pred

\end{verbatim}\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-aux3 \\ \index{sharp-and-cdr-aux3}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\leq$ {\it{n\/}}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\it{m\/}})\index{pred})\index{sharp}, {\rm{pred}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp}, {\it{n\/}})\index{pred})\index{ord-leq}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-aux4 \\ \index{sharp-and-cdr-aux4}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\leq$ {\rm{car}}\,({\it{x\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\it{m\/}})\index{pred})\index{sharp}, {\rm{pred}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp}, {\rm{car}}\,({\it{x\/}}))\index{pred})\index{ord-leq}\-
\end{tabbing}

\begin{verbatim}; now, if (cdr X) is empty, alpha # {beta}(m) = 0

\end{verbatim}\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-aux5 \\ \index{sharp-and-cdr-aux5}
\=\+(\=\+{\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}}))) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{o-largep} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\leq$ {\rm{car}}\,({\it{x\/}})))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\it{m\/}})\index{pred})\index{sharp} $=$ {\tt{0}})\-
\end{tabbing}

\begin{verbatim}; in particular, our result is trivial if (cdr X) is empty

\end{verbatim}\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-aux6 \\ \index{sharp-and-cdr-aux6}
\=\+(\=\+($\neg$ {\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}}))) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\leq$ {\rm{car}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\it{m\/}})\index{pred})\index{sharp})\index{o-largep}\-
\end{tabbing}

\begin{verbatim}; now, consider the case where (cdr X) is non-empty

\end{verbatim}\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-aux7 \\ \index{sharp-and-cdr-aux7}
\=\+({\rm{setp}}\,({\it{x\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}})) $\wedge$ ({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{m\/}} $\leq$ {\rm{car}}\,({\it{x\/}}))) \\ 
$\rightarrow$$\;\;\;\;$({\it{m\/}} $<$ {\rm{cadr}}\,({\it{x\/}}))\-
\end{tabbing}

\begin{verbatim}; we have, from the above:
; aux1 : (o-largep (cdr X) (pred (sharp alpha beta) (car X))  )
; aux4
; (ord-leq (sharp alpha (pred beta m)) (pred (sharp alpha beta) (car X)) )
; aux7 :  m < (cadr X)
; we want to apply large-with-smaller-ordinal to (cdr X)
; so we need that
;  (norm (sharp alpha (pred beta m))) <= 
;    (plus (norm (pred (sharp alpha beta) (car X))) (magic (cadr X)))
; prove this separately, as a lemma:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-aux8 \\ \index{sharp-and-cdr-aux8}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{x0\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $<$ {\it{x1\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{norm}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\it{m\/}})\index{pred})\index{sharp})\index{norm} \\ 
$\leq$$\;\;\;\;$({\rm{norm}}\,({\rm{pred}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp}, {\it{x0\/}})\index{pred})\index{norm} $+$ {\rm{magic}}\,({\it{x1\/}})\index{magic}))\-\-
\end{tabbing}
\begin{verbatim}; intended :  x0 is (car X) ; x1 is (cadr x)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-aux9 \\ \index{sharp-and-cdr-aux9}
\=\+(\=\+{\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\leq$ {\rm{car}}\,({\it{x\/}})))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{norm}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\it{m\/}})\index{pred})\index{sharp})\index{norm} \\ 
$\leq$$\;\;\;\;$({\rm{norm}}\,({\rm{pred}}\,({\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp}, {\rm{car}}\,({\it{x\/}}))\index{pred})\index{norm} $+$ {\rm{magic}}\,({\rm{cadr}}\,({\it{x\/}}))\index{magic}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-aux10 \\ \index{sharp-and-cdr-aux10}
\=\+(\=\+{\rm{listp}}\,({\rm{cdr}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\leq$ {\rm{car}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\it{m\/}})\index{pred})\index{sharp})\index{o-largep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-b \\ \index{sharp-and-cdr-b}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\leq$ {\rm{car}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\it{m\/}})\index{pred})\index{sharp})\index{o-largep}\-
\end{tabbing}


\noindent{\sc Event}:   Disable sharp-and-cdr-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sharp-and-cdr-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sharp-and-cdr-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sharp-and-cdr-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sharp-and-cdr-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sharp-and-cdr-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sharp-and-cdr-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sharp-and-cdr-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sharp-and-cdr-aux9.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sharp-and-cdr-aux10.

\addvspace{18pt}

\begin{verbatim}; the same thing with alpha replacing beta follows automatically by symmetry

\end{verbatim}\begin{tabbing}{\sc Theorem}:  sharp-and-cdr-a \\ \index{sharp-and-cdr-a}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{x\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{m\/}} $\leq$ {\rm{car}}\,({\it{x\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{sharp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{m\/}})\index{pred}, {\it{beta\/}})\index{sharp})\index{o-largep}\-
\end{tabbing}


\begin{verbatim};;;;;;;;;;;  Proof of pigeon-2
; This is the version with 2 holes:
; if (covers A B X) and X is alpha # beta -- large
; then A is alpha -- large     or      B is beta -- large

; we prove this by induction, showing the following can't happen

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-pigeon-2} \\  
\=\+{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{a\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{b\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{o-largep} \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\it{a\/}}, {\it{alpha\/}})\index{o-largep}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\it{b\/}}, {\it{beta\/}})\index{o-largep}))\-\-
\end{tabbing}

\begin{verbatim}; first, kill off some base cases:

; alpha and beta are > 0

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux1 \\ \index{pigeon-2-aux1}
{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\rightarrow$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-2-aux2 \\ \index{pigeon-2-aux2}
{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\rightarrow$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{beta\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-2-aux3 \\ \index{pigeon-2-aux3}
{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\rightarrow$ ({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-2-aux4 \\ \index{pigeon-2-aux4}
{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\rightarrow$ {\rm{ord-lessp}}\,({\tt{0}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-2-aux5 \\ \index{pigeon-2-aux5}
{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\rightarrow$ {\rm{listp}}\,({\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-2-aux6 \\ \index{pigeon-2-aux6}
\=\+{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} \\ 
$\rightarrow$$\;\;\;\;$({\rm{setp}}\,({\it{a\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{b\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{x\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{x\/}}) $\wedge$ {\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-2-aux7 \\ \index{pigeon-2-aux7}
\=\+{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{listp}}\,({\it{a\/}}) $\wedge$ ({\rm{car}}\,({\it{a\/}}) $\leq$ {\rm{car}}\,({\it{x\/}}))) \\ 
$\vee$$\;\;\;\;$({\rm{listp}}\,({\it{b\/}}) $\wedge$ ({\rm{car}}\,({\it{b\/}}) $\leq$ {\rm{car}}\,({\it{x\/}}))))\-\-
\end{tabbing}

\begin{verbatim}; now, consider the first case:
; we have (and (listp A) (leq (car A) (car X)))
; we want to show that 
; (bad-for-pigeon-2 (cdr A) B (cdr X)  (pred alpha (car A)) beta)

; we check the five lines  in the definition

; line1
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux8 \\ \index{pigeon-2-aux8}
\=\+{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} \\ 
$\rightarrow$$\;\;\;\;$({\rm{ordinalp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{a\/}}))\index{pred}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}))\-
\end{tabbing}

\begin{verbatim}; line2
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux9 \\ \index{pigeon-2-aux9}
\=\+({\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\wedge$ {\rm{listp}}\,({\it{a\/}}) $\wedge$ ({\rm{car}}\,({\it{a\/}}) $\leq$ {\rm{car}}\,({\it{x\/}}))) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{setp}}\,({\rm{cdr}}\,({\it{a\/}}))\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{b\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{cdr}}\,({\it{x\/}}))\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{covers}}\,({\rm{cdr}}\,({\it{a\/}}), {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{covers})\-\-
\end{tabbing}

\begin{verbatim}; line3
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux10 \\ \index{pigeon-2-aux10}
\=\+({\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\wedge$ ({\rm{car}}\,({\it{a\/}}) $\leq$ {\rm{car}}\,({\it{x\/}}))) \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{sharp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{a\/}}))\index{pred}, {\it{beta\/}})\index{sharp})\index{o-largep}\-
\end{tabbing}

\begin{verbatim}; line4
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux11 \\ \index{pigeon-2-aux11}
\=\+({\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\wedge$ {\rm{listp}}\,({\it{a\/}})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{cdr}}\,({\it{a\/}}), {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{a\/}}))\index{pred})\index{o-largep})\-
\end{tabbing}

\begin{verbatim}; line5
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux12 \\ \index{pigeon-2-aux12}
{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\rightarrow$ ($\neg$ {\rm{o-largep}}\,({\it{b\/}}, {\it{beta\/}})\index{o-largep})
\end{tabbing}

\begin{verbatim}; summarize what we need for
; (bad-for-pigeon-2 (cdr A) B (cdr X) (pred alpha (car A)) beta)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux13 \\ \index{pigeon-2-aux13}
\=\+(\=\+{\rm{ordinalp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{a\/}}))\index{pred}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{cdr}}\,({\it{a\/}}))\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{b\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{cdr}}\,({\it{x\/}}))\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{covers}}\,({\rm{cdr}}\,({\it{a\/}}), {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}))\index{covers} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{sharp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{a\/}}))\index{pred}, {\it{beta\/}})\index{sharp})\index{o-largep} \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{cdr}}\,({\it{a\/}}), {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{a\/}}))\index{pred})\index{o-largep}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\it{b\/}}, {\it{beta\/}})\index{o-largep}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-pigeon-2}}\,({\rm{cdr}}\,({\it{a\/}}), {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}), {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{a\/}}))\index{pred}, {\it{beta\/}})\index{bad-for-pigeon-2}\-
\end{tabbing}

\begin{verbatim}; putting them together in the first case
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux14 \\ \index{pigeon-2-aux14}
\=\+({\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\wedge$ {\rm{listp}}\,({\it{a\/}}) $\wedge$ ({\rm{car}}\,({\it{a\/}}) $\leq$ {\rm{car}}\,({\it{x\/}}))) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-pigeon-2}}\,({\rm{cdr}}\,({\it{a\/}}), {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}), {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{a\/}}))\index{pred}, {\it{beta\/}})\index{bad-for-pigeon-2}\-
\end{tabbing}

\begin{verbatim}; this ends the first case
; now, consider the second case
; we have (and (listp B) (leq (car B) (car X)))
; we want to show that 
; (bad-for-pigeon-2  A (cdr B) (cdr X)  alpha (pred beta (car B)))

; again we check the five lines  in the definition

; line1
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux15 \\ \index{pigeon-2-aux15}
\=\+{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} \\ 
$\rightarrow$$\;\;\;\;$({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{b\/}}))\index{pred}))\-
\end{tabbing}

\begin{verbatim}; line2
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux16 \\ \index{pigeon-2-aux16}
\=\+({\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\wedge$ {\rm{listp}}\,({\it{b\/}}) $\wedge$ ({\rm{car}}\,({\it{b\/}}) $\leq$ {\rm{car}}\,({\it{x\/}}))) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{setp}}\,({\it{a\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{cdr}}\,({\it{b\/}}))\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{cdr}}\,({\it{x\/}}))\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{covers}}\,({\it{a\/}}, {\rm{cdr}}\,({\it{b\/}}), {\rm{cdr}}\,({\it{x\/}}))\index{covers})\-\-
\end{tabbing}

\begin{verbatim}; line3
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux17 \\ \index{pigeon-2-aux17}
\=\+({\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\wedge$ ({\rm{car}}\,({\it{b\/}}) $\leq$ {\rm{car}}\,({\it{x\/}}))) \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{b\/}}))\index{pred})\index{sharp})\index{o-largep}\-
\end{tabbing}

\begin{verbatim}; line5
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux18 \\ \index{pigeon-2-aux18}
\=\+({\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\wedge$ {\rm{listp}}\,({\it{b\/}})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{cdr}}\,({\it{b\/}}), {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{b\/}}))\index{pred})\index{o-largep})\-
\end{tabbing}

\begin{verbatim}; line4
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux19 \\ \index{pigeon-2-aux19}
{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\rightarrow$ ($\neg$ {\rm{o-largep}}\,({\it{a\/}}, {\it{alpha\/}})\index{o-largep})
\end{tabbing}

\begin{verbatim}; summarize what we need for
; (bad-for-pigeon-2  (cdr B) (cdr X) alpha (pred beta (car B)))  

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux20 \\ \index{pigeon-2-aux20}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{b\/}}))\index{pred}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{a\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{cdr}}\,({\it{b\/}}))\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{cdr}}\,({\it{x\/}}))\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{covers}}\,({\it{a\/}}, {\rm{cdr}}\,({\it{b\/}}), {\rm{cdr}}\,({\it{x\/}}))\index{covers} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{x\/}}), {\rm{sharp}}\,({\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{b\/}}))\index{pred})\index{sharp})\index{o-largep} \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\it{a\/}}, {\it{alpha\/}})\index{o-largep}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{cdr}}\,({\it{b\/}}), {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{b\/}}))\index{pred})\index{o-largep}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\rm{cdr}}\,({\it{b\/}}), {\rm{cdr}}\,({\it{x\/}}), {\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{b\/}}))\index{pred})\index{bad-for-pigeon-2}\-
\end{tabbing}

\begin{verbatim}; putting them together in the second case
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux21 \\ \index{pigeon-2-aux21}
\=\+({\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} $\wedge$ {\rm{listp}}\,({\it{b\/}}) $\wedge$ ({\rm{car}}\,({\it{b\/}}) $\leq$ {\rm{car}}\,({\it{x\/}}))) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\rm{cdr}}\,({\it{b\/}}), {\rm{cdr}}\,({\it{x\/}}), {\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{b\/}}))\index{pred})\index{bad-for-pigeon-2}\-
\end{tabbing}

\begin{verbatim}; now the point is:  if (bad-for-pigeon-2 A B X alpha beta)
; then (listp X) ( by aux5 ) and (cdr X) messes
; up with something -- so we can induct on X

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2-aux22 \\ \index{pigeon-2-aux22}
\=\+{\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{bad-for-pigeon-2}}\,({\rm{cdr}}\,({\it{a\/}}), {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}), {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{a\/}}))\index{pred}, {\it{beta\/}})\index{bad-for-pigeon-2} \\ 
$\vee$$\;\;\;\;${\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\rm{cdr}}\,({\it{b\/}}), {\rm{cdr}}\,({\it{x\/}}), {\it{alpha\/}}, {\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{b\/}}))\index{pred})\index{bad-for-pigeon-2})\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{pigeon-2-kludge} \\  
\=\+{\rm{pigeon-2-kludge}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{pigeon-2-kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{x\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }\=\+{\rm{pigeon-2-kludge}}\,({\rm{cdr}}\,({\it{a\/}}), {\it{b\/}}, {\rm{cdr}}\,({\it{x\/}}), {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{a\/}}))\index{pred}, {\it{beta\/}})\index{pigeon-2-kludge} \\ 
$+$$\;\;\;\;${\rm{pigeon-2-kludge}}\,(\=\+{\it{a\/}}, \\ 
{\rm{cdr}}\,({\it{b\/}}), \\ 
{\rm{cdr}}\,({\it{x\/}}), \\ 
{\it{alpha\/}}, \\ 
{\rm{pred}}\,({\it{beta\/}}, {\rm{car}}\,({\it{b\/}}))\index{pred})\-\index{pigeon-2-kludge}\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-2-aux23 \\ \index{pigeon-2-aux23}
$\neg$ {\rm{bad-for-pigeon-2}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}}, {\it{alpha\/}}, {\it{beta\/}})\index{bad-for-pigeon-2}
\end{tabbing}

\begin{verbatim}; finally, the GOAL:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-2 \\ \index{pigeon-2}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{beta\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{a\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{b\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\rm{sharp}}\,({\it{alpha\/}}, {\it{beta\/}})\index{sharp})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{o-largep}}\,({\it{a\/}}, {\it{alpha\/}})\index{o-largep} $\vee$ {\rm{o-largep}}\,({\it{b\/}}, {\it{beta\/}})\index{o-largep})\-
\end{tabbing}


\noindent{\sc Event}:   Disable bad-for-pigeon-2.

\addvspace{18pt}     
\noindent{\sc Event}:   Disable pigeon-2-kludge.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux1.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable pigeon-2-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux3.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable pigeon-2-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux5.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable pigeon-2-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux7.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable pigeon-2-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux9.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable pigeon-2-aux10.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux11.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable pigeon-2-aux12.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux13.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable pigeon-2-aux14.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux15.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable pigeon-2-aux16.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux17.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable pigeon-2-aux18.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux19.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable pigeon-2-aux20.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux21.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable pigeon-2-aux22.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-2-aux23.

\addvspace{18pt}




\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                 FUNCTIONS AND HOMOGENEOUS SETS                         ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; view every S-expression as an association list, and hence a function

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{funcall}$\;\;$
{\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $=$ {\rm{cadr}}\,({\rm{assoc}}\,({\it{x\/}}, {\it{g\/}}))
\end{tabbing}

\begin{verbatim}; since (cadr nil) = 0, we always have 0 in the range:

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

\begin{tabbing}{\sc Theorem}:  range-is-big-enuf \\ \index{range-is-big-enuf}
{\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $\in$ {\rm{range}}\,({\it{g\/}})\index{range}
\end{tabbing}


\noindent{\sc Event}:   Disable range.

\addvspace{18pt}
\begin{verbatim}; we don't care exactly what it is

\end{verbatim}
\noindent{\sc Event}:   Disable funcall.

\addvspace{18pt}
\begin{verbatim}; for now -- later, we'll need its definition to show that we
; can build up functions with prescribed definitions

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{mapsto} \\  
\=\+{\rm{mapsto}}\,({\it{g\/}}, {\it{set1\/}}, {\it{set2\/}})\index{mapsto} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{set1\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }\=\+{\rm{mapsto}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{set1\/}}), {\it{set2\/}})\index{mapsto} \\ 
$\wedge$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\rm{car}}\,({\it{set1\/}}))\index{funcall} $\in$ {\it{set2\/}})\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  mapsto-works \\ \index{mapsto-works}
({\rm{mapsto}}\,({\it{g\/}}, {\it{set1\/}}, {\it{set2\/}})\index{mapsto} $\wedge$ ({\it{x\/}} $\in$ {\it{set1\/}})) $\rightarrow$ ({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $\in$ {\it{set2\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable mapsto.

\addvspace{18pt}

\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;
; let's disable some ordinal stuff which seems to slow down the set proofs
\end{verbatim}
\noindent{\sc Event}:   Disable numbers-below-omega.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdrs-are-ordinals.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ord-leq-zero.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ord-leq-is-transitive.

\addvspace{18pt}


\begin{verbatim};;;;;;;;;;;;  notion of homogeneous

; (homp set g n) means that  set is homogeneous for g as a partition
; of n-tuples:  that is,
; whenever s1, s2 are subsets of set of size <= n, and 
; |s1| =|s2| and g(s1) = g(s2) < c, then g(s1) = g(s2)

; we first define what a counter-example would be
; search through the list of all possible counter-examples

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{hom-bad-pairp} \\  
\=\+{\rm{hom-bad-pairp}}\,({\it{x\/}}, {\it{y\/}}, {\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{hom-bad-pairp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{sublistp}}\,({\it{x\/}}, {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\it{y\/}}, {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{y\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{y\/}})\index{length} $=$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $\not=$ {\rm{funcall}}\,({\it{g\/}}, {\it{y\/}})\index{funcall}))\-\-
\end{tabbing}
\begin{verbatim}; use sublistp rather than subsetp because power-set was defined
; to work with sublistp.  These are equivalent anyway when
; (setp set), which is what we're interested in.

; pairs is a list of pairs which are possible counter-examples
; counter-hom looks for a pair (x y) which refutes homogeneous
; if it fails, it returns 0

; disable bad-pair temporarily 
\end{verbatim}
\noindent{\sc Event}:   Disable hom-bad-pairp.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{counter-hom} \\  
\=\+{\rm{counter-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}}, {\it{pairs\/}})\index{counter-hom} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{pairs\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\rm{listp}}\,({\rm{counter-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}}, {\rm{cdr}}\,({\it{pairs\/}}))\index{counter-hom}) \\ 
{\bf then }{\rm{counter-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}}, {\rm{cdr}}\,({\it{pairs\/}}))\index{counter-hom} \\ 
{\bf elseif }{\rm{hom-bad-pairp}}\,({\rm{caar}}\,({\it{pairs\/}}), {\rm{cdar}}\,({\it{pairs\/}}), {\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{hom-bad-pairp} \\ 
{\bf then }{\rm{cons}}\,({\rm{caar}}\,({\it{pairs\/}}), {\rm{cdar}}\,({\it{pairs\/}})) \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bad-pair-is-bad \\ \index{bad-pair-is-bad}
\=\+{\rm{listp}}\,({\rm{counter-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}}, {\it{pairs\/}})\index{counter-hom}) \\ 
$\rightarrow$$\;\;\;\;${\rm{hom-bad-pairp}}\,(\=\+{\rm{car}}\,({\rm{counter-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}}, {\it{pairs\/}})\index{counter-hom}), \\ 
{\rm{cdr}}\,({\rm{counter-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}}, {\it{pairs\/}})\index{counter-hom}), \\ 
{\it{set\/}}, \\ 
{\it{g\/}}, \\ 
{\it{n\/}})\-\index{hom-bad-pairp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  counter-hom-finds-one \\ \index{counter-hom-finds-one}
\=\+(({\rm{cons}}\,({\it{x\/}}, {\it{y\/}}) $\in$ {\it{pairs\/}}) $\wedge$ {\rm{hom-bad-pairp}}\,({\it{x\/}}, {\it{y\/}}, {\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{hom-bad-pairp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{listp}}\,({\rm{counter-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}}, {\it{pairs\/}})\index{counter-hom})\-
\end{tabbing}


\noindent{\sc Event}:   Disable counter-hom.

\addvspace{18pt}

\begin{verbatim}; now -- homp means we search thru all pairs from the
; power-set and don't find one

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{homp} \\  
\=\+{\rm{homp}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{homp} \\ 
$=$$\;\;\;\;$({\rm{counter-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}}, {\rm{product}}\,({\rm{power-set}}\,({\it{set\/}})\index{power-set}, {\rm{power-set}}\,({\it{set\/}})\index{power-set})\index{product})\index{counter-hom} $\simeq\;${{\bf{nil}}}${}$)\-
\end{tabbing}


\begin{verbatim}; now, we prove that homp is necessary and sufficient
; this needs the defn of hom-bad-pairp
\end{verbatim}
\noindent{\sc Event}:   Enable hom-bad-pairp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  homp-is-sufficient-a \\ \index{homp-is-sufficient-a}
\=\+(\=\+{\rm{homp}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{homp} \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\it{x\/}}, {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\it{y\/}}, {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{y\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{y\/}})\index{length} $=$ {\it{n\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $=$ {\rm{funcall}}\,({\it{g\/}}, {\it{y\/}})\index{funcall})\-
\end{tabbing}

\begin{verbatim};;; in our paper, it would be less confusing to have a version
; to quote which uses subsetp instead of sublistp

\end{verbatim}\begin{tabbing}{\sc Theorem}:  homp-is-sufficient \\ \index{homp-is-sufficient}
\=\+(\=\+{\rm{homp}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{homp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{x\/}}, {\it{set\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{y\/}}, {\it{set\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{set\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{y\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{y\/}})\index{length} $=$ {\it{n\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $=$ {\rm{funcall}}\,({\it{g\/}}, {\it{y\/}})\index{funcall})\-
\end{tabbing}


\begin{verbatim}; to prove necessary, it would be nice to have an abbreviation for
; the x and y coordinate of the counter-example

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{counter-hom-x} \\  
\=\+{\rm{counter-hom-x}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{counter-hom-x} \\ 
$=$$\;\;\;\;${\rm{car}}\,({\rm{counter-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}}, {\rm{product}}\,({\rm{power-set}}\,({\it{set\/}})\index{power-set}, {\rm{power-set}}\,({\it{set\/}})\index{power-set})\index{product})\index{counter-hom})\-
\end{tabbing}
\begin{tabbing}{\sc Definition}:\index{counter-hom-y} \\  
\=\+{\rm{counter-hom-y}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{counter-hom-y} \\ 
$=$$\;\;\;\;${\rm{cdr}}\,({\rm{counter-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}}, {\rm{product}}\,({\rm{power-set}}\,({\it{set\/}})\index{power-set}, {\rm{power-set}}\,({\it{set\/}})\index{power-set})\index{product})\index{counter-hom})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  homp-is-necessary \\ \index{homp-is-necessary}
\=\+($\neg$ {\rm{homp}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{homp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{sublistp}}\,({\rm{counter-hom-x}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{counter-hom-x}, {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\rm{counter-hom-y}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{counter-hom-y}, {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{counter-hom-x}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{counter-hom-x})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{counter-hom-y}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{counter-hom-y})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\rm{counter-hom-x}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{counter-hom-x})\index{length} $=$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\rm{counter-hom-y}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{counter-hom-y})\index{length} $=$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{funcall}}\,({\it{g\/}}, {\rm{counter-hom-x}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{counter-hom-x})\index{funcall} \\ 
$\not=$$\;\;\;\;${\rm{funcall}}\,({\it{g\/}}, {\rm{counter-hom-y}}\,({\it{set\/}}, {\it{g\/}}, {\it{n\/}})\index{counter-hom-y})\index{funcall})\-)\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable homp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable hom-bad-pairp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable counter-hom-x.

\addvspace{18pt}

\noindent{\sc Event}:   Disable counter-hom-y.

\addvspace{18pt}


\begin{verbatim};;;;;;;;;;;;;;;  add-on-end
; before discussing pre-homogeneous sets, we have to talk
; about adding one element at the end of a set -- maybe
; it's simpler to define this outright, rather than using "append"

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{add-on-end} \\  
\=\+{\rm{add-on-end}}\,({\it{item\/}}, {\it{set\/}})\index{add-on-end} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{set\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\rm{list}}\,({\it{item\/}}) \\ 
{\bf else }{\rm{cons}}\,({\rm{car}}\,({\it{set\/}}), {\rm{add-on-end}}\,({\it{item\/}}, {\rm{cdr}}\,({\it{set\/}}))\index{add-on-end})$\;${\bf  endif}\-\-
\end{tabbing}
\begin{verbatim}; for sets, this is set Union {item}

\end{verbatim}\begin{tabbing}{\sc Theorem}:  add-in-end-is-last \\ \index{add-in-end-is-last}
{\rm{last}}\,({\rm{add-on-end}}\,({\it{item\/}}, {\it{set\/}})\index{add-on-end})\index{last} $=$ {\it{item\/}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  add-in-end-and-length \\ \index{add-in-end-and-length}
{\rm{length}}\,({\rm{add-on-end}}\,({\it{item\/}}, {\it{set\/}})\index{add-on-end})\index{length} $=$ ($1\;+$ {\rm{length}}\,({\it{set\/}})\index{length})
\end{tabbing}

\begin{verbatim}; we should probably define all-but-last  -- everything
; except the last element

\end{verbatim}\begin{tabbing}{\sc Theorem}:  all-but-last-aux1 \\ \index{all-but-last-aux1}
{\rm{listp}}\,({\rm{cdr}}\,({\it{lst\/}})) $\rightarrow$ {\rm{listp}}\,({\it{lst\/}})
\end{tabbing}
\begin{verbatim}; needed for the recursion

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


\noindent{\sc Event}:   Disable all-but-last-aux1.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  all-but-last-and-length \\ \index{all-but-last-and-length}
{\rm{listp}}\,({\rm{cdr}}\,({\it{lst\/}})) $\rightarrow$ ({\rm{length}}\,({\rm{all-but-last}}\,({\it{lst\/}})\index{all-but-last})\index{length} $=$ ({\rm{length}}\,({\it{lst\/}})\index{length} $-\;1$))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-but-last-of-add-on-end \\ \index{all-but-last-of-add-on-end}
{\rm{properp}}\,({\it{lst\/}})\index{properp} $\rightarrow$ ({\rm{all-but-last}}\,({\rm{add-on-end}}\,({\it{item\/}}, {\it{lst\/}})\index{add-on-end})\index{all-but-last} $=$ {\it{lst\/}})
\end{tabbing}


\noindent{\sc Event}:   Enable setp.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  add-on-end-makes-sets \\ \index{add-on-end-makes-sets}
({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{last}}\,({\it{set\/}})\index{last} $<$ {\it{n\/}})) $\rightarrow$ {\rm{setp}}\,({\rm{add-on-end}}\,({\it{n\/}}, {\it{set\/}})\index{add-on-end})\index{setp}
\end{tabbing}

\noindent{\sc Event}:   Disable setp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  all-but-last-is-sublist \\ \index{all-but-last-is-sublist}
{\rm{sublistp}}\,({\rm{all-but-last}}\,({\it{lst\/}})\index{all-but-last}, {\it{lst\/}})\index{sublistp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-but-last-is-sublist-a \\ \index{all-but-last-is-sublist-a}
{\rm{sublistp}}\,({\it{s1\/}}, {\it{set\/}})\index{sublistp} $\rightarrow$ {\rm{sublistp}}\,({\rm{all-but-last}}\,({\it{s1\/}})\index{all-but-last}, {\it{set\/}})\index{sublistp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-but-last-is-non-empty \\ \index{all-but-last-is-non-empty}
({\tt{2}} $\leq$ {\rm{length}}\,({\it{lst\/}})\index{length}) $\rightarrow$ {\rm{listp}}\,({\rm{all-but-last}}\,({\it{lst\/}})\index{all-but-last})
\end{tabbing}

\noindent{\sc Event}:   Enable setp.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  all-but-last-is-a-set \\ \index{all-but-last-is-a-set}
{\rm{setp}}\,({\it{set\/}})\index{setp} $\rightarrow$ {\rm{setp}}\,({\rm{all-but-last}}\,({\it{set\/}})\index{all-but-last})\index{setp}
\end{tabbing}

\noindent{\sc Event}:   Disable setp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  re-assemble-at-end \\ \index{re-assemble-at-end}
\=\+({\rm{properp}}\,({\it{lst\/}})\index{properp} $\wedge$ {\rm{listp}}\,({\it{lst\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{add-on-end}}\,({\rm{last}}\,({\it{lst\/}})\index{last}, {\rm{all-but-last}}\,({\it{lst\/}})\index{all-but-last})\index{add-on-end} $=$ {\it{lst\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  length-of-all-but-last \\ \index{length-of-all-but-last}
{\rm{listp}}\,({\it{x\/}}) $\rightarrow$ ({\rm{length}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})\index{length} $=$ ({\rm{length}}\,({\it{x\/}})\index{length} $-\;1$))
\end{tabbing}


\begin{verbatim};;;;;;;;;;;;  notion of pre-homogeneous

; (pre-homp set g) means that  set is pre-homogeneous for g as a partition
; that is:  whenever s1 is a non-empty subset of set, y,z are members of
; set and are larger than max(s1) :
; g(s1 U {y}) = g(s1 U {z})

; we use the same "bad" method

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{pre-hom-bad-triplep} \\  
\=\+{\rm{pre-hom-bad-triplep}}\,({\it{y\/}}, {\it{z\/}}, {\it{s1\/}}, {\it{set\/}}, {\it{g\/}})\index{pre-hom-bad-triplep} \\ 
$=$$\;\;\;\;$(\=\+{\rm{sublistp}}\,({\it{s1\/}}, {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s1\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s1\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\it{y\/}} $\in$ {\it{set\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{z\/}} $\in$ {\it{set\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s1\/}})\index{last} $<$ {\it{y\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s1\/}})\index{last} $<$ {\it{z\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{y\/}}, {\it{s1\/}})\index{add-on-end})\index{funcall} $\not=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{z\/}}, {\it{s1\/}})\index{add-on-end})\index{funcall}))\-\-
\end{tabbing}

\begin{verbatim}; disable bad-triple temporarily 
\end{verbatim}
\noindent{\sc Event}:   Disable pre-hom-bad-triplep.

\addvspace{18pt}

\begin{verbatim}; triples will be just ( (a .  b) .  c) -- so we get a,b,c as the
; caar, cdar, cdr
; then all triples are getten as (product (product set set) (power-set set))

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{counter-pre-hom} \\  
\=\+{\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{triples\/}})\index{counter-pre-hom} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{triples\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\rm{listp}}\,({\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\rm{cdr}}\,({\it{triples\/}}))\index{counter-pre-hom}) \\ 
{\bf then }{\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\rm{cdr}}\,({\it{triples\/}}))\index{counter-pre-hom} \\ 
{\bf elseif }{\rm{pre-hom-bad-triplep}}\,(\=\+{\rm{caaar}}\,({\it{triples\/}}), \\ 
{\rm{cdaar}}\,({\it{triples\/}}), \\ 
{\rm{cdar}}\,({\it{triples\/}}), \\ 
{\it{set\/}}, \\ 
{\it{g\/}})\-\index{pre-hom-bad-triplep} \\ 
{\bf then }{\rm{cons}}\,({\rm{cons}}\,({\rm{caaar}}\,({\it{triples\/}}), {\rm{cdaar}}\,({\it{triples\/}})), {\rm{cdar}}\,({\it{triples\/}})) \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bad-triple-is-bad \\ \index{bad-triple-is-bad}
\=\+{\rm{listp}}\,({\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{triples\/}})\index{counter-pre-hom}) \\ 
$\rightarrow$$\;\;\;\;${\rm{pre-hom-bad-triplep}}\,(\=\+{\rm{caar}}\,({\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{triples\/}})\index{counter-pre-hom}), \\ 
{\rm{cdar}}\,({\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{triples\/}})\index{counter-pre-hom}), \\ 
{\rm{cdr}}\,({\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{triples\/}})\index{counter-pre-hom}), \\ 
{\it{set\/}}, \\ 
{\it{g\/}})\-\index{pre-hom-bad-triplep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  counter-pre-hom-finds-one \\ \index{counter-pre-hom-finds-one}
\=\+(({\rm{cons}}\,({\rm{cons}}\,({\it{y\/}}, {\it{z\/}}), {\it{s1\/}}) $\in$ {\it{triples\/}}) $\wedge$ {\rm{pre-hom-bad-triplep}}\,({\it{y\/}}, {\it{z\/}}, {\it{s1\/}}, {\it{set\/}}, {\it{g\/}})\index{pre-hom-bad-triplep}) \\ 
$\rightarrow$$\;\;\;\;${\rm{listp}}\,({\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\it{triples\/}})\index{counter-pre-hom})\-
\end{tabbing}


\noindent{\sc Event}:   Disable counter-pre-hom.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{pre-homp} \\  
\=\+{\rm{pre-homp}}\,({\it{set\/}}, {\it{g\/}})\index{pre-homp} \\ 
$=$$\;\;\;\;$({\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\rm{product}}\,({\rm{product}}\,({\it{set\/}}, {\it{set\/}})\index{product}, {\rm{power-set}}\,({\it{set\/}})\index{power-set})\index{product})\index{counter-pre-hom} $\simeq\;${{\bf{nil}}}${}$)\-
\end{tabbing}

\begin{verbatim}; now, we prove that pre-homp is necessary and sufficient
; this needs the defn of pre-hom-bad-triplep
\end{verbatim}
\noindent{\sc Event}:   Enable pre-hom-bad-triplep.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  pre-homp-is-sufficient \\ \index{pre-homp-is-sufficient}
\=\+(\=\+{\rm{pre-homp}}\,({\it{set\/}}, {\it{g\/}})\index{pre-homp} \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\it{s1\/}}, {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s1\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s1\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\it{y\/}} $\in$ {\it{set\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{z\/}} $\in$ {\it{set\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s1\/}})\index{last} $<$ {\it{y\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s1\/}})\index{last} $<$ {\it{z\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{y\/}}, {\it{s1\/}})\index{add-on-end})\index{funcall} $=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{z\/}}, {\it{s1\/}})\index{add-on-end})\index{funcall})\-
\end{tabbing}

\begin{verbatim};  to prove necessary, we use an abbreviation for 
; the y,z, s1 of the counter-example

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{counter-pre-hom-y} \\  
\=\+{\rm{counter-pre-hom-y}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-y} \\ 
$=$$\;\;\;\;${\rm{caar}}\,({\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\rm{product}}\,({\rm{product}}\,({\it{set\/}}, {\it{set\/}})\index{product}, {\rm{power-set}}\,({\it{set\/}})\index{power-set})\index{product})\index{counter-pre-hom})\-
\end{tabbing}
\begin{tabbing}{\sc Definition}:\index{counter-pre-hom-z} \\  
\=\+{\rm{counter-pre-hom-z}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-z} \\ 
$=$$\;\;\;\;${\rm{cdar}}\,({\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\rm{product}}\,({\rm{product}}\,({\it{set\/}}, {\it{set\/}})\index{product}, {\rm{power-set}}\,({\it{set\/}})\index{power-set})\index{product})\index{counter-pre-hom})\-
\end{tabbing}
\begin{tabbing}{\sc Definition}:\index{counter-pre-hom-s1} \\  
\=\+{\rm{counter-pre-hom-s1}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-s1} \\ 
$=$$\;\;\;\;${\rm{cdr}}\,({\rm{counter-pre-hom}}\,({\it{set\/}}, {\it{g\/}}, {\rm{product}}\,({\rm{product}}\,({\it{set\/}}, {\it{set\/}})\index{product}, {\rm{power-set}}\,({\it{set\/}})\index{power-set})\index{product})\index{counter-pre-hom})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pre-homp-is-necessary \\ \index{pre-homp-is-necessary}
\=\+($\neg$ {\rm{pre-homp}}\,({\it{set\/}}, {\it{g\/}})\index{pre-homp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{sublistp}}\,({\rm{counter-pre-hom-s1}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-s1}, {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{counter-pre-hom-s1}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-s1}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{counter-pre-hom-s1}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-s1})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\rm{counter-pre-hom-y}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-y} $\in$ {\it{set\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{counter-pre-hom-z}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-z} $\in$ {\it{set\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\rm{counter-pre-hom-s1}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-s1})\index{last} $<$ {\rm{counter-pre-hom-y}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-y}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\rm{counter-pre-hom-s1}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-s1})\index{last} $<$ {\rm{counter-pre-hom-z}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-z}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{funcall}}\,(\=\+{\it{g\/}}, \\ 
{\rm{add-on-end}}\,(\=\+{\rm{counter-pre-hom-y}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-y}, \\ 
{\rm{counter-pre-hom-s1}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-s1})\-\index{add-on-end})\-\index{funcall} \\ 
$\not=$$\;\;\;\;${\rm{funcall}}\,(\=\+{\it{g\/}}, \\ 
{\rm{add-on-end}}\,(\=\+{\rm{counter-pre-hom-z}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-z}, \\ 
{\rm{counter-pre-hom-s1}}\,({\it{set\/}}, {\it{g\/}})\index{counter-pre-hom-s1})\-\index{add-on-end})\-\index{funcall})\-)\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable pre-homp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pre-hom-bad-triplep.

\addvspace{18pt}

\noindent{\sc Event}:   Disable counter-pre-hom-y.

\addvspace{18pt}

\noindent{\sc Event}:   Disable counter-pre-hom-z.

\addvspace{18pt}

\noindent{\sc Event}:   Disable counter-pre-hom-s1.

\addvspace{18pt}


\begin{verbatim};;;;;;;;;;;;;;;;;;;;   derived partitions
; This is used in the induction step in Ramsey's Theorem --
;  passing from n-1 - tuples to n - tuples
; Think of g as a partition of n-tuples (n >= 2)
; If set is pre-hom for g, there is a derived partition h, on n-1 - tuples
; such that whenever hset is homogeneous for h, hset is homogeneous for g

; to compute (h s1) :  apply g to s1 U {x}, where x =
; (find-larger-element s1 set) -- this returns an element x of set
; which is a number and larger than (last s1)
; it returns nil if there is no such number
; so -- by testing for numberp, we know if we have found one.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{find-larger-element} \\  
\=\+{\rm{find-larger-element}}\,({\it{s1\/}}, {\it{set\/}})\index{find-larger-element} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{set\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }({\rm{car}}\,({\it{set\/}}) $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{last}}\,({\it{s1\/}})\index{last} $<$ {\rm{car}}\,({\it{set\/}}))$\;\;${\bf then }{\rm{car}}\,({\it{set\/}}) \\ 
{\bf else }{\rm{find-larger-element}}\,({\it{s1\/}}, {\rm{cdr}}\,({\it{set\/}}))\index{find-larger-element}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  find-larger-element-works-a \\ \index{find-larger-element-works-a}
\=\+({\rm{find-larger-element}}\,({\it{s1\/}}, {\it{set\/}})\index{find-larger-element} $\in\;${\bf{N}}${}$) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{find-larger-element}}\,({\it{s1\/}}, {\it{set\/}})\index{find-larger-element} $\in$ {\it{set\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{find-larger-element}}\,({\it{s1\/}}, {\it{set\/}})\index{find-larger-element} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s1\/}})\index{last} $<$ {\rm{find-larger-element}}\,({\it{s1\/}}, {\it{set\/}})\index{find-larger-element}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  find-larger-element-works-b \\ \index{find-larger-element-works-b}
\=\+(({\it{x\/}} $\in$ {\it{set\/}}) $\wedge$ ({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{last}}\,({\it{s1\/}})\index{last} $<$ {\it{x\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{find-larger-element}}\,({\it{s1\/}}, {\it{set\/}})\index{find-larger-element} $\in\;${\bf{N}}${}$)\-
\end{tabbing}


\noindent{\sc Event}:   Disable find-larger-element.

\addvspace{18pt} 
\begin{verbatim}; we don't care which one we found

; if s1 is a subset of set and s1 has length at least 2,
; then (find-larger-element (all-but-last) set )  really
; finds one -- since (last s1) is a candidate.

; first, we have to show it really is a candidate
; the following is probably needed also for properties
; of pre-homogeneous sets

\end{verbatim}\begin{tabbing}{\sc Theorem}:  last-is-a-member \\ \index{last-is-a-member}
{\rm{listp}}\,({\it{lst\/}}) $\rightarrow$ ({\rm{last}}\,({\it{lst\/}})\index{last} $\in$ {\it{lst\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  last-is-a-candidate-1 \\ \index{last-is-a-candidate-1}
({\rm{sublistp}}\,({\it{s1\/}}, {\it{set\/}})\index{sublistp} $\wedge$ ({\tt{2}} $\leq$ {\rm{length}}\,({\it{s1\/}})\index{length})) $\rightarrow$ ({\rm{last}}\,({\it{s1\/}})\index{last} $\in$ {\it{set\/}})
\end{tabbing}


\noindent{\sc Event}:   Enable setp.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  members-are-numbers \\ \index{members-are-numbers}
({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ ({\it{x\/}} $\in$ {\it{set\/}})) $\rightarrow$ ({\it{x\/}} $\in\;${\bf{N}}${}$)
\end{tabbing}

\noindent{\sc Event}:   Disable setp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  last-is-a-candidate-2 \\ \index{last-is-a-candidate-2}
({\rm{setp}}\,({\it{s1\/}})\index{setp} $\wedge$ ({\tt{2}} $\leq$ {\rm{length}}\,({\it{s1\/}})\index{length})) $\rightarrow$ ({\rm{last}}\,({\it{s1\/}})\index{last} $\in\;${\bf{N}}${}$)
\end{tabbing}


\noindent{\sc Event}:   Enable setp.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  last-is-a-candidate-3 \\ \index{last-is-a-candidate-3}
\=\+({\rm{setp}}\,({\it{s1\/}})\index{setp} $\wedge$ ({\tt{2}} $\leq$ {\rm{length}}\,({\it{s1\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{last}}\,({\rm{all-but-last}}\,({\it{s1\/}})\index{all-but-last})\index{last} $<$ {\rm{last}}\,({\it{s1\/}})\index{last})\-
\end{tabbing}

\noindent{\sc Event}:   Disable setp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  larger-elt-is-found \\ \index{larger-elt-is-found}
\=\+({\rm{setp}}\,({\it{s1\/}})\index{setp} $\wedge$ {\rm{sublistp}}\,({\it{s1\/}}, {\it{set\/}})\index{sublistp} $\wedge$ ({\tt{2}} $\leq$ {\rm{length}}\,({\it{s1\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{find-larger-element}}\,({\rm{all-but-last}}\,({\it{s1\/}})\index{all-but-last}, {\it{set\/}})\index{find-larger-element} $\in\;${\bf{N}}${}$)\-
\end{tabbing}

\begin{verbatim}; it follows that if g is pre-homogeneous on set, then (g s1) =
; (g  (add-on-end 
;         (find-larger-element (all-but-last s1) set)
;         (all-but-last s1) ) )
; that is, (g s1) is determined as the derived partition
;  applied to (all-but-last s1)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pre-hom-and-all-but-last \\ \index{pre-hom-and-all-but-last}
\=\+({\rm{pre-homp}}\,({\it{set\/}}, {\it{g\/}})\index{pre-homp} $\wedge$ {\rm{setp}}\,({\it{s1\/}})\index{setp} $\wedge$ {\rm{sublistp}}\,({\it{s1\/}}, {\it{set\/}})\index{sublistp} $\wedge$ ({\tt{2}} $\leq$ {\rm{length}}\,({\it{s1\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{funcall}}\,({\it{g\/}}, {\it{s1\/}})\index{funcall} \\ 
$=$$\;\;\;\;${\rm{funcall}}\,(\=\+{\it{g\/}}, \\ 
{\rm{add-on-end}}\,(\=\+{\rm{find-larger-element}}\,({\rm{all-but-last}}\,({\it{s1\/}})\index{all-but-last}, {\it{set\/}})\index{find-larger-element}, \\ 
{\rm{all-but-last}}\,({\it{s1\/}})\index{all-but-last})\-\index{add-on-end})\-\index{funcall})\-\-
\end{tabbing}

\begin{verbatim}; now we simply define the derived partition h = (derived g set)  so that 
;(h s) = 
;(funcall g
;    (add-on-end
;        (find-larger-element s set)
;        s ))  
; but to define a function h like this, we have to run down
; a list of subsets -- i.e., (power-set set)
; and construct h as a list of pairs
    
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{derived-aux} \\  
\=\+{\rm{derived-aux}}\,({\it{g\/}}, {\it{set\/}}, {\it{lst\/}})\index{derived-aux} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{lst\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{cons}}\,(\=\+{\rm{list}}\,(\=\+{\rm{car}}\,({\it{lst\/}}), \\ 
{\rm{funcall}}\,(\=\+{\it{g\/}}, \\ 
{\rm{add-on-end}}\,(\=\+{\rm{find-larger-element}}\,(\=\+{\rm{car}}\,({\it{lst\/}}), \\ 
{\it{set\/}})\-\index{find-larger-element}, \\ 
{\rm{car}}\,({\it{lst\/}}))\-\index{add-on-end})\-\index{funcall})\-, \\ 
{\rm{derived-aux}}\,({\it{g\/}}, {\it{set\/}}, {\rm{cdr}}\,({\it{lst\/}}))\index{derived-aux})\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  derived-aux1 \\ \index{derived-aux1}
\=\+({\it{s\/}} $\in$ {\it{lst\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{assoc}}\,({\it{s\/}}, {\rm{derived-aux}}\,({\it{g\/}}, {\it{set\/}}, {\it{lst\/}})\index{derived-aux}) \\ 
$=$$\;\;\;\;${\rm{list}}\,({\it{s\/}}, {\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\rm{find-larger-element}}\,({\it{s\/}}, {\it{set\/}})\index{find-larger-element}, {\it{s\/}})\index{add-on-end})\index{funcall}))\-\-
\end{tabbing}


\noindent{\sc Event}:   Enable funcall.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  derived-aux2 \\ \index{derived-aux2}
\=\+({\it{s\/}} $\in$ {\it{lst\/}}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{funcall}}\,({\rm{derived-aux}}\,({\it{g\/}}, {\it{set\/}}, {\it{lst\/}})\index{derived-aux}, {\it{s\/}})\index{funcall} \\ 
$=$$\;\;\;\;${\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\rm{find-larger-element}}\,({\it{s\/}}, {\it{set\/}})\index{find-larger-element}, {\it{s\/}})\index{add-on-end})\index{funcall})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable funcall.

\addvspace{18pt}

\noindent{\sc Event}:   Disable derived-aux.

\addvspace{18pt}

\noindent{\sc Event}:   Disable derived-aux1.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{derived}$\;\;$
{\rm{derived}}\,({\it{g\/}}, {\it{set\/}})\index{derived} $=$ {\rm{derived-aux}}\,({\it{g\/}}, {\it{set\/}}, {\rm{power-set}}\,({\it{set\/}})\index{power-set})\index{derived-aux}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  derived-works \\ \index{derived-works}
\=\+({\rm{sublistp}}\,({\it{s\/}}, {\it{set\/}})\index{sublistp} $\wedge$ {\rm{setp}}\,({\it{s\/}})\index{setp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{funcall}}\,({\rm{derived}}\,({\it{g\/}}, {\it{set\/}})\index{derived}, {\it{s\/}})\index{funcall} \\ 
$=$$\;\;\;\;${\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\rm{find-larger-element}}\,({\it{s\/}}, {\it{set\/}})\index{find-larger-element}, {\it{s\/}})\index{add-on-end})\index{funcall})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable derived.

\addvspace{18pt}

\noindent{\sc Event}:   Disable derived-aux2.

\addvspace{18pt}

\begin{verbatim}; now, if g is pre-homogeneous, then 
; (g s1) is computed from ((derived g set) s), where
; s = (all-but-last s1)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  derived-and-prehom \\ \index{derived-and-prehom}
\=\+({\rm{pre-homp}}\,({\it{set\/}}, {\it{g\/}})\index{pre-homp} $\wedge$ {\rm{setp}}\,({\it{s1\/}})\index{setp} $\wedge$ {\rm{sublistp}}\,({\it{s1\/}}, {\it{set\/}})\index{sublistp} $\wedge$ ({\tt{2}} $\leq$ {\rm{length}}\,({\it{s1\/}})\index{length})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\it{s1\/}})\index{funcall} $=$ {\rm{funcall}}\,({\rm{derived}}\,({\it{g\/}}, {\it{set\/}})\index{derived}, {\rm{all-but-last}}\,({\it{s1\/}})\index{all-but-last})\index{funcall})\-
\end{tabbing}


\begin{verbatim}; now suppose n>=2 and  g is prehom on set
; then say we find small-set is a subset of set which
; is homogeneous for (derivde g set) on the n-1 -- tuples
; then small-set is homogeneous for g on the n -- tuples

; to prove this, we consider any two subsets x, y of small-set
; of size n and prove that g(x) = h(all-but-last x) = h(all-but-last y)
; = g(y) , where h is the derived partition

\end{verbatim}\begin{tabbing}{\sc Theorem}:  derived-partition-lemma-aux1 \\ \index{derived-partition-lemma-aux1}
({\rm{length}}\,({\it{x\/}})\index{length} $\not<$ {\tt{2}}) $\rightarrow$ ({\rm{length}}\,({\rm{all-but-last}}\,({\it{x\/}})\index{all-but-last})\index{length} $=$ ({\rm{length}}\,({\it{x\/}})\index{length} $-\;1$))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  derived-partition-lemma-aux2 \\ \index{derived-partition-lemma-aux2}
\=\+(\=\+({\tt{2}} $\leq$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{pre-homp}}\,({\it{set\/}}, {\it{g\/}})\index{pre-homp} \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\it{small-set\/}}, {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{homp}}\,({\it{small-set\/}}, {\rm{derived}}\,({\it{g\/}}, {\it{set\/}})\index{derived}, {\it{n\/}} $-\;1$)\index{homp} \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\it{x\/}}, {\it{small-set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\it{y\/}}, {\it{small-set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{y\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{x\/}})\index{length} $=$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{y\/}})\index{length} $=$ {\it{n\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $=$ {\rm{funcall}}\,({\it{g\/}}, {\it{y\/}})\index{funcall})\-
\end{tabbing}

\begin{verbatim}; now, if (homp small-set g n) fails, lookat a counter-example

\end{verbatim}\begin{tabbing}{\sc Theorem}:  derived-partition-lemma \\ \index{derived-partition-lemma}
\=\+(\=\+({\tt{2}} $\leq$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{pre-homp}}\,({\it{set\/}}, {\it{g\/}})\index{pre-homp} \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\it{small-set\/}}, {\it{set\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{homp}}\,({\it{small-set\/}}, {\rm{derived}}\,({\it{g\/}}, {\it{set\/}})\index{derived}, {\it{n\/}} $-\;1$)\index{homp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{homp}}\,({\it{small-set\/}}, {\it{g\/}}, {\it{n\/}})\index{homp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable derived-partition-lemma-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable derived-partition-lemma-aux2.

\addvspace{18pt}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                           THE TAIL LEMMA                               ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Suppose ZZ is a set which is omega^alpha + omega + k  -- large.
; let z = min ZZ.
; If we take cdr's magic(z+d) times, we get a set QQ such that
; 1. QQ is a set and omega^alpha -- large
; 2. QQ is a subset of ZZ
; 3. min(QQ) >= min(ZZ) + magic(z+k).

; To prove this, we analyze ordinals delta of the forms:
;   type A: delta = omega^alpha + omega + k (k > 0)   (alpha 1 . k) k > 0
;   type B: delta = omega^alpha +  k        (k > 0)   (alpha . k)  k > 0
;   type C: delta = omega^alpha + omega               (alpha 1 . 0)

; As a first step, consider the {delta}(n) for these ordinals.

; type A  : (cons alpha (cons 1 k)) : k > 0

\end{verbatim}
\noindent{\sc Event}:   Enable ord-lessp.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  type-a-is-ordinal \\ \index{type-a-is-ordinal}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\tt{0}} $<$ {\it{k\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ordinalp}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{k\/}})))\-
\end{tabbing}

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

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  type-a-is-a-successor \\ \index{type-a-is-a-successor}
({\tt{0}} $<$ {\it{k\/}}) $\rightarrow$ {\rm{successorp}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{k\/}})))\index{successorp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  predecessor-of-type-a \\ \index{predecessor-of-type-a}
\=\+({\tt{0}} $<$ {\it{k\/}}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{predecessor}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{k\/}})))\index{predecessor} $=$ {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{k\/}} $-\;1$)))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-type-a \\ \index{pred-type-a}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\tt{0}} $<$ {\it{k\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{pred}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{k\/}})), {\it{n\/}})\index{pred} $=$ {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{k\/}} $-\;1$)))\-
\end{tabbing}

\begin{verbatim}; type B  : (cons alpha k) : k > 0

\end{verbatim}
\noindent{\sc Event}:   Enable ord-lessp.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  type-b-is-ordinal \\ \index{type-b-is-ordinal}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\tt{0}} $<$ {\it{k\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{ordinalp}}\,({\rm{cons}}\,({\it{alpha\/}}, {\it{k\/}}))\-
\end{tabbing}

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

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  type-b-is-a-successor \\ \index{type-b-is-a-successor}
({\tt{0}} $<$ {\it{k\/}}) $\rightarrow$ {\rm{successorp}}\,({\rm{cons}}\,({\it{alpha\/}}, {\it{k\/}}))\index{successorp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  predecessor-of-type-b \\ \index{predecessor-of-type-b}
({\tt{0}} $<$ {\it{k\/}}) $\rightarrow$ ({\rm{predecessor}}\,({\rm{cons}}\,({\it{alpha\/}}, {\it{k\/}}))\index{predecessor} $=$ {\rm{cons}}\,({\it{alpha\/}}, {\it{k\/}} $-\;1$))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-type-b \\ \index{pred-type-b}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\tt{0}} $<$ {\it{k\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{pred}}\,({\rm{cons}}\,({\it{alpha\/}}, {\it{k\/}}), {\it{n\/}})\index{pred} $=$ {\rm{cons}}\,({\it{alpha\/}}, {\it{k\/}} $-\;1$))\-
\end{tabbing}

\begin{verbatim}; type C  : (cons alpha (cons 1 0)) 
\end{verbatim}
\noindent{\sc Event}:   Enable ord-lessp.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  type-c-is-ordinal \\ \index{type-c-is-ordinal}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq}) $\rightarrow$ {\rm{ordinalp}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})))
\end{tabbing}

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

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  type-c-is-a-limit \\ \index{type-c-is-a-limit}
{\rm{limitp}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})))\index{limitp}
\end{tabbing}

\begin{verbatim}; Now we want:
; (equal 
;   (pred (cons alpha (cons 1 0)) n)
;   (cons alpha (plus (magic n) 2)) )  

; first, compute the norms

\end{verbatim}\begin{tabbing}{\sc Theorem}:  norm-of-type-c \\ \index{norm-of-type-c}
{\rm{norm}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})))\index{norm} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\tt{3}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-pred-of-type-c \\ \index{norm-of-pred-of-type-c}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{norm}}\,({\rm{pred}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})), {\it{n\/}})\index{pred})\index{norm} \\ 
$=$$\;\;\;\;$({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\tt{3}} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-right-answer-c \\ \index{norm-of-right-answer-c}
\=\+({\it{n\/}} $\in\;${\bf{N}}${}$) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{norm}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{magic}}\,({\it{n\/}})\index{magic} $+$ {\tt{2}}))\index{norm} \\ 
$=$$\;\;\;\;$({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\tt{3}} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic}))\-\-
\end{tabbing}

\begin{verbatim}; now, we prove that the right answer,  omega^alpha + (magic n) + 2
; is less than omega^alpha + omega  -- then we need
; only show that anything strictly betwwen 
; omega^alpha + (magic n) + 2 and omega^alpha + omega  has larger norm


\end{verbatim}\begin{tabbing}{\sc Theorem}:  pred-type-c-aux1 \\ \index{pred-type-c-aux1}
{\rm{ord-lessp}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{magic}}\,({\it{n\/}})\index{magic} $+$ {\tt{2}}), {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-type-c-aux2 \\ \index{pred-type-c-aux2}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-leq}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{magic}}\,({\it{n\/}})\index{magic} $+$ {\tt{2}}), {\rm{pred}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})), {\it{n\/}})\index{pred})\index{ord-leq}\-
\end{tabbing}

\begin{verbatim}; so, the only remaining possibility is that 
; (pred (cons alpha (cons 1 0)) n)   is strictly between
; (cons alpha (plus (magic n) 2))   and (cons alpha (cons 1 0))
; but then its norm would be too large

; any ordinal strictly between must be of the form
;  (cons alpha j)  where j > (plus (magic n) 2)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pred-type-c-aux3 \\ \index{pred-type-c-aux3}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{sigma\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{r\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{cons}}\,({\it{alpha\/}}, {\it{r\/}}), {\it{sigma\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{sigma\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}}))))\- \\ 
$\rightarrow$$\;\;\;\;$(({\rm{car}}\,({\it{sigma\/}}) $=$ {\it{alpha\/}}) $\wedge$ ({\rm{cdr}}\,({\it{sigma\/}}) $\in\;${\bf{N}}${}$) $\wedge$ ({\it{r\/}} $<$ {\rm{cdr}}\,({\it{sigma\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-type-c-aux4 \\ \index{pred-type-c-aux4}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{sigma\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{magic}}\,({\it{n\/}})\index{magic} $+$ {\tt{2}}), {\it{sigma\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{sigma\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}}))))\- \\ 
$\rightarrow$$\;\;\;\;$(({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\tt{3}} $+$ {\rm{magic}}\,({\it{n\/}})\index{magic}) $<$ {\rm{norm}}\,({\it{sigma\/}})\index{norm})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-type-c-aux5 \\ \index{pred-type-c-aux5}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{ord-lessp}}\,(\=\+{\rm{cons}}\,({\it{alpha\/}}, {\rm{magic}}\,({\it{n\/}})\index{magic} $+$ {\tt{2}}), \\ 
{\rm{pred}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})), {\it{n\/}})\index{pred})\-)\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pred-type-c \\ \index{pred-type-c}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{pred}}\,({\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})), {\it{n\/}})\index{pred} $=$ {\rm{cons}}\,({\it{alpha\/}}, {\rm{magic}}\,({\it{n\/}})\index{magic} $+$ {\tt{2}}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable pred-type-c-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pred-type-c-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pred-type-c-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pred-type-c-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pred-type-c-aux5.

\addvspace{18pt}

\begin{verbatim};; OK -- that finishes the {delta}(n) discussion

;;;;;;;; nthcdr
; this is like the common lisp function

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

\begin{verbatim}; some trivail properties:

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

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

\begin{tabbing}{\sc Theorem}:  nthcdr-add \\ \index{nthcdr-add}
{\rm{nthcdr}}\,({\it{m\/}}, {\rm{nthcdr}}\,({\it{n\/}}, {\it{lst\/}})\index{nthcdr})\index{nthcdr} $=$ {\rm{nthcdr}}\,({\it{m\/}} $+$ {\it{n\/}}, {\it{lst\/}})\index{nthcdr}
\end{tabbing}

\begin{verbatim}; since the cdr of a non-list is 0:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  length-of-nthcdr \\ \index{length-of-nthcdr}
({\rm{nthcdr}}\,({\it{n\/}}, {\it{lst\/}})\index{nthcdr} $\not=$ {\tt{0}}) $\rightarrow$ ({\rm{length}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{lst\/}})\index{nthcdr})\index{length} $=$ ({\rm{length}}\,({\it{lst\/}})\index{length} $-$ {\it{n\/}}))
\end{tabbing}

\begin{verbatim}; since non-lists are subsets of everying

\end{verbatim}
\noindent{\sc Event}:   Enable subsetp.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  nthcdr-is-subset \\ \index{nthcdr-is-subset}
{\rm{subsetp}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{lst\/}})\index{nthcdr}, {\it{lst\/}})\index{subsetp}
\end{tabbing}

\noindent{\sc Event}:   Disable subsetp.

\addvspace{18pt}


\begin{verbatim}; now, special facts about sets -- 
; we want to know that (nthcdr n set) is a subset of set
; whose car is at least  (car set) + n
; (assuming  the nthdr isn't empty)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  cdr-is-a-set \\ \index{cdr-is-a-set}
({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ ({\rm{cdr}}\,({\it{set\/}}) $\not=$ {\tt{0}})) $\rightarrow$ {\rm{setp}}\,({\rm{cdr}}\,({\it{set\/}}))\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-is-a-set \\ \index{nthcdr-is-a-set}
({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ ({\rm{nthcdr}}\,({\it{n\/}}, {\it{set\/}})\index{nthcdr} $\not=$ {\tt{0}})) $\rightarrow$ {\rm{setp}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{set\/}})\index{nthcdr})\index{setp}
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  cdr-is-above \\ \index{cdr-is-above}
({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\rm{cdr}}\,({\it{set\/}}))) $\rightarrow$ ({\rm{car}}\,({\it{set\/}}) $<$ {\rm{car}}\,({\rm{cdr}}\,({\it{set\/}})))
\end{tabbing} 

\begin{tabbing}{\sc Theorem}:  cdr-is-above-by-1 \\ \index{cdr-is-above-by-1}
({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\rm{cdr}}\,({\it{set\/}}))) $\rightarrow$ ({\rm{car}}\,({\rm{cdr}}\,({\it{set\/}})) $\not<$ ($1\;+$ {\rm{car}}\,({\it{set\/}})))
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bad-for-nthcdr-is-above-by-n} \\  
\=\+{\rm{bad-for-nthcdr-is-above-by-n}}\,({\it{n\/}}, {\it{set\/}})\index{bad-for-nthcdr-is-above-by-n} \\ 
$=$$\;\;\;\;$(\=\+{\rm{setp}}\,({\it{set\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{set\/}})\index{nthcdr}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{set\/}})\index{nthcdr}) $<$ ({\it{n\/}} $+$ {\rm{car}}\,({\it{set\/}}))))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-is-above-by-n-aux1 \\ \index{nthcdr-is-above-by-n-aux1}
({\it{n\/}} $\simeq {\tt{0}}$) $\rightarrow$ ($\neg$ {\rm{bad-for-nthcdr-is-above-by-n}}\,({\it{n\/}}, {\it{set\/}})\index{bad-for-nthcdr-is-above-by-n})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-is-above-by-n-aux2 \\ \index{nthcdr-is-above-by-n-aux2}
\=\+({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ ($\neg$ {\rm{setp}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{set\/}})\index{nthcdr})\index{setp})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{listp}}\,({\rm{cdr}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{set\/}})\index{nthcdr})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-is-above-by-n-aux3 \\ \index{nthcdr-is-above-by-n-aux3}
\=\+{\rm{bad-for-nthcdr-is-above-by-n}}\,($1\;+$ {\it{n\/}}, {\it{set\/}})\index{bad-for-nthcdr-is-above-by-n} \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-nthcdr-is-above-by-n}}\,({\it{n\/}}, {\it{set\/}})\index{bad-for-nthcdr-is-above-by-n}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-is-above-by-n-aux4 \\ \index{nthcdr-is-above-by-n-aux4}
$\neg$ {\rm{bad-for-nthcdr-is-above-by-n}}\,({\it{n\/}}, {\it{set\/}})\index{bad-for-nthcdr-is-above-by-n}
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  nthcdr-is-above-by-n \\ \index{nthcdr-is-above-by-n}
\=\+({\rm{setp}}\,({\it{set\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{set\/}})\index{nthcdr})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{nthcdr}}\,({\it{n\/}}, {\it{set\/}})\index{nthcdr}) $\not<$ ({\it{n\/}} $+$ {\rm{car}}\,({\it{set\/}})))\-
\end{tabbing} 

\begin{verbatim};;;;;;;;;;;
; now, suppose Z is omega^alpha + omega + d large (say, alpha > 0),
; and z = min(Z).   Let Q = (nthcdr (magic(z +d )  Z))
; then Q is omega^alpha large (in particular, non-empty) , and
; then, by the above, Q is a subset of Z and min(Q)  >= magic(z + d)

; we consider the three types of ordinals in sequence.

; one more simple fact -- needed in the following inductive proofs
\end{verbatim}\begin{tabbing}{\sc Theorem}:  nthcdr-of-cdr \\ \index{nthcdr-of-cdr}
({\it{k\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ ({\rm{nthcdr}}\,({\it{k\/}} $-\;1$, {\rm{cdr}}\,({\it{set\/}}))\index{nthcdr} $=$ {\rm{nthcdr}}\,({\it{k\/}}, {\it{set\/}})\index{nthcdr})
\end{tabbing}

\begin{verbatim}; type A  : (cons alpha (cons 1 k)) : k > 0  : omega^alpha + omega + k
; we iterate k times to get to Z' which is omega^alpha + omega -- large

\end{verbatim}\begin{tabbing}{\sc Theorem}:  cdr-large-a \\ \index{cdr-large-a}
\=\+(\=\+{\rm{setp}}\,({\it{set\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\it{k\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{set\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{k\/}})))\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{set\/}}), {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{k\/}} $-\;1$)))\index{o-largep}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bad-for-nthcdr-large-a} \\  
\=\+{\rm{bad-for-nthcdr-large-a}}\,({\it{set\/}}, {\it{alpha\/}}, {\it{k\/}})\index{bad-for-nthcdr-large-a} \\ 
$=$$\;\;\;\;$(\=\+{\rm{setp}}\,({\it{set\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{k\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{set\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{k\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$(\=\+($\neg$ {\rm{setp}}\,({\rm{nthcdr}}\,({\it{k\/}}, {\it{set\/}})\index{nthcdr})\index{setp}) \\ 
$\vee$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{nthcdr}}\,({\it{k\/}}, {\it{set\/}})\index{nthcdr}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})))\index{o-largep}))\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-large-a-aux1 \\ \index{nthcdr-large-a-aux1}
({\it{k\/}} $\simeq {\tt{0}}$) $\rightarrow$ ($\neg$ {\rm{bad-for-nthcdr-large-a}}\,({\it{set\/}}, {\it{alpha\/}}, {\it{k\/}})\index{bad-for-nthcdr-large-a})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-large-a-aux2 \\ \index{nthcdr-large-a-aux2}
{\rm{setp}}\,({\rm{cons}}\,({\it{z\/}}, {\it{x\/}}))\index{setp} $\rightarrow$ {\rm{setp}}\,({\it{x\/}})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-large-a-aux3 \\ \index{nthcdr-large-a-aux3}
{\rm{o-largep}}\,({\it{v\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{k\/}})))\index{o-largep} $\rightarrow$ {\rm{listp}}\,({\it{v\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-large-a-aux4 \\ \index{nthcdr-large-a-aux4}
\=\+(({\it{k\/}} $\not\simeq {\tt{0}}$) $\wedge$ {\rm{bad-for-nthcdr-large-a}}\,({\it{set\/}}, {\it{alpha\/}}, {\it{k\/}})\index{bad-for-nthcdr-large-a}) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-nthcdr-large-a}}\,({\rm{cdr}}\,({\it{set\/}}), {\it{alpha\/}}, {\it{k\/}} $-\;1$)\index{bad-for-nthcdr-large-a}\-
\end{tabbing}

\begin{verbatim}; force correct induction
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{nthcdr-large-a-kludge} \\  
\=\+{\rm{nthcdr-large-a-kludge}}\,({\it{set\/}}, {\it{alpha\/}}, {\it{k\/}})\index{nthcdr-large-a-kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\tt{0}} $<$ {\it{k\/}}$\;\;${\bf then }{\rm{nthcdr-large-a-kludge}}\,({\rm{cdr}}\,({\it{set\/}}), {\it{alpha\/}}, {\it{k\/}} $-\;1$)\index{nthcdr-large-a-kludge} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  nthcdr-large-a-aux5 \\ \index{nthcdr-large-a-aux5}
$\neg$ {\rm{bad-for-nthcdr-large-a}}\,({\it{set\/}}, {\it{alpha\/}}, {\it{k\/}})\index{bad-for-nthcdr-large-a}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-large-a \\ \index{nthcdr-large-a}
\=\+(\=\+{\rm{setp}}\,({\it{set\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{k\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{set\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{k\/}})))\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{setp}}\,({\rm{nthcdr}}\,({\it{k\/}}, {\it{set\/}})\index{nthcdr})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\rm{nthcdr}}\,({\it{k\/}}, {\it{set\/}})\index{nthcdr}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})))\index{o-largep})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable nthcdr-large-a-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nthcdr-large-a-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nthcdr-large-a-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nthcdr-large-a-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nthcdr-large-a-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bad-for-nthcdr-large-a.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nthcdr-large-a-kludge.

\addvspace{18pt}

\begin{verbatim}; repeat for
; type B  : (cons alpha  k) : k > 0  : omega^alpha +  k
; start with Z whih is omega^alpha +  k -- large
; we iterate k times to get to Z' which is omega^alpha  -- large

\end{verbatim}\begin{tabbing}{\sc Theorem}:  cdr-large-b \\ \index{cdr-large-b}
\=\+(\=\+{\rm{setp}}\,({\it{set\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\tt{0}} $<$ {\it{k\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{set\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\it{k\/}}))\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{set\/}}), {\rm{cons}}\,({\it{alpha\/}}, {\it{k\/}} $-\;1$))\index{o-largep}\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{bad-for-nthcdr-large-b} \\  
\=\+{\rm{bad-for-nthcdr-large-b}}\,({\it{set\/}}, {\it{alpha\/}}, {\it{k\/}})\index{bad-for-nthcdr-large-b} \\ 
$=$$\;\;\;\;$(\=\+{\rm{setp}}\,({\it{set\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{k\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{set\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\it{k\/}}))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$(\=\+($\neg$ {\rm{setp}}\,({\rm{nthcdr}}\,({\it{k\/}}, {\it{set\/}})\index{nthcdr})\index{setp}) \\ 
$\vee$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{nthcdr}}\,({\it{k\/}}, {\it{set\/}})\index{nthcdr}, {\rm{cons}}\,({\it{alpha\/}}, {\tt{0}}))\index{o-largep}))\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-large-b-aux1 \\ \index{nthcdr-large-b-aux1}
({\it{k\/}} $\simeq {\tt{0}}$) $\rightarrow$ ($\neg$ {\rm{bad-for-nthcdr-large-b}}\,({\it{set\/}}, {\it{alpha\/}}, {\it{k\/}})\index{bad-for-nthcdr-large-b})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-large-b-aux2 \\ \index{nthcdr-large-b-aux2}
{\rm{setp}}\,({\rm{cons}}\,({\it{z\/}}, {\it{x\/}}))\index{setp} $\rightarrow$ {\rm{setp}}\,({\it{x\/}})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-large-b-aux4 \\ \index{nthcdr-large-b-aux4}
\=\+(({\it{k\/}} $\not\simeq {\tt{0}}$) $\wedge$ {\rm{bad-for-nthcdr-large-b}}\,({\it{set\/}}, {\it{alpha\/}}, {\it{k\/}})\index{bad-for-nthcdr-large-b}) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-nthcdr-large-b}}\,({\rm{cdr}}\,({\it{set\/}}), {\it{alpha\/}}, {\it{k\/}} $-\;1$)\index{bad-for-nthcdr-large-b}\-
\end{tabbing}

\begin{verbatim}; force correct induction
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{nthcdr-large-b-kludge} \\  
\=\+{\rm{nthcdr-large-b-kludge}}\,({\it{set\/}}, {\it{alpha\/}}, {\it{k\/}})\index{nthcdr-large-b-kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\tt{0}} $<$ {\it{k\/}}$\;\;${\bf then }{\rm{nthcdr-large-b-kludge}}\,({\rm{cdr}}\,({\it{set\/}}), {\it{alpha\/}}, {\it{k\/}} $-\;1$)\index{nthcdr-large-b-kludge} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-large-b-aux5 \\ \index{nthcdr-large-b-aux5}
$\neg$ {\rm{bad-for-nthcdr-large-b}}\,({\it{set\/}}, {\it{alpha\/}}, {\it{k\/}})\index{bad-for-nthcdr-large-b}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-large-b \\ \index{nthcdr-large-b}
\=\+(\=\+{\rm{setp}}\,({\it{set\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{k\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{set\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\it{k\/}}))\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{setp}}\,({\rm{nthcdr}}\,({\it{k\/}}, {\it{set\/}})\index{nthcdr})\index{setp} $\wedge$ {\rm{o-largep}}\,({\rm{nthcdr}}\,({\it{k\/}}, {\it{set\/}})\index{nthcdr}, {\rm{cons}}\,({\it{alpha\/}}, {\tt{0}}))\index{o-largep})\-
\end{tabbing}


\noindent{\sc Event}:   Disable nthcdr-large-b-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nthcdr-large-b-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nthcdr-large-b-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nthcdr-large-b-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bad-for-nthcdr-large-b.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nthcdr-large-b-kludge.

\addvspace{18pt}

\begin{verbatim}; type C  : (cons alpha (cons 1 0))  : omega^alpha + omega
; start with Z which is omega^alpha + omega -- large
; then its cdr is a set and is omega^alpha + (magic z) + 2 -- large

\end{verbatim}\begin{tabbing}{\sc Theorem}:  nthcdr-c-1 \\ \index{nthcdr-c-1}
\=\+(\=\+{\rm{setp}}\,({\it{set\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{set\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})))\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{setp}}\,({\rm{cdr}}\,({\it{set\/}}))\index{setp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nthcdr-c-2 \\ \index{nthcdr-c-2}
\=\+(\=\+{\rm{setp}}\,({\it{set\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{set\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\tt{0}})))\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{set\/}}), {\rm{cons}}\,({\it{alpha\/}}, {\rm{magic}}\,({\rm{car}}\,({\it{set\/}}))\index{magic} $+$ {\tt{2}}))\index{o-largep}\-
\end{tabbing}

\begin{verbatim}; now; return to the tail lemma:
; Suppose ZZ is a set which is omega^alpha + omega + d  -- large.
; let z = min ZZ.
; If we take cdr's magic(z+d) times, we get a set QQ such that
; 1. QQ is a set and omega^alpha -- large
; 2. QQ is a subset of ZZ
; 3. min(QQ) >= min(ZZ) + magic(z+d).
; call these parts tail-lemma-1, tail-lemma-2, tail-lemma-3


; First, apply the reductions for types A, C, B in sequence,
; to get an omega^alpha -- large set

\end{verbatim}\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux1 \\ \index{tail-lemma-1-aux1}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{z1\/}} $=$ {\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}) \\ 
$\wedge$$\;\;\;\;$({\it{z2\/}} $=$ {\rm{cdr}}\,({\it{z1\/}})) \\ 
$\wedge$$\;\;\;\;$({\it{z3\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{z1\/}}))\index{magic} $+$ {\tt{2}}, {\it{z2\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{setp}}\,({\it{z3\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{z3\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\tt{0}}))\index{o-largep})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux2 \\ \index{tail-lemma-1-aux2}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{z1\/}} $=$ {\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}) \\ 
$\wedge$$\;\;\;\;$({\it{z2\/}} $=$ {\rm{cdr}}\,({\it{z1\/}})) \\ 
$\wedge$$\;\;\;\;$({\it{z3\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{magic} $+$ {\tt{2}}, {\rm{cdr}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{setp}}\,({\it{z3\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{z3\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\tt{0}}))\index{o-largep})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux3 \\ \index{tail-lemma-1-aux3}
{\rm{nthcdr}}\,({\it{i\/}}, {\rm{cdr}}\,({\it{set\/}}))\index{nthcdr} $=$ {\rm{nthcdr}}\,($1\;+$ {\it{i\/}}, {\it{set\/}})\index{nthcdr}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux4 \\ \index{tail-lemma-1-aux4}
{\rm{nthcdr}}\,({\it{j\/}} $+$ {\tt{2}}, {\rm{cdr}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{nthcdr} $=$ {\rm{nthcdr}}\,($1\;+$ ({\it{j\/}} $+$ {\tt{2}}), {\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr})\index{nthcdr}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux5 \\ \index{tail-lemma-1-aux5}
{\rm{nthcdr}}\,({\it{j\/}} $+$ {\tt{2}}, {\rm{cdr}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{nthcdr} $=$ {\rm{nthcdr}}\,({\it{j\/}} $+$ {\tt{3}} $+$ {\it{d\/}}, {\it{zz\/}})\index{nthcdr}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux6 \\ \index{tail-lemma-1-aux6}
\=\+{\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{magic} $+$ {\tt{2}}, {\rm{cdr}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{nthcdr} \\ 
$=$$\;\;\;\;${\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{magic} $+$ {\tt{3}} $+$ {\it{d\/}}, {\it{zz\/}})\index{nthcdr}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux7 \\ \index{tail-lemma-1-aux7}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{z3\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{magic} $+$ {\tt{3}} $+$ {\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{setp}}\,({\it{z3\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{z3\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\tt{0}}))\index{o-largep})\-
\end{tabbing}

\begin{verbatim}; now, what we want is not Z3, but
; QQ = (nthcdr (magic (plus (car ZZ) d))  ZZ)
; so, we need that QQ is a subset of Z3, which involves
; showing that 
;  (magic (plus (car ZZ) d)) <= (plus (magic (car (nthcdr d ZZ))) 3 d)
; magic is monotonic, so we need only: 
; (plus (car ZZ) d) <=  (car (nthcdr d ZZ))

\end{verbatim}\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux8 \\ \index{tail-lemma-1-aux8}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{listp}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux9 \\ \index{tail-lemma-1-aux9}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}) $\not<$ ({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux10 \\ \index{tail-lemma-1-aux10}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{magic}}\,({\rm{car}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{magic} $\not<$ {\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux11 \\ \index{tail-lemma-1-aux11}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic} $<$ ({\rm{magic}}\,({\rm{car}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{magic} $+$ {\tt{3}} $+$ {\it{d\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux12 \\ \index{tail-lemma-1-aux12}
({\it{i\/}} $<$ {\it{j\/}}) $\rightarrow$ ((({\it{j\/}} $-$ {\it{i\/}}) $+$ {\it{i\/}}) $=$ {\it{j\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux13 \\ \index{tail-lemma-1-aux13}
({\it{i\/}} $<$ {\it{j\/}}) $\rightarrow$ {\rm{subsetp}}\,({\rm{nthcdr}}\,({\it{j\/}}, {\it{zz\/}})\index{nthcdr}, {\rm{nthcdr}}\,({\it{i\/}}, {\it{zz\/}})\index{nthcdr})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux14 \\ \index{tail-lemma-1-aux14}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}, {\it{zz\/}})\index{nthcdr}) \\ 
$\wedge$$\;\;\;\;$({\it{z3\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{magic} $+$ {\tt{3}} $+$ {\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{subsetp}}\,({\it{z3\/}}, {\it{qq\/}})\index{subsetp}\-
\end{tabbing}

\begin{verbatim}; now, QQ will be a set if it's not 0

\end{verbatim}\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux15 \\ \index{tail-lemma-1-aux15}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{z3\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{magic} $+$ {\tt{3}} $+$ {\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{listp}}\,({\it{z3\/}})\-
\end{tabbing}

\begin{verbatim}; all these aux lemmas are getting in our way now -- let's 
; just disable them and just quote the ones we need

\end{verbatim}
\noindent{\sc Event}:   Disable tail-lemma-1-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux9.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux10.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux11.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux12.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux13.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux14.

\addvspace{18pt}

\noindent{\sc Event}:   Disable tail-lemma-1-aux15.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux16 \\ \index{tail-lemma-1-aux16}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}, {\it{zz\/}})\index{nthcdr}) \\ 
$\wedge$$\;\;\;\;$({\it{z3\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{magic} $+$ {\tt{3}} $+$ {\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{listp}}\,({\it{qq\/}})\-
\end{tabbing}


\noindent{\sc Event}:   Disable tail-lemma-1-aux16.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1-aux17 \\ \index{tail-lemma-1-aux17}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}, {\it{zz\/}})\index{nthcdr}) \\ 
$\wedge$$\;\;\;\;$({\it{z3\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\rm{nthcdr}}\,({\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\index{magic} $+$ {\tt{3}} $+$ {\it{d\/}}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{setp}}\,({\it{qq\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{qq\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\tt{0}}))\index{o-largep})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-1 \\ \index{tail-lemma-1}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{setp}}\,({\it{qq\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{qq\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\tt{0}}))\index{o-largep})\-
\end{tabbing}


\noindent{\sc Event}:   Disable tail-lemma-1-aux17.

\addvspace{18pt}

\begin{verbatim}; now return to parts 2 and 3 of the tail-lemma:
; Suppose ZZ is a set which is omega^alpha + omega + d  -- large.
; let z = min ZZ.
; If we take cdr's magic(z+d) times, we get a set QQ such that
; 1. QQ is a set and omega^alpha -- large
; 2. QQ is a subset of ZZ
; 3. min(QQ) >= min(ZZ) + magic(z+d).
; call these parts tail-lemma-1, tail-lemma-2, tail-lemma-3


\end{verbatim}\begin{tabbing}{\sc Theorem}:  tail-lemma-2 \\ \index{tail-lemma-2}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{subsetp}}\,({\it{qq\/}}, {\it{zz\/}})\index{subsetp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-aux1 \\ \index{tail-lemma-aux1}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{listp}}\,({\it{qq\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  tail-lemma-3 \\ \index{tail-lemma-3}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\it{qq\/}}) $\not<$ ({\rm{car}}\,({\it{zz\/}}) $+$ {\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable tail-lemma-aux1.

\addvspace{18pt}




\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                    PROPERTIES OF PHI AND STAR                          ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; phi(alpha, c) = omega^alpha + omega + norm(alpha) + c

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{phi} \\  
\=\+{\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) \\ 
{\bf then }{\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\it{c\/}})) \\ 
{\bf else }{\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\it{c\/}} $+$ {\tt{3}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  phi-is-an-ord \\ \index{phi-is-an-ord}
{\rm{ordinalp}}\,({\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-phi \\ \index{norm-of-phi}
\=\+({\it{c\/}} $\in\;${\bf{N}}${}$) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{norm} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\it{c\/}} $+$ {\tt{3}}))\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  star-is-an-ord \\ \index{star-is-an-ord}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ {\rm{ordinalp}}\,({\rm{star}}\,({\it{alpha\/}}, {\it{n\/}})\index{star})
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  star-with-1 \\ \index{star-with-1}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ ({\rm{star}}\,({\it{alpha\/}}, {\tt{1}})\index{star} $=$ {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-of-star \\ \index{norm-of-star}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{star}}\,({\it{alpha\/}}, {\it{n\/}})\index{star})\index{norm} $=$ ({\it{n\/}} $*$ {\rm{norm}}\,({\it{alpha\/}})\index{norm}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sharp-with-0-reversed \\ \index{sharp-with-0-reversed}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ ({\rm{sharp}}\,({\it{alpha\/}}, {\tt{0}})\index{sharp} $=$ {\it{alpha\/}})
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  car-of-star \\ \index{car-of-star}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\tt{0}} $<$ {\it{n\/}})) $\rightarrow$ ({\rm{car}}\,({\rm{star}}\,({\it{alpha\/}}, {\it{n\/}})\index{star}) $=$ {\rm{car}}\,({\it{alpha\/}}))
\end{tabbing}

\begin{verbatim};; now we show: "bound-on-phi":
; if alpha < beta , then phi(alpha,c) * n < omega^beta  (for any n)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  bound-on-phi-aux1 \\ \index{bound-on-phi-aux1}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ (($\neg$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq}) $=$ ({\it{alpha\/}} $=$ {\tt{0}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-phi-aux2 \\ \index{bound-on-phi-aux2}
{\rm{ord-lessp}}\,({\rm{car}}\,({\it{sigma\/}}), {\rm{car}}\,({\it{tau\/}})) $\rightarrow$ {\rm{ord-lessp}}\,({\it{sigma\/}}, {\it{tau\/}})
\end{tabbing}

\begin{verbatim}; now, we just need to look at the cars:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  car-of-phi \\ \index{car-of-phi}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi}) $=$ {\it{alpha\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-phi-aux3 \\ \index{bound-on-phi-aux3}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\not\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{star}}\,({\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi}, {\it{n\/}})\index{star}) $=$ {\it{alpha\/}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-phi-aux4 \\ \index{bound-on-phi-aux4}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\simeq {\tt{0}}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{star}}\,({\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi}, {\it{n\/}})\index{star}) $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-phi-aux5 \\ \index{bound-on-phi-aux5}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ($\neg$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{star}}\,({\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi}, {\it{n\/}})\index{star}) $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-phi \\ \index{bound-on-phi}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{beta\/}}) $\wedge$ {\rm{ord-lessp}}\,({\it{alpha\/}}, {\it{beta\/}}) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{star}}\,({\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi}, {\it{n\/}})\index{star}, {\rm{cons}}\,({\it{beta\/}}, {\tt{0}}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable bound-on-phi-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bound-on-phi-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bound-on-phi-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bound-on-phi-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bound-on-phi-aux5.

\addvspace{18pt}


\begin{verbatim};;; we plan to apply norm-star-phi with n = c^{2^z}

\end{verbatim}\begin{tabbing}{\sc Theorem}:  norm-star-phi-aux1 \\ \index{norm-star-phi-aux1}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{norm}}\,({\rm{star}}\,({\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi}, {\it{n\/}})\index{star})\index{norm} \\ 
$=$$\;\;\;\;$({\it{n\/}} $*$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\it{c\/}} $+$ {\tt{3}})))\-\-
\end{tabbing}


\begin{verbatim}; revise the format to be consistent with lemma magic-18 in Basic arithmetic
; We need some trivial arithmetic to do this.
\end{verbatim}\begin{tabbing}{\sc Theorem}:  times-with-zero-1 \\ \index{times-with-zero-1}
({\it{x\/}} $\simeq {\tt{0}}$) $\rightarrow$ (({\it{x\/}} $*$ {\it{y\/}}) $=$ {\tt{0}})
\end{tabbing}
\begin{tabbing}{\sc Theorem}:  times-with-zero-2 \\ \index{times-with-zero-2}
({\it{y\/}} $\simeq {\tt{0}}$) $\rightarrow$ (({\it{x\/}} $*$ {\it{y\/}}) $=$ {\tt{0}})
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  commut-of-times-aux1 \\ \index{commut-of-times-aux1}
({\it{z\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ (({\it{y\/}} $*$ ($1\;+$ {\it{z\/}})) $=$ ({\it{y\/}} $+$ ({\it{z\/}} $*$ {\it{y\/}})))
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  norm-star-phi-aux2 \\ \index{norm-star-phi-aux2}
\=\+(({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$((({\it{x\/}} $+$ {\it{x\/}}) $+$ ($1\;+$ ({\tt{2}} $+$ {\it{c\/}}))) $=$ ({\it{x\/}} $+$ {\it{x\/}} $+$ {\it{c\/}} $+$ {\tt{3}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-star-phi-aux3 \\ \index{norm-star-phi-aux3}
\=\+(({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$(({\it{n\/}} $*$ ({\it{x\/}} $+$ {\it{x\/}} $+$ {\it{c\/}} $+$ {\tt{3}})) $=$ ((({\tt{2}} $*$ {\it{x\/}}) $+$ {\tt{3}} $+$ {\it{c\/}}) $*$ {\it{n\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-star-phi \\ \index{norm-star-phi}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{norm}}\,({\rm{star}}\,({\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi}, {\it{n\/}})\index{star})\index{norm} \\ 
$=$$\;\;\;\;$((({\tt{2}} $*$ {\rm{norm}}\,({\it{alpha\/}})\index{norm}) $+$ {\tt{3}} $+$ {\it{c\/}}) $*$ {\it{n\/}}))\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable norm-star-phi-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-star-phi-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-star-phi-aux3.

\addvspace{18pt}


\noindent{\sc Event}:   Disable phi.

\addvspace{18pt} \begin{verbatim}; probably we don't need its defn again


;;;;; lemma "norm-star-exp-phi"
;; One more arithmetic fact about phi -- to be used
; in the "cdr-lemma" below.

; suppose  alpha-hat = {alpha}(z),  c > 0
; d = norm(alpha) + c, and q >= magic(z+d).
; Then:    norm(phi(alpha-hat, c) * c^(2^z)) <= magic(q).
; reason   norm(alpha-hat) <= norm(alpha) + magic(z)
; so norm(phi(alpha-hat, c) * c^(2^z)) <= 
;     2 norm (alpha) + 2 magic(z) + 3 + c  <=
;     magic(q)    (by lemma magic-18)

; first, all we use about alpha-hat is its norm

\end{verbatim}\begin{tabbing}{\sc Theorem}:  norm-star-exp-phi-aux1 \\ \index{norm-star-exp-phi-aux1}
\=\+({\it{alpha-hat\/}} $=$ {\rm{pred}}\,({\it{alpha\/}}, {\it{z\/}})\index{pred}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\it{alpha-hat\/}})\index{norm} $\leq$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\rm{magic}}\,({\it{z\/}})\index{magic}))\-
\end{tabbing}

\begin{verbatim}; second, plug alpha-hat into norm-star-phi

\end{verbatim}\begin{tabbing}{\sc Theorem}:  norm-star-exp-phi-aux2 \\ \index{norm-star-exp-phi-aux2}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{alpha-hat\/}} $=$ {\rm{pred}}\,({\it{alpha\/}}, {\it{z\/}})\index{pred})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{norm}}\,({\rm{star}}\,({\rm{phi}}\,({\it{alpha-hat\/}}, {\it{c\/}})\index{phi}, {\it{n\/}})\index{star})\index{norm} \\ 
$=$$\;\;\;\;$((({\tt{2}} $*$ {\rm{norm}}\,({\it{alpha-hat\/}})\index{norm}) $+$ {\tt{3}} $+$ {\it{c\/}}) $*$ {\it{n\/}}))\-\-
\end{tabbing}

\begin{verbatim}; now, we apply aux1 to get an inequality
; since this involves a product with n, we need some preliminary
; arithmetic.  Think of
; a = norm(alpha)
; a-hat = norm(alpha-hat)
; nsp = (norm (star (phi alpha-hat c) n ))
; mz = (magic z)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  norm-star-exp-phi-aux3 \\ \index{norm-star-exp-phi-aux3}
\=\+({\it{a-hat\/}} $\leq$ ({\it{a\/}} $+$ {\it{mz\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(({\tt{2}} $*$ {\it{a-hat\/}}) $+$ {\tt{3}} $+$ {\it{c\/}}) \\ 
$\leq$$\;\;\;\;$(({\tt{2}} $*$ {\it{a\/}}) $+$ ({\tt{2}} $*$ {\it{mz\/}}) $+$ {\tt{3}} $+$ {\it{c\/}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-star-exp-phi-aux4 \\ \index{norm-star-exp-phi-aux4}
\=\+({\it{a-hat\/}} $\leq$ ({\it{a\/}} $+$ {\it{mz\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+((({\tt{2}} $*$ {\it{a-hat\/}}) $+$ {\tt{3}} $+$ {\it{c\/}}) $*$ {\it{n\/}}) \\ 
$\leq$$\;\;\;\;$((({\tt{2}} $*$ {\it{a\/}}) $+$ ({\tt{2}} $*$ {\it{mz\/}}) $+$ {\tt{3}} $+$ {\it{c\/}}) $*$ {\it{n\/}}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-star-exp-phi-aux5 \\ \index{norm-star-exp-phi-aux5}
\=\+(({\it{nsp\/}} $=$ ((({\tt{2}} $*$ {\it{a-hat\/}}) $+$ {\tt{3}} $+$ {\it{c\/}}) $*$ {\it{n\/}})) $\wedge$ ({\it{a-hat\/}} $\leq$ ({\it{a\/}} $+$ {\it{mz\/}}))) \\ 
$\rightarrow$$\;\;\;\;$({\it{nsp\/}} $\leq$ ((({\tt{2}} $*$ {\it{a\/}}) $+$ ({\tt{2}} $*$ {\it{mz\/}}) $+$ {\tt{3}} $+$ {\it{c\/}}) $*$ {\it{n\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-star-exp-phi-aux6 \\ \index{norm-star-exp-phi-aux6}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{alpha-hat\/}} $=$ {\rm{pred}}\,({\it{alpha\/}}, {\it{z\/}})\index{pred})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{norm}}\,({\rm{star}}\,({\rm{phi}}\,({\it{alpha-hat\/}}, {\it{c\/}})\index{phi}, {\it{n\/}})\index{star})\index{norm} \\ 
$\leq$$\;\;\;\;$(\=\+(({\tt{2}} $*$ {\rm{norm}}\,({\it{alpha\/}})\index{norm}) $+$ ({\tt{2}} $*$ {\rm{magic}}\,({\it{z\/}})\index{magic}) $+$ {\tt{3}} $+$ {\it{c\/}}) \\ 
$*$$\;\;\;\;${\it{n\/}})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  norm-star-exp-phi \\ \index{norm-star-exp-phi}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{alpha-hat\/}} $=$ {\rm{pred}}\,({\it{alpha\/}}, {\it{z\/}})\index{pred}) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\it{c\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{magic}}\,({\it{z\/}} $+$ {\it{d\/}})\index{magic} $\leq$ {\it{q\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{norm}}\,({\rm{star}}\,({\rm{phi}}\,({\it{alpha-hat\/}}, {\it{c\/}})\index{phi}, {\rm{expt}}\,({\it{c\/}}, {\rm{expt}}\,({\tt{2}}, {\it{z\/}})\index{expt})\index{expt})\index{star})\index{norm} $\leq$ {\rm{magic}}\,({\it{q\/}})\index{magic})\-
\end{tabbing}


\noindent{\sc Event}:   Disable norm-star-exp-phi-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-star-exp-phi-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-star-exp-phi-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-star-exp-phi-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-star-exp-phi-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable norm-star-exp-phi-aux6.

\addvspace{18pt}


\noindent{\sc Event}:   Disable norm-star-phi.

\addvspace{18pt}  \begin{verbatim}; this is firing when we don't want it to


\end{verbatim}
\newpage
\begin{verbatim}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                             THE CDR LEMMA                              ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Suppose ZZ is a set which is phi(alpha,c) -- large ; alpha >= 1 ; c >= 1
; let z = min ZZ, and alpha-hat = {alpha}(z)
; then
; 1. (cdr ZZ) is a set
; 2. (cdr ZZ) is phi(alpha-hat,c) * c^(2^z)  --  large
; call these cdr-lemma-1 and cdr-lemma-2

; cdr-lemma-1 should be a triviality -- it just says that ZZ is non-empty

\end{verbatim}\begin{tabbing}{\sc Theorem}:  cdr-lemma-1 \\ \index{cdr-lemma-1}
({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep}) $\rightarrow$ {\rm{setp}}\,({\rm{cdr}}\,({\it{zz\/}}))\index{setp}
\end{tabbing}

\begin{verbatim}; for cdr-lemma-2, let 
;        d = norm(alpha) + c
;        QQ = (nthcdr (magic (plus (car ZZ) d)) ZZ )
;         q = (car QQ)
; by defn of phi, ZZ is omega^alpha + omega + d -- large
; then 
; QQ is a set and is omega^alpha -- large (by tail-lemma-1)
; q >= z + magic(z+d)  (by tail-lemma 3)
; phi(alpha-hat,c)* c^(2^z) < omega^alpha (by bound-on-phi)
; norm( phi(alpha-hat,c)* c^(2^z)) <= magic(q) (by norm-star-exp-phi)
; QQ is phi(alpha-hat,c) * c^(2^z)  --  large  (by large-with-smaller-ord)
; QQ is a subset of (cdr Z)  (since (magic (plus (car ZZ) d)) >= 1)
; (cdr ZZ) is phi(alpha-hat,c) * c^(2^z)  --  large  (by large-goes-up)

; unwind defn of phi
\end{verbatim}\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux1 \\ \index{cdr-lemma-aux1}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\it{c\/}})))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\rm{cons}}\,({\tt{1}}, {\it{d\/}})))\index{o-largep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux2 \\ \index{cdr-lemma-aux2}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\it{c\/}})) \\ 
$\wedge$$\;\;\;\;$({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{setp}}\,({\it{qq\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{qq\/}}, {\rm{cons}}\,({\it{alpha\/}}, {\tt{0}}))\index{o-largep})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux3 \\ \index{cdr-lemma-aux3}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\it{c\/}})) \\ 
$\wedge$$\;\;\;\;$({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;$(({\rm{car}}\,({\it{zz\/}}) $+$ {\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}) $\leq$ {\rm{car}}\,({\it{qq\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux4 \\ \index{cdr-lemma-aux4}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq}) $\rightarrow$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux5 \\ \index{cdr-lemma-aux5}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq}) $\rightarrow$ {\rm{ord-lessp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{z\/}})\index{pred}, {\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux6 \\ \index{cdr-lemma-aux6}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{alpha-hat\/}} $=$ {\rm{pred}}\,({\it{alpha\/}}, {\it{z\/}})\index{pred}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-lessp}}\,({\rm{star}}\,({\rm{phi}}\,({\it{alpha-hat\/}}, {\it{c\/}})\index{phi}, {\it{n\/}})\index{star}, {\rm{cons}}\,({\it{alpha\/}}, {\tt{0}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux7 \\ \index{cdr-lemma-aux7}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\it{alpha-hat\/}} $=$ {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\it{c\/}})) \\ 
$\wedge$$\;\;\;\;$({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{norm}}\,({\rm{star}}\,({\rm{phi}}\,({\it{alpha-hat\/}}, {\it{c\/}})\index{phi}, {\rm{expt}}\,({\it{c\/}}, {\rm{expt}}\,({\tt{2}}, {\rm{car}}\,({\it{zz\/}}))\index{expt})\index{expt})\index{star})\index{norm} \\ 
$\leq$$\;\;\;\;${\rm{magic}}\,({\rm{car}}\,({\it{qq\/}}))\index{magic})\-\-
\end{tabbing}

\begin{verbatim}; the form of large-with-smaller-ord we need:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux8 \\ \index{cdr-lemma-aux8}
\=\+(\=\+{\rm{ordinalp}}\,({\it{sigma\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{tau\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{qq\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{qq\/}}, {\it{tau\/}})\index{o-largep} \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\it{sigma\/}}, {\it{tau\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{norm}}\,({\it{sigma\/}})\index{norm} $\leq$ {\rm{magic}}\,({\rm{car}}\,({\it{qq\/}}))\index{magic}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\it{qq\/}}, {\it{sigma\/}})\index{o-largep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux9 \\ \index{cdr-lemma-aux9}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\it{alpha-hat\/}} $=$ {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{d\/}} $=$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\it{c\/}})) \\ 
$\wedge$$\;\;\;\;$({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ {\it{d\/}})\index{magic}, {\it{zz\/}})\index{nthcdr}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\it{qq\/}}, {\rm{star}}\,({\rm{phi}}\,({\it{alpha-hat\/}}, {\it{c\/}})\index{phi}, {\rm{expt}}\,({\it{c\/}}, {\rm{expt}}\,({\tt{2}}, {\rm{car}}\,({\it{zz\/}}))\index{expt})\index{expt})\index{star})\index{o-largep}\-
\end{tabbing}

\begin{verbatim}; we know that (cdr ZZ) is a set (cdr-lemma-1) and 
; that QQ is a set (aux2)
; now we just need that QQ is a subset of (cdr ZZ)
\end{verbatim}\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux10 \\ \index{cdr-lemma-aux10}
({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep}) $\rightarrow$ {\rm{listp}}\,({\it{zz\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux11 \\ \index{cdr-lemma-aux11}
{\tt{2}} $<$ {\rm{magic}}\,({\it{s\/}})\index{magic}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux12 \\ \index{cdr-lemma-aux12}
({\it{x\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ ({\rm{nthcdr}}\,({\it{x\/}}, {\it{zz\/}})\index{nthcdr} $=$ {\rm{nthcdr}}\,({\it{x\/}} $-\;1$, {\rm{cdr}}\,({\it{zz\/}}))\index{nthcdr})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux13 \\ \index{cdr-lemma-aux13}
({\it{x\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ {\rm{subsetp}}\,({\rm{nthcdr}}\,({\it{x\/}}, {\it{zz\/}})\index{nthcdr}, {\rm{cdr}}\,({\it{zz\/}}))\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux14 \\ \index{cdr-lemma-aux14}
({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ ({\it{qq\/}} $=$ {\rm{nthcdr}}\,({\rm{magic}}\,({\it{u\/}})\index{magic}, {\it{zz\/}})\index{nthcdr})) $\rightarrow$ {\rm{subsetp}}\,({\it{qq\/}}, {\rm{cdr}}\,({\it{zz\/}}))\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-aux15 \\ \index{cdr-lemma-aux15}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{setp}}\,({\rm{nthcdr}}\,({\rm{magic}}\,({\rm{car}}\,({\it{zz\/}}) $+$ ({\rm{norm}}\,({\it{alpha\/}})\index{norm} $+$ {\it{c\/}}))\index{magic}, {\it{zz\/}})\index{nthcdr})\index{setp}\-
\end{tabbing}

\begin{verbatim}; disable all the aux's now -- the prover doesn't get them right
\end{verbatim}
\noindent{\sc Event}:   Disable cdr-lemma-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux9.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux10.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux11.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux12.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux13.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux14.

\addvspace{18pt}

\noindent{\sc Event}:   Disable cdr-lemma-aux15.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  cdr-lemma-2 \\ \index{cdr-lemma-2}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\it{alpha-hat\/}} $=$ {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{cdr}}\,({\it{zz\/}}), {\rm{star}}\,({\rm{phi}}\,({\it{alpha-hat\/}}, {\it{c\/}})\index{phi}, {\rm{expt}}\,({\it{c\/}}, {\rm{expt}}\,({\tt{2}}, {\rm{car}}\,({\it{zz\/}}))\index{expt})\index{expt})\index{star})\index{o-largep}\-
\end{tabbing}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                      THE PIGEON-HOLE PRINCIPLE                         ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; We need a pigeon lemma which says:  If c>0,
;  (mapsto g XX lst),   XX is alpha * c -- large, and c >= |lst|
; then there is a  set YY such that YY is a subset of XX,
; YY is alpha -- large and  g is constant on YY.
; YY will be computed as: (extract-pigeon g XX lst alpha c)
; then the lemma has 4 parts:
; "pigeon-A" says that YY is a subset of XX
; "pigeon-B" says that YY is a set
; "pigeon-C" says that g is constant on YY
; "pigeon-D" says that YY is alpha-large


;;;; first, some facts about mapsto and constant

; define "g is constant on lst"

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{constantp} \\  
\=\+{\rm{constantp}}\,({\it{g\/}}, {\it{lst\/}})\index{constantp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{lst\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf elseif }{\rm{cdr}}\,({\it{lst\/}}) $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }\=\+({\rm{funcall}}\,({\it{g\/}}, {\rm{car}}\,({\it{lst\/}}))\index{funcall} $=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{cadr}}\,({\it{lst\/}}))\index{funcall}) \\ 
$\wedge$$\;\;\;\;${\rm{constantp}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{lst\/}}))\index{constantp}\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  constant-same-value \\ \index{constant-same-value}
\=\+({\rm{constantp}}\,({\it{g\/}}, {\it{lst\/}})\index{constantp} $\wedge$ ({\it{x\/}} $\in$ {\it{lst\/}}) $\wedge$ ({\it{y\/}} $\in$ {\it{lst\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $=$ {\rm{funcall}}\,({\it{g\/}}, {\it{y\/}})\index{funcall})\-
\end{tabbing}

\begin{verbatim}; constantp is trivially true for lists of length 0 and 1

\end{verbatim}\begin{tabbing}{\sc Theorem}:  constant-0 \\ \index{constant-0}
({\it{lst\/}} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ {\rm{constantp}}\,({\it{g\/}}, {\it{lst\/}})\index{constantp}
\end{tabbing}
\begin{tabbing}{\sc Theorem}:  constant-1 \\ \index{constant-1}
({\rm{cdr}}\,({\it{lst\/}}) $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ {\rm{constantp}}\,({\it{g\/}}, {\it{lst\/}})\index{constantp}
\end{tabbing}

\begin{verbatim}; if not (constantp g lst),  there is a pair of members
; dif1(g,lst) and dif2(g,lst) such that 
; g(dif1(g,lst)) != g(dif2(g,lst))

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{dif-pair} \\  
\=\+{\rm{dif-pair}}\,({\it{g\/}}, {\it{lst\/}})\index{dif-pair} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{lst\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }{\rm{cdr}}\,({\it{lst\/}}) $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }{\rm{funcall}}\,({\it{g\/}}, {\rm{car}}\,({\it{lst\/}}))\index{funcall} $\not=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{cadr}}\,({\it{lst\/}}))\index{funcall} \\ 
{\bf then }{\rm{cons}}\,({\rm{car}}\,({\it{lst\/}}), {\rm{cadr}}\,({\it{lst\/}})) \\ 
{\bf else }{\rm{dif-pair}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{lst\/}}))\index{dif-pair}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{dif1}$\;\;$
{\rm{dif1}}\,({\it{g\/}}, {\it{lst\/}})\index{dif1} $=$ {\rm{car}}\,({\rm{dif-pair}}\,({\it{g\/}}, {\it{lst\/}})\index{dif-pair})
\end{tabbing}
\begin{tabbing}{\sc Definition}:\index{dif2}$\;\;$
{\rm{dif2}}\,({\it{g\/}}, {\it{lst\/}})\index{dif2} $=$ {\rm{cdr}}\,({\rm{dif-pair}}\,({\it{g\/}}, {\it{lst\/}})\index{dif-pair})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  non-constant-different-values \\ \index{non-constant-different-values}
\=\+($\neg$ {\rm{constantp}}\,({\it{g\/}}, {\it{lst\/}})\index{constantp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{dif1}}\,({\it{g\/}}, {\it{lst\/}})\index{dif1} $\in$ {\it{lst\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{dif2}}\,({\it{g\/}}, {\it{lst\/}})\index{dif2} $\in$ {\it{lst\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\rm{dif1}}\,({\it{g\/}}, {\it{lst\/}})\index{dif1})\index{funcall} $\not=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{dif2}}\,({\it{g\/}}, {\it{lst\/}})\index{dif2})\index{funcall}))\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable constantp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable dif-pair.

\addvspace{18pt}

\noindent{\sc Event}:   Disable dif1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable dif2.

\addvspace{18pt}

\begin{verbatim}; if (mapgst g XX lst) and (length lst) <= 1 then g is constant on XX:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  constant-range-1-aux1 \\ \index{constant-range-1-aux1}
(({\rm{length}}\,({\it{lst\/}})\index{length} $\leq$ {\tt{1}}) $\wedge$ ({\it{u\/}} $\in$ {\it{lst\/}}) $\wedge$ ({\it{v\/}} $\in$ {\it{lst\/}})) $\rightarrow$ ({\it{u\/}} $=$ {\it{v\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  constant-range-1 \\ \index{constant-range-1}
({\rm{mapsto}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{mapsto} $\wedge$ ({\rm{length}}\,({\it{lst\/}})\index{length} $\leq$ {\tt{1}})) $\rightarrow$ {\rm{constantp}}\,({\it{g\/}}, {\it{xx\/}})\index{constantp}
\end{tabbing}


\noindent{\sc Event}:   Disable constant-range-1-aux1.

\addvspace{18pt}


\begin{verbatim};;;;; we prove the pigeon-hole principle as follows:

; Suppose (mapsto g XX lst) , and (listp lst)
; there are two subsets of XX:
; AA = (first-part g XX lst) = set of elements of XX which
;   map to the element (car lst)
; BB = (rest-part g XX lst) = set of elements of XX which 
;   map into (cdr lst)
; then (covers AA BB XX), g is constant on AA, and maps BB to (cdr lst)
; (star alpha n) is (sharp alpha (star alpha (sub1 n)))
; so we will have that if XX is (star alpha n) -- large
; then either AA is alpha-large or BB is 
;       (sharp alpha (star alpha (sub1 n))) -- large

;  AA:
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{first-part} \\  
\=\+{\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{xx\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }{\rm{funcall}}\,({\it{g\/}}, {\rm{car}}\,({\it{xx\/}}))\index{funcall} $=$ {\rm{car}}\,({\it{lst\/}}) \\ 
{\bf then }{\rm{cons}}\,({\rm{car}}\,({\it{xx\/}}), {\rm{first-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{first-part}) \\ 
{\bf else }{\rm{first-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{first-part}$\;${\bf  endif}\-\-
\end{tabbing}
	
\begin{tabbing}{\sc Theorem}:  value-on-first-part \\ \index{value-on-first-part}
({\it{x\/}} $\in$ {\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part}) $\rightarrow$ ({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $=$ {\rm{car}}\,({\it{lst\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  constantp-on-first-part \\ \index{constantp-on-first-part}
{\rm{constantp}}\,({\it{g\/}}, {\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part})\index{constantp}
\end{tabbing}

\begin{verbatim}; BB:
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{rest-part} \\  
\=\+{\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{xx\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }{\rm{funcall}}\,({\it{g\/}}, {\rm{car}}\,({\it{xx\/}}))\index{funcall} $\in$ {\rm{cdr}}\,({\it{lst\/}}) \\ 
{\bf then }{\rm{cons}}\,({\rm{car}}\,({\it{xx\/}}), {\rm{rest-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{rest-part}) \\ 
{\bf else }{\rm{rest-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{rest-part}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  values-on-rest-part \\ \index{values-on-rest-part}
({\it{x\/}} $\in$ {\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}) $\rightarrow$ ({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $\in$ {\rm{cdr}}\,({\it{lst\/}}))
\end{tabbing}
	
\begin{tabbing}{\sc Theorem}:  mapsto-rest-part \\ \index{mapsto-rest-part}
{\rm{mapsto}}\,({\it{g\/}}, {\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}, {\rm{cdr}}\,({\it{lst\/}}))\index{mapsto}
\end{tabbing}

\begin{verbatim};; covering properties
\end{verbatim}\begin{tabbing}{\sc Theorem}:  members-of-first-part \\ \index{members-of-first-part}
\=\+({\rm{mapsto}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{mapsto} $\wedge$ ({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $=$ {\rm{car}}\,({\it{lst\/}})) $\wedge$ ({\it{x\/}} $\in$ {\it{xx\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\it{x\/}} $\in$ {\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  members-of-rest-part \\ \index{members-of-rest-part}
\=\+({\rm{mapsto}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{mapsto} $\wedge$ ({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $\in$ {\rm{cdr}}\,({\it{lst\/}})) $\wedge$ ({\it{x\/}} $\in$ {\it{xx\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\it{x\/}} $\in$ {\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  first-rest-member \\ \index{first-rest-member}
\=\+({\rm{mapsto}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{mapsto} $\wedge$ ({\it{x\/}} $\in$ {\it{xx\/}})) \\ 
$\rightarrow$$\;\;\;\;$(({\it{x\/}} $\in$ {\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part}) $\vee$ ({\it{x\/}} $\in$ {\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  first-rest-cover \\ \index{first-rest-cover}
{\rm{mapsto}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{mapsto} $\rightarrow$ {\rm{covers}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part}, {\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}, {\it{xx\/}})\index{covers}
\end{tabbing}

\begin{verbatim}; we also need that the first-part and the rest-part are subsets

\end{verbatim}\begin{tabbing}{\sc Theorem}:  first-part-is-sublist \\ \index{first-part-is-sublist}
{\rm{sublistp}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part}, {\it{xx\/}})\index{sublistp}
\end{tabbing}
\begin{tabbing}{\sc Theorem}:  rest-part-is-sublist \\ \index{rest-part-is-sublist}
{\rm{sublistp}}\,({\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}, {\it{xx\/}})\index{sublistp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  first-part-is-subset \\ \index{first-part-is-subset}
{\rm{subsetp}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part}, {\it{xx\/}})\index{subsetp}
\end{tabbing}
\begin{tabbing}{\sc Theorem}:  rest-part-is-subset \\ \index{rest-part-is-subset}
{\rm{subsetp}}\,({\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}, {\it{xx\/}})\index{subsetp}
\end{tabbing}

\begin{verbatim}; now, prove they are sets
; this is a little inelegant -- we just repeat the same
; argument for first-part and for rest-part

; first-part
\end{verbatim}\begin{tabbing}{\sc Theorem}:  first-part-is-set-aux1 \\ \index{first-part-is-set-aux1}
({\it{u\/}} $\in$ {\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part}) $\rightarrow$ ({\it{u\/}} $\in$ {\it{xx\/}})
\end{tabbing}
\begin{tabbing}{\sc Theorem}:  first-part-is-set-aux2 \\ \index{first-part-is-set-aux2}
({\it{u\/}} $\in$ {\rm{first-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{first-part}) $\rightarrow$ ({\it{u\/}} $\in$ {\rm{cdr}}\,({\it{xx\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  first-part-is-set-aux3 \\ \index{first-part-is-set-aux3}
({\rm{setp}}\,({\it{xx\/}})\index{setp} $\wedge$ ({\it{u\/}} $\in$ {\rm{first-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{first-part})) $\rightarrow$ ({\rm{car}}\,({\it{xx\/}}) $<$ {\it{u\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  first-part-is-set-aux4 \\ \index{first-part-is-set-aux4}
\=\+({\rm{setp}}\,({\it{xx\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\rm{first-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{first-part})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\it{xx\/}}) $<$ {\rm{car}}\,({\rm{first-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{first-part}))\-
\end{tabbing}

\begin{verbatim}; we need the following trivial set fact:
\end{verbatim}
\noindent{\sc Event}:   Enable setp.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  set-builder \\ \index{set-builder}
({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ ({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{x\/}} $<$ {\rm{car}}\,({\it{s\/}}))) $\rightarrow$ {\rm{setp}}\,({\rm{cons}}\,({\it{x\/}}, {\it{s\/}}))\index{setp}
\end{tabbing}

\noindent{\sc Event}:   Disable setp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  first-part-is-set-aux5 \\ \index{first-part-is-set-aux5}
\=\+(\=\+{\rm{setp}}\,({\it{xx\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{first-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{first-part}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{first-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{first-part})\index{setp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{setp}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part})\index{setp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  first-part-is-set-aux6 \\ \index{first-part-is-set-aux6}
({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ ({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part} $=$ {\bf{nil}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  first-part-is-set-aux7 \\ \index{first-part-is-set-aux7}
\=\+({\rm{setp}}\,({\it{xx\/}})\index{setp} $\wedge$ ({\rm{first-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{first-part} $\simeq\;${{\bf{nil}}}${}$)) \\ 
$\rightarrow$$\;\;\;\;${\rm{setp}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part})\index{setp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  first-part-is-set-aux8 \\ \index{first-part-is-set-aux8}
($\neg$ {\rm{listp}}\,({\it{xx\/}})) $\rightarrow$ {\rm{setp}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  first-part-is-set-aux9 \\ \index{first-part-is-set-aux9}
\=\+({\rm{setp}}\,({\it{xx\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\rm{first-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{first-part})\index{setp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{setp}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part})\index{setp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  first-part-is-set \\ \index{first-part-is-set}
{\rm{setp}}\,({\it{xx\/}})\index{setp} $\rightarrow$ {\rm{setp}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part})\index{setp}
\end{tabbing}


\noindent{\sc Event}:   Disable first-part-is-set-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable first-part-is-set-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable first-part-is-set-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable first-part-is-set-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable first-part-is-set-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable first-part-is-set-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable first-part-is-set-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable first-part-is-set-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable first-part-is-set-aux9.

\addvspace{18pt}


\begin{verbatim};;; rest-part
\end{verbatim}\begin{tabbing}{\sc Theorem}:  rest-part-is-set-aux1 \\ \index{rest-part-is-set-aux1}
({\it{u\/}} $\in$ {\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}) $\rightarrow$ ({\it{u\/}} $\in$ {\it{xx\/}})
\end{tabbing}
\begin{tabbing}{\sc Theorem}:  rest-part-is-set-aux2 \\ \index{rest-part-is-set-aux2}
({\it{u\/}} $\in$ {\rm{rest-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{rest-part}) $\rightarrow$ ({\it{u\/}} $\in$ {\rm{cdr}}\,({\it{xx\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rest-part-is-set-aux3 \\ \index{rest-part-is-set-aux3}
({\rm{setp}}\,({\it{xx\/}})\index{setp} $\wedge$ ({\it{u\/}} $\in$ {\rm{rest-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{rest-part})) $\rightarrow$ ({\rm{car}}\,({\it{xx\/}}) $<$ {\it{u\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rest-part-is-set-aux4 \\ \index{rest-part-is-set-aux4}
\=\+({\rm{setp}}\,({\it{xx\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\rm{rest-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{rest-part})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\it{xx\/}}) $<$ {\rm{car}}\,({\rm{rest-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{rest-part}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rest-part-is-set-aux5 \\ \index{rest-part-is-set-aux5}
\=\+(\=\+{\rm{setp}}\,({\it{xx\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{rest-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{rest-part}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{rest-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{rest-part})\index{setp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{setp}}\,({\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part})\index{setp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rest-part-is-set-aux6 \\ \index{rest-part-is-set-aux6}
({\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part} $\simeq\;${{\bf{nil}}}${}$) $\rightarrow$ ({\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part} $=$ {\bf{nil}})
\end{tabbing}

\begin{verbatim}; a trivial set fact:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  singleton-set \\ \index{singleton-set}
({\it{m\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ {\rm{setp}}\,({\rm{list}}\,({\it{m\/}}))\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rest-part-is-set-aux7 \\ \index{rest-part-is-set-aux7}
({\rm{setp}}\,({\it{xx\/}})\index{setp} $\wedge$ ({\rm{rest-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{rest-part} $\simeq\;${{\bf{nil}}}${}$)) $\rightarrow$ {\rm{setp}}\,({\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rest-part-is-set-aux8 \\ \index{rest-part-is-set-aux8}
($\neg$ {\rm{listp}}\,({\it{xx\/}})) $\rightarrow$ {\rm{setp}}\,({\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rest-part-is-set-aux9 \\ \index{rest-part-is-set-aux9}
({\rm{setp}}\,({\it{xx\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\rm{rest-part}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{xx\/}}), {\it{lst\/}})\index{rest-part})\index{setp}) $\rightarrow$ {\rm{setp}}\,({\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rest-part-is-set \\ \index{rest-part-is-set}
{\rm{setp}}\,({\it{xx\/}})\index{setp} $\rightarrow$ {\rm{setp}}\,({\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part})\index{setp}
\end{tabbing}


\noindent{\sc Event}:   Disable rest-part-is-set-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable rest-part-is-set-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable rest-part-is-set-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable rest-part-is-set-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable rest-part-is-set-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable rest-part-is-set-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable rest-part-is-set-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable rest-part-is-set-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable rest-part-is-set-aux9.

\addvspace{18pt}


\begin{verbatim};;;;;; now, back to the pigeon-hole principle:
; if (mapsto g XX lst) and XX is alpha * c -- large, and c >= |lst|
; and c > 0,
; then there is a YY subset XX such that YY is alpha -- large
; and g is constant on YY.

; YY will be (extract-pigeon g XX lst alpha c)

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{extract-pigeon} \\  
\=\+{\rm{extract-pigeon}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-pigeon} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{c\/}} $\leq$ {\tt{1}}$\;\;${\bf then }{\it{xx\/}} \\ 
{\bf elseif }{\rm{o-largep}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part}, {\it{alpha\/}})\index{o-largep}$\;\;${\bf then }{\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part} \\ 
{\bf else }{\rm{extract-pigeon}}\,({\it{g\/}}, {\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}, {\rm{cdr}}\,({\it{lst\/}}), {\it{alpha\/}}, {\it{c\/}} $-\;1$)\index{extract-pigeon}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; "pigeon-A" says that YY is a subset of XX
; "pigeon-B" says that YY is a set
; "pigeon-C" says that g is constant on YY
; "pigeon-D" says that YY is alpha-large

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-a \\ \index{pigeon-a}
{\rm{subsetp}}\,({\rm{extract-pigeon}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-pigeon}, {\it{xx\/}})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-b \\ \index{pigeon-b}
{\rm{setp}}\,({\it{xx\/}})\index{setp} $\rightarrow$ {\rm{setp}}\,({\rm{extract-pigeon}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-pigeon})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-c-aux1 \\ \index{pigeon-c-aux1}
\=\+({\rm{mapsto}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{mapsto} $\wedge$ ({\rm{length}}\,({\it{lst\/}})\index{length} $\leq$ {\it{c\/}}) $\wedge$ ({\it{c\/}} $\leq$ {\tt{1}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{constantp}}\,({\it{g\/}}, {\rm{extract-pigeon}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-pigeon})\index{constantp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-c-aux2 \\ \index{pigeon-c-aux2}
\=\+(({\tt{1}} $<$ {\it{c\/}}) $\wedge$ ($\neg$ {\rm{o-largep}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part}, {\it{alpha\/}})\index{o-largep})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{extract-pigeon}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-pigeon} \\ 
$=$$\;\;\;\;${\rm{extract-pigeon}}\,({\it{g\/}}, {\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}, {\rm{cdr}}\,({\it{lst\/}}), {\it{alpha\/}}, {\it{c\/}} $-\;1$)\index{extract-pigeon})\-\-
\end{tabbing}
		
\begin{tabbing}{\sc Theorem}:  pigeon-c \\ \index{pigeon-c}
\=\+({\rm{mapsto}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{mapsto} $\wedge$ ({\rm{length}}\,({\it{lst\/}})\index{length} $\leq$ {\it{c\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{constantp}}\,({\it{g\/}}, {\rm{extract-pigeon}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-pigeon})\index{constantp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable pigeon-c-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-c-aux2.

\addvspace{18pt}

\begin{verbatim}; now, for D, we have to induct on c

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-pigeon-d} \\  
\=\+{\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{bad-for-pigeon-d} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{xx\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{xx\/}}, {\rm{star}}\,({\it{alpha\/}}, {\it{c\/}})\index{star})\index{o-largep} \\ 
$\wedge$$\;\;\;\;${\rm{mapsto}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{mapsto} \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{lst\/}})\index{length} $\leq$ {\it{c\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{extract-pigeon}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-pigeon}, {\it{alpha\/}})\index{o-largep}))\-\-
\end{tabbing}

\begin{verbatim}; basis:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-d-aux1 \\ \index{pigeon-d-aux1}
({\it{c\/}} $\simeq {\tt{0}}$) $\rightarrow$ ($\neg$ {\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{bad-for-pigeon-d})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-d-aux2 \\ \index{pigeon-d-aux2}
$\neg$ {\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\tt{1}})\index{bad-for-pigeon-d}
\end{tabbing}

\begin{verbatim}; now we have to work on the induction step, where c > 1:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-d-aux3 \\ \index{pigeon-d-aux3}
\=\+(({\tt{1}} $<$ {\it{c\/}}) $\wedge$ {\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{bad-for-pigeon-d}) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part}, {\it{alpha\/}})\index{o-largep})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-d-aux4 \\ \index{pigeon-d-aux4}
\=\+(({\tt{1}} $<$ {\it{c\/}}) $\wedge$ {\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{bad-for-pigeon-d}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{extract-pigeon}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-pigeon} \\ 
$=$$\;\;\;\;${\rm{extract-pigeon}}\,({\it{g\/}}, {\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}, {\rm{cdr}}\,({\it{lst\/}}), {\it{alpha\/}}, {\it{c\/}} $-\;1$)\index{extract-pigeon})\-\-
\end{tabbing}
		
\begin{tabbing}{\sc Theorem}:  pigeon-d-aux5 \\ \index{pigeon-d-aux5}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\tt{1}} $<$ {\it{c\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{a\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{b\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{x\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{covers}}\,({\it{a\/}}, {\it{b\/}}, {\it{x\/}})\index{covers} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{x\/}}, {\rm{star}}\,({\it{alpha\/}}, {\it{c\/}})\index{star})\index{o-largep} \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\it{a\/}}, {\it{alpha\/}})\index{o-largep}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\it{b\/}}, {\rm{star}}\,({\it{alpha\/}}, {\it{c\/}} $-\;1$)\index{star})\index{o-largep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-d-aux6 \\ \index{pigeon-d-aux6}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{mapsto}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{mapsto} \\ 
$\wedge$$\;\;\;\;$({\tt{1}} $<$ {\it{c\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{xx\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{xx\/}}, {\rm{star}}\,({\it{alpha\/}}, {\it{c\/}})\index{star})\index{o-largep} \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{first-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{first-part}, {\it{alpha\/}})\index{o-largep}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}, {\rm{star}}\,({\it{alpha\/}}, {\it{c\/}} $-\;1$)\index{star})\index{o-largep}\-
\end{tabbing}

\begin{verbatim}; induction step:  
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-d-aux7 \\ \index{pigeon-d-aux7}
\=\+(({\tt{1}} $<$ {\it{c\/}}) $\wedge$ {\rm{listp}}\,({\it{lst\/}}) $\wedge$ {\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{bad-for-pigeon-d}) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}, {\rm{cdr}}\,({\it{lst\/}}), {\it{alpha\/}}, {\it{c\/}} $-\;1$)\index{bad-for-pigeon-d}\-
\end{tabbing}

\begin{verbatim}; now, what if lst is empty
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-d-aux8 \\ \index{pigeon-d-aux8}
({\rm{mapsto}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{mapsto} $\wedge$ ($\neg$ {\rm{listp}}\,({\it{lst\/}}))) $\rightarrow$ ($\neg$ {\rm{listp}}\,({\it{xx\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-d-aux9 \\ \index{pigeon-d-aux9}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{alpha\/}} $\not=$ {\tt{0}}) $\wedge$ ({\it{c\/}} $\not\simeq {\tt{0}}$)) $\rightarrow$ ({\rm{star}}\,({\it{alpha\/}}, {\it{c\/}})\index{star} $\not=$ {\tt{0}})
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  pigeon-d-aux10 \\ \index{pigeon-d-aux10}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{c\/}} $\not\simeq {\tt{0}}$) $\wedge$ {\rm{o-largep}}\,({\it{xx\/}}, {\rm{star}}\,({\it{alpha\/}}, {\it{c\/}})\index{star})\index{o-largep} $\wedge$ ({\it{xx\/}} $\simeq\;${{\bf{nil}}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\it{alpha\/}} $=$ {\tt{0}})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-d-aux11 \\ \index{pigeon-d-aux11}
(({\it{c\/}} $\not\simeq {\tt{0}}$) $\wedge$ ({\it{lst\/}} $\simeq\;${{\bf{nil}}}${}$)) $\rightarrow$ ($\neg$ {\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{bad-for-pigeon-d})
\end{tabbing}

\begin{verbatim}; revised induction step:  
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-d-aux12 \\ \index{pigeon-d-aux12}
\=\+(({\tt{1}} $<$ {\it{c\/}}) $\wedge$ {\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{bad-for-pigeon-d}) \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\rm{rest-part}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{rest-part}, {\rm{cdr}}\,({\it{lst\/}}), {\it{alpha\/}}, {\it{c\/}} $-\;1$)\index{bad-for-pigeon-d}\-
\end{tabbing}

\begin{verbatim}; rephrase the  basis
\end{verbatim}\begin{tabbing}{\sc Theorem}:  pigeon-d-aux13 \\ \index{pigeon-d-aux13}
({\tt{1}} $\not<$ {\it{c\/}}) $\rightarrow$ ($\neg$ {\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{bad-for-pigeon-d})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-d-aux14 \\ \index{pigeon-d-aux14}
$\neg$ {\rm{bad-for-pigeon-d}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{bad-for-pigeon-d}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  pigeon-d \\ \index{pigeon-d}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{xx\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{xx\/}}, {\rm{star}}\,({\it{alpha\/}}, {\it{c\/}})\index{star})\index{o-largep} \\ 
$\wedge$$\;\;\;\;${\rm{mapsto}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}})\index{mapsto} \\ 
$\wedge$$\;\;\;\;$({\rm{length}}\,({\it{lst\/}})\index{length} $\leq$ {\it{c\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{extract-pigeon}}\,({\it{g\/}}, {\it{xx\/}}, {\it{lst\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-pigeon}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}


\noindent{\sc Event}:   Disable bad-for-pigeon-d.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux7.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux9.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux10.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux11.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux12.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux13.

\addvspace{18pt}

\noindent{\sc Event}:   Disable pigeon-d-aux14.

\addvspace{18pt}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                                 RANGES                                 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; We follow the usual set-theoretic convention that a partition into
; c pieces is just a map into c = {0 ... c-1}.
; when we work with partitions g on tuples from a set XX -- 
; it will be simpler to just assume that g of anything is < c
; Since our definition has (funcall g x) = 0 whenever x is
; outside the natural range of g, this will not cause any problem

; first, let's define the intended domain of g

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{domain} \\  
\=\+{\rm{domain}}\,({\it{g\/}})\index{domain} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{g\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }{\rm{listp}}\,({\rm{car}}\,({\it{g\/}}))$\;\;${\bf then }{\rm{cons}}\,({\rm{caar}}\,({\it{g\/}}), {\rm{domain}}\,({\rm{cdr}}\,({\it{g\/}}))\index{domain}) \\ 
{\bf else }{\rm{domain}}\,({\rm{cdr}}\,({\it{g\/}}))\index{domain}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; even for 0, if 0 is not in (domain g), then (assoc 0 g) is an 
; atom, so its cdr is 0

\end{verbatim}\begin{tabbing}{\sc Theorem}:  assoc-outside-domain \\ \index{assoc-outside-domain}
({\it{x\/}} $\not\in$ {\rm{domain}}\,({\it{g\/}})\index{domain}) $\rightarrow$ ({\rm{cdr}}\,({\rm{assoc}}\,({\it{x\/}}, {\it{g\/}})) $=$ {\tt{0}})
\end{tabbing}


\noindent{\sc Event}:   Enable funcall.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  funcall-outside-domain \\ \index{funcall-outside-domain}
({\it{x\/}} $\not\in$ {\rm{domain}}\,({\it{g\/}})\index{domain}) $\rightarrow$ ({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $=$ {\tt{0}})
\end{tabbing}

\noindent{\sc Event}:   Disable funcall.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{rangep} \\  
\=\+{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{g\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\tt{0}} $<$ {\it{c\/}} \\ 
{\bf else }{\rm{rangep}}\,({\rm{cdr}}\,({\it{g\/}}), {\it{c\/}})\index{rangep} $\wedge$ ({\rm{cadar}}\,({\it{g\/}}) $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{cadar}}\,({\it{g\/}}) $<$ {\it{c\/}})$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rangep-is-positive \\ \index{rangep-is-positive}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ (({\tt{0}} $<$ {\it{c\/}}) $=$ {\bf{t}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rangep-bounds \\ \index{rangep-bounds}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ ({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $<$ {\it{c\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  rangep-numbers \\ \index{rangep-numbers}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ ({\rm{funcall}}\,({\it{g\/}}, {\it{x\/}})\index{funcall} $\in\;${\bf{N}}${}$)
\end{tabbing}


\noindent{\sc Event}:   Disable rangep.

\addvspace{18pt}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                             SEGMENTS                                  ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;; we need some more on segments now, since (segment 0 c) will
;; be used as the range of a function

\end{verbatim}
\noindent{\sc Event}:   Enable segment.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  segments-non-empty \\ \index{segments-non-empty}
(({\it{m\/}} $\leq$ {\it{n\/}}) $\wedge$ ({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) $\rightarrow$ {\rm{listp}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  car-of-segment \\ \index{car-of-segment}
{\rm{listp}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment}) $\rightarrow$ ({\rm{car}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment}) $=$ {\it{m\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cdr-of-segment \\ \index{cdr-of-segment}
{\rm{listp}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment}) $\rightarrow$ ({\rm{cdr}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment}) $=$ {\rm{segment}}\,($1\;+$ {\it{m\/}}, {\it{n\/}})\index{segment})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  empty-segment \\ \index{empty-segment}
(({\it{m\/}} $\not\in\;${\bf{N}}${}$) $\vee$ ({\it{n\/}} $\not\in\;${\bf{N}}${}$) $\vee$ ({\it{n\/}} $<$ {\it{m\/}})) $\rightarrow$ ({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment} $=$ {\bf{nil}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  non-list-segment \\ \index{non-list-segment}
($\neg$ {\rm{listp}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment})) $\rightarrow$ ({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment} $=$ {\bf{nil}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  recursive-case-for-segment \\ \index{recursive-case-for-segment}
\=\+(({\it{m\/}} $\leq$ {\it{n\/}}) $\wedge$ ({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment} $=$ {\rm{cons}}\,({\it{m\/}}, {\rm{segment}}\,($1\;+$ {\it{m\/}}, {\it{n\/}})\index{segment}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable segment.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  singleton-segment \\ \index{singleton-segment}
({\it{m\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{segment}}\,({\it{m\/}}, {\it{m\/}})\index{segment} $=$ {\rm{list}}\,({\it{m\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  cadr-of-segment \\ \index{cadr-of-segment}
{\rm{listp}}\,({\rm{cdr}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment})) $\rightarrow$ ({\rm{cadr}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment}) $=$ ($1\;+$ {\it{m\/}}))
\end{tabbing}

\begin{verbatim}; let's prove segments are sets -- this is a bit of a pain

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-segments-are-sets} \\  
{\rm{bad-for-segments-are-sets}}\,({\it{m\/}}, {\it{n\/}})\index{bad-for-segments-are-sets} $=$ ($\neg$ {\rm{setp}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment})\index{setp})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  segments-are-sets-aux1 \\ \index{segments-are-sets-aux1}
{\rm{bad-for-segments-are-sets}}\,({\it{m\/}}, {\it{n\/}})\index{bad-for-segments-are-sets} $\rightarrow$ (({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{m\/}} $\leq$ {\it{n\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  segments-are-sets-aux2 \\ \index{segments-are-sets-aux2}
({\it{m\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ($\neg$ {\rm{bad-for-segments-are-sets}}\,({\it{m\/}}, {\it{m\/}})\index{bad-for-segments-are-sets})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  segments-are-sets-aux3 \\ \index{segments-are-sets-aux3}
\=\+($\neg$ (({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{m\/}} $<$ {\it{n\/}}))) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{bad-for-segments-are-sets}}\,({\it{m\/}}, {\it{n\/}})\index{bad-for-segments-are-sets})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  segments-are-sets \\ \index{segments-are-sets}
{\rm{setp}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment})\index{setp}
\end{tabbing}


\noindent{\sc Event}:   Disable segments-are-sets-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable segments-are-sets-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable segments-are-sets-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable bad-for-segments-are-sets.

\addvspace{18pt}

\begin{verbatim}; another trivial segment fact:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  first-of-segment \\ \index{first-of-segment}
(({\it{m\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{n\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{m\/}} $\leq$ {\it{n\/}})) $\rightarrow$ ({\rm{car}}\,({\rm{segment}}\,({\it{m\/}}, {\it{n\/}})\index{segment}) $=$ {\it{m\/}})
\end{tabbing}




\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                      BASIS OF RAMSEY THEOREM                           ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; This will be "ramsey-basis" -- the Ramsey theorem for 1-tuples.
; Suppose (rangep g c) (so c > 0), XX is a set which is alpha * c -- large.
; Then there is a  set YY such that YY is a subset of XX,
; YY is alpha -- large,  g is constant on the singletons of YY --
; that is:  (homp YY g 1)
; the proof is to define an auxilliary function h -- so that
; (funcall h x) = (funcall g (list x)), 
; and then apply the pigeon-hole principle

; call this h "(sing-fn g)"
; this will be (sing-fn-aux g (domain g))
; if h = (sing-fn-aux g lst)  and (list x) is in lst, then
; (funcall h x) = (funcall g (list x))

; then YY will be (extract-ramsey-basis g XX alpha c) = 
; (extract-pigeon (sing-fn g) XX (segment 0 c) alpha c)

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{sing-fn-aux} \\  
\=\+{\rm{sing-fn-aux}}\,({\it{g\/}}, {\it{lst\/}})\index{sing-fn-aux} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{lst\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }{\rm{car}}\,({\it{lst\/}}) $=$ {\rm{list}}\,({\rm{caar}}\,({\it{lst\/}})) \\ 
{\bf then }{\rm{cons}}\,({\rm{list}}\,({\rm{caar}}\,({\it{lst\/}}), {\rm{funcall}}\,({\it{g\/}}, {\rm{car}}\,({\it{lst\/}}))\index{funcall}), {\rm{sing-fn-aux}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{lst\/}}))\index{sing-fn-aux}) \\ 
{\bf else }{\rm{sing-fn-aux}}\,({\it{g\/}}, {\rm{cdr}}\,({\it{lst\/}}))\index{sing-fn-aux}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sing-fn-aux-1 \\ \index{sing-fn-aux-1}
\=\+({\rm{list}}\,({\it{x\/}}) $\in$ {\it{lst\/}}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{assoc}}\,({\it{x\/}}, {\rm{sing-fn-aux}}\,({\it{g\/}}, {\it{lst\/}})\index{sing-fn-aux}) $=$ {\rm{list}}\,({\it{x\/}}, {\rm{funcall}}\,({\it{g\/}}, {\rm{list}}\,({\it{x\/}}))\index{funcall}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sing-fn-aux-2 \\ \index{sing-fn-aux-2}
({\rm{list}}\,({\it{x\/}}) $\not\in$ {\it{lst\/}}) $\rightarrow$ ($\neg$ {\rm{listp}}\,({\rm{assoc}}\,({\it{x\/}}, {\rm{sing-fn-aux}}\,({\it{g\/}}, {\it{lst\/}})\index{sing-fn-aux})))
\end{tabbing}


\noindent{\sc Event}:   Enable funcall.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  sing-fn-aux-3 \\ \index{sing-fn-aux-3}
\=\+({\rm{list}}\,({\it{x\/}}) $\in$ {\it{lst\/}}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\rm{sing-fn-aux}}\,({\it{g\/}}, {\it{lst\/}})\index{sing-fn-aux}, {\it{x\/}})\index{funcall} $=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{list}}\,({\it{x\/}}))\index{funcall})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sing-fn-aux-4 \\ \index{sing-fn-aux-4}
({\rm{list}}\,({\it{x\/}}) $\not\in$ {\it{lst\/}}) $\rightarrow$ ({\rm{funcall}}\,({\rm{sing-fn-aux}}\,({\it{g\/}}, {\it{lst\/}})\index{sing-fn-aux}, {\it{x\/}})\index{funcall} $=$ {\tt{0}})
\end{tabbing}


\noindent{\sc Event}:   Disable funcall.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{sing-fn}$\;\;$
{\rm{sing-fn}}\,({\it{g\/}})\index{sing-fn} $=$ {\rm{sing-fn-aux}}\,({\it{g\/}}, {\rm{domain}}\,({\it{g\/}})\index{domain})\index{sing-fn-aux}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sing-fn-on-sings \\ \index{sing-fn-on-sings}
{\rm{funcall}}\,({\rm{sing-fn}}\,({\it{g\/}})\index{sing-fn}, {\it{x\/}})\index{funcall} $=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{list}}\,({\it{x\/}}))\index{funcall}
\end{tabbing}


\noindent{\sc Event}:   Disable sing-fn-aux.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sing-fn-aux-1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sing-fn-aux-2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sing-fn-aux-3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable sing-fn-aux-4.

\addvspace{18pt}


\noindent{\sc Event}:   Disable sing-fn.

\addvspace{18pt}  \begin{verbatim}; all we need is its properties

; now, if (rangep g c) (so c > 0) , then
; g takes anything to (segment 0 (sub1 c)) = {0 ... c-1} = c
; this is a list of length c, so the pigeon hole principle
; should apply.

; as preliminaries

\end{verbatim}\begin{tabbing}{\sc Theorem}:  size-of-initial-segment \\ \index{size-of-initial-segment}
({\tt{0}} $<$ {\it{c\/}}) $\rightarrow$ ({\rm{length}}\,({\rm{segment}}\,({\tt{0}}, {\it{c\/}} $-\;1$)\index{segment})\index{length} $=$ {\it{c\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  members-of-initial-segment \\ \index{members-of-initial-segment}
({\tt{0}} $<$ {\it{c\/}}) $\rightarrow$ (({\it{x\/}} $\in$ {\rm{segment}}\,({\tt{0}}, {\it{c\/}} $-\;1$)\index{segment}) $=$ (({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{x\/}} $<$ {\it{c\/}})))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-values-of-sing-fn \\ \index{bound-values-of-sing-fn}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ ({\rm{funcall}}\,({\rm{sing-fn}}\,({\it{g\/}})\index{sing-fn}, {\it{x\/}})\index{funcall} $<$ {\it{c\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  number-values-of-sing-fn \\ \index{number-values-of-sing-fn}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ ({\rm{funcall}}\,({\rm{sing-fn}}\,({\it{g\/}})\index{sing-fn}, {\it{x\/}})\index{funcall} $\in\;${\bf{N}}${}$)
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sing-fn-mapsto-aux1 \\ \index{sing-fn-mapsto-aux1}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ ({\rm{funcall}}\,({\rm{sing-fn}}\,({\it{g\/}})\index{sing-fn}, {\it{x\/}})\index{funcall} $\in$ {\rm{segment}}\,({\tt{0}}, {\it{c\/}} $-\;1$)\index{segment})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  sing-fn-mapsto \\ \index{sing-fn-mapsto}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ {\rm{mapsto}}\,({\rm{sing-fn}}\,({\it{g\/}})\index{sing-fn}, {\it{xx\/}}, {\rm{segment}}\,({\tt{0}}, {\it{c\/}} $-\;1$)\index{segment})\index{mapsto}
\end{tabbing}


\noindent{\sc Event}:   Disable sing-fn-mapsto-aux1.

\addvspace{18pt}

\begin{verbatim};; now, we are set up for a proof of the basis of Ramsey's theorem

; the YY that works is given by

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{extract-ramsey-basis} \\  
\=\+{\rm{extract-ramsey-basis}}\,({\it{g\/}}, {\it{xx\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-ramsey-basis} \\ 
$=$$\;\;\;\;${\rm{extract-pigeon}}\,({\rm{sing-fn}}\,({\it{g\/}})\index{sing-fn}, {\it{xx\/}}, {\rm{segment}}\,({\tt{0}}, {\it{c\/}} $-\;1$)\index{segment}, {\it{alpha\/}}, {\it{c\/}})\index{extract-pigeon}\-
\end{tabbing}

\begin{verbatim}; We're assuming 
; (rangep g c) (so c > 0), XX is a set which is alpha * c -- large.

; "ramsey-basis-A" says that YY is a subset of XX
; "ramsey-basis-B" says that YY is a set
; "ramsey-basis-C" says that (homp YY g 1)
; "ramsey-basis-D" says that YY is alpha-large

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ramsey-basis-a \\ \index{ramsey-basis-a}
{\rm{subsetp}}\,({\rm{extract-ramsey-basis}}\,({\it{g\/}}, {\it{xx\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-ramsey-basis}, {\it{xx\/}})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ramsey-basis-b \\ \index{ramsey-basis-b}
{\rm{setp}}\,({\it{xx\/}})\index{setp} $\rightarrow$ {\rm{setp}}\,({\rm{extract-ramsey-basis}}\,({\it{g\/}}, {\it{xx\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-ramsey-basis})\index{setp}
\end{tabbing}

\begin{verbatim}; now to prove (homp YY g 1) -- 
; we need to prove that 
; (constantp (sing-fn g) YY) implies (homp YY g 1)
; this is true because we've proved if (not ((homp YY g n)))
; we have an explicit counter-example
; first, let's recast this counter-example in the case n = 1

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ramsey-basis-c-aux1 \\ \index{ramsey-basis-c-aux1}
{\rm{sublistp}}\,({\rm{list}}\,({\it{x\/}}), {\it{set\/}})\index{sublistp} $\rightarrow$ ({\it{x\/}} $\in$ {\it{set\/}})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{counter-hom-aux-x} \\  
{\rm{counter-hom-aux-x}}\,({\it{set\/}}, {\it{g\/}})\index{counter-hom-aux-x} $=$ {\rm{car}}\,({\rm{counter-hom-x}}\,({\it{set\/}}, {\it{g\/}}, {\tt{1}})\index{counter-hom-x})
\end{tabbing}
\begin{tabbing}{\sc Definition}:\index{counter-hom-aux-y} \\  
{\rm{counter-hom-aux-y}}\,({\it{set\/}}, {\it{g\/}})\index{counter-hom-aux-y} $=$ {\rm{car}}\,({\rm{counter-hom-y}}\,({\it{set\/}}, {\it{g\/}}, {\tt{1}})\index{counter-hom-y})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ramsey-basis-c-aux2 \\ \index{ramsey-basis-c-aux2}
({\rm{setp}}\,({\it{lst\/}})\index{setp} $\wedge$ ({\rm{length}}\,({\it{lst\/}})\index{length} $=$ {\tt{1}})) $\rightarrow$ ({\rm{list}}\,({\rm{car}}\,({\it{lst\/}})) $=$ {\it{lst\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ramsey-basis-c-aux3 \\ \index{ramsey-basis-c-aux3}
\=\+($\neg$ {\rm{homp}}\,({\it{set\/}}, {\it{g\/}}, {\tt{1}})\index{homp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{counter-hom-x}}\,({\it{set\/}}, {\it{g\/}}, {\tt{1}})\index{counter-hom-x} $=$ {\rm{list}}\,({\rm{counter-hom-aux-x}}\,({\it{set\/}}, {\it{g\/}})\index{counter-hom-aux-x}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ramsey-basis-c-aux4 \\ \index{ramsey-basis-c-aux4}
\=\+($\neg$ {\rm{homp}}\,({\it{set\/}}, {\it{g\/}}, {\tt{1}})\index{homp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{counter-hom-y}}\,({\it{set\/}}, {\it{g\/}}, {\tt{1}})\index{counter-hom-y} $=$ {\rm{list}}\,({\rm{counter-hom-aux-y}}\,({\it{set\/}}, {\it{g\/}})\index{counter-hom-aux-y}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ramsey-basis-c-aux5 \\ \index{ramsey-basis-c-aux5}
\=\+($\neg$ {\rm{homp}}\,({\it{set\/}}, {\it{g\/}}, {\tt{1}})\index{homp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{counter-hom-aux-x}}\,({\it{set\/}}, {\it{g\/}})\index{counter-hom-aux-x} $\in$ {\it{set\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{counter-hom-aux-y}}\,({\it{set\/}}, {\it{g\/}})\index{counter-hom-aux-y} $\in$ {\it{set\/}}) \\ 
$\wedge$$\;\;\;\;$(\=\+{\rm{funcall}}\,({\rm{sing-fn}}\,({\it{g\/}})\index{sing-fn}, {\rm{counter-hom-aux-x}}\,({\it{set\/}}, {\it{g\/}})\index{counter-hom-aux-x})\index{funcall} \\ 
$\not=$$\;\;\;\;${\rm{funcall}}\,({\rm{sing-fn}}\,({\it{g\/}})\index{sing-fn}, {\rm{counter-hom-aux-y}}\,({\it{set\/}}, {\it{g\/}})\index{counter-hom-aux-y})\index{funcall})\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ramsey-basis-c-aux6 \\ \index{ramsey-basis-c-aux6}
{\rm{constantp}}\,({\rm{sing-fn}}\,({\it{g\/}})\index{sing-fn}, {\it{set\/}})\index{constantp} $\rightarrow$ {\rm{homp}}\,({\it{set\/}}, {\it{g\/}}, {\tt{1}})\index{homp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ramsey-basis-c \\ \index{ramsey-basis-c}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ {\rm{homp}}\,({\rm{extract-ramsey-basis}}\,({\it{g\/}}, {\it{xx\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-ramsey-basis}, {\it{g\/}}, {\tt{1}})\index{homp}
\end{tabbing}


\noindent{\sc Event}:   Disable counter-hom-aux-x.

\addvspace{18pt}

\noindent{\sc Event}:   Disable counter-hom-aux-y.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ramsey-basis-c-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ramsey-basis-c-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ramsey-basis-c-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ramsey-basis-c-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ramsey-basis-c-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ramsey-basis-c-aux6.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  ramsey-basis-d \\ \index{ramsey-basis-d}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{setp}}\,({\it{xx\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{xx\/}}, {\rm{star}}\,({\it{alpha\/}}, {\it{c\/}})\index{star})\index{o-largep} $\wedge$ {\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep}) \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{extract-ramsey-basis}}\,({\it{g\/}}, {\it{xx\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-ramsey-basis}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                     MISCELLANEOUS CONSTRUCTIONS                        ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;  vn

; first, to make our notation more compact:
; Look a number z as a von Neumann ordinal -- 
; the set of all smaller numbers.  
; to make this a standard set, we list them in increasing order

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

\begin{tabbing}{\sc Theorem}:  size-of-vn \\ \index{size-of-vn}
({\it{z\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{length}}\,({\rm{vn}}\,({\it{z\/}})\index{vn})\index{length} $=$ {\it{z\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  last-of-vn \\ \index{last-of-vn}
({\it{z\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ ({\rm{last}}\,({\rm{vn}}\,({\it{z\/}})\index{vn})\index{last} $=$ ({\it{z\/}} $-\;1$))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  vn-is-a-set-aux1 \\ \index{vn-is-a-set-aux1}
(({\tt{1}} $<$ {\it{z\/}}) $\wedge$ {\rm{setp}}\,({\rm{vn}}\,({\it{z\/}} $-\;1$)\index{vn})\index{setp}) $\rightarrow$ {\rm{setp}}\,({\rm{vn}}\,({\it{z\/}})\index{vn})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  vn-is-a-set-aux2 \\ \index{vn-is-a-set-aux2}
({\it{z\/}} $\simeq {\tt{0}}$) $\rightarrow$ {\rm{setp}}\,({\rm{vn}}\,({\it{z\/}})\index{vn})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  vn-is-a-set-aux3 \\ \index{vn-is-a-set-aux3}
{\rm{setp}}\,({\rm{vn}}\,({\tt{1}})\index{vn})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  vn-is-a-set \\ \index{vn-is-a-set}
{\rm{setp}}\,({\rm{vn}}\,({\it{z\/}})\index{vn})\index{setp}
\end{tabbing}


\noindent{\sc Event}:   Disable vn-is-a-set-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable vn-is-a-set-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable vn-is-a-set-aux3.

\addvspace{18pt}

\begin{verbatim}; to prove that the members of (vn z) are the numbers below z
; we have to say what the members of add-on-end are

\end{verbatim}\begin{tabbing}{\sc Theorem}:  members-of-add-on-end \\ \index{members-of-add-on-end}
({\it{x\/}} $\in$ {\rm{add-on-end}}\,({\it{item\/}}, {\it{lst\/}})\index{add-on-end}) $=$ (({\it{x\/}} $\in$ {\it{lst\/}}) $\vee$ ({\it{x\/}} $=$ {\it{item\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  members-of-vn-aux1 \\ \index{members-of-vn-aux1}
({\it{z\/}} $\simeq {\tt{0}}$) $\rightarrow$ ({\it{x\/}} $\not\in$ {\rm{vn}}\,({\it{z\/}})\index{vn})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  members-of-vn-aux2 \\ \index{members-of-vn-aux2}
({\it{z\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ (({\it{x\/}} $\in$ {\rm{vn}}\,({\it{z\/}})\index{vn}) $=$ (({\it{x\/}} $\in$ {\rm{vn}}\,({\it{z\/}} $-\;1$)\index{vn}) $\vee$ ({\it{x\/}} $=$ ({\it{z\/}} $-\;1$))))
\end{tabbing}


\noindent{\sc Event}:   Disable vn.

\addvspace{18pt}   \begin{verbatim}; probably, we will never need its defn

\end{verbatim}\begin{tabbing}{\sc Theorem}:  members-of-vn \\ \index{members-of-vn}
({\it{x\/}} $\in$ {\rm{vn}}\,({\it{z\/}})\index{vn}) $=$ (({\it{x\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{x\/}} $<$ {\it{z\/}}))
\end{tabbing}


\noindent{\sc Event}:   Disable members-of-vn-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable members-of-vn-aux2.

\addvspace{18pt}


\begin{verbatim};;;;;;;;;;;;;;   all-maps
;;; let c>0

; (standard-fn g lst c) says that g is a function in standard
;  form from lst into c.   If lst = (x_1 ... x_n . foo), then
; g should be ( (x_1 v_1) ... (x_n v_n))
; we will build these in the induction step for Ramsey's theorem.
; now, we just want to prove that there are c^(length lst) of these

; we define (all-maps lst c), show that it contains all standard
; functions, and show that its size is c^(length lst)

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{standard-function} \\  
\=\+{\rm{standard-function}}\,({\it{g\/}}, {\it{lst\/}}, {\it{c\/}})\index{standard-function} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{lst\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\it{g\/}} $=$ {\bf{nil}} \\ 
{\bf else }\=\+{\rm{standard-function}}\,({\rm{cdr}}\,({\it{g\/}}), {\rm{cdr}}\,({\it{lst\/}}), {\it{c\/}})\index{standard-function} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{car}}\,({\it{g\/}})) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{g\/}}) $=$ {\rm{list}}\,({\rm{car}}\,({\it{lst\/}}), {\rm{cadar}}\,({\it{g\/}}))) \\ 
$\wedge$$\;\;\;\;$(({\rm{cadar}}\,({\it{g\/}}) $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{cadar}}\,({\it{g\/}}) $<$ {\it{c\/}}))\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; in an r-loop
; *(standard-function '((a 3) (b 1)) '(a b) 4 )
;  T
; *(standard-function '((a 3) (b 1)) '(a b) 3 )
;  F
; *(standard-function '((a 3) (b 1)) '(a b c) 5 )
;  F

\end{verbatim}\begin{tabbing}{\sc Theorem}:  tail-of-standard-function \\ \index{tail-of-standard-function}
{\rm{standard-function}}\,({\it{g\/}}, {\rm{cons}}\,({\it{x\/}}, {\it{lst\/}}), {\it{c\/}})\index{standard-function} $\rightarrow$ {\rm{standard-function}}\,({\rm{cdr}}\,({\it{g\/}}), {\it{lst\/}}, {\it{c\/}})\index{standard-function}
\end{tabbing}

\begin{verbatim}; to build up (all-maps lst c):
; suppose g is a standard fn from (cons x lst) to c
; and (cdr g) is a member of a family FF
; then g is of the form (cons (list x i) h) for some i < c
; there are exactly c possibilites for (cons x i)

; we define (extend-family FF x c) to be all such g -- 
; then this will have length = c * |FF|

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

\begin{tabbing}{\sc Theorem}:  list-all-gets-all \\ \index{list-all-gets-all}
(({\it{i\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{i\/}} $<$ {\it{c\/}})) $\rightarrow$ ({\rm{list}}\,({\it{x\/}}, {\it{i\/}}) $\in$ {\rm{list-all}}\,({\it{x\/}}, {\it{c\/}})\index{list-all})
\end{tabbing}
\begin{verbatim}; the list of all (list x i) ; with i < c

\end{verbatim}\begin{tabbing}{\sc Theorem}:  size-of-list-all \\ \index{size-of-list-all}
({\it{c\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{length}}\,({\rm{list-all}}\,({\it{x\/}}, {\it{c\/}})\index{list-all})\index{length} $=$ {\it{c\/}})
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{all-maps} \\  
\=\+{\rm{all-maps}}\,({\it{lst\/}}, {\it{c\/}})\index{all-maps} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{lst\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\tt{'}}{\tt{(}}{\tt{nil}}{\tt{)}} \\ 
{\bf else }{\rm{product}}\,({\rm{list-all}}\,({\rm{car}}\,({\it{lst\/}}), {\it{c\/}})\index{list-all}, {\rm{all-maps}}\,({\rm{cdr}}\,({\it{lst\/}}), {\it{c\/}})\index{all-maps})\index{product}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  all-maps-gets-all \\ \index{all-maps-gets-all}
{\rm{standard-function}}\,({\it{g\/}}, {\it{lst\/}}, {\it{c\/}})\index{standard-function} $\rightarrow$ ({\it{g\/}} $\in$ {\rm{all-maps}}\,({\it{lst\/}}, {\it{c\/}})\index{all-maps})
\end{tabbing}

\begin{verbatim}; now, to compute the size of (all-maps lst c)
; we first need to compute the size of the product of two lists

\end{verbatim}
\noindent{\sc Event}:   Enable product.

\addvspace{18pt}
\begin{tabbing}{\sc Theorem}:  size-of-product \\ \index{size-of-product}
{\rm{length}}\,({\rm{product}}\,({\it{lst1\/}}, {\it{lst2\/}})\index{product})\index{length} $=$ ({\rm{length}}\,({\it{lst1\/}})\index{length} $*$ {\rm{length}}\,({\it{lst2\/}})\index{length})
\end{tabbing}

\noindent{\sc Event}:   Disable product.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  size-of-all-maps \\ \index{size-of-all-maps}
({\it{c\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{length}}\,({\rm{all-maps}}\,({\it{lst\/}}, {\it{c\/}})\index{all-maps})\index{length} $=$ {\rm{expt}}\,({\it{c\/}}, {\rm{length}}\,({\it{lst\/}})\index{length})\index{expt})
\end{tabbing}


\begin{verbatim};;;;;;;  constructing standard functions
; If OP is any defined function, we may construct a standard fn from
; lst to c by running down lst and applying OP
; Since we can't quantify over all defined functions without using
; something like $eval, we just do this for the one OP needed
; in the proof of Ramsey's theorem.

; Suppose (rangep g c) ; think of g as a partition of tuples
; we are trying to get a homogeneous set for.
; In an attempt to construct a pre-homogeneous set, we fix
; a z in omega and let lst be the power set of z  (so |lst| = 2^z)
; for a y > z, we consider g to define a map lst --> c 
; which takes a set S to g(S union {z,y})
; we can call this new function (power-map g z y), and
; later try to get a large set of y's for which (power-map g z y) is the same.

; (power-map g z y)  will be (augmented-map g z y (power-set (vn z)))

; first, let's define (augmented-map g z y lst)

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{end-end} \\  
{\rm{end-end}}\,({\it{x\/}}, {\it{g\/}}, {\it{z\/}}, {\it{y\/}})\index{end-end} $=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{y\/}}, {\rm{add-on-end}}\,({\it{z\/}}, {\it{x\/}})\index{add-on-end})\index{add-on-end})\index{funcall}
\end{tabbing}
\begin{verbatim}; i.e., we're expecting x subset z < y, so we apply the partition
; g to x union {z,y}

; for now, we only care that this defines a function of x,
; with g,z,y as parameters, and that the values are < c 
; if g has range c

\end{verbatim}\begin{tabbing}{\sc Theorem}:  end-end-yields-numbers \\ \index{end-end-yields-numbers}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ ({\rm{end-end}}\,({\it{x\/}}, {\it{g\/}}, {\it{z\/}}, {\it{y\/}})\index{end-end} $\in\;${\bf{N}}${}$)
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  bound-on-end-end \\ \index{bound-on-end-end}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ ({\rm{end-end}}\,({\it{x\/}}, {\it{g\/}}, {\it{z\/}}, {\it{y\/}})\index{end-end} $<$ {\it{c\/}})
\end{tabbing}


\noindent{\sc Event}:   Disable end-end.

\addvspace{18pt}

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

\begin{tabbing}{\sc Theorem}:  augmented-map-is-standard \\ \index{augmented-map-is-standard}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ {\rm{standard-function}}\,({\rm{augmented-map}}\,({\it{g\/}}, {\it{z\/}}, {\it{y\/}}, {\it{lst\/}})\index{augmented-map}, {\it{lst\/}}, {\it{c\/}})\index{standard-function}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  values-of-augmented-map \\ \index{values-of-augmented-map}
({\it{x\/}} $\in$ {\it{lst\/}}) $\rightarrow$ ({\rm{funcall}}\,({\rm{augmented-map}}\,({\it{g\/}}, {\it{z\/}}, {\it{y\/}}, {\it{lst\/}})\index{augmented-map}, {\it{x\/}})\index{funcall} $=$ {\rm{end-end}}\,({\it{x\/}}, {\it{g\/}}, {\it{z\/}}, {\it{y\/}})\index{end-end})
\end{tabbing}


\begin{verbatim};;;;;;;  power-map
; now, let's develop the properties of (power-map g z y)

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{power-map} \\  
{\rm{power-map}}\,({\it{g\/}}, {\it{z\/}}, {\it{y\/}})\index{power-map} $=$ {\rm{augmented-map}}\,({\it{g\/}}, {\it{z\/}}, {\it{y\/}}, {\rm{power-set}}\,({\rm{vn}}\,({\it{z\/}})\index{vn})\index{power-set})\index{augmented-map}
\end{tabbing}

\begin{verbatim}; intent :  z is in omega, and y > z
; then (power-map g z y) is a function which takes the
; sub-set S of z to  g(S U {z,y})

; first, let's consider the kind of object (power-map g z y) is,
; and show that there are  only c^(2^z) of these.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{all-fns-on-power} \\  
{\rm{all-fns-on-power}}\,({\it{z\/}}, {\it{c\/}})\index{all-fns-on-power} $=$ {\rm{all-maps}}\,({\rm{power-set}}\,({\rm{vn}}\,({\it{z\/}})\index{vn})\index{power-set}, {\it{c\/}})\index{all-maps}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  size-of-all-fns-on-power \\ \index{size-of-all-fns-on-power}
\=\+(({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{z\/}} $\in\;${\bf{N}}${}$)) \\ 
$\rightarrow$$\;\;\;\;$({\rm{length}}\,({\rm{all-fns-on-power}}\,({\it{z\/}}, {\it{c\/}})\index{all-fns-on-power})\index{length} $=$ {\rm{expt}}\,({\it{c\/}}, {\rm{expt}}\,({\tt{2}}, {\it{z\/}})\index{expt})\index{expt})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  power-map-in-all-fns \\ \index{power-map-in-all-fns}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ ({\rm{power-map}}\,({\it{g\/}}, {\it{z\/}}, {\it{y\/}})\index{power-map} $\in$ {\rm{all-fns-on-power}}\,({\it{z\/}}, {\it{c\/}})\index{all-fns-on-power})
\end{tabbing}

\begin{verbatim}; now, show that power-map takes sub-sets of z where they should go:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  value-of-power-map \\ \index{value-of-power-map}
\=\+({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ {\rm{subsetp}}\,({\it{s\/}}, {\rm{vn}}\,({\it{z\/}})\index{vn})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\rm{power-map}}\,({\it{g\/}}, {\it{z\/}}, {\it{y\/}})\index{power-map}, {\it{s\/}})\index{funcall} $=$ {\rm{end-end}}\,({\it{s\/}}, {\it{g\/}}, {\it{z\/}}, {\it{y\/}})\index{end-end})\-
\end{tabbing}

\begin{verbatim}; the main point of this is:  if we have a set YY such that
; (power-map g z y) is the same for all y in YY, then
; g(S U {z,y}) is independent of y in YY:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  same-power-maps \\ \index{same-power-maps}
\=\+({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ {\rm{subsetp}}\,({\it{s\/}}, {\rm{vn}}\,({\it{z\/}})\index{vn})\index{subsetp} $\wedge$ ({\rm{power-map}}\,({\it{g\/}}, {\it{z\/}}, {\it{y1\/}})\index{power-map} $=$ {\rm{power-map}}\,({\it{g\/}}, {\it{z\/}}, {\it{y2\/}})\index{power-map})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{y1\/}}, {\rm{add-on-end}}\,({\it{z\/}}, {\it{s\/}})\index{add-on-end})\index{add-on-end})\index{funcall} \\ 
$=$$\;\;\;\;${\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{y2\/}}, {\rm{add-on-end}}\,({\it{z\/}}, {\it{s\/}})\index{add-on-end})\index{add-on-end})\index{funcall})\-\-
\end{tabbing}

\begin{verbatim}; now, in order to get such a YY, we consider (power-map g z y)
; as a function on YY, and then apply the pigeon-hole principle

; first, repeat the procedure to get a function on YY

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{power-power} \\  
\=\+{\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{power-power} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{yy\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf else }{\rm{cons}}\,(\=\+{\rm{list}}\,({\rm{car}}\,({\it{yy\/}}), {\rm{power-map}}\,({\it{g\/}}, {\it{z\/}}, {\rm{car}}\,({\it{yy\/}}))\index{power-map}), \\ 
{\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\rm{cdr}}\,({\it{yy\/}}))\index{power-power})\-$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; this maps YY into (all-fns-on-power z c) -- i.e., the
; set of functions from power-set of z into c

\end{verbatim}\begin{tabbing}{\sc Theorem}:  value-of-power-power \\ \index{value-of-power-power}
({\it{y\/}} $\in$ {\it{yy\/}}) $\rightarrow$ ({\rm{funcall}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{power-power}, {\it{y\/}})\index{funcall} $=$ {\rm{power-map}}\,({\it{g\/}}, {\it{z\/}}, {\it{y\/}})\index{power-map})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  member-values-of-power-power \\ \index{member-values-of-power-power}
\=\+({\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\wedge$ ({\it{y\/}} $\in$ {\it{yy\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{power-power}, {\it{y\/}})\index{funcall} $\in$ {\rm{all-fns-on-power}}\,({\it{z\/}}, {\it{c\/}})\index{all-fns-on-power})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  range-of-power-power-aux1 \\ \index{range-of-power-power-aux1}
\=\+({\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\wedge$ {\rm{subsetp}}\,({\it{k\/}}, {\it{yy\/}})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{mapsto}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{power-power}, {\it{k\/}}, {\rm{all-fns-on-power}}\,({\it{z\/}}, {\it{c\/}})\index{all-fns-on-power})\index{mapsto}\-
\end{tabbing}

\begin{verbatim}; the following was a little tricky to prove, since
; we need to induct on the second YY -- with the first one fixed
; the "natural" induction will replace YY with (cdr YY) in both occurences
\end{verbatim}\begin{tabbing}{\sc Theorem}:  range-of-power-power \\ \index{range-of-power-power}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ {\rm{mapsto}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{power-power}, {\it{yy\/}}, {\rm{all-fns-on-power}}\,({\it{z\/}}, {\it{c\/}})\index{all-fns-on-power})\index{mapsto}
\end{tabbing}


\noindent{\sc Event}:   Disable range-of-power-power-aux1.

\addvspace{18pt}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                           THE NICE SET LEMMA                           ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; assume z is a number and XX is a set
;      (we plan to have z < min XX)
; we want (nice g z XX)  to say that whenever x1,x2 are in X
; and S is a subset of z, g(S U {z,x1}) = g(S U {z,x2})

; since we will get this situation by applying the pigeon-hole
; principle, which uses constantp, we make that the official defn
; and then derive the main property

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{nice}$\;\;$
{\rm{nice}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{nice} $=$ {\rm{constantp}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{power-power}, {\it{xx\/}})\index{constantp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nice-implies-constant \\ \index{nice-implies-constant}
\=\+({\rm{nice}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{nice} $\wedge$ ({\it{x1\/}} $\in$ {\it{xx\/}}) $\wedge$ ({\it{x2\/}} $\in$ {\it{xx\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{power-power}, {\it{x1\/}})\index{funcall} $=$ {\rm{funcall}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{power-power}, {\it{x2\/}})\index{funcall})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nice-implies-same-values \\ \index{nice-implies-same-values}
\=\+(\=\+{\rm{nice}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{nice} \\ 
$\wedge$$\;\;\;\;$({\it{x1\/}} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{x2\/}} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{s\/}}, {\rm{vn}}\,({\it{z\/}})\index{vn})\index{subsetp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{x1\/}}, {\rm{add-on-end}}\,({\it{z\/}}, {\it{s\/}})\index{add-on-end})\index{add-on-end})\index{funcall} \\ 
$=$$\;\;\;\;${\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{x2\/}}, {\rm{add-on-end}}\,({\it{z\/}}, {\it{s\/}})\index{add-on-end})\index{add-on-end})\index{funcall})\-\-
\end{tabbing}


\begin{verbatim};;;;;;;  lemma "nice-going-down"

; now, we plan to start with a big XX and apply the pigeon-hole
; principle to the map (power-power g z XX) to get a subset YY
; of XX such that (constantp (power-power g z XX) YY)

; we will need that this implies (constantp (power-power g z YY) YY) --
; i.e., (nice g z YY) :  lemma "nice-going-down"

; this is true because if y is in YY, a subset of XX
; then (funcall (power-power g z YY) y)  = (funcall (power-power g z XX) y)

; this is because both are equal to (power-map g z y)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  nice-goes-down-aux1 \\ \index{nice-goes-down-aux1}
\=\+(({\it{y\/}} $\in$ {\it{yy\/}}) $\wedge$ {\rm{subsetp}}\,({\it{yy\/}}, {\it{xx\/}})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{power-power}, {\it{y\/}})\index{funcall} $=$ {\rm{funcall}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{power-power}, {\it{y\/}})\index{funcall})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nice-goes-down-aux2 \\ \index{nice-goes-down-aux2}
\=\+(\=\+{\rm{constantp}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{power-power}, {\it{yy\/}})\index{constantp} \\ 
$\wedge$$\;\;\;\;$({\it{y1\/}} $\in$ {\it{yy\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{y2\/}} $\in$ {\it{yy\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{yy\/}}, {\it{xx\/}})\index{subsetp})\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{power-power}, {\it{y1\/}})\index{funcall} $=$ {\rm{funcall}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{power-power}, {\it{y2\/}})\index{funcall})\-
\end{tabbing}


\noindent{\sc Event}:   Disable nice-goes-down-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nice-goes-down-aux2.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  nice-goes-down-aux3 \\ \index{nice-goes-down-aux3}
\=\+(\=\+{\rm{constantp}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{power-power}, {\it{yy\/}})\index{constantp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{vv\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{cdr}}\,({\it{vv\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{yy\/}}, {\it{xx\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{vv\/}}, {\it{yy\/}})\index{subsetp})\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{funcall}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{power-power}, {\rm{car}}\,({\it{vv\/}}))\index{funcall} \\ 
$=$$\;\;\;\;${\rm{funcall}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{power-power}, {\rm{cadr}}\,({\it{vv\/}}))\index{funcall})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nice-goes-down-aux4 \\ \index{nice-goes-down-aux4}
({\rm{subsetp}}\,({\it{vv\/}}, {\it{yy\/}})\index{subsetp} $\wedge$ {\rm{listp}}\,({\it{vv\/}})) $\rightarrow$ {\rm{subsetp}}\,({\rm{cdr}}\,({\it{vv\/}}), {\it{yy\/}})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nice-goes-down-aux5 \\ \index{nice-goes-down-aux5}
\=\+({\rm{constantp}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{power-power}, {\it{yy\/}})\index{constantp} $\wedge$ {\rm{subsetp}}\,({\it{yy\/}}, {\it{xx\/}})\index{subsetp} $\wedge$ {\rm{subsetp}}\,({\it{vv\/}}, {\it{yy\/}})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{constantp}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{power-power}, {\it{vv\/}})\index{constantp}\-
\end{tabbing}

\begin{verbatim}; we had the following problem in proving this:
; we want to prove  (constantp (power-power g z YY) YY) --
; but we have to induct on the second YY -- not the first --
; so we added a set VV:  assume VV subset YY subset XX
; and prove (constantp (power-power g z YY) VV) -- then set VV = YY  :
\end{verbatim}\begin{tabbing}{\sc Theorem}:  nice-goes-down \\ \index{nice-goes-down}
({\rm{constantp}}\,({\rm{power-power}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{power-power}, {\it{yy\/}})\index{constantp} $\wedge$ {\rm{subsetp}}\,({\it{yy\/}}, {\it{xx\/}})\index{subsetp}) $\rightarrow$ {\rm{nice}}\,({\it{g\/}}, {\it{z\/}}, {\it{yy\/}})\index{nice}
\end{tabbing}


\noindent{\sc Event}:   Disable nice-goes-down-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nice-goes-down-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nice-goes-down-aux5.

\addvspace{18pt}


\begin{verbatim};;;;;;;;  now, back to the nice set lemma
; Suppose ZZ is a set which is phi(alpha,c) -- large ; alpha >= 1 ; c >= 1
; let z = min ZZ, and alpha-hat = {alpha}(z)
; then, by cdr-lemma-1 and cdr-lemma2
; 1. (cdr ZZ) is a set
; 2. (cdr ZZ) is phi(alpha-hat,c) * c^(2^z)  --  large

; now, suppose also that g maps into c.
; then, we can apply the pigeon-hole principle to the
; function (power-power g z (cdr ZZ)) to get a subset
; YY of (cdr ZZ) such that YY is phi(alpha-hat,c)  -- large
; and (power-power g z (cdr ZZ)) is constant on YY --
; so (nice g z YY)

; we obtain YY as (extract-nice g ZZ alpha c)
; we define extract-nice so that it will return NIL if the
; hypotheses to the nice set lemma aren't met

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{extract-nice} \\  
\=\+{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice} \\ 
$=$$\;\;\;\;$\=\+{\bf if }\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;${\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep}\- \\ 
{\bf then }{\rm{extract-pigeon}}\,(\=\+{\rm{power-power}}\,({\it{g\/}}, {\rm{car}}\,({\it{zz\/}}), {\rm{cdr}}\,({\it{zz\/}}))\index{power-power}, \\ 
{\rm{cdr}}\,({\it{zz\/}}), \\ 
{\rm{all-fns-on-power}}\,({\rm{car}}\,({\it{zz\/}}), {\it{c\/}})\index{all-fns-on-power}, \\ 
{\rm{phi}}\,({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, {\it{c\/}})\index{phi}, \\ 
{\rm{expt}}\,({\it{c\/}}, {\rm{expt}}\,({\tt{2}}, {\rm{car}}\,({\it{zz\/}}))\index{expt})\index{expt})\-\index{extract-pigeon} \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}


\begin{verbatim}; if ZZ is a set and YY = (extract-nice g ZZ alpha c)
; "nice-set-A" says that YY is a set
; "nice-set-B" says that if ZZ is also phi(alpha,c) -- large
;           YY is a sub-set of (cdr ZZ)
; "nice-set-C" says that (nice g z YY)
; "nice-set-D" says that YY is phi(alpha-hat,c) -- large
;           whenever alpha is an ord >= 1, c > 0, and
;           ZZ is phi(alpha,c) -- large and (rangep g c)


; Here's a trivial property of phi:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  phi-non-zero \\ \index{phi-non-zero}
{\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi} $\not=$ {\tt{0}}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nice-set-a-aux1 \\ \index{nice-set-a-aux1}
({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep}) $\rightarrow$ {\rm{listp}}\,({\it{zz\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nice-set-a-aux2 \\ \index{nice-set-a-aux2}
({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep}) $\rightarrow$ {\rm{setp}}\,({\rm{cdr}}\,({\it{zz\/}}))\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nice-set-a-aux3 \\ \index{nice-set-a-aux3}
{\rm{setp}}\,({\bf{nil}})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nice-set-a \\ \index{nice-set-a}
{\rm{setp}}\,({\it{zz\/}})\index{setp} $\rightarrow$ {\rm{setp}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\index{setp}
\end{tabbing}


\noindent{\sc Event}:   Disable nice-set-a-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nice-set-a-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nice-set-a-aux3.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  nice-set-b \\ \index{nice-set-b}
\=\+({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep}) \\ 
$\rightarrow$$\;\;\;\;${\rm{subsetp}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\rm{cdr}}\,({\it{zz\/}}))\index{subsetp}\-
\end{tabbing}

\begin{verbatim}; for nice-set-C -- we need (contantp ...) which involves establishing
; "mapsto" hypothesis
; we have to show that the function, (power-power g (car ZZ) (cdr ZZ))
; which is mapping on (cdr ZZ), mapsto
; (all-fns-on-power (car ZZ) c)
; 

\end{verbatim}\begin{tabbing}{\sc Theorem}:  nice-set-c-aux1 \\ \index{nice-set-c-aux1}
\=\+{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$\rightarrow$$\;\;\;\;${\rm{mapsto}}\,(\=\+{\rm{power-power}}\,({\it{g\/}}, {\rm{car}}\,({\it{zz\/}}), {\rm{cdr}}\,({\it{zz\/}}))\index{power-power}, \\ 
{\rm{cdr}}\,({\it{zz\/}}), \\ 
{\rm{all-fns-on-power}}\,({\rm{car}}\,({\it{zz\/}}), {\it{c\/}})\index{all-fns-on-power})\-\index{mapsto}\-
\end{tabbing}

\begin{verbatim}; we also need that the size of the range >= c^(2^z)
; which follows since c and z are numbers

\end{verbatim}
\noindent{\sc Event}:   Enable nice-set-a-aux1.

\addvspace{18pt}
\begin{verbatim}; ZZ is non-empty, assuming (setp ZZ) and (o-largep ZZ (phi alpha c))

\end{verbatim}\begin{tabbing}{\sc Theorem}:  nice-set-c-aux2 \\ \index{nice-set-c-aux2}
\=\+(({\it{c\/}} $\not\simeq {\tt{0}}$) $\wedge$ {\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{length}}\,({\rm{all-fns-on-power}}\,({\rm{car}}\,({\it{zz\/}}), {\it{c\/}})\index{all-fns-on-power})\index{length} $=$ {\rm{expt}}\,({\it{c\/}}, {\rm{expt}}\,({\tt{2}}, {\rm{car}}\,({\it{zz\/}}))\index{expt})\index{expt})\-
\end{tabbing}

\begin{verbatim}; putting this together with pigeon-C, we get (constantp ...)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  nice-set-c-aux3 \\ \index{nice-set-c-aux3}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;${\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{constantp}}\,({\rm{power-power}}\,({\it{g\/}}, {\rm{car}}\,({\it{zz\/}}), {\rm{cdr}}\,({\it{zz\/}}))\index{power-power}, {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\index{constantp}\-
\end{tabbing}

\begin{verbatim}; actually, if the above hypotheses fail, then
; extract-nice returns nil, so we still have constantp

\end{verbatim}\begin{tabbing}{\sc Theorem}:  nice-set-c-aux4 \\ \index{nice-set-c-aux4}
\=\+($\neg$ (\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;${\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep})\-) \\ 
$\rightarrow$$\;\;\;\;${\rm{constantp}}\,({\rm{power-power}}\,({\it{g\/}}, {\rm{car}}\,({\it{zz\/}}), {\rm{cdr}}\,({\it{zz\/}}))\index{power-power}, {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\index{constantp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  nice-set-c-aux5 \\ \index{nice-set-c-aux5}
{\rm{constantp}}\,({\rm{power-power}}\,({\it{g\/}}, {\rm{car}}\,({\it{zz\/}}), {\rm{cdr}}\,({\it{zz\/}}))\index{power-power}, {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\index{constantp}
\end{tabbing}

\begin{verbatim}; now, we apply nice-goes-down, since (extract-nice g ZZ alpha c)
; is a subset of (cdr ZZ) (by nice-set-B --
; assuming (and (setp ZZ) (o-largep ZZ (phi alpha c)))   )

\end{verbatim}
\noindent{\sc Event}:   Disable nice-set-a-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nice-set-c-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nice-set-c-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nice-set-c-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nice-set-c-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable nice-set-c-aux5.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  nice-set-c \\ \index{nice-set-c}
\=\+({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep}) \\ 
$\rightarrow$$\;\;\;\;${\rm{nice}}\,({\it{g\/}}, {\rm{car}}\,({\it{zz\/}}), {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\index{nice}\-
\end{tabbing}

\begin{verbatim}; finally, nice-set-D assumes the full hypotheses of extract-nice
; and concludes that (extract-nice g ZZ alpha c)
; is phi(alpha-hat,c) -- large, where alpha-hat is
; (pred alpha (car ZZ))

; this uses the fact that the set we're mapping from, (cdr ZZ)
; is (phi (pred alpha (car ZZ)) c) * (expt c (expt 2 (car ZZ))) -- large
; -- this is by the cdr-lemma

; then, we have to apply pigeon-D to get a large set

\end{verbatim}\begin{tabbing}{\sc Theorem}:  nice-set-d \\ \index{nice-set-d}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;${\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\rm{phi}}\,({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, {\it{c\/}})\index{phi})\index{o-largep}\-
\end{tabbing}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                 THE PRE-HOMOGENEOUS SET LEMMA                          ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; we iterate extract-nice to obtain a prehomogeneous set

;;;;;;;;;  Preliminaries

;;;;  nice-and-last :    a more useful version of nice
; we want this in terms of (last S)

; probably, we don't need the defn of nice any more

\end{verbatim}
\noindent{\sc Event}:   Disable nice.

\addvspace{18pt}

\begin{verbatim};;;  here's some simple fact about (last S)
\end{verbatim}\begin{tabbing}{\sc Theorem}:  last-is-member \\ \index{last-is-member}
({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{s\/}})) $\rightarrow$ ({\rm{last}}\,({\it{s\/}})\index{last} $\in$ {\it{s\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subset-of-last-aux1 \\ \index{subset-of-last-aux1}
({\rm{listp}}\,({\it{z\/}}) $\wedge$ {\rm{setp}}\,({\rm{cons}}\,({\it{v\/}}, {\it{z\/}}))\index{setp}) $\rightarrow$ ({\it{v\/}} $<$ {\rm{last}}\,({\it{z\/}})\index{last})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subset-of-last-aux2 \\ \index{subset-of-last-aux2}
({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{s\/}}) $\wedge$ ({\it{x\/}} $\in$ {\rm{all-but-last}}\,({\it{s\/}})\index{all-but-last})) $\rightarrow$ ({\it{x\/}} $<$ {\rm{last}}\,({\it{s\/}})\index{last})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subset-of-last-aux3 \\ \index{subset-of-last-aux3}
({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{s\/}}) $\wedge$ ({\it{x\/}} $\in$ {\rm{all-but-last}}\,({\it{s\/}})\index{all-but-last})) $\rightarrow$ ({\it{x\/}} $\in$ {\rm{vn}}\,({\rm{last}}\,({\it{s\/}})\index{last})\index{vn})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subset-of-last \\ \index{subset-of-last}
({\rm{setp}}\,({\it{s\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{s\/}})) $\rightarrow$ {\rm{subsetp}}\,({\rm{all-but-last}}\,({\it{s\/}})\index{all-but-last}, {\rm{vn}}\,({\rm{last}}\,({\it{s\/}})\index{last})\index{vn})\index{subsetp}
\end{tabbing}


\noindent{\sc Event}:   Disable subset-of-last-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subset-of-last-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subset-of-last-aux3.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  nice-and-last \\ \index{nice-and-last}
\=\+(\=\+{\rm{nice}}\,({\it{g\/}}, {\it{z\/}}, {\it{xx\/}})\index{nice} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{x1\/}} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{x2\/}} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s\/}})\index{last} $=$ {\it{z\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{x1\/}}, {\it{s\/}})\index{add-on-end})\index{funcall} $=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{x2\/}}, {\it{s\/}})\index{add-on-end})\index{funcall})\-
\end{tabbing}


\begin{verbatim};;;;;;;  rephrase the nice set lemma
;; for iterating extract-nice, it will be simpler to have an
;; explicit name for the hypotheses under which it works
; then, this can be disabled when not needed

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{nice-set-hyp} \\  
\=\+{\rm{nice-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{nice-set-hyp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq} \\ 
$\wedge$$\;\;\;\;${\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep})\-\-
\end{tabbing}


\begin{verbatim}; if the hyp fails, extract-nice returns nil

\end{verbatim}\begin{tabbing}{\sc Theorem}:  extract-nice-is-nil \\ \index{extract-nice-is-nil}
($\neg$ {\rm{nice-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{nice-set-hyp}) $\rightarrow$ ({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice} $=$ {\bf{nil}})
\end{tabbing}

\begin{verbatim}; now, restate the four parts of the nice set lemma
; using this hyp

; probably, we don't need the defn of extract-nice any more

\end{verbatim}
\noindent{\sc Event}:   Disable extract-nice.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  simple-nice-set-a \\ \index{simple-nice-set-a}
{\rm{nice-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{nice-set-hyp} $\rightarrow$ {\rm{setp}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  simple-nice-set-b \\ \index{simple-nice-set-b}
{\rm{nice-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{nice-set-hyp} $\rightarrow$ {\rm{subsetp}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\rm{cdr}}\,({\it{zz\/}}))\index{subsetp}
\end{tabbing}


\begin{tabbing}{\sc Theorem}:  simple-nice-set-c \\ \index{simple-nice-set-c}
{\rm{nice-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{nice-set-hyp} $\rightarrow$ {\rm{nice}}\,({\it{g\/}}, {\rm{car}}\,({\it{zz\/}}), {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\index{nice}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  simple-nice-set-d \\ \index{simple-nice-set-d}
\=\+{\rm{nice-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{nice-set-hyp} \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\rm{phi}}\,({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, {\it{c\/}})\index{phi})\index{o-largep}\-
\end{tabbing}


\begin{verbatim};;;;;;  iterability

;; to prove that iterating extract-nice to a set produces
;; a subset, all we need is

\end{verbatim}\begin{tabbing}{\sc Theorem}:  extract-nice-produces-subset \\ \index{extract-nice-produces-subset}
({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{zz\/}})) $\rightarrow$ {\rm{subsetp}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\rm{cdr}}\,({\it{zz\/}}))\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  extract-nice-produces-set \\ \index{extract-nice-produces-set}
({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{zz\/}})) $\rightarrow$ {\rm{setp}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\index{setp}
\end{tabbing}

\begin{verbatim}; in the iteration, we also need that the hypotheses replicate
; themselves until alpha becomes 0

\end{verbatim}\begin{tabbing}{\sc Theorem}:  replication-of-hyp-aux1 \\ \index{replication-of-hyp-aux1}
\=\+({\rm{nice-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{nice-set-hyp} $\wedge$ {\rm{ord-leq}}\,({\tt{1}}, {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred})\index{ord-leq}) \\ 
$\rightarrow$$\;\;\;\;${\rm{nice-set-hyp}}\,({\it{g\/}}, {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, {\it{c\/}})\index{nice-set-hyp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  replication-of-hyp-aux2 \\ \index{replication-of-hyp-aux2}
{\rm{nice-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{nice-set-hyp} $\rightarrow$ {\rm{ordinalp}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{u\/}})\index{pred})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  replication-of-hyp \\ \index{replication-of-hyp}
\=\+({\rm{nice-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{nice-set-hyp} $\wedge$ ({\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{nice-set-hyp}}\,({\it{g\/}}, {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, {\it{c\/}})\index{nice-set-hyp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable replication-of-hyp-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable replication-of-hyp-aux2.

\addvspace{18pt}


\begin{verbatim};;;;;;;;;  End Preliminaries


;; we get extract-prehom by iterating extract-nice

; to prove the recursion works -- we should prove
; that extract-nice returns a set of smaller length

\end{verbatim}\begin{tabbing}{\sc Theorem}:  sublists-smaller-length \\ \index{sublists-smaller-length}
({\rm{listp}}\,({\it{zz\/}}) $\wedge$ {\rm{sublistp}}\,({\it{uu\/}}, {\rm{cdr}}\,({\it{zz\/}}))\index{sublistp}) $\rightarrow$ ({\rm{length}}\,({\it{uu\/}})\index{length} $<$ {\rm{length}}\,({\it{zz\/}})\index{length})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  subsets-smaller-length \\ \index{subsets-smaller-length}
\=\+({\rm{listp}}\,({\it{zz\/}}) $\wedge$ {\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\it{uu\/}})\index{setp} $\wedge$ {\rm{subsetp}}\,({\it{uu\/}}, {\rm{cdr}}\,({\it{zz\/}}))\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{length}}\,({\it{uu\/}})\index{length} $<$ {\rm{length}}\,({\it{zz\/}})\index{length})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  extract-prehom-aux1 \\ \index{extract-prehom-aux1}
\=\+({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{zz\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{length}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\index{length} $<$ {\rm{length}}\,({\it{zz\/}})\index{length})\-
\end{tabbing}

\begin{verbatim}; the following keep getting in the way of the next defn
\end{verbatim}
\noindent{\sc Event}:   Disable o-largep.

\addvspace{18pt}  \begin{verbatim}; let's keep this off permanently
\end{verbatim}
\noindent{\sc Event}:   Disable large-goes-up.

\addvspace{18pt}

\noindent{\sc Event}:   Disable setp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable simple-nice-set-a.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{extract-prehom} \\  
\=\+{\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{zz\/}}) $\wedge$ ({\it{alpha\/}} $\not=$ {\tt{0}}) \\ 
{\bf then }{\rm{cons}}\,(\=\+{\rm{car}}\,({\it{zz\/}}), \\ 
{\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom})\- \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}   
\begin{verbatim}; use ordinary recursion, on length, not transfinite recursion on epsilon_0

\end{verbatim}
\noindent{\sc Event}:   Enable large-goes-up.

\addvspace{18pt}

\noindent{\sc Event}:   Enable setp.

\addvspace{18pt}

\noindent{\sc Event}:   Enable simple-nice-set-a.

\addvspace{18pt}

\begin{verbatim}; this will return an alpha-large set 
; so, if alpha = 0, any set will do
; so,   the intended hypotheses to extract-prehom are
; like that of extract-nice, except that alpha could be 0

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{prehom-set-hyp} \\  
\=\+{\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{prehom-set-hyp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{c\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  compare-hyps \\ \index{compare-hyps}
\=\+({\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{prehom-set-hyp} $\wedge$ ({\it{alpha\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{nice-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{nice-set-hyp}\-
\end{tabbing}


\begin{verbatim};;; now if ZZ is a set and XX = (extract-prehom g ZZ alpha c)
; the PREHOMOGENEOUS SET LEMMA has 6 parts.  the first
; 3 don't use any properties of extract-nice -- only the
; lemma above that it returns a subset of (cdr ZZ)

; "prehom-set-A" says that if (listp ZZ) and alpha != 0 then
;           (car XX) = (car ZZ)
; "prehom-set-B" says that 
;           XX is a sub-set of ZZ
; "prehom-set-C" says that if (listp ZZ) and alpha != 0  then
;            (listp XX)
; "prehom-set-D" says that XX is a set
; "prehom-set-E" says that if (prehom-set-hyp g ZZ alpha c)
;          then (o-largep XX alpha)
; "prehom-set-F" says that if (prehom-set-hyp g ZZ alpha c)
;          then (pre-homp XX g)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-a \\ \index{prehom-set-a}
\=\+({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{zz\/}}) $\wedge$ ({\it{alpha\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom}) $=$ {\rm{car}}\,({\it{zz\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-b-aux1 \\ \index{prehom-set-b-aux1}
\=\+({\rm{listp}}\,({\it{zz\/}}) $\wedge$ {\rm{subsetp}}\,({\it{uu\/}}, {\it{ww\/}})\index{subsetp} $\wedge$ {\rm{subsetp}}\,({\it{ww\/}}, {\rm{cdr}}\,({\it{zz\/}}))\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{subsetp}}\,({\rm{cons}}\,({\rm{car}}\,({\it{zz\/}}), {\it{uu\/}}), {\it{zz\/}})\index{subsetp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-b-aux2 \\ \index{prehom-set-b-aux2}
\=\+({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{zz\/}}) $\wedge$ {\rm{subsetp}}\,({\it{uu\/}}, {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{subsetp}}\,({\rm{cons}}\,({\rm{car}}\,({\it{zz\/}}), {\it{uu\/}}), {\it{zz\/}})\index{subsetp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-b \\ \index{prehom-set-b}
{\rm{setp}}\,({\it{zz\/}})\index{setp} $\rightarrow$ {\rm{subsetp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom}, {\it{zz\/}})\index{subsetp}
\end{tabbing}



\noindent{\sc Event}:   Disable prehom-set-b-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-b-aux2.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  prehom-set-c \\ \index{prehom-set-c}
\=\+({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{zz\/}}) $\wedge$ ({\it{alpha\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{listp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom})\-
\end{tabbing}

\begin{verbatim}; for D, we will have to force the correct induction
; first, consider some trivial cases

; first, when (extract-prehom g ZZ alpha c) is empty

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux1 \\ \index{prehom-set-d-aux1}
($\neg$ {\rm{setp}}\,({\it{zz\/}})\index{setp}) $\rightarrow$ {\rm{setp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom})\index{setp}
\end{tabbing}
\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux2 \\ \index{prehom-set-d-aux2}
($\neg$ {\rm{listp}}\,({\it{zz\/}})) $\rightarrow$ {\rm{setp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom})\index{setp}
\end{tabbing}
\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux3 \\ \index{prehom-set-d-aux3}
({\it{alpha\/}} $=$ {\tt{0}}) $\rightarrow$ {\rm{setp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom})\index{setp}
\end{tabbing}

\begin{verbatim}; next, when (extract-prehom g ZZ alpha c) is a singleton

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux4 \\ \index{prehom-set-d-aux4}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{zz\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{alpha\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;$({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice} $\simeq\;${{\bf{nil}}}${}$))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{setp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom})\index{setp}\-
\end{tabbing}

\begin{verbatim}; we can summarize the only case left to consider as:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux5 \\ \index{prehom-set-d-aux5}
\=\+($\neg$ {\rm{setp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom})\index{setp}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{zz\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{alpha\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}))\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable prehom-set-d-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-d-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-d-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-d-aux4.

\addvspace{18pt}

\begin{verbatim}; in the inductive case, we use lemma "set-builder", but we
; have to check that it applies.  It does, because 
; "extract-nice" returns a subset of the cdr
; let UU = (extract-nice g ZZ alpha c) 
; and let VV = (extract-prehom g  UU (pred alpha (car ZZ)) c)   
; then (extract-prehom g ZZ alpha c)  = 
; (cons (car ZZ) VV)

; first, state abstractly what we're using about sets:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux6 \\ \index{prehom-set-d-aux6}
\=\+({\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{zz\/}}) $\wedge$ {\rm{listp}}\,({\it{uu\/}}) $\wedge$ {\rm{subsetp}}\,({\it{uu\/}}, {\rm{cdr}}\,({\it{zz\/}}))\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\it{zz\/}}) $<$ {\rm{car}}\,({\it{uu\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux7 \\ \index{prehom-set-d-aux7}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{zz\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{uu\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{uu\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{vv\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{vv\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{car}}\,({\it{vv\/}}) $=$ {\rm{car}}\,({\it{uu\/}})) \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{uu\/}}, {\rm{cdr}}\,({\it{zz\/}}))\index{subsetp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{setp}}\,({\rm{cons}}\,({\rm{car}}\,({\it{zz\/}}), {\it{vv\/}}))\index{setp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable prehom-set-d-aux6.

\addvspace{18pt}

\begin{verbatim}; now, plug in what VV is:  of form
;    (extract-prehom g  UU delta c)
;  we still assume VV is a set (that's the induction), but
; we can drop the other hypotheses, since they follow
; from parts A,B,C of the lemma

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux8 \\ \index{prehom-set-d-aux8}
({\rm{setp}}\,({\it{ee\/}})\index{setp} $\wedge$ {\rm{setp}}\,({\rm{cons}}\,({\it{z\/}}, {\it{x\/}}))\index{setp} $\wedge$ ($\neg$ {\rm{listp}}\,({\it{ee\/}}))) $\rightarrow$ {\rm{setp}}\,({\rm{cons}}\,({\it{z\/}}, {\it{ee\/}}))\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux9 \\ \index{prehom-set-d-aux9}
\=\+{\rm{listp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{uu\/}}, {\it{delta\/}}, {\it{c\/}})\index{extract-prehom}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{car}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{uu\/}}, {\it{delta\/}}, {\it{c\/}})\index{extract-prehom}) $=$ {\rm{car}}\,({\it{uu\/}}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux10 \\ \index{prehom-set-d-aux10}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{zz\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{uu\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{uu\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{uu\/}}, {\rm{cdr}}\,({\it{zz\/}}))\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{uu\/}}, {\it{delta\/}}, {\it{c\/}})\index{extract-prehom})\index{setp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{setp}}\,({\rm{cons}}\,({\rm{car}}\,({\it{zz\/}}), {\rm{extract-prehom}}\,({\it{g\/}}, {\it{uu\/}}, {\it{delta\/}}, {\it{c\/}})\index{extract-prehom}))\index{setp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable prehom-set-d-aux7.

\addvspace{18pt}

\begin{verbatim}; now, plug in what UU is :  (extract-nice g ZZ alpha c) 
; this is a set -- it may be empty, but we've already
; considered that case, so keep the hypothesis that it's non-empty
; it is always a subset of (cdr ZZ)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux11 \\ \index{prehom-set-d-aux11}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{zz\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\it{delta\/}}, {\it{c\/}})\index{extract-prehom})\index{setp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{setp}}\,({\rm{cons}}\,(\=\+{\rm{car}}\,({\it{zz\/}}), \\ 
{\rm{extract-prehom}}\,({\it{g\/}}, {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\it{delta\/}}, {\it{c\/}})\index{extract-prehom})\-)\index{setp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable prehom-set-d-aux10.

\addvspace{18pt}

\begin{verbatim}; now, with delta =  (pred alpha (car ZZ)) , we have the induction step

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-d-aux12 \\ \index{prehom-set-d-aux12}
\=\+(\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{zz\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom})\index{setp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{setp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom})\index{setp}\-
\end{tabbing}

\begin{verbatim}; now, the induction should work

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-d \\ \index{prehom-set-d}
{\rm{setp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom})\index{setp}
\end{tabbing}


\noindent{\sc Event}:   Disable prehom-set-d-aux5.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-d-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-d-aux9.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-d-aux11.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-d-aux12.

\addvspace{18pt}

\begin{verbatim}; to do the inductions in E and F, we should check that
; the hypotheses replicates to the inductive call

; the following seem useful in general:


\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-hyp-implies-non-empty \\ \index{prehom-hyp-implies-non-empty}
{\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{prehom-set-hyp} $\rightarrow$ {\rm{listp}}\,({\it{zz\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  positive-ordinals \\ \index{positive-ordinals}
({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ({\it{alpha\/}} $\not=$ {\tt{0}})) $\rightarrow$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  replication-of-prehom-hyp-aux1 \\ \index{replication-of-prehom-hyp-aux1}
{\rm{o-largep}}\,({\it{zz\/}}, {\rm{phi}}\,({\it{alpha\/}}, {\it{c\/}})\index{phi})\index{o-largep} $\rightarrow$ {\rm{listp}}\,({\it{zz\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  replication-of-prehom-hyp \\ \index{replication-of-prehom-hyp}
\=\+({\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{prehom-set-hyp} $\wedge$ ({\it{alpha\/}} $\not=$ {\tt{0}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{prehom-set-hyp}}\,({\it{g\/}}, {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, {\it{c\/}})\index{prehom-set-hyp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable replication-of-prehom-hyp-aux1.

\addvspace{18pt}


\begin{verbatim}; now, on to E.
; for the basis:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-e-aux1 \\ \index{prehom-set-e-aux1}
{\rm{o-largep}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom}, {\tt{0}})\index{o-largep}
\end{tabbing}

\begin{verbatim}; for the induction, we need
\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-e-aux2 \\ \index{prehom-set-e-aux2}
\=\+(\=\+({\it{alpha\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,(\=\+{\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred})\-\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,(\=\+{\rm{cons}}\,(\=\+{\rm{car}}\,({\it{zz\/}}), \\ 
{\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom})\-, \\ 
{\it{alpha\/}})\-\index{o-largep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-e-aux3 \\ \index{prehom-set-e-aux3}
\=\+(\=\+{\rm{listp}}\,({\it{zz\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;$({\it{alpha\/}} $\not=$ {\tt{0}}) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,(\=\+{\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred})\-\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}

\begin{verbatim}; to force the correct induction

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-e-aux4 \\ \index{prehom-set-e-aux4}
\=\+(\=\+{\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{prehom-set-hyp} \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom}, {\it{alpha\/}})\index{o-largep}))\- \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,(\=\+{\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred})\-\index{o-largep})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-e-aux5 \\ \index{prehom-set-e-aux5}
\=\+(\=\+{\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{prehom-set-hyp} \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{o-largep}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom}, {\it{alpha\/}})\index{o-largep}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{prehom-set-hyp}}\,({\it{g\/}}, {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, {\it{c\/}})\index{prehom-set-hyp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-e \\ \index{prehom-set-e}
\=\+{\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{prehom-set-hyp} \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}


\noindent{\sc Event}:   Disable prehom-set-e-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-e-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-e-aux3.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-e-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-e-aux5.

\addvspace{18pt}

\begin{verbatim}; finally, F -- that the resulting set
;  XX = (extract-prehom g ZZ alpha c) is pre-homogeneous
; so, we have to look at all non-empty subsets of XX  --
; but in fact, the defn of pre-homogeneous works will ALL sets
; S whose last element is in XX -- regardless of whether S is
; a subset of XX.

; That's not relevant to Ramsey's Theoreom, but this stronger
; statement is a lot easier to prove by induction.

; let's summarize what we're saying can't happen:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bad-for-prehom-set} \\  
\=\+{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} \\ 
$=$$\;\;\;\;$(\=\+{\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{prehom-set-hyp} \\ 
$\wedge$$\;\;\;\;$({\it{xx\/}} $=$ {\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s\/}})\index{last} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{x1\/}} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{x2\/}} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s\/}})\index{last} $<$ {\it{x1\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s\/}})\index{last} $<$ {\it{x2\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{x1\/}}, {\it{s\/}})\index{add-on-end})\index{funcall} $\not=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{x2\/}}, {\it{s\/}})\index{add-on-end})\index{funcall}))\-\-
\end{tabbing}

\begin{verbatim}; we show this can't happen by induction on ZZ (with a fixed SS)
; first, note that XX and ZZ are non-empty sets and 1 <= alpha
; and (car XX) = (car ZZ)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux1 \\ \index{prehom-set-f-aux1}
{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\rightarrow$ {\rm{listp}}\,({\it{xx\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux2 \\ \index{prehom-set-f-aux2}
{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\rightarrow$ {\rm{setp}}\,({\it{xx\/}})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux3 \\ \index{prehom-set-f-aux3}
{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\rightarrow$ {\rm{listp}}\,({\it{zz\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux4 \\ \index{prehom-set-f-aux4}
{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\rightarrow$ {\rm{setp}}\,({\it{zz\/}})\index{setp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux5 \\ \index{prehom-set-f-aux5}
{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\rightarrow$ {\rm{ordinalp}}\,({\it{alpha\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux6 \\ \index{prehom-set-f-aux6}
{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\rightarrow$ {\rm{ord-leq}}\,({\tt{1}}, {\it{alpha\/}})\index{ord-leq}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux7 \\ \index{prehom-set-f-aux7}
\=\+{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} \\ 
$\rightarrow$$\;\;\;\;$({\it{xx\/}} $=$ {\rm{cons}}\,(\=\+{\rm{car}}\,({\it{zz\/}}), \\ 
{\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom})\-)\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux8 \\ \index{prehom-set-f-aux8}
{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\rightarrow$ ({\rm{car}}\,({\it{xx\/}}) $=$ {\rm{car}}\,({\it{zz\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux9 \\ \index{prehom-set-f-aux9}
\=\+{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{cdr}}\,({\it{xx\/}}) \\ 
$=$$\;\;\;\;${\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom})\-\-
\end{tabbing}

\begin{verbatim}; now, we plan to use the nice set lemma to contradict (last S) = (car XX),
; so then (last S) > (car XX), whence we can use induction on ZZ
; in either case, we need that x1,x2 are in 
; (extract-prehom g (extract-nice g ZZ alpha c) (pred alpha (car ZZ))  c)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux10 \\ \index{prehom-set-f-aux10}
({\rm{setp}}\,({\it{xx\/}})\index{setp} $\wedge$ ({\it{u\/}} $\in$ {\it{xx\/}}) $\wedge$ ({\it{x\/}} $\in$ {\it{xx\/}}) $\wedge$ ({\it{u\/}} $<$ {\it{x\/}})) $\rightarrow$ ({\it{x\/}} $\in$ {\rm{cdr}}\,({\it{xx\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux11 \\ \index{prehom-set-f-aux11}
{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\rightarrow$ ({\it{x1\/}} $\in$ {\rm{cdr}}\,({\it{xx\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux12 \\ \index{prehom-set-f-aux12}
{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\rightarrow$ ({\it{x2\/}} $\in$ {\rm{cdr}}\,({\it{xx\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux13 \\ \index{prehom-set-f-aux13}
\=\+{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} \\ 
$\rightarrow$$\;\;\;\;$({\it{x1\/}} $\in$ {\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux14 \\ \index{prehom-set-f-aux14}
\=\+{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} \\ 
$\rightarrow$$\;\;\;\;$({\it{x2\/}} $\in$ {\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom})\-
\end{tabbing}

\begin{verbatim}; now, we work on refuting the case that (last S) = (car XX) ,
; using the nice set lemma
; for this, first note that x1,x2 are in (extract-nice g ZZ alpha c)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux15 \\ \index{prehom-set-f-aux15}
\=\+{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} \\ 
$\rightarrow$$\;\;\;\;$({\it{x1\/}} $\in$ {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux16 \\ \index{prehom-set-f-aux16}
\=\+{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} \\ 
$\rightarrow$$\;\;\;\;$({\it{x2\/}} $\in$ {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux17 \\ \index{prehom-set-f-aux17}
\=\+({\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\wedge$ ({\rm{last}}\,({\it{s\/}})\index{last} $=$ {\rm{car}}\,({\it{zz\/}}))) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ {\rm{nice}}\,({\it{g\/}}, {\rm{car}}\,({\it{zz\/}}), {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice})\index{nice})\-
\end{tabbing}

\begin{verbatim}; but it should be nice, by nice-set-C

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux18 \\ \index{prehom-set-f-aux18}
{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\rightarrow$ ({\rm{last}}\,({\it{s\/}})\index{last} $\not=$ {\rm{car}}\,({\it{zz\/}}))
\end{tabbing}

\begin{verbatim}; now, (car ZZ) = (car XX), so (last S) is a member of (cdr XX)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux19 \\ \index{prehom-set-f-aux19}
{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} $\rightarrow$ ({\rm{last}}\,({\it{s\/}})\index{last} $\in$ {\rm{cdr}}\,({\it{xx\/}}))
\end{tabbing}

\begin{verbatim}; now, applying aux9, we get for (last S) what we already have for x1,x2

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux20 \\ \index{prehom-set-f-aux20}
\=\+{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{last}}\,({\it{s\/}})\index{last} \\ 
$\in$$\;\;\;\;${\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom})\-\-
\end{tabbing}

\begin{verbatim}; now, we almost have the induction, but we have to take
; car of the prehom-set-hyp part

\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux21 \\ \index{prehom-set-f-aux21}
\=\+{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} \\ 
$\rightarrow$$\;\;\;\;${\rm{prehom-set-hyp}}\,({\it{g\/}}, {\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, {\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, {\it{c\/}})\index{prehom-set-hyp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux22 \\ \index{prehom-set-f-aux22}
\=\+{\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set} \\ 
$\rightarrow$$\;\;\;\;${\rm{bad-for-prehom-set}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}}, \\ 
{\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom}, \\ 
{\it{s\/}}, \\ 
{\it{x1\/}}, \\ 
{\it{x2\/}})\-\index{bad-for-prehom-set}\-
\end{tabbing}

\begin{verbatim}; now, force the correct induction
\end{verbatim}
\noindent{\sc Event}:   Enable extract-prehom-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable setp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable length-of-subset.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subsetp.

\addvspace{18pt}

\begin{tabbing}{\sc Definition}:\index{prehom-set-f-kludge} \\  
\=\+{\rm{prehom-set-f-kludge}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{prehom-set-f-kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{setp}}\,({\it{zz\/}})\index{setp} $\wedge$ {\rm{listp}}\,({\it{zz\/}}) \\ 
{\bf then }{\rm{prehom-set-f-kludge}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}}, \\ 
{\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-nice}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-nice}, \\ 
{\rm{pred}}\,({\it{alpha\/}}, {\rm{car}}\,({\it{zz\/}}))\index{pred}, \\ 
{\it{c\/}})\-\index{extract-prehom}, \\ 
{\it{s\/}}, \\ 
{\it{x1\/}}, \\ 
{\it{x2\/}})\-\index{prehom-set-f-kludge} \\ 
{\bf else }{\bf{nil}}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable extract-prehom-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Enable setp.

\addvspace{18pt}

\noindent{\sc Event}:   Enable length-of-subset.

\addvspace{18pt}

\noindent{\sc Event}:   Enable subsetp.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux23 \\ \index{prehom-set-f-aux23}
$\neg$ {\rm{bad-for-prehom-set}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}}, {\it{xx\/}}, {\it{s\/}}, {\it{x1\/}}, {\it{x2\/}})\index{bad-for-prehom-set}
\end{tabbing}

\begin{verbatim}; MAIN SUBGOAL:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux24 \\ \index{prehom-set-f-aux24}
\=\+(\=\+{\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{prehom-set-hyp} \\ 
$\wedge$$\;\;\;\;$({\it{xx\/}} $=$ {\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s\/}})\index{last} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{x1\/}} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{x2\/}} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s\/}})\index{last} $<$ {\it{x1\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s\/}})\index{last} $<$ {\it{x2\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{x1\/}}, {\it{s\/}})\index{add-on-end})\index{funcall} $=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{x2\/}}, {\it{s\/}})\index{add-on-end})\index{funcall})\-
\end{tabbing}


\noindent{\sc Event}:   Disable bad-for-prehom-set.

\addvspace{18pt}   
\noindent{\sc Event}:   Disable prehom-set-f-kludge.

\addvspace{18pt}


\noindent{\sc Event}:   Disable prehom-set-f-aux1.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable prehom-set-f-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux3.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable prehom-set-f-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux5.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable prehom-set-f-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux7.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable prehom-set-f-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux9.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable prehom-set-f-aux10.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux11.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable prehom-set-f-aux12.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux13.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable prehom-set-f-aux14.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux15.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable prehom-set-f-aux16.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux17.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable prehom-set-f-aux18.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux19.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable prehom-set-f-aux20.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux21.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable prehom-set-f-aux22.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux23.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux25 \\ \index{prehom-set-f-aux25}
({\rm{listp}}\,({\it{s\/}}) $\wedge$ {\rm{subsetp}}\,({\it{s\/}}, {\it{xx\/}})\index{subsetp}) $\rightarrow$ ({\rm{last}}\,({\it{s\/}})\index{last} $\in$ {\it{xx\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  prehom-set-f-aux26 \\ \index{prehom-set-f-aux26}
\=\+(\=\+{\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{prehom-set-hyp} \\ 
$\wedge$$\;\;\;\;$({\it{xx\/}} $=$ {\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom}) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{s\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{listp}}\,({\it{s\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{s\/}}, {\it{xx\/}})\index{subsetp} \\ 
$\wedge$$\;\;\;\;$({\it{x1\/}} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;$({\it{x2\/}} $\in$ {\it{xx\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s\/}})\index{last} $<$ {\it{x1\/}}) \\ 
$\wedge$$\;\;\;\;$({\rm{last}}\,({\it{s\/}})\index{last} $<$ {\it{x2\/}}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{x1\/}}, {\it{s\/}})\index{add-on-end})\index{funcall} $=$ {\rm{funcall}}\,({\it{g\/}}, {\rm{add-on-end}}\,({\it{x2\/}}, {\it{s\/}})\index{add-on-end})\index{funcall})\-
\end{tabbing}


\noindent{\sc Event}:   Disable prehom-set-f-aux24.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux25.

\addvspace{18pt}

\noindent{\sc Event}:   Disable prehom-set-f-aux26.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  prehom-set-f \\ \index{prehom-set-f}
{\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{prehom-set-hyp} $\rightarrow$ {\rm{pre-homp}}\,({\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-prehom}, {\it{g\/}})\index{pre-homp}
\end{tabbing}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                    RAMSEY THEOREM -- ORDINAL VERSION                   ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; This is really the main Ramsey theorem
; It says: a partition on n-tuples of a Gamma(alpha,n,c) -- large
; set has a homogeneous alpha-large set.

; first, define Gamma:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{gamma} \\  
\=\+{\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{gamma} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\leq$ {\tt{1}}$\;\;${\bf then }{\rm{star}}\,({\it{alpha\/}}, {\it{c\/}})\index{star} \\ 
{\bf else }{\rm{phi}}\,({\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{gamma}, {\it{c\/}})\index{phi}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  gamma-is-an-ord \\ \index{gamma-is-an-ord}
{\rm{ordinalp}}\,({\it{alpha\/}}) $\rightarrow$ {\rm{ordinalp}}\,({\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{gamma})
\end{tabbing}

\begin{verbatim}; now, extract-ramsey produces the homogeneous set
; assuming ZZ is Gamma(alpha,n,c) -- large

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{extract-ramsey} \\  
\=\+{\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\leq$ {\tt{1}}$\;\;${\bf then }{\rm{extract-ramsey-basis}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{c\/}})\index{extract-ramsey-basis} \\ 
{\bf else }{\rm{extract-ramsey}}\,(\=\+{\rm{derived}}\,(\=\+{\it{g\/}}, \\ 
{\rm{extract-prehom}}\,(\=\+{\it{g\/}}, \\ 
{\it{zz\/}}, \\ 
{\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{gamma}, \\ 
{\it{c\/}})\-\index{extract-prehom})\-\index{derived}, \\ 
{\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{gamma}, {\it{c\/}})\index{extract-prehom}, \\ 
{\it{alpha\/}}, \\ 
{\it{n\/}} $-\;1$, \\ 
{\it{c\/}})\-\index{extract-ramsey}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};;; now, if ZZ is a set and YY = (extract-prehom g ZZ alpha c)

; "ord-ramsey-A" says that YY is a set and a subset of ZZ
; "ord-ramsey-B" says that YY is alpha-large
;    assuming (ordinalp alpha) and (rangep g c) and (not (zerop n))
;       and (o-largep ZZ (Gamma alpha n c))
; "ord-ramsey-C" says that (homp YY g n)
;    assuming (ordinalp alpha) and (rangep g c) and (not (zerop n))
;       and (o-largep ZZ (Gamma alpha n c))

; Then, we put these together in one "official-looking" theorem, 
; "ord-ramsey"

; note -- (not (zerop c)) follows from "rangep-is-positive"

; the details of the following are probably all irrelevant now
\end{verbatim}
\noindent{\sc Event}:   Disable extract-prehom.

\addvspace{18pt}

\noindent{\sc Event}:   Disable extract-nice.

\addvspace{18pt}

\noindent{\sc Event}:   Disable extract-ramsey-basis.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  ord-ramsey-a \\ \index{ord-ramsey-a}
\=\+{\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{setp}}\,({\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey}, {\it{zz\/}})\index{subsetp})\-\-
\end{tabbing}

\begin{verbatim}; for B, and C, we need that if (rangep g c), then
;  (rangep (derived g WW) c), so that (rangep g c) can be
; applied inductively to the derived partition

\end{verbatim}\begin{tabbing}{\sc Theorem}:  range-of-derived-aux1 \\ \index{range-of-derived-aux1}
({\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\wedge$ ({\it{pr\/}} $\in$ {\rm{derived-aux}}\,({\it{g\/}}, {\it{ww\/}}, {\it{lst\/}})\index{derived-aux})) $\rightarrow$ ({\rm{cadr}}\,({\it{pr\/}}) $<$ {\it{c\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  range-of-derived-aux2 \\ \index{range-of-derived-aux2}
({\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\wedge$ ({\it{pr\/}} $\in$ {\rm{derived-aux}}\,({\it{g\/}}, {\it{ww\/}}, {\it{lst\/}})\index{derived-aux})) $\rightarrow$ ({\rm{cadr}}\,({\it{pr\/}}) $\in\;${\bf{N}}${}$)
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{counter-range} \\  
\=\+{\rm{counter-range}}\,({\it{g\/}}, {\it{c\/}})\index{counter-range} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{g\/}} $\simeq\;${{\bf{nil}}}${}$$\;\;${\bf then }{\bf{nil}} \\ 
{\bf elseif }$\neg$ (({\rm{cadar}}\,({\it{g\/}}) $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{cadar}}\,({\it{g\/}}) $<$ {\it{c\/}}))$\;\;${\bf then }{\rm{car}}\,({\it{g\/}}) \\ 
{\bf else }{\rm{counter-range}}\,({\rm{cdr}}\,({\it{g\/}}), {\it{c\/}})\index{counter-range}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; let's list the ways rangep can fail if c is positive:

\end{verbatim}
\noindent{\sc Event}:   Enable rangep.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  range-of-derived-aux3 \\ \index{range-of-derived-aux3}
(({\tt{0}} $<$ {\it{c\/}}) $\wedge$ ($\neg$ {\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep})) $\rightarrow$ {\rm{listp}}\,({\it{g\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  range-of-derived-aux4 \\ \index{range-of-derived-aux4}
\=\+(({\tt{0}} $<$ {\it{c\/}}) $\wedge$ ($\neg$ {\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep})) \\ 
$\rightarrow$$\;\;\;\;$(($\neg$ {\rm{rangep}}\,({\rm{cdr}}\,({\it{g\/}}), {\it{c\/}})\index{rangep}) $\vee$ ({\rm{cadar}}\,({\it{g\/}}) $\not\in\;${\bf{N}}${}$) $\vee$ ({\rm{cadar}}\,({\it{g\/}}) $\not<$ {\it{c\/}}))\-
\end{tabbing} 

\begin{verbatim}; in the positive direction
\end{verbatim}\begin{tabbing}{\sc Theorem}:  range-of-derived-aux5 \\ \index{range-of-derived-aux5}
(({\rm{cadar}}\,({\it{g\/}}) $\in\;${\bf{N}}${}$) $\wedge$ ({\rm{cadar}}\,({\it{g\/}}) $<$ {\it{c\/}}) $\wedge$ {\rm{rangep}}\,({\rm{cdr}}\,({\it{g\/}}), {\it{c\/}})\index{rangep}) $\rightarrow$ {\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep}
\end{tabbing} 


\noindent{\sc Event}:   Disable rangep.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  range-of-derived-aux6 \\ \index{range-of-derived-aux6}
(({\it{c\/}} $\not=$ {\tt{0}}) $\wedge$ ({\it{c\/}} $\in\;${\bf{N}}${}$) $\wedge$ ($\neg$ {\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep})) $\rightarrow$ {\rm{listp}}\,({\it{g\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  range-of-derived-aux7 \\ \index{range-of-derived-aux7}
(({\tt{0}} $<$ {\it{c\/}}) $\wedge$ ($\neg$ {\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep})) $\rightarrow$ ({\rm{counter-range}}\,({\it{g\/}}, {\it{c\/}})\index{counter-range} $\in$ {\it{g\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  range-of-derived-aux8 \\ \index{range-of-derived-aux8}
\=\+(({\tt{0}} $<$ {\it{c\/}}) $\wedge$ ($\neg$ {\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep})) \\ 
$\rightarrow$$\;\;\;\;$($\neg$ (\=\+({\rm{cadr}}\,({\rm{counter-range}}\,({\it{g\/}}, {\it{c\/}})\index{counter-range}) $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\rm{cadr}}\,({\rm{counter-range}}\,({\it{g\/}}, {\it{c\/}})\index{counter-range}) $<$ {\it{c\/}}))\-)\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  range-of-derived-aux9 \\ \index{range-of-derived-aux9}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ {\rm{rangep}}\,({\rm{derived-aux}}\,({\it{g\/}}, {\it{ww\/}}, {\it{lst\/}})\index{derived-aux}, {\it{c\/}})\index{rangep}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  range-of-derived \\ \index{range-of-derived}
{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} $\rightarrow$ {\rm{rangep}}\,({\rm{derived}}\,({\it{g\/}}, {\it{ww\/}})\index{derived}, {\it{c\/}})\index{rangep}
\end{tabbing}


\noindent{\sc Event}:   Disable counter-range.

\addvspace{18pt}

\noindent{\sc Event}:   Disable range-of-derived-aux1.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable range-of-derived-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable range-of-derived-aux3.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable range-of-derived-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable range-of-derived-aux5.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable range-of-derived-aux6.

\addvspace{18pt}

\noindent{\sc Event}:   Disable range-of-derived-aux7.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable range-of-derived-aux8.

\addvspace{18pt}

\noindent{\sc Event}:   Disable range-of-derived-aux9.

\addvspace{18pt}


\begin{verbatim}; for B and C, which require a non-trivial induction,
; it is convenient to summarize the hypotheses.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{ord-ramsey-hyp} \\  
\=\+{\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{ord-ramsey-hyp} \\ 
$=$$\;\;\;\;$(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{gamma})\index{o-largep})\-\-
\end{tabbing}

\begin{verbatim}; since some of the earlier hyps had c > 0,

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ord-ramsey-hyp-positive \\ \index{ord-ramsey-hyp-positive}
{\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{ord-ramsey-hyp} $\rightarrow$ ({\it{c\/}} $\not\simeq {\tt{0}}$)
\end{tabbing}

\begin{verbatim};;;;;;;  replication results 
; these should be useful in inductions

\end{verbatim}\begin{tabbing}{\sc Theorem}:  recursive-case-for-gamma \\ \index{recursive-case-for-gamma}
({\tt{1}} $<$ {\it{n\/}}) $\rightarrow$ ({\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{gamma} $=$ {\rm{phi}}\,({\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{gamma}, {\it{c\/}})\index{phi})
\end{tabbing}

\begin{verbatim}; first, note that ZZ satisfies the prehom set hyp

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ord-ramsey-to-prehom-set-hyp \\ \index{ord-ramsey-to-prehom-set-hyp}
\=\+(({\tt{1}} $<$ {\it{n\/}}) $\wedge$ {\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{ord-ramsey-hyp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{prehom-set-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{gamma}, {\it{c\/}})\index{prehom-set-hyp}\-
\end{tabbing}

\begin{verbatim}; now, consider XX = (extract-prehom g ZZ (Gamma alpha (sub1 n) c) c)
; XX will be (Gamma alpha (sub1 n) c) -- large and a set, so:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  replication-of-ord-ramsey-hyp \\ \index{replication-of-ord-ramsey-hyp}
\=\+(\=\+({\tt{1}} $<$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{ord-ramsey-hyp} \\ 
$\wedge$$\;\;\;\;$({\it{xx\/}} $=$ {\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{gamma}, {\it{c\/}})\index{extract-prehom}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{ord-ramsey-hyp}}\,({\rm{derived}}\,({\it{g\/}}, {\it{xx\/}})\index{derived}, {\it{xx\/}}, {\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{ord-ramsey-hyp}\-
\end{tabbing}

\begin{verbatim}; also, formalize the recursive case for extract-ramsey:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  recursive-case-for-extract-ramsey \\ \index{recursive-case-for-extract-ramse!y}
\=\+(({\tt{1}} $<$ {\it{n\/}}) $\wedge$ ({\it{xx\/}} $=$ {\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{gamma}, {\it{c\/}})\index{extract-prehom})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey} \\ 
$=$$\;\;\;\;${\rm{extract-ramsey}}\,({\rm{derived}}\,({\it{g\/}}, {\it{xx\/}})\index{derived}, {\it{xx\/}}, {\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{extract-ramsey})\-\-
\end{tabbing}


\begin{verbatim}; the basis for ramsey-B is:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  ord-ramsey-b-aux1 \\ \index{ord-ramsey-b-aux1}
\=\+{\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\tt{1}}, {\it{c\/}})\index{ord-ramsey-hyp} \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\tt{1}}, {\it{c\/}})\index{extract-ramsey}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}
\begin{verbatim}; this is immediate by ramsey-basis-D

; now, the induction should work because a counter-example with 
; n will generate a counter-example with n-1

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ord-ramsey-b-aux2 \\ \index{ord-ramsey-b-aux2}
\=\+(({\tt{1}} $\leq$ {\it{n\/}}) $\wedge$ {\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{ord-ramsey-hyp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}

\begin{verbatim}; but of course, the (leq 1 n) is irrelevant

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ord-ramsey-b \\ \index{ord-ramsey-b}
\=\+{\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{ord-ramsey-hyp} \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}


\noindent{\sc Event}:   Disable ord-ramsey-b-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ord-ramsey-b-aux2.

\addvspace{18pt}

\begin{verbatim}; the basis for ramsey-C is:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  ord-ramsey-c-aux1 \\ \index{ord-ramsey-c-aux1}
\=\+{\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\tt{1}}, {\it{c\/}})\index{ord-ramsey-hyp} \\ 
$\rightarrow$$\;\;\;\;${\rm{homp}}\,({\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\tt{1}}, {\it{c\/}})\index{extract-ramsey}, {\it{g\/}}, {\tt{1}})\index{homp}\-
\end{tabbing}
\begin{verbatim}; this is immediate by ramsey-basis-C

; now, the induction should work because a counter-example with 
; n will generate a counter-example with n-1

; the induction will be:  if
; XX =  (extract-prehom g ZZ (Gamma alpha (sub1 n) c) c)
; YY = (extract-ramsey g ZZ alpha n c) = 
;      (extract-ramsey (derived g XX) XX alpha (sub1 n) c)
;         (by recursive-case-for-extract-ramsey)
; and inductively, 
;  (homp  YY  (derived g XX) (sub1 n))
; then by the derived partition lemma
; (homp YY g n)

; let's phrase the derived-partition-lemma in the current notation
\end{verbatim}\begin{tabbing}{\sc Theorem}:  ord-ramsey-c-aux2 \\ \index{ord-ramsey-c-aux2}
\=\+(\=\+({\tt{1}} $<$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{pre-homp}}\,({\it{xx\/}}, {\it{g\/}})\index{pre-homp} \\ 
$\wedge$$\;\;\;\;${\rm{sublistp}}\,({\it{yy\/}}, {\it{xx\/}})\index{sublistp} \\ 
$\wedge$$\;\;\;\;${\rm{homp}}\,({\it{yy\/}}, {\rm{derived}}\,({\it{g\/}}, {\it{xx\/}})\index{derived}, {\it{n\/}} $-\;1$)\index{homp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{homp}}\,({\it{yy\/}}, {\it{g\/}}, {\it{n\/}})\index{homp}\-
\end{tabbing}

\begin{verbatim}; now, let's check that the XX and YY as above really
; satisfy the (pre-homp XX g)  and (sublistp YY XX)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ord-ramsey-c-aux3 \\ \index{ord-ramsey-c-aux3}
\=\+(\=\+({\tt{1}} $<$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{ord-ramsey-hyp} \\ 
$\wedge$$\;\;\;\;$({\it{xx\/}} $=$ {\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{gamma}, {\it{c\/}})\index{extract-prehom}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{pre-homp}}\,({\it{xx\/}}, {\it{g\/}})\index{pre-homp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ord-ramsey-c-aux4 \\ \index{ord-ramsey-c-aux4}
\=\+(\=\+({\tt{1}} $<$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{ord-ramsey-hyp} \\ 
$\wedge$$\;\;\;\;$({\it{xx\/}} $=$ {\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{gamma}, {\it{c\/}})\index{extract-prehom}) \\ 
$\wedge$$\;\;\;\;$({\it{yy\/}} $=$ {\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey}))\- \\ 
$\rightarrow$$\;\;\;\;${\rm{sublistp}}\,({\it{yy\/}}, {\it{xx\/}})\index{sublistp}\-
\end{tabbing}

\begin{verbatim}; it follows that aux2 gives

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ord-ramsey-c-aux5 \\ \index{ord-ramsey-c-aux5}
\=\+(\=\+({\tt{1}} $<$ {\it{n\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{ord-ramsey-hyp} \\ 
$\wedge$$\;\;\;\;$({\it{xx\/}} $=$ {\rm{extract-prehom}}\,({\it{g\/}}, {\it{zz\/}}, {\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}} $-\;1$, {\it{c\/}})\index{gamma}, {\it{c\/}})\index{extract-prehom}) \\ 
$\wedge$$\;\;\;\;$({\it{yy\/}} $=$ {\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey}) \\ 
$\wedge$$\;\;\;\;${\rm{homp}}\,({\it{yy\/}}, {\rm{derived}}\,({\it{g\/}}, {\it{xx\/}})\index{derived}, {\it{n\/}} $-\;1$)\index{homp})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{homp}}\,({\it{yy\/}}, {\it{g\/}}, {\it{n\/}})\index{homp}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ord-ramsey-c-aux6 \\ \index{ord-ramsey-c-aux6}
\=\+(({\tt{1}} $\leq$ {\it{n\/}}) $\wedge$ {\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{ord-ramsey-hyp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{homp}}\,({\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey}, {\it{g\/}}, {\it{n\/}})\index{homp}\-
\end{tabbing}

\begin{verbatim}; but of course, the (leq 1 n) is irrelevant

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ord-ramsey-c \\ \index{ord-ramsey-c}
{\rm{ord-ramsey-hyp}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{ord-ramsey-hyp} $\rightarrow$ {\rm{homp}}\,({\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey}, {\it{g\/}}, {\it{n\/}})\index{homp}
\end{tabbing}


\noindent{\sc Event}:   Disable ord-ramsey-c-aux1.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable ord-ramsey-c-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ord-ramsey-c-aux3.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable ord-ramsey-c-aux4.

\addvspace{18pt}

\noindent{\sc Event}:   Disable ord-ramsey-c-aux5.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable ord-ramsey-c-aux6.

\addvspace{18pt}

\begin{verbatim}; Finally, a version suitable for framing:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ord-ramsey \\ \index{ord-ramsey}
\=\+(\=\+{\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;${\rm{setp}}\,({\it{zz\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{zz\/}}, {\rm{gamma}}\,({\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{gamma})\index{o-largep} \\ 
$\wedge$$\;\;\;\;$({\it{yy\/}} $=$ {\rm{extract-ramsey}}\,({\it{g\/}}, {\it{zz\/}}, {\it{alpha\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey}))\- \\ 
$\rightarrow$$\;\;\;\;$({\rm{setp}}\,({\it{yy\/}})\index{setp} $\wedge$ {\rm{subsetp}}\,({\it{yy\/}}, {\it{zz\/}})\index{subsetp} $\wedge$ {\rm{o-largep}}\,({\it{yy\/}}, {\it{alpha\/}})\index{o-largep} $\wedge$ {\rm{homp}}\,({\it{yy\/}}, {\it{g\/}}, {\it{n\/}})\index{homp})\-
\end{tabbing}



\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                  RAMSEY THEOREM -- PARIS-HARRINGTON VERSION            ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; FINALLY, we use epsilon_0 recursion/induction.  We define
; a function (lambda alpha k) such that ; (lambda alpha k) >= k,
; and the interval [k, (lamda alpha k)] is alpha - large
; This will show that applying the ordinal version of Ramsey's
; theorem to a suitable large interval will produce an
; omega-large (hence large) homogeneous set.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{lambda\_kludge} \\  
\=\+{\rm{lambda\_kludge}}\,({\it{alpha\/}}, {\it{k\/}})\index{lambda\_kludge} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ordinalp}}\,({\it{alpha\/}})$\;\;${\bf then }{\it{alpha\/}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}
\begin{verbatim}; just to get the prover to accept the following definition

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{lambda} \\  
\=\+{\rm{lambda}}\,({\it{alpha\/}}, {\it{k\/}})\index{lambda} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}}) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
{\bf then }{\rm{lambda}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{k\/}})\index{pred}, $1\;+$ {\it{k\/}})\index{lambda} \\ 
{\bf else }{\it{k\/}}$\;${\bf  endif}\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable lambda\_kludge.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  lambda-is-a-number \\ \index{lambda-is-a-number}
({\it{k\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{lambda}}\,({\it{alpha\/}}, {\it{k\/}})\index{lambda} $\in\;${\bf{N}}${}$)
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lambda-is-big \\ \index{lambda-is-big}
({\it{k\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{lambda}}\,({\it{alpha\/}}, {\it{k\/}})\index{lambda} $\not<$ {\it{k\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  base-case-for-lambda \\ \index{base-case-for-lambda}
($\neg$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}})) $\rightarrow$ ({\rm{lambda}}\,({\it{alpha\/}}, {\it{k\/}})\index{lambda} $=$ {\it{k\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  recursive-case-for-lambda \\ \index{recursive-case-for-lambda}
\=\+({\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{lambda}}\,({\it{alpha\/}}, {\it{k\/}})\index{lambda} $=$ {\rm{lambda}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{k\/}})\index{pred}, $1\;+$ {\it{k\/}})\index{lambda})\-
\end{tabbing}


\noindent{\sc Event}:   Disable lambda.

\addvspace{18pt}

\begin{verbatim}; let's prove that (o-largep (segment k (lambda alpha k)) alpha)
; this is by induction

; base case:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  lambda-gives-large-segments-aux1 \\ \index{lambda-gives-large-segments-aux!1}
\=\+(({\it{k\/}} $\in\;${\bf{N}}${}$) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ ($\neg$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}}))) \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{segment}}\,({\it{k\/}}, {\rm{lambda}}\,({\it{alpha\/}}, {\it{k\/}})\index{lambda})\index{segment}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}

\begin{verbatim}; for the recursive case:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  lambda-gives-large-segments-aux2 \\ \index{lambda-gives-large-segments-aux!2}
\=\+(({\it{k\/}} $\in\;${\bf{N}}${}$) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}}) $\wedge$ {\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{segment}}\,({\it{k\/}}, {\rm{lambda}}\,({\it{alpha\/}}, {\it{k\/}})\index{lambda})\index{segment} \\ 
$=$$\;\;\;\;${\rm{cons}}\,({\it{k\/}}, {\rm{segment}}\,($1\;+$ {\it{k\/}}, {\rm{lambda}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{k\/}})\index{pred}, $1\;+$ {\it{k\/}})\index{lambda})\index{segment}))\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lambda-gives-large-segments-aux3 \\ \index{lambda-gives-large-segments-aux!3}
\=\+(\=\+({\it{k\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;${\rm{ordinalp}}\,({\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{ord-lessp}}\,({\tt{0}}, {\it{alpha\/}}) \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\rm{segment}}\,($1\;+$ {\it{k\/}}, {\rm{lambda}}\,({\rm{pred}}\,({\it{alpha\/}}, {\it{k\/}})\index{pred}, $1\;+$ {\it{k\/}})\index{lambda})\index{segment}, {\rm{pred}}\,({\it{alpha\/}}, {\it{k\/}})\index{pred})\index{o-largep})\- \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{segment}}\,({\it{k\/}}, {\rm{lambda}}\,({\it{alpha\/}}, {\it{k\/}})\index{lambda})\index{segment}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  lambda-gives-large-segments \\ \index{lambda-gives-large-segments}
\=\+(({\it{k\/}} $\in\;${\bf{N}}${}$) $\wedge$ {\rm{ordinalp}}\,({\it{alpha\/}})) \\ 
$\rightarrow$$\;\;\;\;${\rm{o-largep}}\,({\rm{segment}}\,({\it{k\/}}, {\rm{lambda}}\,({\it{alpha\/}}, {\it{k\/}})\index{lambda})\index{segment}, {\it{alpha\/}})\index{o-largep}\-
\end{tabbing}


\noindent{\sc Event}:   Disable lambda-gives-large-segments-aux1.

\addvspace{18pt}

\noindent{\sc Event}:   Disable lambda-gives-large-segments-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable lambda-gives-large-segments-aux3.

\addvspace{18pt}
\begin{verbatim}; so, the Ramsey number is:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{r}$\;\;$
{\rm{r}}\,({\it{k\/}}, {\it{n\/}}, {\it{c\/}})\index{r} $=$ {\rm{lambda}}\,({\rm{gamma}}\,({\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}}, {\it{n\/}}, {\it{c\/}})\index{gamma}, {\it{k\/}})\index{lambda}
\end{tabbing}

\begin{verbatim}; this is a number:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  r-is-a-number \\ \index{r-is-a-number}
({\it{k\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{r}}\,({\it{k\/}}, {\it{n\/}}, {\it{c\/}})\index{r} $\in\;${\bf{N}}${}$)
\end{tabbing}
\begin{tabbing}{\sc Theorem}:  r-is-a-big \\ \index{r-is-a-big}
({\it{k\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ ({\rm{r}}\,({\it{k\/}}, {\it{n\/}}, {\it{c\/}})\index{r} $\not<$ {\it{k\/}})
\end{tabbing}

\begin{verbatim}; now, we will get YY as an omega--large subset of ZZ = [k, (R k n c)]
; we want to show that that implies that YY is 
; large (in Paris-Harrington sense) and has size at least k
; (which follows from the defn of large)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  result-is-large-aux1 \\ \index{result-is-large-aux1}
\=\+({\rm{setp}}\,({\it{yy\/}})\index{setp} $\wedge$ {\rm{o-largep}}\,({\it{yy\/}}, {\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}})\index{o-largep}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{largep}}\,({\it{yy\/}})\index{largep} $\wedge$ {\rm{listp}}\,({\it{yy\/}}) $\wedge$ ({\rm{length}}\,({\it{yy\/}})\index{length} $\not<$ {\rm{car}}\,({\it{yy\/}})))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  result-is-large-aux2 \\ \index{result-is-large-aux2}
({\it{x\/}} $\in$ {\rm{segment}}\,({\it{k\/}}, {\it{j\/}})\index{segment}) $\rightarrow$ ({\rm{car}}\,({\rm{segment}}\,({\it{k\/}}, {\it{j\/}})\index{segment}) $=$ {\it{k\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  result-is-large-aux3 \\ \index{result-is-large-aux3}
({\it{x\/}} $\in$ {\rm{segment}}\,({\it{k\/}}, {\it{j\/}})\index{segment}) $\rightarrow$ ({\it{x\/}} $\not<$ {\it{k\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  result-is-large-aux4 \\ \index{result-is-large-aux4}
({\rm{listp}}\,({\it{yy\/}}) $\wedge$ {\rm{subsetp}}\,({\it{yy\/}}, {\rm{segment}}\,({\it{k\/}}, {\it{j\/}})\index{segment})\index{subsetp}) $\rightarrow$ ({\rm{car}}\,({\it{yy\/}}) $\not<$ {\it{k\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  result-is-large \\ \index{result-is-large}
\=\+({\rm{setp}}\,({\it{yy\/}})\index{setp} $\wedge$ {\rm{subsetp}}\,({\it{yy\/}}, {\rm{segment}}\,({\it{k\/}}, {\it{j\/}})\index{segment})\index{subsetp} $\wedge$ {\rm{o-largep}}\,({\it{yy\/}}, {\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}})\index{o-largep}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{largep}}\,({\it{yy\/}})\index{largep} $\wedge$ ({\rm{length}}\,({\it{yy\/}})\index{length} $\not<$ {\it{k\/}}))\-
\end{tabbing}


\noindent{\sc Event}:   Disable result-is-large-aux1.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable result-is-large-aux2.

\addvspace{18pt}

\noindent{\sc Event}:   Disable result-is-large-aux3.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable result-is-large-aux4.

\addvspace{18pt}

\begin{verbatim};;;;;;;;  extracting the homogeneous set 

; (extract-ramsey-P-H g k n c)  finds a subset
; of (segment 0 (R k n c))  which is large and of size at least k
; actually, it just finds an omega-large subset of [k, (R k n c)]

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{extract-ramsey-p-h} \\  
\=\+{\rm{extract-ramsey-p-h}}\,({\it{g\/}}, {\it{k\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey-p-h} \\ 
$=$$\;\;\;\;${\rm{extract-ramsey}}\,({\it{g\/}}, {\rm{segment}}\,({\it{k\/}}, {\rm{r}}\,({\it{k\/}}, {\it{n\/}}, {\it{c\/}})\index{r})\index{segment}, {\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey}\-
\end{tabbing}

\begin{verbatim}; first, let's see what we get by a direct application
; of the ord-ramsey theorem.  To apply that, we need that
; the segment  (segment k (R k n c))  is
; (Gamma omega n c) -- large

\end{verbatim}\begin{tabbing}{\sc Theorem}:  r-segment-is-large \\ \index{r-segment-is-large}
({\it{k\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ {\rm{o-largep}}\,({\rm{segment}}\,({\it{k\/}}, {\rm{r}}\,({\it{k\/}}, {\it{n\/}}, {\it{c\/}})\index{r})\index{segment}, {\rm{gamma}}\,({\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}}, {\it{n\/}}, {\it{c\/}})\index{gamma})\index{o-largep}
\end{tabbing}

\begin{verbatim}; applying ord-ramsey,

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ramsey-p-h-aux1 \\ \index{ramsey-p-h-aux1}
\=\+(\=\+{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\it{k\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{r\/}} $=$ {\rm{r}}\,({\it{k\/}}, {\it{n\/}}, {\it{c\/}})\index{r}) \\ 
$\wedge$$\;\;\;\;$({\it{yy\/}} $=$ {\rm{extract-ramsey-p-h}}\,({\it{g\/}}, {\it{k\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey-p-h}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{setp}}\,({\it{yy\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{yy\/}}, {\rm{segment}}\,({\it{k\/}}, {\it{r\/}})\index{segment})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{homp}}\,({\it{yy\/}}, {\it{g\/}}, {\it{n\/}})\index{homp} \\ 
$\wedge$$\;\;\;\;${\rm{o-largep}}\,({\it{yy\/}}, {\tt{'}}{\tt{(}}{\tt{1}}{\tt{ .\ }}{\tt{0}}{\tt{)}})\index{o-largep})\-\-
\end{tabbing}


\noindent{\sc Event}:   Disable ord-ramsey.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable ord-ramsey-a.

\addvspace{18pt} 

\noindent{\sc Event}:   Disable ord-ramsey-b.

\addvspace{18pt} 
\noindent{\sc Event}:   Disable ord-ramsey-c.

\addvspace{18pt} 

\begin{verbatim}; to convert to intended Ramsey theorem:
; we need that (subsetp YY (segment k R))
; implies (subsetp YY (segment 0 R))

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ramsey-p-h-aux2 \\ \index{ramsey-p-h-aux2}
\=\+(({\it{k\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{r\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{k\/}} $\leq$ {\it{r\/}}) $\wedge$ ({\it{x\/}} $\in$ {\rm{segment}}\,({\it{k\/}}, {\it{r\/}})\index{segment})) \\ 
$\rightarrow$$\;\;\;\;$({\it{x\/}} $\in$ {\rm{segment}}\,({\tt{0}}, {\it{r\/}})\index{segment})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ramsey-p-h-aux3 \\ \index{ramsey-p-h-aux3}
(({\it{k\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{r\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{k\/}} $\leq$ {\it{r\/}})) $\rightarrow$ {\rm{subsetp}}\,({\rm{segment}}\,({\it{k\/}}, {\it{r\/}})\index{segment}, {\rm{segment}}\,({\tt{0}}, {\it{r\/}})\index{segment})\index{subsetp}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ramsey-p-h-aux4 \\ \index{ramsey-p-h-aux4}
\=\+(({\it{k\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{r\/}} $\in\;${\bf{N}}${}$) $\wedge$ ({\it{k\/}} $\leq$ {\it{r\/}}) $\wedge$ {\rm{subsetp}}\,({\it{yy\/}}, {\rm{segment}}\,({\it{k\/}}, {\it{r\/}})\index{segment})\index{subsetp}) \\ 
$\rightarrow$$\;\;\;\;${\rm{subsetp}}\,({\it{yy\/}}, {\rm{segment}}\,({\tt{0}}, {\it{r\/}})\index{segment})\index{subsetp}\-
\end{tabbing}


\noindent{\sc Event}:   Disable segment.

\addvspace{18pt}

\noindent{\sc Event}:   Disable subsetp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable setp.

\addvspace{18pt}

\noindent{\sc Event}:   Disable extract-ramsey.

\addvspace{18pt}

\noindent{\sc Event}:   Disable extract-ramsey-p-h.

\addvspace{18pt}

\noindent{\sc Event}:   Disable recursive-case-for-segment.

\addvspace{18pt}

\begin{verbatim}; Paris - Harrington version of Ramsey Theorem:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ramsey-p-h \\ \index{ramsey-p-h}
\=\+(\=\+{\rm{rangep}}\,({\it{g\/}}, {\it{c\/}})\index{rangep} \\ 
$\wedge$$\;\;\;\;$({\it{n\/}} $\not\simeq {\tt{0}}$) \\ 
$\wedge$$\;\;\;\;$({\it{k\/}} $\in\;${\bf{N}}${}$) \\ 
$\wedge$$\;\;\;\;$({\it{r\/}} $=$ {\rm{r}}\,({\it{k\/}}, {\it{n\/}}, {\it{c\/}})\index{r}) \\ 
$\wedge$$\;\;\;\;$({\it{yy\/}} $=$ {\rm{extract-ramsey-p-h}}\,({\it{g\/}}, {\it{k\/}}, {\it{n\/}}, {\it{c\/}})\index{extract-ramsey-p-h}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{setp}}\,({\it{yy\/}})\index{setp} \\ 
$\wedge$$\;\;\;\;${\rm{subsetp}}\,({\it{yy\/}}, {\rm{segment}}\,({\tt{0}}, {\it{r\/}})\index{segment})\index{subsetp} \\ 
$\wedge$$\;\;\;\;${\rm{homp}}\,({\it{yy\/}}, {\it{g\/}}, {\it{n\/}})\index{homp} \\ 
$\wedge$$\;\;\;\;$({\it{k\/}} $\leq$ {\rm{length}}\,({\it{yy\/}})\index{length}) \\ 
$\wedge$$\;\;\;\;${\rm{largep}}\,({\it{yy\/}})\index{largep})\-\-
\end{tabbing}

\begin{verbatim};;; NOTE! : without the (largep YY), this would just be the
;;; standard Ramsey theorem, which is provable in PRA

\end{verbatim}
\noindent{\sc Event}:   Make the library {\tt{"paris-harrington"}} and compile it.

\addvspace{18pt}

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