\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 library {\tt{"mlp"}} using the compiled version.

\addvspace{18pt}

\begin{verbatim}; macc.bm
; 	Circuit is similar to acc, but uses multiplication instead of
; addition, i.e. it's a multiplying accumulator.  It's expressed in CSXA form,
; which is the form we've currently settled on.
; NOTE that it has to be initialized with 1 in order to function right! See
; prod0 for what happens with 0-initialization...
;
;;; DEFINITION OF CIRCUIT:
#|
(setq sysd '(sy-macc ( x)
(Ymacc S Times x Ymacc2)
(Ymacc2 R 1 Ymacc)
))

(setq macc '(
; BM DEFINITIONS and A2 LEMMAS, generated by BMSYSD:
|#
; comb_times.bm: Times combinational element.
; U7-DONE

; no character function def since BM already knows about Times..

; Everything below generated by:     (bmcomb 'times '() '(x y))

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

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

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

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

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

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

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

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

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

\begin{tabbing}{\sc Theorem}:  a2-hc-s-times \\ \index{a2-hc-s-times}
\=\+(($\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-times}}\,({\it{x\/}}, {\it{y\/}})\index{s-times})\index{h} $=$ ({\rm{h}}\,({\it{x\/}})\index{h} $*$ {\rm{h}}\,({\it{y\/}})\index{h}))\-
\end{tabbing}

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

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

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

; eof:comb_times.bm


\end{verbatim}\begin{tabbing}{\sc Definition}:\index{topor-sy-macc} \\  
\=\+{\rm{topor-sy-macc}}\,({\it{ln\/}})\index{topor-sy-macc} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{ln\/}} $=$ {\tt{'}}{\tt{ymacc}}$\;\;${\bf then }{\tt{1}} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{ymacc2}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{sy-macc} \\  
\=\+{\rm{sy-macc}}\,({\it{ln\/}}, {\it{x\/}})\index{sy-macc} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{ln\/}} $=$ {\tt{'}}{\tt{ymacc}}$\;\;${\bf then }{\rm{s-times}}\,({\it{x\/}}, {\rm{sy-macc}}\,({\tt{'}}{\tt{ymacc2}}, {\it{x\/}})\index{sy-macc})\index{s-times} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{ymacc2}} \\ 
{\bf then }\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{i}}\,({\tt{1}}, {\rm{sy-macc}}\,({\tt{'}}{\tt{ymacc}}, {\rm{p}}\,({\it{x\/}})\index{p})\index{sy-macc})\index{i}$\;${\bf  endif}\- \\ 
{\bf else }{\rm{sfix}}\,({\it{x\/}})\index{sfix}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};; A2-Begin-SY-MACC

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

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

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

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

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

\begin{verbatim};; A2-End-SY-MACC

;;; SPEC definition:

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

\begin{verbatim}; this is the standard extension from last-char-fun to MLP-string-fun.
\end{verbatim}\begin{tabbing}{\sc Definition}:\index{spec-macc} \\  
\=\+{\rm{spec-macc}}\,({\it{x\/}})\index{spec-macc} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{x\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{a}}\,({\rm{spec-macc}}\,({\rm{p}}\,({\it{x\/}})\index{p})\index{spec-macc}, {\rm{numer-macc}}\,({\it{x\/}})\index{numer-macc})\index{a}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim};;; Circuit CORRECTNESS:

; Macc-correct-ax is a "predicative correctness statement", i.e. what we would
; do if we didn't have functional equality as a specification method, but 
; instead used a purely axiomatic approach.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  macc-correct-ax \\ \index{macc-correct-ax}
($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) $\rightarrow$ ({\rm{l}}\,({\rm{sy-macc}}\,({\tt{'}}{\tt{ymacc}}, {\it{x\/}})\index{sy-macc})\index{l} $=$ {\rm{numer-macc}}\,({\it{x\/}})\index{numer-macc})
\end{tabbing}

\begin{verbatim}; to go to a functional equality once we have the "last" (ax) statement is
; a trivial induction, if we start out with an P-L split which is unnatural
; for BM, so we force it w/ a USE hint of A-p-l-split
; We really would like to use it as a one-time rewrite, but it's a looping
; rule, so we can't.  Instead we have to use it in USE hints, which in case
; of induction, makes things more complex than they should.

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a-p-l-split \\ \index{a-p-l-split}
\=\+($\neg$ {\rm{empty}}\,({\it{x\/}})\index{empty}) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{sy-macc}}\,({\tt{'}}{\tt{ymacc}}, {\it{x\/}})\index{sy-macc} \\ 
$=$$\;\;\;\;${\rm{a}}\,({\rm{p}}\,({\rm{sy-macc}}\,({\tt{'}}{\tt{ymacc}}, {\it{x\/}})\index{sy-macc})\index{p}, {\rm{l}}\,({\rm{sy-macc}}\,({\tt{'}}{\tt{ymacc}}, {\it{x\/}})\index{sy-macc})\index{l})\index{a})\-\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  macc-correct \\ \index{macc-correct}
{\rm{sy-macc}}\,({\tt{'}}{\tt{ymacc}}, {\it{x\/}})\index{sy-macc} $=$ {\rm{spec-macc}}\,({\it{x\/}})\index{spec-macc}
\end{tabbing}

\begin{verbatim}; eof: macc.bm

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