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

\begin{verbatim}#|

 Copyright (C) 1994 by Alex Bronstein and Carolyn Talcott.  All Rights
 Reserved.

 You may copy and distribute verbatim copies of this Nqthm-1992 event script as
 you receive it, in any medium, including embedding it verbatim in derivative
 works, provided that you conspicuously and appropriately publish on each copy
 a valid copyright notice "Copyright (C) 1994 by Alex Bronstein and Carolyn
 Talcott.  All Rights Reserved."

 NO WARRANTY

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

 IN NO EVENT WILL Alex Bronstein or Carolyn Talcott BE LIABLE TO YOU FOR ANY
 DAMAGES, ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR
 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THIS SCRIPT
 (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE
 OR LOSSES SUSTAINED BY THIRD PARTIES), EVEN IF YOU HAVE ADVISED US OF THE
 POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.

|#

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

\addvspace{18pt}

\begin{verbatim};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 				TH_ARITHMETIC.BM
;;;
;;; This file contains natural number arithmetic lemmas for BM.
;;;

;; FUNDAMENTAL: 

; standard Nint-induction, which sometime we want to force

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

\begin{verbatim};; PLUS and TIMES: a lot of the basic stuff is in "linear 
;; arithmetic" already.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ari-plus-0-ident-r \\ \index{ari-plus-0-ident-r}
({\it{x\/}} $+$ {\tt{0}}) $=$ {\rm{fix}}\,({\it{x\/}})
\end{tabbing}
 
\begin{tabbing}{\sc Theorem}:  ari-plus-0-ident-l \\ \index{ari-plus-0-ident-l}
({\tt{0}} $+$ {\it{x\/}}) $=$ {\rm{fix}}\,({\it{x\/}})
\end{tabbing}
 
\begin{tabbing}{\sc Theorem}:  ari-times-0-cancel-r \\ \index{ari-times-0-cancel-r}
({\it{y\/}} $*$ {\tt{0}}) $=$ {\tt{0}}
\end{tabbing}
 
\begin{tabbing}{\sc Theorem}:  ari-times-0-cancel-l \\ \index{ari-times-0-cancel-l}
({\tt{0}} $*$ {\it{y\/}}) $=$ {\tt{0}}
\end{tabbing}

\begin{verbatim}; Note: each of the 4 previous lemmas has a corresponding strong 
; version, which is more powerful, since it trivially implies the 
; weak versions. But they are too AGRESSIVE because they trigger 
; EVERY TIME we have a PLUS/TIMES expression, and generate a case 
; disjunction as to whether one of the arguments is ZEROP, which 
; may be totally irrelevant to the proof at hand. In fact, in 
; testing just this arithmetic package with the strong or the weak
; axioms, and observing the proofs, the conclusion was that the 
; proofs based on the weak theorems never reestablished the strong
; versions (as intermediate lemmas) and the theorems only triggered
; when they were guaranteed to be relevant, yielding fewer or equal
; number of case disjunctions, and significantly faster proofs.  
; We therefore prove the strong theorems but keep them disabled, to
; be enabled explicitly when needed.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ari-plus-0-ident-r2 \\ \index{ari-plus-0-ident-r2}
({\it{z\/}} $\simeq {\tt{0}}$) $\rightarrow$ (({\it{x\/}} $+$ {\it{z\/}}) $=$ {\rm{fix}}\,({\it{x\/}}))
\end{tabbing}

\noindent{\sc Event}:   Disable ari-plus-0-ident-r2.

\addvspace{18pt}

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

\noindent{\sc Event}:   Disable ari-plus-0-ident-l2.

\addvspace{18pt}
 
\begin{tabbing}{\sc Theorem}:  ari-times-0-cancel-r2 \\ \index{ari-times-0-cancel-r2}
({\it{z\/}} $\simeq {\tt{0}}$) $\rightarrow$ (({\it{y\/}} $*$ {\it{z\/}}) $=$ {\tt{0}})
\end{tabbing}

\noindent{\sc Event}:   Disable ari-times-0-cancel-r2.

\addvspace{18pt}

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

\noindent{\sc Event}:   Disable ari-times-0-cancel-l2.

\addvspace{18pt}

\begin{verbatim}; now onto more properties..

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

\begin{tabbing}{\sc Theorem}:  ari-times-1-ident \\ \index{ari-times-1-ident}
({\it{x\/}} $*$ {\tt{1}}) $=$ {\rm{fix}}\,({\it{x\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ari-times-add1 \\ \index{ari-times-add1}
({\it{z\/}} $\in\;${\bf{N}}${}$) $\rightarrow$ (({\it{y\/}} $+$ ({\it{y\/}} $*$ {\it{z\/}})) $=$ ({\it{y\/}} $*$ ($1\;+$ {\it{z\/}})))
\end{tabbing}

\begin{verbatim}; WARNING: ARI-times-commute sometime loops, so we leave it 
; disabled.

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

\noindent{\sc Event}:   Disable ari-times-commute.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  ari-times-plus-distribute \\ \index{ari-times-plus-distribute}
(({\it{x\/}} $*$ {\it{x1\/}}) $+$ ({\it{x\/}} $*$ {\it{x2\/}})) $=$ ({\it{x\/}} $*$ ({\it{x1\/}} $+$ {\it{x2\/}}))
\end{tabbing}

\begin{verbatim}; WARNING: ARI-lessp-sub1 looped infinitely once (in remainder 
; context). It does not seem to be used anywhere. So we leave it
; DISABLEd for ever.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ari-lessp-sub1 \\ \index{ari-lessp-sub1}
(({\it{p\/}} $\not\simeq {\tt{0}}$) $\wedge$ ({\it{q\/}} $\not\simeq {\tt{0}}$)) $\rightarrow$ ((({\it{p\/}} $-\;1$) $<$ ({\it{q\/}} $-\;1$)) $=$ ({\it{p\/}} $<$ {\it{q\/}}))
\end{tabbing}

\noindent{\sc Event}:   Disable ari-lessp-sub1.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  ari-lessp-plus \\ \index{ari-lessp-plus}
(({\it{n\/}} $+$ {\it{p\/}}) $<$ ({\it{n\/}} $+$ {\it{q\/}})) $=$ ({\it{p\/}} $<$ {\it{q\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ari-lessp-times \\ \index{ari-lessp-times}
({\it{n\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ ((({\it{n\/}} $*$ {\it{p\/}}) $\not<$ ({\it{n\/}} $*$ {\it{q\/}})) $=$ ({\it{p\/}} $\not<$ {\it{q\/}}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ari-lessp-times2 \\ \index{ari-lessp-times2}
({\it{n\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ ((({\it{n\/}} $*$ {\it{p\/}}) $<$ ({\it{n\/}} $*$ {\it{q\/}})) $=$ ({\it{p\/}} $<$ {\it{q\/}}))
\end{tabbing}

\begin{verbatim};; DIFFERENCE:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ari-diff-less-0 \\ \index{ari-diff-less-0}
({\it{a\/}} $\not<$ {\it{b\/}}) $\rightarrow$ (({\it{b\/}} $-$ {\it{a\/}}) $=$ {\tt{0}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  ari-lessp-diff \\ \index{ari-lessp-diff}
({\tt{0}} $<$ ({\it{p\/}} $-$ {\it{q\/}})) $=$ ({\it{q\/}} $<$ {\it{p\/}})
\end{tabbing}

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

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

\begin{tabbing}{\sc Theorem}:  ari-times-diff-distribute \\ \index{ari-times-diff-distribute}
(({\it{x\/}} $*$ {\it{x1\/}}) $-$ ({\it{x\/}} $*$ {\it{x2\/}})) $=$ ({\it{x\/}} $*$ ({\it{x1\/}} $-$ {\it{x2\/}}))
\end{tabbing}

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

\begin{verbatim}; Difference recurses on both arguments, but sometime we need to 
; recurse just on the first one.
; Note that this lemma also appears in Hunt's thesis (rn 451),
; p.119, but with "NIL" as BM-use.  It may interfere with regular
; diff-induction, in which case we'll disable it locally, or more
; drastically, disable here, and enable locally.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ari-diff-add1 \\ \index{ari-diff-add1}
\=\+(($1\;+$ {\it{n\/}}) $-$ {\it{p\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{p\/}} $<$ ($1\;+$ {\it{n\/}})$\;\;${\bf then }$1\;+$ ({\it{n\/}} $-$ {\it{p\/}}) \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; REMAINDER:

; ARI-lessp-remainder is fundamental. 

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ari-lessp-remainder \\ \index{ari-lessp-remainder}
({\it{p\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ (({\it{n\/}} ${}${\bf{mod}}${}$ {\it{p\/}}) $<$ {\it{p\/}})
\end{tabbing}

\begin{verbatim}; Note that the following phrasing found in Hunt's thesis, p.120, 
; but even though it seems more powerful, it failed to allow BM to
; deduce a contradiction from (not (equal (rem n 4) 0..3)) so we 
; stick with ours.
;(prove-lemma ARI-lessp-remainder (rewrite generalize)
;(equal (lessp (remainder n p) p)
;       (not (zerop p)))
;)

; Remainder recurses on both arguments, but sometime we need to 
; recurse just on the first one.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  ari-remainder-add1 \\ \index{ari-remainder-add1}
\=\+({\it{p\/}} $\not\simeq {\tt{0}}$) \\ 
$\rightarrow$$\;\;\;\;$(\=\+(($1\;+$ {\it{n\/}}) ${}${\bf{mod}}${}$ {\it{p\/}}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }({\it{n\/}} ${}${\bf{mod}}${}$ {\it{p\/}}) $=$ ({\it{p\/}} $-\;1$)$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }$1\;+$ ({\it{n\/}} ${}${\bf{mod}}${}$ {\it{p\/}})$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{verbatim}; This more specific version of the same in the case of remainder 
; by 2 is true and provable, but does not help anything.  We leave
; it commented out, for future generations...
;
;(prove-lemma ARI-remainder-2-not (rewrite)
;(implies (and (numberp n) (numberp r))
;	 (equal (not (equal (remainder n 2) r))
;		(if (equal r 0) (equal (remainder n 2) 1)
;		    (if (equal r 1) (equal (remainder n 2) 0)
;		        T))))
;)

;;; eof: th_arithmetic.bm



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; STRINGADD.BM: string theory with <add,past,last> shell for BM.
;;;
;;; The normalization we are trying to achieve with all the basic
;;; theorems is:  I (all the way to the outside)... , then A...,
;;; then P & L (all the way in).
;;;
;;; Note that all the H/B stuff only comes into real play with
;;; pipelines. The rules of interaction with base constructors are 
;;; defined in the H/B theory and a bit fuzzy (they came in late 
;;; in the work, and are a bit ad-hoc).
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; String type definition:  
; constructor: A, destructors: P, L, empty string: (e).

\end{verbatim}
\noindent{\sc Event}:   Add the shell {\it{a\/}}\index{a}, with bottom object function symbol {\it{e\/}}, with recognizer function symbol {\it{stringp\/}}, and 2 accessors: {\it{p\/}}, with type restriction (one-of stringp) and default value e; {\it{l\/}}, with type restriction (none-of) and default value e.

\addvspace{18pt}

\begin{verbatim};PN: iterations of the P constructor, useful in specification, and 
;    maybe in proofs. Note however that in hand proofs we use it
;    only as a macro, whereas the general definition is recursive
;    and hence may not always be expanded appropriately by BM. 
;    Beware... 
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{pn} \\  
\=\+{\rm{pn}}\,({\it{n\/}}, {\it{x\/}})\index{pn} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{n\/}} $\simeq {\tt{0}}$$\;\;${\bf then }{\it{x\/}} \\ 
{\bf else }{\rm{pn}}\,({\it{n\/}} $-\;1$, {\rm{p}}\,({\it{x\/}})\index{p})\index{pn}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; Empty: non-strings are treated as empty, which is a standard
; BM trick.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{empty}$\;\;$
{\rm{empty}}\,({\it{x\/}})\index{empty} $=$ (($\neg$ {\rm{stringp}}\,({\it{x\/}})\index{stringp}) $\vee$ ({\it{x\/}} $=$ {\sc{e}}\index{e}))
\end{tabbing}

\begin{verbatim}; These 3 lemmas allow running w/ empty DISABLED 99% of the time, 
; winning big.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-empty-p \\ \index{str-empty-p}
{\rm{empty}}\,({\it{x\/}})\index{empty} $\rightarrow$ {\rm{empty}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{empty}
\end{tabbing}

\begin{verbatim}; STR-Empty-Stringp was intended to deal w/ the silly case brought 
; on by the (inappropriate when Empty disabled) P/L elimination
; theorem.  Instead it seems to be a LOSER: helping its purpose
; rarely, and triggering all over the place:
;(prove-lemma STR-Empty-Stringp (rewrite)
;(implies (not (empty x))
;	 (stringp x))
;)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-empty-count \\ \index{str-empty-count}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{count}}\,({\rm{p}}\,({\it{x\/}})\index{p}) $\not=$ {\rm{count}}\,({\it{x\/}}))
\end{tabbing}


\begin{verbatim}; STR-P-L-Elim provides an elimination more suitable to running 
; w/ empty disabled, than the shell P-L-Elim.  %%% BUT CURRENTLY BM
; REJECTS IT ON GROUNDS OF NOT BEING ABLE TO HANDLE MANY ELIM 
; LEMMAS FOR ONE DESTRUCTOR. %%%
;
;(prove-lemma STR-P-L-Elim (ELIM)
;(implies (not (empty x))
;	 (equal (A (P x) (L x))
;		x))
;)

; Late decision, but helpful nonetheless:

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

\addvspace{18pt}

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

\begin{verbatim}; EQLEN was suggested by Shankar as a way to push BM toward a 
; better, richer induction scheme.  
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{eqlen} \\  
\=\+{\rm{eqlen}}\,({\it{x\/}}, {\it{y\/}})\index{eqlen} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty} $\wedge$ {\rm{empty}}\,({\it{y\/}})\index{empty}$\;\;${\bf then }{\bf{t}} \\ 
{\bf elseif }{\rm{empty}}\,({\it{x\/}})\index{empty} $\vee$ {\rm{empty}}\,({\it{y\/}})\index{empty}$\;\;${\bf then }{\bf{f}} \\ 
{\bf else }{\rm{eqlen}}\,({\rm{p}}\,({\it{x\/}})\index{p}, {\rm{p}}\,({\it{y\/}})\index{p})\index{eqlen}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; the idea is that EQLEN(x,y) <=> |x| = |y| which can be proved, 
; but should not be used in general..
\end{verbatim}\begin{tabbing}{\sc Theorem}:  eqlen-is-equal-len \\ \index{eqlen-is-equal-len}
{\rm{eqlen}}\,({\it{x\/}}, {\it{y\/}})\index{eqlen} $=$ ({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len})
\end{tabbing}

\noindent{\sc Event}:   Disable eqlen-is-equal-len.

\addvspace{18pt}

\begin{verbatim}; EQLEN-EMPTY is a KEY inference about EQLEN .
\end{verbatim}\begin{tabbing}{\sc Theorem}:  eqlen-empty \\ \index{eqlen-empty}
{\rm{eqlen}}\,({\it{x\/}}, {\it{y\/}})\index{eqlen} $\rightarrow$ ({\rm{empty}}\,({\it{x\/}})\index{empty} $=$ {\rm{empty}}\,({\it{y\/}})\index{empty})
\end{tabbing}


\begin{verbatim};; Derived constructors:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{i} \\  
\=\+{\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\rm{a}}\,({\sc{e}}\index{e}, {\it{u\/}})\index{a} \\ 
{\bf else }{\rm{a}}\,({\rm{i}}\,({\it{u\/}}, {\rm{p}}\,({\it{x\/}})\index{p})\index{i}, {\rm{l}}\,({\it{x\/}})\index{l})\index{a}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{h} \\  
\=\+{\rm{h}}\,({\it{x\/}})\index{h} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf elseif }{\rm{empty}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{empty}$\;\;${\bf then }{\rm{l}}\,({\it{x\/}})\index{l} \\ 
{\bf else }{\rm{h}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{h}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{b} \\  
\=\+{\rm{b}}\,({\it{x\/}})\index{b} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf elseif }{\rm{empty}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{a}}\,({\rm{b}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{b}, {\rm{l}}\,({\it{x\/}})\index{l})\index{a}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; Bn is the iteration of B.  Same warnings as for Pn in 
; th_stringadd.bm apply. Note however that for Pn we used a tail
; recursive (more efficient) def. whereas here we use a fully
; recursive def, less efficient, but usually easier to prove things
; about, since x is fixed in the recursion.  (Clearly, we got a
; little bit smarter in the many many months which separate the
; definition of Pn and Bn...)   

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


\begin{verbatim};;; Fundamental properties of the THEORY of STRINGS; all names 
;;; prefixed w/ "STR".

;; NOT-EMPTY theorems, which clearly need to know about empty...:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-not-empty-a \\ \index{str-not-empty-a}
$\neg$ {\rm{empty}}\,({\rm{a}}\,({\it{x\/}}, {\it{u\/}})\index{a})\index{empty}
\end{tabbing}

\begin{verbatim}; the next 2 lemmas say almost the same thing, but both facts are 
; helpful to BM
\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-not-e-i \\ \index{str-not-e-i}
{\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i} $\not=$ {\sc{e}}\index{e}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  str-not-empty-i \\ \index{str-not-empty-i}
$\neg$ {\rm{empty}}\,({\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i})\index{empty}
\end{tabbing}

\begin{verbatim};; key commutativity/distributivity properties of A/P/L with I:

; STR-A-I should never coexist with I as they will loop.
\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-a-i \\ \index{str-a-i}
{\rm{a}}\,({\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i}, {\it{v\/}})\index{a} $=$ {\rm{i}}\,({\it{u\/}}, {\rm{a}}\,({\it{x\/}}, {\it{v\/}})\index{a})\index{i}
\end{tabbing}

\noindent{\sc Event}:   Disable str-a-i.

\addvspace{18pt}

\begin{verbatim}; one additional lemma which is useful for running with I disabled 
; is:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-i-e \\ \index{str-i-e}
{\rm{i}}\,({\it{u\/}}, {\sc{e}}\index{e})\index{i} $=$ {\rm{a}}\,({\sc{e}}\index{e}, {\it{u\/}})\index{a}
\end{tabbing}

\begin{verbatim}; The 2 theorems STR-P-I and STR-L-I can be written more
; "powerfully": however they trigger too "agressively" for my 
; taste, and cause case disjunctions too early at times. So in 
; general I keep the strong versions disabled.
; 2/4/89 note: that comment was written when the "2" versions 
; where physically AFTER the weak versions. Now that they're 
; before, we may be able to leave them enabled all the time, since
; BM will try the non-disjunctive rules first...

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-p-i2 \\ \index{str-p-i2}
\=\+{\rm{p}}\,({\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i})\index{p} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{i}}\,({\it{u\/}}, {\rm{p}}\,({\it{x\/}})\index{p})\index{i}$\;${\bf  endif}\-\-
\end{tabbing}

\noindent{\sc Event}:   Disable str-p-i2.

\addvspace{18pt}

\begin{tabbing}{\sc Theorem}:  str-l-i2 \\ \index{str-l-i2}
\=\+{\rm{l}}\,({\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i})\index{l} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\it{u\/}} \\ 
{\bf else }{\rm{l}}\,({\it{x\/}})\index{l}$\;${\bf  endif}\-\-
\end{tabbing}

\noindent{\sc Event}:   Disable str-l-i2.

\addvspace{18pt}

\begin{verbatim}; also, because of Fundamental Remark in THETA-PRF-35, need 
; explicit bottom cases:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-p-i-e \\ \index{str-p-i-e}
{\rm{empty}}\,({\it{x\/}})\index{empty} $\rightarrow$ ({\rm{p}}\,({\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i})\index{p} $=$ {\sc{e}}\index{e})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  str-p-i \\ \index{str-p-i}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{p}}\,({\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i})\index{p} $=$ {\rm{i}}\,({\it{u\/}}, {\rm{p}}\,({\it{x\/}})\index{p})\index{i})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  str-l-i-e \\ \index{str-l-i-e}
{\rm{empty}}\,({\it{x\/}})\index{empty} $\rightarrow$ ({\rm{l}}\,({\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i})\index{l} $=$ {\it{u\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  str-l-i \\ \index{str-l-i}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i})\index{l} $=$ {\rm{l}}\,({\it{x\/}})\index{l})
\end{tabbing}

\begin{verbatim};; properties (and assorted kludges) of LEN:

; STR-len0-empty helps, and the zero result is always re-obtainable
; as long as EMPTY and LEN are enabled.
; Note: we tried to also have the symmetric rule: 
; (equal (equal 0 (len x)) (empty x))
; but 1: BM warned us it was useless, and 2: we tried it and it 
; was useless.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-len0-empty \\ \index{str-len0-empty}
({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\tt{0}}) $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{verbatim}; on rare occasions we may need the symmetric:
;(prove-lemma STR-empty-len0 (rewrite) 
;(equal (empty x)
;       (equal (len x) 0))
;)
; but so far the only time we thought it might help (in PPLFadd,
; bypassing the impotent use of eq-len hyps by BM) it did not, so..

; STR-len-eq-empty is another symptom of us bad EQLEN handling...
; Also, it's only useful w/ LEN disabled, of course.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-len-eq-empty \\ \index{str-len-eq-empty}
({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\rightarrow$ (({\rm{empty}}\,({\it{y\/}})\index{empty} $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $=$ {\bf{t}})
\end{tabbing}

\begin{verbatim}; this back-chaining helps on RARE occasions when you need think:
; "x can't be empty, we know its length is something (>0)", enable
; it then.
; Note that if you can disable len when you use it, it can help 
; a lot...

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-not-empty-len \\ \index{str-not-empty-len}
({\tt{0}} $<$ {\rm{len}}\,({\it{x\/}})\index{len}) $\rightarrow$ ($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty})
\end{tabbing}

\noindent{\sc Event}:   Disable str-not-empty-len.

\addvspace{18pt}

\begin{verbatim}; STR-len-P is a hack for LEN in "backwards" contexts, loops 
; w/ len, of course.
\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-len-p \\ \index{str-len-p}
({\tt{0}} $<$ {\rm{len}}\,({\it{x\/}})\index{len}) $\rightarrow$ ({\rm{len}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{len} $=$ ({\rm{len}}\,({\it{x\/}})\index{len} $-\;1$))
\end{tabbing}

\noindent{\sc Event}:   Disable str-len-p.

\addvspace{18pt}

\begin{verbatim}; This is also an "anti-definition" which is useful when we want to
; prevent LEN being around because of mindless case disjunctions...
\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-add1-len-p \\ \index{str-add1-len-p}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ (($1\;+$ {\rm{len}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{len}) $=$ {\rm{len}}\,({\it{x\/}})\index{len})
\end{tabbing}

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

\addvspace{18pt}

\begin{verbatim}; This should be used as last resort to force a case disjunction.  
; Using it globally is like having L-I2 and P-I2 around: they 
; trigger too agressively, preventing some bigger-formula thms to
; trigger, and failing.
; When used, LEN should be disabled, as they will loop together.
\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-add1-len-p2 \\ \index{str-add1-len-p2}
\=\+($1\;+$ {\rm{len}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{len}) \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\tt{1}} \\ 
{\bf else }{\rm{len}}\,({\it{x\/}})\index{len}$\;${\bf  endif}\-\-
\end{tabbing}

\noindent{\sc Event}:   Disable str-add1-len-p2.

\addvspace{18pt}

\begin{verbatim}; Another hack which we may use instead of LEN is:
; Note however, that when testing on IC_times, it resulted to 
; a passage to len0 to reduce to T instead of arithmetic, taking a
; lot more time, and different cases, but same total # cases.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-len-e \\ \index{str-len-e}
{\rm{empty}}\,({\it{x\/}})\index{empty} $\rightarrow$ ({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\tt{0}})
\end{tabbing}

\noindent{\sc Event}:   Disable str-len-e.

\addvspace{18pt}

\begin{verbatim}; This is yet another hack needed to run with LEN disabled. It's 
; left on all the time because it won't trigger much.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-len-1 \\ \index{str-len-1}
(($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\wedge$ {\rm{empty}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{empty}) $\rightarrow$ (({\tt{1}} $=$ {\rm{len}}\,({\it{x\/}})\index{len}) $=$ {\bf{t}})
\end{tabbing}

\begin{verbatim}; STR-len-lessp-1-empty: general effect? doesn't hurt...

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-len-lessp-1-empty \\ \index{str-len-lessp-1-empty}
({\rm{len}}\,({\it{x\/}})\index{len} $<$ {\tt{1}}) $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  str-len-p-i \\ \index{str-len-p-i}
{\rm{len}}\,({\rm{p}}\,({\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i})\index{p})\index{len} $=$ {\rm{len}}\,({\it{x\/}})\index{len}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  str-len-i-p \\ \index{str-len-i-p}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{len}}\,({\rm{i}}\,({\it{u\/}}, {\rm{p}}\,({\it{x\/}})\index{p})\index{i})\index{len} $=$ {\rm{len}}\,({\it{x\/}})\index{len})
\end{tabbing}

\begin{verbatim}; STR-equal-len-P actually DOES help during IC-S-Plus.  It may hurt
; under other circumstances, so beware... Note also that the rule
; has to be written with the extra " equal ... t" so as not to be
; confused with an attempt to rewrite "len P x" .

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-equal-len-p \\ \index{str-equal-len-p}
({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\rightarrow$ (({\rm{len}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{len} $=$ {\rm{len}}\,({\rm{p}}\,({\it{y\/}})\index{p})\index{len}) $=$ {\bf{t}})
\end{tabbing}

\begin{verbatim};; Basic Properties of H/B , essentially what we would have gotten 
;; in a shell.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-b-decreases \\ \index{str-b-decreases}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{count}}\,({\rm{b}}\,({\it{x\/}})\index{b}) $<$ {\rm{count}}\,({\it{x\/}}))
\end{tabbing}


\begin{verbatim}; The reverse of the following theorem would make a fine H/B ELIM 
; thm if we ever need it.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-i-h-b \\ \index{str-i-h-b}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{i}}\,({\rm{h}}\,({\it{x\/}})\index{h}, {\rm{b}}\,({\it{x\/}})\index{b})\index{i} $=$ {\it{x\/}})
\end{tabbing}

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

\begin{verbatim}; STR-B-I should be changed to return: if (empty x) (e) x .
; Note: we could also use SFIX here, but we'd have to 
; leave it enabled all the time, which so far we have avoided.
\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-b-i \\ \index{str-b-i}
\=\+{\rm{b}}\,({\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i})\index{b} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{stringp}}\,({\it{x\/}})\index{stringp}$\;\;${\bf then }{\it{x\/}} \\ 
{\bf else }{\sc{e}}\index{e}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; STR-Empty-B is useful because it eliminates a B, and links case 
; disjunctions.
\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-empty-b \\ \index{str-empty-b}
{\rm{empty}}\,({\rm{b}}\,({\it{x\/}})\index{b})\index{empty} $=$ {\rm{empty}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{empty}
\end{tabbing}

\begin{verbatim}; STR-P-B is our usual P pushthrough
\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-p-b \\ \index{str-p-b}
{\rm{p}}\,({\rm{b}}\,({\it{x\/}})\index{b})\index{p} $=$ {\rm{b}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{b}
\end{tabbing}


\begin{verbatim}; STR-L-B doesn't require induction, but it's sometimes useful..
\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-l-b \\ \index{str-l-b}
($\neg$ {\rm{empty}}\,({\rm{b}}\,({\it{x\/}})\index{b})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{b}}\,({\it{x\/}})\index{b})\index{l} $=$ {\rm{l}}\,({\it{x\/}})\index{l})
\end{tabbing}

\begin{verbatim}; STR-Bn-1 for some weird reason, BM doesn't get that by itself...

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-bn-1 \\ \index{str-bn-1}
{\rm{bn}}\,({\tt{1}}, {\it{x\/}})\index{bn} $=$ {\rm{b}}\,({\it{x\/}})\index{b}
\end{tabbing}

\begin{verbatim}; STR-Bn-E: if we used fix, we would have the more general:
;           if (empty x) ...
\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-bn-e \\ \index{str-bn-e}
{\rm{bn}}\,({\it{n\/}}, {\sc{e}}\index{e})\index{bn} $=$ {\sc{e}}\index{e}
\end{tabbing}


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


\begin{verbatim}; STR-B-Bn-I may not be in its most general form, and we pay for 
; the fact that for n=0 we use "x" instead of sfix x:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-b-bn-i \\ \index{str-b-bn-i}
{\rm{stringp}}\,({\it{x\/}})\index{stringp} $\rightarrow$ ({\rm{b}}\,({\rm{bn}}\,({\it{n\/}}, {\rm{i}}\,({\it{u\/}}, {\it{x\/}})\index{i})\index{bn})\index{b} $=$ {\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn})
\end{tabbing}

\begin{verbatim};; properties of H/B w/ Len, probably should be copied largely
;; from above properties of L/P w/ Len.

; We have the weak version below, but it didn't trigger in 
; len-Stut-R since we don't have a condition on empty(Stut-R x y).
; Keeping this one higher should have the right effect of only
; introducing the case disjunction when needed; it may also do it
; too much...

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-len-b2 \\ \index{str-len-b2}
\=\+{\rm{len}}\,({\rm{b}}\,({\it{x\/}})\index{b})\index{len} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\rm{len}}\,({\it{x\/}})\index{len} $-\;1$$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  str-len-b \\ \index{str-len-b}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{len}}\,({\rm{b}}\,({\it{x\/}})\index{b})\index{len} $=$ ({\rm{len}}\,({\it{x\/}})\index{len} $-\;1$))
\end{tabbing}


\begin{verbatim}; STR-len-Bn needs ARIthmetic properties... and is the first such 
; property which caused ARIthmetic to be loaded before string 
; theory.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-len-bn \\ \index{str-len-bn}
{\rm{len}}\,({\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn})\index{len} $=$ ({\rm{len}}\,({\it{x\/}})\index{len} $-$ {\it{n\/}})
\end{tabbing}


\begin{verbatim}; STR-Bn-empty not necessarily phrased in the most universally 
; useful way..  Probably should be able to disable Bn here...  

\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-bn-empty \\ \index{str-bn-empty}
{\rm{empty}}\,({\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn})\index{empty} $=$ ({\rm{len}}\,({\it{x\/}})\index{len} $<$ ($1\;+$ {\it{n\/}}))
\end{tabbing}


\begin{verbatim}; STR-L-Bn needs STR-Bn-Empty, hence its position here.
\end{verbatim}\begin{tabbing}{\sc Theorem}:  str-l-bn \\ \index{str-l-bn}
($\neg$ {\rm{empty}}\,({\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn})\index{l} $=$ {\rm{l}}\,({\it{x\/}})\index{l})
\end{tabbing}

\begin{verbatim};;; END OF FUNDAMENTAL PROPERTIES.

;; at this point I is completely characterized, and since BM 
;; rewrites formulas inside-out, its definition goes against our 
;; normalization, hence:
\end{verbatim}
\noindent{\sc Event}:   Disable i.

\addvspace{18pt}

\noindent{\sc Event}:   Enable str-a-i.

\addvspace{18pt}

\begin{verbatim};; and ditto, in general, for H and B:
\end{verbatim}
\noindent{\sc Event}:   Disable h.

\addvspace{18pt}

\noindent{\sc Event}:   Disable b.

\addvspace{18pt}

\begin{verbatim}; at this point we should rarely have to use LEN's definition 
; anymore:
\end{verbatim}
\noindent{\sc Event}:   Disable len.

\addvspace{18pt}
\begin{verbatim}; ??? Maybe we should enable: (enable STR-add1-len-P) here

; SFIX is the "type fixer" for BM.  We don't really use it much, 
;      the only place is in SYSD definitions for the (uninteresting
;      case) when the line variable is none defined, and we could
;      use S-Id instead, but I think it would give it too much 
;      meaning.
; old: (defn sfix (x) (if (stringp x) x (e)))
; new: proved equivalent to old, and computationally no worse, and
;      better suited to running with empty disabled:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{sfix} \\  
\=\+{\rm{sfix}}\,({\it{x\/}})\index{sfix} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\it{x\/}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; BM doesn't figure that out right away for new def, so...

\end{verbatim}\begin{tabbing}{\sc Theorem}:  sfix-stringp \\ \index{sfix-stringp}
{\rm{stringp}}\,({\rm{sfix}}\,({\it{x\/}})\index{sfix})\index{stringp}
\end{tabbing}

\begin{verbatim}; We prove the key A2 properties for sfix, just like a 
; combinational, so they don't become an issue in A2-SYSD proofs..

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-e-sfix \\ \index{a2-e-sfix}
({\rm{sfix}}\,({\it{x\/}})\index{sfix} $=$ {\sc{e}}\index{e}) $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

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

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

\begin{tabbing}{\sc Theorem}:  a2-lpe-sfix \\ \index{a2-lpe-sfix}
{\rm{eqlen}}\,({\rm{sfix}}\,({\it{x\/}})\index{sfix}, {\it{x\/}})\index{eqlen}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-ic-sfix \\ \index{a2-ic-sfix}
{\rm{sfix}}\,({\rm{i}}\,({\it{c\_x\/}}, {\it{x\/}})\index{i})\index{sfix} $=$ {\rm{i}}\,({\it{c\_x\/}}, {\rm{sfix}}\,({\it{x\/}})\index{sfix})\index{i}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lc-sfix \\ \index{a2-lc-sfix}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{sfix}}\,({\it{x\/}})\index{sfix})\index{l} $=$ {\rm{l}}\,({\it{x\/}})\index{l})
\end{tabbing}

\begin{verbatim}; HISTORICAL NOTE: the fact that we need EMPTY for A2-PC-Sfix is 
; what held us back so long in A2-PC-Sysds, forcing us to allow 
; EMPTY there, increasing entropy beyond belief...

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-pc-sfix \\ \index{a2-pc-sfix}
{\rm{p}}\,({\rm{sfix}}\,({\it{x\/}})\index{sfix})\index{p} $=$ {\rm{sfix}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{sfix}
\end{tabbing} 

\begin{tabbing}{\sc Theorem}:  a2-hc-sfix \\ \index{a2-hc-sfix}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{h}}\,({\rm{sfix}}\,({\it{x\/}})\index{sfix})\index{h} $=$ {\rm{h}}\,({\it{x\/}})\index{h})
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  a2-bnc-sfix \\ \index{a2-bnc-sfix}
{\rm{bn}}\,({\it{n\/}}, {\rm{sfix}}\,({\it{x\/}})\index{sfix})\index{bn} $=$ {\rm{sfix}}\,({\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn})\index{sfix}
\end{tabbing}

\begin{verbatim}; for all thinkable purposes, sfix is sufficiently characterized:
\end{verbatim}
\noindent{\sc Event}:   Disable sfix.

\addvspace{18pt}

\begin{verbatim}; eof: th_stringadd.bm






;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; TH_STRSPEC.BM: additional string theory with string things 
;;;     needed in SPECIFICATIONS, as opposed to just sysd 
;;;     definitions.  This could just have been appended to
;;;     th_stringadd.bm, but it doesn't feel right, and has some
;;;     automatically generated pieces, so it didn't look as 
;;;     "bottom" as Stringadd. 
;;;
;;; Functions: S-IF, S-AND, S-OR, S-NOT, S-EQUAL, S-CONST, S-CONSTL
;;; Predicate: S-BOOLP
;;; Miscellaneous boolean identities extended to the S versions.
;;;
;;; Induction scheme induct-P,P2,P3,P4.
;;;
;;; BEWARE (when updating with new versions of Sugar for
;;; combinationals): Most A2's are automatically generated by 
;;; Sugar, EXCEPT where expressely noted in the comments, in
;;; particular for: AND, OR, CONSTL .
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; S-IF is just the STAR of the logical If-Then-Else.  Paillet uses
;; it a lot.  
;; The code below is Sugar generated by: (bmcomb 'if '() '(x y z))

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{s-if} \\  
\=\+{\rm{s-if}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{s-if} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{a}}\,(\=\+{\rm{s-if}}\,({\rm{p}}\,({\it{x\/}})\index{p}, {\rm{p}}\,({\it{y\/}})\index{p}, {\rm{p}}\,({\it{z\/}})\index{p})\index{s-if}, \\ 
\=\+{\bf if }{\rm{l}}\,({\it{x\/}})\index{l}$\;\;${\bf then }{\rm{l}}\,({\it{y\/}})\index{l} \\ 
{\bf else }{\rm{l}}\,({\it{z\/}})\index{l}$\;${\bf  endif}\-)\-\index{a}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; A2-Begin-S-IF

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-empty-s-if \\ \index{a2-empty-s-if}
{\rm{empty}}\,({\rm{s-if}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{s-if})\index{empty} $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-e-s-if \\ \index{a2-e-s-if}
({\rm{s-if}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{s-if} $=$ {\sc{e}}\index{e}) $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lp-s-if \\ \index{a2-lp-s-if}
{\rm{len}}\,({\rm{s-if}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{s-if})\index{len} $=$ {\rm{len}}\,({\it{x\/}})\index{len}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lpe-s-if \\ \index{a2-lpe-s-if}
{\rm{eqlen}}\,({\rm{s-if}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{s-if}, {\it{x\/}})\index{eqlen}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-ic-s-if \\ \index{a2-ic-s-if}
\=\+(({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\wedge$ ({\rm{len}}\,({\it{y\/}})\index{len} $=$ {\rm{len}}\,({\it{z\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{s-if}}\,({\rm{i}}\,({\it{c\_x\/}}, {\it{x\/}})\index{i}, {\rm{i}}\,({\it{c\_y\/}}, {\it{y\/}})\index{i}, {\rm{i}}\,({\it{c\_z\/}}, {\it{z\/}})\index{i})\index{s-if} \\ 
$=$$\;\;\;\;${\rm{i}}\,(\=\+\=\+{\bf if }{\it{c\_x\/}}$\;\;${\bf then }{\it{c\_y\/}} \\ 
{\bf else }{\it{c\_z\/}}$\;${\bf  endif}\-, \\ 
{\rm{s-if}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{s-if})\-\index{i})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lc-s-if \\ \index{a2-lc-s-if}
\=\+($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{l}}\,({\rm{s-if}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{s-if})\index{l} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{l}}\,({\it{x\/}})\index{l}$\;\;${\bf then }{\rm{l}}\,({\it{y\/}})\index{l} \\ 
{\bf else }{\rm{l}}\,({\it{z\/}})\index{l}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-pc-s-if \\ \index{a2-pc-s-if}
{\rm{p}}\,({\rm{s-if}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{s-if})\index{p} $=$ {\rm{s-if}}\,({\rm{p}}\,({\it{x\/}})\index{p}, {\rm{p}}\,({\it{y\/}})\index{p}, {\rm{p}}\,({\it{z\/}})\index{p})\index{s-if}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-hc-s-if \\ \index{a2-hc-s-if}
\=\+(($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\wedge$ (({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\wedge$ ({\rm{len}}\,({\it{y\/}})\index{len} $=$ {\rm{len}}\,({\it{z\/}})\index{len}))) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{h}}\,({\rm{s-if}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{s-if})\index{h} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{h}}\,({\it{x\/}})\index{h}$\;\;${\bf then }{\rm{h}}\,({\it{y\/}})\index{h} \\ 
{\bf else }{\rm{h}}\,({\it{z\/}})\index{h}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bc-s-if \\ \index{a2-bc-s-if}
\=\+(({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\wedge$ ({\rm{len}}\,({\it{y\/}})\index{len} $=$ {\rm{len}}\,({\it{z\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{b}}\,({\rm{s-if}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{s-if})\index{b} $=$ {\rm{s-if}}\,({\rm{b}}\,({\it{x\/}})\index{b}, {\rm{b}}\,({\it{y\/}})\index{b}, {\rm{b}}\,({\it{z\/}})\index{b})\index{s-if})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bnc-s-if \\ \index{a2-bnc-s-if}
\=\+(({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\wedge$ ({\rm{len}}\,({\it{y\/}})\index{len} $=$ {\rm{len}}\,({\it{z\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{bn}}\,({\it{n\/}}, {\rm{s-if}}\,({\it{x\/}}, {\it{y\/}}, {\it{z\/}})\index{s-if})\index{bn} $=$ {\rm{s-if}}\,({\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn}, {\rm{bn}}\,({\it{n\/}}, {\it{y\/}})\index{bn}, {\rm{bn}}\,({\it{n\/}}, {\it{z\/}})\index{bn})\index{s-if})\-
\end{tabbing}

\begin{verbatim};; A2-End-S-IF


;; S-AND is just the STAR of the logical AND, put in because of 
;; Paillet.
;; The code below is Sugar generated by: (bmcomb 'AND '() '(x y))
;; Note: we reenable AND by hand everywhere sugar disables it, 
;; because it's necessary at least for IC and LC.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{s-and} \\  
\=\+{\rm{s-and}}\,({\it{x\/}}, {\it{y\/}})\index{s-and} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{a}}\,({\rm{s-and}}\,({\rm{p}}\,({\it{x\/}})\index{p}, {\rm{p}}\,({\it{y\/}})\index{p})\index{s-and}, {\rm{l}}\,({\it{x\/}})\index{l} $\wedge$ {\rm{l}}\,({\it{y\/}})\index{l})\index{a}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; A2-Begin-S-AND

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-empty-s-and \\ \index{a2-empty-s-and}
{\rm{empty}}\,({\rm{s-and}}\,({\it{x\/}}, {\it{y\/}})\index{s-and})\index{empty} $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-e-s-and \\ \index{a2-e-s-and}
({\rm{s-and}}\,({\it{x\/}}, {\it{y\/}})\index{s-and} $=$ {\sc{e}}\index{e}) $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lp-s-and \\ \index{a2-lp-s-and}
{\rm{len}}\,({\rm{s-and}}\,({\it{x\/}}, {\it{y\/}})\index{s-and})\index{len} $=$ {\rm{len}}\,({\it{x\/}})\index{len}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lpe-s-and \\ \index{a2-lpe-s-and}
{\rm{eqlen}}\,({\rm{s-and}}\,({\it{x\/}}, {\it{y\/}})\index{s-and}, {\it{x\/}})\index{eqlen}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-ic-s-and \\ \index{a2-ic-s-and}
\=\+({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{s-and}}\,({\rm{i}}\,({\it{c\_x\/}}, {\it{x\/}})\index{i}, {\rm{i}}\,({\it{c\_y\/}}, {\it{y\/}})\index{i})\index{s-and} $=$ {\rm{i}}\,({\it{c\_x\/}} $\wedge$ {\it{c\_y\/}}, {\rm{s-and}}\,({\it{x\/}}, {\it{y\/}})\index{s-and})\index{i})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lc-s-and \\ \index{a2-lc-s-and}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{s-and}}\,({\it{x\/}}, {\it{y\/}})\index{s-and})\index{l} $=$ ({\rm{l}}\,({\it{x\/}})\index{l} $\wedge$ {\rm{l}}\,({\it{y\/}})\index{l}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-pc-s-and \\ \index{a2-pc-s-and}
{\rm{p}}\,({\rm{s-and}}\,({\it{x\/}}, {\it{y\/}})\index{s-and})\index{p} $=$ {\rm{s-and}}\,({\rm{p}}\,({\it{x\/}})\index{p}, {\rm{p}}\,({\it{y\/}})\index{p})\index{s-and}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-hc-s-and \\ \index{a2-hc-s-and}
\=\+(($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\wedge$ ({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{h}}\,({\rm{s-and}}\,({\it{x\/}}, {\it{y\/}})\index{s-and})\index{h} $=$ ({\rm{h}}\,({\it{x\/}})\index{h} $\wedge$ {\rm{h}}\,({\it{y\/}})\index{h}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bc-s-and \\ \index{a2-bc-s-and}
({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\rightarrow$ ({\rm{b}}\,({\rm{s-and}}\,({\it{x\/}}, {\it{y\/}})\index{s-and})\index{b} $=$ {\rm{s-and}}\,({\rm{b}}\,({\it{x\/}})\index{b}, {\rm{b}}\,({\it{y\/}})\index{b})\index{s-and})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bnc-s-and \\ \index{a2-bnc-s-and}
({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\rightarrow$ ({\rm{bn}}\,({\it{n\/}}, {\rm{s-and}}\,({\it{x\/}}, {\it{y\/}})\index{s-and})\index{bn} $=$ {\rm{s-and}}\,({\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn}, {\rm{bn}}\,({\it{n\/}}, {\it{y\/}})\index{bn})\index{s-and})
\end{tabbing}

\begin{verbatim};; A2-End-S-AND


;; S-OR is just the STAR of the logical OR, put in because of 
;; Paillet.
;; The code below is Sugar generated by: (bmcomb 'OR '() '(x y))
;; Note: just like for AND we reenable OR by hand everywhere 
;; because it's necessary at least for IC and LC.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{s-or} \\  
\=\+{\rm{s-or}}\,({\it{x\/}}, {\it{y\/}})\index{s-or} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{a}}\,({\rm{s-or}}\,({\rm{p}}\,({\it{x\/}})\index{p}, {\rm{p}}\,({\it{y\/}})\index{p})\index{s-or}, {\rm{l}}\,({\it{x\/}})\index{l} $\vee$ {\rm{l}}\,({\it{y\/}})\index{l})\index{a}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; A2-Begin-S-OR

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-empty-s-or \\ \index{a2-empty-s-or}
{\rm{empty}}\,({\rm{s-or}}\,({\it{x\/}}, {\it{y\/}})\index{s-or})\index{empty} $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-e-s-or \\ \index{a2-e-s-or}
({\rm{s-or}}\,({\it{x\/}}, {\it{y\/}})\index{s-or} $=$ {\sc{e}}\index{e}) $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lp-s-or \\ \index{a2-lp-s-or}
{\rm{len}}\,({\rm{s-or}}\,({\it{x\/}}, {\it{y\/}})\index{s-or})\index{len} $=$ {\rm{len}}\,({\it{x\/}})\index{len}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lpe-s-or \\ \index{a2-lpe-s-or}
{\rm{eqlen}}\,({\rm{s-or}}\,({\it{x\/}}, {\it{y\/}})\index{s-or}, {\it{x\/}})\index{eqlen}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-ic-s-or \\ \index{a2-ic-s-or}
\=\+({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{s-or}}\,({\rm{i}}\,({\it{c\_x\/}}, {\it{x\/}})\index{i}, {\rm{i}}\,({\it{c\_y\/}}, {\it{y\/}})\index{i})\index{s-or} $=$ {\rm{i}}\,({\it{c\_x\/}} $\vee$ {\it{c\_y\/}}, {\rm{s-or}}\,({\it{x\/}}, {\it{y\/}})\index{s-or})\index{i})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lc-s-or \\ \index{a2-lc-s-or}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{s-or}}\,({\it{x\/}}, {\it{y\/}})\index{s-or})\index{l} $=$ ({\rm{l}}\,({\it{x\/}})\index{l} $\vee$ {\rm{l}}\,({\it{y\/}})\index{l}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-pc-s-or \\ \index{a2-pc-s-or}
{\rm{p}}\,({\rm{s-or}}\,({\it{x\/}}, {\it{y\/}})\index{s-or})\index{p} $=$ {\rm{s-or}}\,({\rm{p}}\,({\it{x\/}})\index{p}, {\rm{p}}\,({\it{y\/}})\index{p})\index{s-or}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-hc-s-or \\ \index{a2-hc-s-or}
\=\+(($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\wedge$ ({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{h}}\,({\rm{s-or}}\,({\it{x\/}}, {\it{y\/}})\index{s-or})\index{h} $=$ ({\rm{h}}\,({\it{x\/}})\index{h} $\vee$ {\rm{h}}\,({\it{y\/}})\index{h}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bc-s-or \\ \index{a2-bc-s-or}
({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\rightarrow$ ({\rm{b}}\,({\rm{s-or}}\,({\it{x\/}}, {\it{y\/}})\index{s-or})\index{b} $=$ {\rm{s-or}}\,({\rm{b}}\,({\it{x\/}})\index{b}, {\rm{b}}\,({\it{y\/}})\index{b})\index{s-or})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bnc-s-or \\ \index{a2-bnc-s-or}
({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\rightarrow$ ({\rm{bn}}\,({\it{n\/}}, {\rm{s-or}}\,({\it{x\/}}, {\it{y\/}})\index{s-or})\index{bn} $=$ {\rm{s-or}}\,({\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn}, {\rm{bn}}\,({\it{n\/}}, {\it{y\/}})\index{bn})\index{s-or})
\end{tabbing}

\begin{verbatim};; A2-End-S-OR


;; S-NOT is just the STAR of the logical NOT, put in because of 
;; Paillet, but useful in tons of other places!
;; The code below is Sugar generated by: (bmcomb 'NOT '() '(x))

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{s-not} \\  
\=\+{\rm{s-not}}\,({\it{x\/}})\index{s-not} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{a}}\,({\rm{s-not}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{s-not}, $\neg$ {\rm{l}}\,({\it{x\/}})\index{l})\index{a}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; A2-Begin-S-NOT

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-empty-s-not \\ \index{a2-empty-s-not}
{\rm{empty}}\,({\rm{s-not}}\,({\it{x\/}})\index{s-not})\index{empty} $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-e-s-not \\ \index{a2-e-s-not}
({\rm{s-not}}\,({\it{x\/}})\index{s-not} $=$ {\sc{e}}\index{e}) $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lp-s-not \\ \index{a2-lp-s-not}
{\rm{len}}\,({\rm{s-not}}\,({\it{x\/}})\index{s-not})\index{len} $=$ {\rm{len}}\,({\it{x\/}})\index{len}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lpe-s-not \\ \index{a2-lpe-s-not}
{\rm{eqlen}}\,({\rm{s-not}}\,({\it{x\/}})\index{s-not}, {\it{x\/}})\index{eqlen}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-ic-s-not \\ \index{a2-ic-s-not}
{\rm{s-not}}\,({\rm{i}}\,({\it{c\_x\/}}, {\it{x\/}})\index{i})\index{s-not} $=$ {\rm{i}}\,($\neg$ {\it{c\_x\/}}, {\rm{s-not}}\,({\it{x\/}})\index{s-not})\index{i}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lc-s-not \\ \index{a2-lc-s-not}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{s-not}}\,({\it{x\/}})\index{s-not})\index{l} $=$ ($\neg$ {\rm{l}}\,({\it{x\/}})\index{l}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-pc-s-not \\ \index{a2-pc-s-not}
{\rm{p}}\,({\rm{s-not}}\,({\it{x\/}})\index{s-not})\index{p} $=$ {\rm{s-not}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{s-not}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-hc-s-not \\ \index{a2-hc-s-not}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{h}}\,({\rm{s-not}}\,({\it{x\/}})\index{s-not})\index{h} $=$ ($\neg$ {\rm{h}}\,({\it{x\/}})\index{h}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bc-s-not \\ \index{a2-bc-s-not}
{\rm{b}}\,({\rm{s-not}}\,({\it{x\/}})\index{s-not})\index{b} $=$ {\rm{s-not}}\,({\rm{b}}\,({\it{x\/}})\index{b})\index{s-not}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bnc-s-not \\ \index{a2-bnc-s-not}
{\rm{bn}}\,({\it{n\/}}, {\rm{s-not}}\,({\it{x\/}})\index{s-not})\index{bn} $=$ {\rm{s-not}}\,({\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn})\index{s-not}
\end{tabbing}

\begin{verbatim};; A2-End-S-NOT


;; S-EQUAL is just the STAR of the logical Equal.  Paillet uses it
;; a lot.
;; The code below is Sugar generated by: (bmcomb 'equal '() '(x y))

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{s-equal} \\  
\=\+{\rm{s-equal}}\,({\it{x\/}}, {\it{y\/}})\index{s-equal} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{a}}\,({\rm{s-equal}}\,({\rm{p}}\,({\it{x\/}})\index{p}, {\rm{p}}\,({\it{y\/}})\index{p})\index{s-equal}, {\rm{l}}\,({\it{x\/}})\index{l} $=$ {\rm{l}}\,({\it{y\/}})\index{l})\index{a}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; A2-Begin-S-EQUAL

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-empty-s-equal \\ \index{a2-empty-s-equal}
{\rm{empty}}\,({\rm{s-equal}}\,({\it{x\/}}, {\it{y\/}})\index{s-equal})\index{empty} $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-e-s-equal \\ \index{a2-e-s-equal}
({\rm{s-equal}}\,({\it{x\/}}, {\it{y\/}})\index{s-equal} $=$ {\sc{e}}\index{e}) $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lp-s-equal \\ \index{a2-lp-s-equal}
{\rm{len}}\,({\rm{s-equal}}\,({\it{x\/}}, {\it{y\/}})\index{s-equal})\index{len} $=$ {\rm{len}}\,({\it{x\/}})\index{len}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lpe-s-equal \\ \index{a2-lpe-s-equal}
{\rm{eqlen}}\,({\rm{s-equal}}\,({\it{x\/}}, {\it{y\/}})\index{s-equal}, {\it{x\/}})\index{eqlen}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-ic-s-equal \\ \index{a2-ic-s-equal}
\=\+({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{s-equal}}\,({\rm{i}}\,({\it{c\_x\/}}, {\it{x\/}})\index{i}, {\rm{i}}\,({\it{c\_y\/}}, {\it{y\/}})\index{i})\index{s-equal} $=$ {\rm{i}}\,({\it{c\_x\/}} $=$ {\it{c\_y\/}}, {\rm{s-equal}}\,({\it{x\/}}, {\it{y\/}})\index{s-equal})\index{i})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lc-s-equal \\ \index{a2-lc-s-equal}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{s-equal}}\,({\it{x\/}}, {\it{y\/}})\index{s-equal})\index{l} $=$ ({\rm{l}}\,({\it{x\/}})\index{l} $=$ {\rm{l}}\,({\it{y\/}})\index{l}))
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-pc-s-equal \\ \index{a2-pc-s-equal}
{\rm{p}}\,({\rm{s-equal}}\,({\it{x\/}}, {\it{y\/}})\index{s-equal})\index{p} $=$ {\rm{s-equal}}\,({\rm{p}}\,({\it{x\/}})\index{p}, {\rm{p}}\,({\it{y\/}})\index{p})\index{s-equal}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-hc-s-equal \\ \index{a2-hc-s-equal}
\=\+(($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\wedge$ ({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{h}}\,({\rm{s-equal}}\,({\it{x\/}}, {\it{y\/}})\index{s-equal})\index{h} $=$ ({\rm{h}}\,({\it{x\/}})\index{h} $=$ {\rm{h}}\,({\it{y\/}})\index{h}))\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bc-s-equal \\ \index{a2-bc-s-equal}
({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\rightarrow$ ({\rm{b}}\,({\rm{s-equal}}\,({\it{x\/}}, {\it{y\/}})\index{s-equal})\index{b} $=$ {\rm{s-equal}}\,({\rm{b}}\,({\it{x\/}})\index{b}, {\rm{b}}\,({\it{y\/}})\index{b})\index{s-equal})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bnc-s-equal \\ \index{a2-bnc-s-equal}
({\rm{len}}\,({\it{x\/}})\index{len} $=$ {\rm{len}}\,({\it{y\/}})\index{len}) $\rightarrow$ ({\rm{bn}}\,({\it{n\/}}, {\rm{s-equal}}\,({\it{x\/}}, {\it{y\/}})\index{s-equal})\index{bn} $=$ {\rm{s-equal}}\,({\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn}, {\rm{bn}}\,({\it{n\/}}, {\it{y\/}})\index{bn})\index{s-equal})
\end{tabbing}

\begin{verbatim};; A2-End-S-EQUAL


;; S-CONST: CONSTANT combinational element, takes VALue as 
;;   parameter.  Even though in most circuits this will be 0 or 1,
;;   it makes no sense to hardwire it for BM.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{const}$\;\;$
{\rm{const}}\,({\it{val\/}}, {\it{u\/}})\index{const} $=$ {\it{val\/}}
\end{tabbing}  \begin{verbatim};we require at least one string argument (MLP sfuns)

; Everything until A2-End-S-CONST Sugar generated by:
;   (bmcomb 'const '(val) '(x))

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{s-const} \\  
\=\+{\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{a}}\,({\rm{s-const}}\,({\it{val\/}}, {\rm{p}}\,({\it{x\/}})\index{p})\index{s-const}, {\rm{const}}\,({\it{val\/}}, {\rm{l}}\,({\it{x\/}})\index{l})\index{const})\index{a}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; A2-Begin-S-CONST

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-empty-s-const \\ \index{a2-empty-s-const}
{\rm{empty}}\,({\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const})\index{empty} $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-e-s-const \\ \index{a2-e-s-const}
({\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const} $=$ {\sc{e}}\index{e}) $=$ {\rm{empty}}\,({\it{x\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lp-s-const \\ \index{a2-lp-s-const}
{\rm{len}}\,({\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const})\index{len} $=$ {\rm{len}}\,({\it{x\/}})\index{len}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lpe-s-const \\ \index{a2-lpe-s-const}
{\rm{eqlen}}\,({\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const}, {\it{x\/}})\index{eqlen}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-ic-s-const \\ \index{a2-ic-s-const}
{\rm{s-const}}\,({\it{val\/}}, {\rm{i}}\,({\it{c\_x\/}}, {\it{x\/}})\index{i})\index{s-const} $=$ {\rm{i}}\,({\rm{const}}\,({\it{val\/}}, {\it{c\_x\/}})\index{const}, {\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const})\index{i}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lc-s-const \\ \index{a2-lc-s-const}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const})\index{l} $=$ {\rm{const}}\,({\it{val\/}}, {\rm{l}}\,({\it{x\/}})\index{l})\index{const})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-pc-s-const \\ \index{a2-pc-s-const}
{\rm{p}}\,({\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const})\index{p} $=$ {\rm{s-const}}\,({\it{val\/}}, {\rm{p}}\,({\it{x\/}})\index{p})\index{s-const}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-hc-s-const \\ \index{a2-hc-s-const}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{h}}\,({\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const})\index{h} $=$ {\rm{const}}\,({\it{val\/}}, {\rm{h}}\,({\it{x\/}})\index{h})\index{const})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bc-s-const \\ \index{a2-bc-s-const}
{\rm{b}}\,({\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const})\index{b} $=$ {\rm{s-const}}\,({\it{val\/}}, {\rm{b}}\,({\it{x\/}})\index{b})\index{s-const}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bnc-s-const \\ \index{a2-bnc-s-const}
{\rm{bn}}\,({\it{n\/}}, {\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const})\index{bn} $=$ {\rm{s-const}}\,({\it{val\/}}, {\rm{bn}}\,({\it{n\/}}, {\it{x\/}})\index{bn})\index{s-const}
\end{tabbing}

\begin{verbatim};; A2-End-S-CONST

; Additional lemmas which give the key properties of S-CONST:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  l-sconst \\ \index{l-sconst}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const})\index{l} $=$ {\it{val\/}})
\end{tabbing}

\begin{verbatim}; Note that I-SConst remotely descends from the insadd experiment 
; and the solution that David Goldschlag gave me to that problem 
; then..

\end{verbatim}\begin{tabbing}{\sc Theorem}:  i-sconst \\ \index{i-sconst}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{i}}\,({\it{val\/}}, {\rm{s-const}}\,({\it{val\/}}, {\rm{p}}\,({\it{x\/}})\index{p})\index{s-const})\index{i} $=$ {\rm{s-const}}\,({\it{val\/}}, {\it{x\/}})\index{s-const})
\end{tabbing}

\begin{verbatim};; S-CONSTL is like S-Const, except that the length is given 
;; numerically, and so the definition does NOT follow the standard
;; S- def.  A2's are therefore generated by hand.

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

\begin{verbatim}; we need to prove the fundamental sequentiality properties of 
; S-Const, which are significantly DIFFERENT from the standard, 
; although I've kept the names since they FUNCTION identically.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-e-s-constl \\ \index{a2-e-s-constl}
({\rm{s-constl}}\,({\it{val\/}}, {\it{n\/}})\index{s-constl} $=$ {\sc{e}}\index{e}) $=$ ({\it{n\/}} $\simeq {\tt{0}}$)
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-empty-s-constl \\ \index{a2-empty-s-constl}
{\rm{empty}}\,({\rm{s-constl}}\,({\it{val\/}}, {\it{n\/}})\index{s-constl})\index{empty} $=$ ({\it{n\/}} $\simeq {\tt{0}}$)
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lp-s-constl \\ \index{a2-lp-s-constl}
{\rm{len}}\,({\rm{s-constl}}\,({\it{val\/}}, {\it{n\/}})\index{s-constl})\index{len} $=$ {\rm{fix}}\,({\it{n\/}})
\end{tabbing}

\begin{verbatim}; no LPE of course

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-lc-s-constl \\ \index{a2-lc-s-constl}
({\it{n\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ ({\rm{l}}\,({\rm{s-constl}}\,({\it{val\/}}, {\it{n\/}})\index{s-constl})\index{l} $=$ {\it{val\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-pc-s-constl \\ \index{a2-pc-s-constl}
{\rm{p}}\,({\rm{s-constl}}\,({\it{val\/}}, {\it{n\/}})\index{s-constl})\index{p} $=$ {\rm{s-constl}}\,({\it{val\/}}, {\it{n\/}} $-\;1$)\index{s-constl}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-hc-s-constl \\ \index{a2-hc-s-constl}
({\it{n\/}} $\not\simeq {\tt{0}}$) $\rightarrow$ ({\rm{h}}\,({\rm{s-constl}}\,({\it{val\/}}, {\it{n\/}})\index{s-constl})\index{h} $=$ {\it{val\/}})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bc-s-constl \\ \index{a2-bc-s-constl}
{\rm{b}}\,({\rm{s-constl}}\,({\it{val\/}}, {\it{n\/}})\index{s-constl})\index{b} $=$ {\rm{s-constl}}\,({\it{val\/}}, {\it{n\/}} $-\;1$)\index{s-constl}
\end{tabbing}

\begin{verbatim}; A2-BNC-S-ConstL is a bit deep...  We haven't needed it anywhere, 
; but we prove it just to show off!  Yeeeahh!

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-bnc-s-constl \\ \index{a2-bnc-s-constl}
{\rm{bn}}\,({\it{n\/}}, {\rm{s-constl}}\,({\it{val\/}}, {\it{m\/}})\index{s-constl})\index{bn} $=$ {\rm{s-constl}}\,({\it{val\/}}, {\it{m\/}} $-$ {\it{n\/}})\index{s-constl}
\end{tabbing}

\begin{verbatim}; Back in multadd.bm (Paillet#7) we noticed that S-ConstL was quite
; virulent and counter-productive, i.e. failed proofs expensively, 
; so:

\end{verbatim}
\noindent{\sc Event}:   Disable s-constl.

\addvspace{18pt}

\begin{verbatim};; BOOLP:

; Note: we experimented w/ Hunt's def: (or (truep u) (falsep u)) 
; and it doesn't seem to make any difference whatsoever, so we 
; stick with ours.

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{boolp}$\;\;$
{\rm{boolp}}\,({\it{u\/}})\index{boolp} $=$ (({\it{u\/}} $=$ {\bf{t}}) $\vee$ ({\it{u\/}} $=$ {\bf{f}}))
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{s-boolp} \\  
\=\+{\rm{s-boolp}}\,({\it{x\/}})\index{s-boolp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\it{x\/}} $=$ {\sc{e}}\index{e} \\ 
{\bf else }{\rm{boolp}}\,({\rm{l}}\,({\it{x\/}})\index{l})\index{boolp} $\wedge$ {\rm{s-boolp}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{s-boolp}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; Sometime we just want this weaker fact around, and disabling 
; S-boolp saves big.
; Note that S-boolp-P is true even without the hypothesis:
; (not (empty x)). The question is whether we want it to be applied
; in cases when that hyp. is not known...
\end{verbatim}\begin{tabbing}{\sc Theorem}:  s-boolp-p \\ \index{s-boolp-p}
(($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\wedge$ {\rm{s-boolp}}\,({\it{x\/}})\index{s-boolp}) $\rightarrow$ {\rm{s-boolp}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{s-boolp}
\end{tabbing}

\noindent{\sc Event}:   Disable s-boolp-p.

\addvspace{18pt}


\begin{verbatim};;; MISCELLANEOUS BOOLEAN IDENTITIES extended to S versions:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  s-and-x-x \\ \index{s-and-x-x}
{\rm{s-boolp}}\,({\it{x\/}})\index{s-boolp} $\rightarrow$ ({\rm{s-and}}\,({\it{x\/}}, {\it{x\/}})\index{s-and} $=$ {\it{x\/}})
\end{tabbing}
 
\begin{tabbing}{\sc Theorem}:  s-or-not-x-x \\ \index{s-or-not-x-x}
{\rm{s-boolp}}\,({\it{x\/}})\index{s-boolp} $\rightarrow$ ({\rm{s-or}}\,({\rm{s-not}}\,({\it{x\/}})\index{s-not}, {\it{x\/}})\index{s-or} $=$ {\rm{s-const}}\,({\bf{t}}, {\it{x\/}})\index{s-const})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  s-and-x-t \\ \index{s-and-x-t}
{\rm{s-boolp}}\,({\it{x\/}})\index{s-boolp} $\rightarrow$ ({\rm{s-and}}\,({\it{x\/}}, {\rm{s-const}}\,({\bf{t}}, {\it{x\/}})\index{s-const})\index{s-and} $=$ {\it{x\/}})
\end{tabbing}

\begin{verbatim};;; INDUCTION SCHEMES which correspond to our SYSD definitions and
;;; theory:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{induct-p} \\  
\=\+{\rm{induct-p}}\,({\it{x1\/}})\index{induct-p} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x1\/}})\index{empty}$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{induct-p}}\,({\rm{p}}\,({\it{x1\/}})\index{p})\index{induct-p}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{induct-p2} \\  
\=\+{\rm{induct-p2}}\,({\it{x1\/}}, {\it{x2\/}})\index{induct-p2} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x1\/}})\index{empty}$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{induct-p2}}\,({\rm{p}}\,({\it{x1\/}})\index{p}, {\rm{p}}\,({\it{x2\/}})\index{p})\index{induct-p2}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{induct-p3} \\  
\=\+{\rm{induct-p3}}\,({\it{x1\/}}, {\it{x2\/}}, {\it{x3\/}})\index{induct-p3} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x1\/}})\index{empty}$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{induct-p3}}\,({\rm{p}}\,({\it{x1\/}})\index{p}, {\rm{p}}\,({\it{x2\/}})\index{p}, {\rm{p}}\,({\it{x3\/}})\index{p})\index{induct-p3}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{induct-p4} \\  
\=\+{\rm{induct-p4}}\,({\it{x1\/}}, {\it{x2\/}}, {\it{x3\/}}, {\it{x4\/}})\index{induct-p4} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x1\/}})\index{empty}$\;\;${\bf then }{\bf{t}} \\ 
{\bf else }{\rm{induct-p4}}\,({\rm{p}}\,({\it{x1\/}})\index{p}, {\rm{p}}\,({\it{x2\/}})\index{p}, {\rm{p}}\,({\it{x3\/}})\index{p}, {\rm{p}}\,({\it{x4\/}})\index{p})\index{induct-p4}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; eof: th_strspec.bm



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 				TH_TYPES.BM
;;;
;;; This file contains TYPE defns & lemmas for Boyer-Moore, to deal
;;; with standard hardware coding of booleans, numbers, and others.
;;; as well of course as their star extensions.
;;;
;;; Type: NUMERIC BITS
;;;   bitp: predicate.
;;;   bibo: translator: bit to bool (positive logic)
;;;   bobi: translator: bool to bit (positive logic)
;;; Note: experimentation (bcdS, bcdSbi) has revealed that this is
;;;   a BAD way to represent bits.  Booleans are much better.  In
;;;   an industrial setting, this type could disappear.
;;;

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bitp}$\;\;$
{\rm{bitp}}\,({\it{u\/}})\index{bitp} $=$ (({\it{u\/}} $=$ {\tt{0}}) $\vee$ ({\it{u\/}} $=$ {\tt{1}}))
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{s-bitp} \\  
\=\+{\rm{s-bitp}}\,({\it{x\/}})\index{s-bitp} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\it{x\/}} $=$ {\sc{e}}\index{e} \\ 
{\bf else }{\rm{bitp}}\,({\rm{l}}\,({\it{x\/}})\index{l})\index{bitp} $\wedge$ {\rm{s-bitp}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{s-bitp}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; BIBO:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{bibo} \\  
\=\+{\rm{bibo}}\,({\it{bi\/}})\index{bibo} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{bi\/}} $=$ {\tt{0}}$\;\;${\bf then }{\bf{f}} \\ 
{\bf else }{\bf{t}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; star extension generated by: (bmcomb 'bibo '() '(bi))

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{s-bibo} \\  
\=\+{\rm{s-bibo}}\,({\it{bi\/}})\index{s-bibo} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{bi\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{a}}\,({\rm{s-bibo}}\,({\rm{p}}\,({\it{bi\/}})\index{p})\index{s-bibo}, {\rm{bibo}}\,({\rm{l}}\,({\it{bi\/}})\index{l})\index{bibo})\index{a}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; A2-Begin-S-BIBO

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-empty-s-bibo \\ \index{a2-empty-s-bibo}
{\rm{empty}}\,({\rm{s-bibo}}\,({\it{bi\/}})\index{s-bibo})\index{empty} $=$ {\rm{empty}}\,({\it{bi\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-e-s-bibo \\ \index{a2-e-s-bibo}
({\rm{s-bibo}}\,({\it{bi\/}})\index{s-bibo} $=$ {\sc{e}}\index{e}) $=$ {\rm{empty}}\,({\it{bi\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lp-s-bibo \\ \index{a2-lp-s-bibo}
{\rm{len}}\,({\rm{s-bibo}}\,({\it{bi\/}})\index{s-bibo})\index{len} $=$ {\rm{len}}\,({\it{bi\/}})\index{len}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lpe-s-bibo \\ \index{a2-lpe-s-bibo}
{\rm{eqlen}}\,({\rm{s-bibo}}\,({\it{bi\/}})\index{s-bibo}, {\it{bi\/}})\index{eqlen}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-ic-s-bibo \\ \index{a2-ic-s-bibo}
{\rm{s-bibo}}\,({\rm{i}}\,({\it{c\_bi\/}}, {\it{bi\/}})\index{i})\index{s-bibo} $=$ {\rm{i}}\,({\rm{bibo}}\,({\it{c\_bi\/}})\index{bibo}, {\rm{s-bibo}}\,({\it{bi\/}})\index{s-bibo})\index{i}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lc-s-bibo \\ \index{a2-lc-s-bibo}
($\neg$ {\rm{empty}}\,({\it{bi\/}})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{s-bibo}}\,({\it{bi\/}})\index{s-bibo})\index{l} $=$ {\rm{bibo}}\,({\rm{l}}\,({\it{bi\/}})\index{l})\index{bibo})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-pc-s-bibo \\ \index{a2-pc-s-bibo}
{\rm{p}}\,({\rm{s-bibo}}\,({\it{bi\/}})\index{s-bibo})\index{p} $=$ {\rm{s-bibo}}\,({\rm{p}}\,({\it{bi\/}})\index{p})\index{s-bibo}
\end{tabbing}

\begin{verbatim};; A2-End-S-BIBO

;; BOBI:

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

\begin{verbatim}; star extension generated by: (bmcomb 'bobi '() '(bo))

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{s-bobi} \\  
\=\+{\rm{s-bobi}}\,({\it{bo\/}})\index{s-bobi} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{bo\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{a}}\,({\rm{s-bobi}}\,({\rm{p}}\,({\it{bo\/}})\index{p})\index{s-bobi}, {\rm{bobi}}\,({\rm{l}}\,({\it{bo\/}})\index{l})\index{bobi})\index{a}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; A2-Begin-S-BOBI

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-empty-s-bobi \\ \index{a2-empty-s-bobi}
{\rm{empty}}\,({\rm{s-bobi}}\,({\it{bo\/}})\index{s-bobi})\index{empty} $=$ {\rm{empty}}\,({\it{bo\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-e-s-bobi \\ \index{a2-e-s-bobi}
({\rm{s-bobi}}\,({\it{bo\/}})\index{s-bobi} $=$ {\sc{e}}\index{e}) $=$ {\rm{empty}}\,({\it{bo\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lp-s-bobi \\ \index{a2-lp-s-bobi}
{\rm{len}}\,({\rm{s-bobi}}\,({\it{bo\/}})\index{s-bobi})\index{len} $=$ {\rm{len}}\,({\it{bo\/}})\index{len}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lpe-s-bobi \\ \index{a2-lpe-s-bobi}
{\rm{eqlen}}\,({\rm{s-bobi}}\,({\it{bo\/}})\index{s-bobi}, {\it{bo\/}})\index{eqlen}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-ic-s-bobi \\ \index{a2-ic-s-bobi}
{\rm{s-bobi}}\,({\rm{i}}\,({\it{c\_bo\/}}, {\it{bo\/}})\index{i})\index{s-bobi} $=$ {\rm{i}}\,({\rm{bobi}}\,({\it{c\_bo\/}})\index{bobi}, {\rm{s-bobi}}\,({\it{bo\/}})\index{s-bobi})\index{i}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lc-s-bobi \\ \index{a2-lc-s-bobi}
($\neg$ {\rm{empty}}\,({\it{bo\/}})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{s-bobi}}\,({\it{bo\/}})\index{s-bobi})\index{l} $=$ {\rm{bobi}}\,({\rm{l}}\,({\it{bo\/}})\index{l})\index{bobi})
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-pc-s-bobi \\ \index{a2-pc-s-bobi}
{\rm{p}}\,({\rm{s-bobi}}\,({\it{bo\/}})\index{s-bobi})\index{p} $=$ {\rm{s-bobi}}\,({\rm{p}}\,({\it{bo\/}})\index{p})\index{s-bobi}
\end{tabbing}

\begin{verbatim};; A2-End-S-BOBI

;;; eof: th_types.bm



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

\addvspace{18pt}



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