\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}; handrec.bm: a HANDSHAKE RECEIVER piece, Paillet #6
;
;  Note: The same remark as for Serial applies: we were able to get 
;  this whole multi-input circuit through without EQ-LEN hyps, but 
;  that's because of a lucky shot in line Y4 (order made right).
;  The more general version is of course slower and uglier...
;

;;; CIRCUIT in SUGARED form:
#|
(setq sysd '(sy-HANDREC (Xcall Xm)
(Yrcall R F Xcall)
(Y0 S not Yrcall)
(Y1 S and Yrcall Yhear)
(Y2 S or Y0 Y1)
(Y3 S and Xcall Y2)
(Y4 S and Xcall Xm)
(Y5 S and Y4 Y0)
(Yhear R F Y3)
(Yinfin R F Y5)
))

(setq handrec '( |#
; BM DEFINITIONS and A2 LEMMAS, generated by BMSYSD:

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{topor-sy-handrec} \\  
\=\+{\rm{topor-sy-handrec}}\,({\it{ln\/}})\index{topor-sy-handrec} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{ln\/}} $=$ {\tt{'}}{\tt{yrcall}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y0}}$\;\;${\bf then }{\tt{1}} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y1}}$\;\;${\bf then }{\tt{1}} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y2}}$\;\;${\bf then }{\tt{2}} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y3}}$\;\;${\bf then }{\tt{3}} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y4}}$\;\;${\bf then }{\tt{1}} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y5}}$\;\;${\bf then }{\tt{2}} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{yhear}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{yinfin}}$\;\;${\bf then }{\tt{0}} \\ 
{\bf else }{\tt{0}}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{tabbing}{\sc Definition}:\index{sy-handrec} \\  
\=\+{\rm{sy-handrec}}\,({\it{ln\/}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{ln\/}} $=$ {\tt{'}}{\tt{yrcall}} \\ 
{\bf then }\=\+{\bf if }{\rm{empty}}\,({\it{xcall\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{i}}\,({\bf{f}}, {\rm{p}}\,({\it{xcall\/}})\index{p})\index{i}$\;${\bf  endif}\- \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y0}}$\;\;${\bf then }{\rm{s-not}}\,({\rm{sy-handrec}}\,({\tt{'}}{\tt{yrcall}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\index{s-not} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y1}} \\ 
{\bf then }{\rm{s-and}}\,(\=\+{\rm{sy-handrec}}\,({\tt{'}}{\tt{yrcall}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec}, \\ 
{\rm{sy-handrec}}\,({\tt{'}}{\tt{yhear}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\-\index{s-and} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y2}} \\ 
{\bf then }{\rm{s-or}}\,({\rm{sy-handrec}}\,({\tt{'}}{\tt{y0}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec}, {\rm{sy-handrec}}\,({\tt{'}}{\tt{y1}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\index{s-or} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y3}}$\;\;${\bf then }{\rm{s-and}}\,({\it{xcall\/}}, {\rm{sy-handrec}}\,({\tt{'}}{\tt{y2}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\index{s-and} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y4}}$\;\;${\bf then }{\rm{s-and}}\,({\it{xcall\/}}, {\it{xm\/}})\index{s-and} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y5}} \\ 
{\bf then }{\rm{s-and}}\,({\rm{sy-handrec}}\,({\tt{'}}{\tt{y4}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec}, {\rm{sy-handrec}}\,({\tt{'}}{\tt{y0}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\index{s-and} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{yhear}} \\ 
{\bf then }\=\+{\bf if }{\rm{empty}}\,({\it{xcall\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{i}}\,({\bf{f}}, {\rm{sy-handrec}}\,({\tt{'}}{\tt{y3}}, {\rm{p}}\,({\it{xcall\/}})\index{p}, {\rm{p}}\,({\it{xm\/}})\index{p})\index{sy-handrec})\index{i}$\;${\bf  endif}\- \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{yinfin}} \\ 
{\bf then }\=\+{\bf if }{\rm{empty}}\,({\it{xcall\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{i}}\,({\bf{f}}, {\rm{sy-handrec}}\,({\tt{'}}{\tt{y5}}, {\rm{p}}\,({\it{xcall\/}})\index{p}, {\rm{p}}\,({\it{xm\/}})\index{p})\index{sy-handrec})\index{i}$\;${\bf  endif}\- \\ 
{\bf else }{\rm{sfix}}\,({\it{xcall\/}})\index{sfix}$\;${\bf  endif}\-\-
\end{tabbing}

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

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-empty-sy-handrec \\ \index{a2-empty-sy-handrec}
\=\+({\rm{len}}\,({\it{xcall\/}})\index{len} $=$ {\rm{len}}\,({\it{xm\/}})\index{len}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{empty}}\,({\rm{sy-handrec}}\,({\it{ln\/}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\index{empty} $=$ {\rm{empty}}\,({\it{xcall\/}})\index{empty})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-e-sy-handrec \\ \index{a2-e-sy-handrec}
\=\+({\rm{len}}\,({\it{xcall\/}})\index{len} $=$ {\rm{len}}\,({\it{xm\/}})\index{len}) \\ 
$\rightarrow$$\;\;\;\;$(({\rm{sy-handrec}}\,({\it{ln\/}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec} $=$ {\sc{e}}\index{e}) $=$ {\rm{empty}}\,({\it{xcall\/}})\index{empty})\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  a2-lpe-sy-handrec \\ \index{a2-lpe-sy-handrec}
({\rm{len}}\,({\it{xcall\/}})\index{len} $=$ {\rm{len}}\,({\it{xm\/}})\index{len}) $\rightarrow$ {\rm{eqlen}}\,({\rm{sy-handrec}}\,({\it{ln\/}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec}, {\it{xcall\/}})\index{eqlen}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-pc-sy-handrec \\ \index{a2-pc-sy-handrec}
\=\+({\rm{len}}\,({\it{xcall\/}})\index{len} $=$ {\rm{len}}\,({\it{xm\/}})\index{len}) \\ 
$\rightarrow$$\;\;\;\;$({\rm{p}}\,({\rm{sy-handrec}}\,({\it{ln\/}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\index{p} $=$ {\rm{sy-handrec}}\,({\it{ln\/}}, {\rm{p}}\,({\it{xcall\/}})\index{p}, {\rm{p}}\,({\it{xm\/}})\index{p})\index{sy-handrec})\-
\end{tabbing}

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

;;; Circuit CORRECTNESS /Paillet:

; The first correctness formula derived from the temporal logic spec
; is below, suitably accounting for the initial value output by the 
; circuit.
; Optimization notes: disabling:
;  - EMPTY alone helps in cases: 20 -> 8, but little in time: 
; 56 -> 51
;  - LEN alone helps a little in cases: 20 -> 16, a little in
; time: 56 -> 47
; both results in 16 cases (because STR-L-I fails) and 36s.
; Enabling STR-L-I2 then reduces to 4 cases and 25s.
;  
\end{verbatim}\begin{tabbing}{\sc Theorem}:  correct-handrec-hear-l \\ \index{correct-handrec-hear-l}
\=\+(($\neg$ {\rm{empty}}\,({\it{xcall\/}})\index{empty}) $\wedge$ {\rm{s-boolp}}\,({\it{xcall\/}})\index{s-boolp} $\wedge$ ({\rm{len}}\,({\it{xcall\/}})\index{len} $=$ {\rm{len}}\,({\it{xm\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{l}}\,({\rm{sy-handrec}}\,({\tt{'}}{\tt{yhear}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\index{l} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\rm{p}}\,({\it{xcall\/}})\index{p})\index{empty}$\;\;${\bf then }{\bf{f}} \\ 
{\bf else }{\rm{l}}\,({\rm{p}}\,({\it{xcall\/}})\index{p})\index{l}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{verbatim}; naturally we can weaken this theorem to look like Paillet:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  correct-handrec-hear-paillet \\ \index{correct-handrec-hear-paillet}
\=\+(($\neg$ {\rm{empty}}\,({\rm{p}}\,({\it{xcall\/}})\index{p})\index{empty}) $\wedge$ {\rm{s-boolp}}\,({\it{xcall\/}})\index{s-boolp} $\wedge$ ({\rm{len}}\,({\it{xcall\/}})\index{len} $=$ {\rm{len}}\,({\it{xm\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{l}}\,({\rm{sy-handrec}}\,({\tt{'}}{\tt{yhear}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\index{l} $=$ {\rm{l}}\,({\rm{p}}\,({\it{xcall\/}})\index{p})\index{l})\-
\end{tabbing}
\begin{verbatim}; Note: we can also obtain it DIRECTLY w/ the same blastful 
; induction:
; (induct (induct-P2 Xcall Xm))
; (expand (sy-HANDREC 'Yhear Xcall Xm) 
;	 (SY-HANDREC 'Y3 (P XCALL) (P XM))
;	 (SY-HANDREC 'Y2 (P XCALL) (P XM))
;	 (SY-HANDREC 'Y0 (P XCALL) (P XM))
;	 (SY-HANDREC 'Y1 (P XCALL) (P XM))
;	 )

; Of course, from there with a APL-split we get the string version:
; note: disabling LEN here works fine. (Never tried it enabled 
; though.)

\end{verbatim}\begin{tabbing}{\sc Theorem}:  apl-split \\ \index{apl-split}
\=\+(($\neg$ {\rm{empty}}\,({\it{xcall\/}})\index{empty}) $\wedge$ ({\rm{len}}\,({\it{xcall\/}})\index{len} $=$ {\rm{len}}\,({\it{xm\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{sy-handrec}}\,({\tt{'}}{\tt{yhear}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec} \\ 
$=$$\;\;\;\;${\rm{a}}\,(\=\+{\rm{p}}\,({\rm{sy-handrec}}\,({\tt{'}}{\tt{yhear}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\index{p}, \\ 
{\rm{l}}\,({\rm{sy-handrec}}\,({\tt{'}}{\tt{yhear}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\index{l})\-\index{a})\-\-
\end{tabbing}

\begin{verbatim}; Note: A-P-L is required here. The fact that it wasn't in handreco
; is probably a freak...

\end{verbatim}\begin{tabbing}{\sc Theorem}:  correct-handrec-hear-s \\ \index{correct-handrec-hear-s}
\=\+({\rm{s-boolp}}\,({\it{xcall\/}})\index{s-boolp} $\wedge$ ({\rm{len}}\,({\it{xcall\/}})\index{len} $=$ {\rm{len}}\,({\it{xm\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{sy-handrec}}\,({\tt{'}}{\tt{yhear}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{xcall\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{i}}\,({\bf{f}}, {\rm{p}}\,({\it{xcall\/}})\index{p})\index{i}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{verbatim}; We can also get the string equality directly by a blastful 
; induction:
; Note also that disabling LEN here is a MAJOR win: 20 cases -> 1,
; time: 31s -> 8s.
; Note also that disabling EMPTY fails the proof.  We're probably 
; missing some crucial substitute for it.  Since it's not recursive
; it may not be worth it to worry about it...

\end{verbatim}\begin{tabbing}{\sc Theorem}:  correct-handrec-hear-s2 \\ \index{correct-handrec-hear-s2}
\=\+({\rm{s-boolp}}\,({\it{xcall\/}})\index{s-boolp} $\wedge$ ({\rm{len}}\,({\it{xcall\/}})\index{len} $=$ {\rm{len}}\,({\it{xm\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{sy-handrec}}\,({\tt{'}}{\tt{yhear}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\rm{empty}}\,({\it{xcall\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{i}}\,({\bf{f}}, {\rm{p}}\,({\it{xcall\/}})\index{p})\index{i}$\;${\bf  endif}\-)\-\-
\end{tabbing}

\begin{verbatim}; As for INFIN, the correctness property is rather trivial, except
; of course that for strings we have to correct for initial 
; values...

; comb_and3.bm: Logical And combinational element, with 3 inputs
; U7-DONE

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{and3}$\;\;$
{\rm{and3}}\,({\it{u1\/}}, {\it{u2\/}}, {\it{u3\/}})\index{and3} $=$ ({\it{u1\/}} $\wedge$ {\it{u2\/}} $\wedge$ {\it{u3\/}})
\end{tabbing}

\begin{verbatim}; Everything below generated by: (bmcomb 'and3 '() '(x1 x2 x3))

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

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

\end{verbatim}\begin{tabbing}{\sc Theorem}:  a2-empty-s-and3 \\ \index{a2-empty-s-and3}
{\rm{empty}}\,({\rm{s-and3}}\,({\it{x1\/}}, {\it{x2\/}}, {\it{x3\/}})\index{s-and3})\index{empty} $=$ {\rm{empty}}\,({\it{x1\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-e-s-and3 \\ \index{a2-e-s-and3}
({\rm{s-and3}}\,({\it{x1\/}}, {\it{x2\/}}, {\it{x3\/}})\index{s-and3} $=$ {\sc{e}}\index{e}) $=$ {\rm{empty}}\,({\it{x1\/}})\index{empty}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lp-s-and3 \\ \index{a2-lp-s-and3}
{\rm{len}}\,({\rm{s-and3}}\,({\it{x1\/}}, {\it{x2\/}}, {\it{x3\/}})\index{s-and3})\index{len} $=$ {\rm{len}}\,({\it{x1\/}})\index{len}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-lpe-s-and3 \\ \index{a2-lpe-s-and3}
{\rm{eqlen}}\,({\rm{s-and3}}\,({\it{x1\/}}, {\it{x2\/}}, {\it{x3\/}})\index{s-and3}, {\it{x1\/}})\index{eqlen}
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-ic-s-and3 \\ \index{a2-ic-s-and3}
\=\+(({\rm{len}}\,({\it{x1\/}})\index{len} $=$ {\rm{len}}\,({\it{x2\/}})\index{len}) $\wedge$ ({\rm{len}}\,({\it{x2\/}})\index{len} $=$ {\rm{len}}\,({\it{x3\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{s-and3}}\,({\rm{i}}\,({\it{c\_x1\/}}, {\it{x1\/}})\index{i}, {\rm{i}}\,({\it{c\_x2\/}}, {\it{x2\/}})\index{i}, {\rm{i}}\,({\it{c\_x3\/}}, {\it{x3\/}})\index{i})\index{s-and3} \\ 
$=$$\;\;\;\;${\rm{i}}\,({\rm{and3}}\,({\it{c\_x1\/}}, {\it{c\_x2\/}}, {\it{c\_x3\/}})\index{and3}, {\rm{s-and3}}\,({\it{x1\/}}, {\it{x2\/}}, {\it{x3\/}})\index{s-and3})\index{i})\-\-
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  a2-pc-s-and3 \\ \index{a2-pc-s-and3}
{\rm{p}}\,({\rm{s-and3}}\,({\it{x1\/}}, {\it{x2\/}}, {\it{x3\/}})\index{s-and3})\index{p} $=$ {\rm{s-and3}}\,({\rm{p}}\,({\it{x1\/}})\index{p}, {\rm{p}}\,({\it{x2\/}})\index{p}, {\rm{p}}\,({\it{x3\/}})\index{p})\index{s-and3}
\end{tabbing}

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

\begin{tabbing}{\sc Theorem}:  a2-bc-s-and3 \\ \index{a2-bc-s-and3}
\=\+(({\rm{len}}\,({\it{x1\/}})\index{len} $=$ {\rm{len}}\,({\it{x2\/}})\index{len}) $\wedge$ ({\rm{len}}\,({\it{x2\/}})\index{len} $=$ {\rm{len}}\,({\it{x3\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{b}}\,({\rm{s-and3}}\,({\it{x1\/}}, {\it{x2\/}}, {\it{x3\/}})\index{s-and3})\index{b} $=$ {\rm{s-and3}}\,({\rm{b}}\,({\it{x1\/}})\index{b}, {\rm{b}}\,({\it{x2\/}})\index{b}, {\rm{b}}\,({\it{x3\/}})\index{b})\index{s-and3})\-
\end{tabbing}

\begin{tabbing}{\sc Theorem}:  a2-bnc-s-and3 \\ \index{a2-bnc-s-and3}
\=\+(({\rm{len}}\,({\it{x1\/}})\index{len} $=$ {\rm{len}}\,({\it{x2\/}})\index{len}) $\wedge$ ({\rm{len}}\,({\it{x2\/}})\index{len} $=$ {\rm{len}}\,({\it{x3\/}})\index{len})) \\ 
$\rightarrow$$\;\;\;\;$({\rm{bn}}\,({\it{n\/}}, {\rm{s-and3}}\,({\it{x1\/}}, {\it{x2\/}}, {\it{x3\/}})\index{s-and3})\index{bn} $=$ {\rm{s-and3}}\,({\rm{bn}}\,({\it{n\/}}, {\it{x1\/}})\index{bn}, {\rm{bn}}\,({\it{n\/}}, {\it{x2\/}})\index{bn}, {\rm{bn}}\,({\it{n\/}}, {\it{x3\/}})\index{bn})\index{s-and3})\-
\end{tabbing}

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

; eof:comb_and3.bm
 ; for spec only

; a stupid local linguistic hack, which we won't always want:
\end{verbatim}\begin{tabbing}{\sc Theorem}:  s-and3-to-s-and2 \\ \index{s-and3-to-s-and2}
{\rm{s-and3}}\,({\it{x1\/}}, {\it{x2\/}}, {\it{x3\/}})\index{s-and3} $=$ {\rm{s-and}}\,({\rm{s-and}}\,({\it{x1\/}}, {\it{x2\/}})\index{s-and}, {\it{x3\/}})\index{s-and}
\end{tabbing}

\noindent{\sc Event}:   Disable s-and3-to-s-and2.

\addvspace{18pt}

\begin{verbatim}; Note: we may need some A2-EMPTY in here, hence no EQ-LEN hyp., 
; but we should not need any e-equalization, hence LEN disabled
 
\end{verbatim}\begin{tabbing}{\sc Theorem}:  correct-handrec-infin-s \\ \index{correct-handrec-infin-s}
\=\+(\=\+($\neg$ {\rm{empty}}\,({\rm{p}}\,({\rm{p}}\,({\it{xcall\/}})\index{p})\index{p})\index{empty}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{empty}}\,({\rm{p}}\,({\it{xm\/}})\index{p})\index{empty}) \\ 
$\wedge$$\;\;\;\;$({\rm{len}}\,({\it{xcall\/}})\index{len} $=$ {\rm{len}}\,({\it{xm\/}})\index{len}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{sy-handrec}}\,({\tt{'}}{\tt{yinfin}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec} \\ 
$=$$\;\;\;\;${\rm{i}}\,({\bf{f}}, {\rm{s-and3}}\,({\rm{p}}\,({\it{xcall\/}})\index{p}, {\rm{p}}\,({\it{xm\/}})\index{p}, {\rm{i}}\,({\bf{t}}, {\rm{s-not}}\,({\rm{p}}\,({\rm{p}}\,({\it{xcall\/}})\index{p})\index{p})\index{s-not})\index{i})\index{s-and3})\index{i})\-\-
\end{tabbing}

\begin{verbatim}; or in terms of last-chars, and obtained from INFIN-S:

\end{verbatim}\begin{tabbing}{\sc Theorem}:  correct-handrec-infin-l \\ \index{correct-handrec-infin-l}
\=\+(\=\+($\neg$ {\rm{empty}}\,({\rm{p}}\,({\rm{p}}\,({\it{xcall\/}})\index{p})\index{p})\index{empty}) \\ 
$\wedge$$\;\;\;\;$($\neg$ {\rm{empty}}\,({\rm{p}}\,({\it{xm\/}})\index{p})\index{empty}) \\ 
$\wedge$$\;\;\;\;$({\rm{len}}\,({\it{xcall\/}})\index{len} $=$ {\rm{len}}\,({\it{xm\/}})\index{len}))\- \\ 
$\rightarrow$$\;\;\;\;$(\=\+{\rm{l}}\,({\rm{sy-handrec}}\,({\tt{'}}{\tt{yinfin}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec})\index{l} \\ 
$=$$\;\;\;\;$({\rm{l}}\,({\rm{p}}\,({\it{xcall\/}})\index{p})\index{l} $\wedge$ {\rm{l}}\,({\rm{p}}\,({\it{xm\/}})\index{p})\index{l} $\wedge$ ($\neg$ {\rm{l}}\,({\rm{p}}\,({\rm{p}}\,({\it{xcall\/}})\index{p})\index{p})\index{l})))\-\-
\end{tabbing}

\begin{verbatim}; To prove the INITIALIZATION PROPERTY for the HANDSHAKE RECEIVER,
; Paillet #6, we take the SYSD definition for the (normal, 
; initialized) sysd, and hand-MODIFY it to be EXPLICITLY
; PARAMETRIZED on the register initial values. Then we prove that
; the right inital input sequence produces the right values in
; the register (lines).

\end{verbatim}\begin{tabbing}{\sc Definition}:\index{sy-handrec-i} \\  
\=\+{\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\it{ln\/}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec-i} \\ 
$=$$\;\;\;\;$\=\+{\bf if }{\it{ln\/}} $=$ {\tt{'}}{\tt{yrcall}} \\ 
{\bf then }\=\+{\bf if }{\rm{empty}}\,({\it{xcall\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{i}}\,({\it{a1\/}}, {\rm{p}}\,({\it{xcall\/}})\index{p})\index{i}$\;${\bf  endif}\- \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y0}} \\ 
{\bf then }{\rm{s-not}}\,({\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{yrcall}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec-i})\index{s-not} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y1}} \\ 
{\bf then }{\rm{s-and}}\,(\=\+{\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{yrcall}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec-i}, \\ 
{\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{yhear}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec-i})\-\index{s-and} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y2}} \\ 
{\bf then }{\rm{s-or}}\,(\=\+{\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{y0}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec-i}, \\ 
{\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{y1}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec-i})\-\index{s-or} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y3}} \\ 
{\bf then }{\rm{s-and}}\,({\it{xcall\/}}, {\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{y2}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec-i})\index{s-and} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y4}}$\;\;${\bf then }{\rm{s-and}}\,({\it{xcall\/}}, {\it{xm\/}})\index{s-and} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{y5}} \\ 
{\bf then }{\rm{s-and}}\,(\=\+{\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{y4}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec-i}, \\ 
{\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{y0}}, {\it{xcall\/}}, {\it{xm\/}})\index{sy-handrec-i})\-\index{s-and} \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{yhear}} \\ 
{\bf then }\=\+{\bf if }{\rm{empty}}\,({\it{xcall\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{i}}\,({\it{a2\/}}, {\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{y3}}, {\rm{p}}\,({\it{xcall\/}})\index{p}, {\rm{p}}\,({\it{xm\/}})\index{p})\index{sy-handrec-i})\index{i}$\;${\bf  endif}\- \\ 
{\bf elseif }{\it{ln\/}} $=$ {\tt{'}}{\tt{yinfin}} \\ 
{\bf then }\=\+{\bf if }{\rm{empty}}\,({\it{xcall\/}})\index{empty}$\;\;${\bf then }{\sc{e}}\index{e} \\ 
{\bf else }{\rm{i}}\,({\it{a3\/}}, {\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{y5}}, {\rm{p}}\,({\it{xcall\/}})\index{p}, {\rm{p}}\,({\it{xm\/}})\index{p})\index{sy-handrec-i})\index{i}$\;${\bf  endif}\- \\ 
{\bf else }{\rm{sfix}}\,({\it{xcall\/}})\index{sfix}$\;${\bf  endif}\-\-
\end{tabbing}

\begin{verbatim}; the correct initialization theorem reads:
; Note: u's are unconstrained characters

\end{verbatim}\begin{tabbing}{\sc Theorem}:  correct-handrec-init \\ \index{correct-handrec-init}
\=\+(({\it{xcall\_i\/}} $=$ {\rm{a}}\,({\rm{a}}\,({\sc{e}}\index{e}, {\bf{f}})\index{a}, {\it{u1\/}})\index{a}) $\wedge$ ({\it{xm\_i\/}} $=$ {\rm{a}}\,({\rm{a}}\,({\sc{e}}\index{e}, {\it{u2\/}})\index{a}, {\it{u3\/}})\index{a})) \\ 
$\rightarrow$$\;\;\;\;$(\=\+({\rm{l}}\,({\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{yrcall}}, {\it{xcall\_i\/}}, {\it{xm\_i\/}})\index{sy-handrec-i})\index{l} $=$ {\bf{f}}) \\ 
$\wedge$$\;\;\;\;$({\rm{l}}\,({\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{yhear}}, {\it{xcall\_i\/}}, {\it{xm\_i\/}})\index{sy-handrec-i})\index{l} $=$ {\bf{f}}) \\ 
$\wedge$$\;\;\;\;$({\rm{l}}\,({\rm{sy-handrec-i}}\,({\it{a1\/}}, {\it{a2\/}}, {\it{a3\/}}, {\tt{'}}{\tt{yinfin}}, {\it{xcall\_i\/}}, {\it{xm\_i\/}})\index{sy-handrec-i})\index{l} $=$ {\bf{f}}))\-\-
\end{tabbing}

\begin{verbatim}#| ))

;; THE REST OF THIS are unneeded (anymore) experiments:

(setq handrec-h1 '(
; we can try to go through the intermediate equations, like 
; Paillet, using the technique we worked out in bcdS, but it's not 
; clear it's worth it!

(defn sy-H1 (ln Xcall Xm)
(if (equal ln 'Yhear)
    (if (empty Xcall) (e) ; by hand
    (if (empty (P Xcall)) (A (e) F) ; by hand
        (I F (S-AND (P XCALL)
		    (S-OR (S-NOT (I F (P (P XCALL))))
			  (S-AND (I F (P (P XCALL)))
				 (SY-H1 'YHEAR (P XCALL) (P XM))))))
	))
(sfix Xcall)
))

;; NOTE that we got the expansion from BM by doing:
;;(dcl dummy ())
;;
;;(prove-lemma x1 ()
;;(implies (and (not (empty Xcall)) (not (empty (P Xcall))))
;;	 (equal (sy-HANDREC 'Yhear Xcall Xm) (dummy)))
;;((expand (sy-HANDREC 'Yhear Xcall Xm)
;;	 (SY-HANDREC 'Y3 (P XCALL) (P XM)) ; grabbing from proof 
;;	 (SY-HANDREC 'Y2 (P XCALL) (P XM)) ; as we went along..
;;	 (SY-HANDREC 'Y0 (P XCALL) (P XM))
;;	 (SY-HANDREC 'Y1 (P XCALL) (P XM))
;;	 )
;; (do-not-induct) (do-not-generalize) 
;; (disable a2-ic-s-not)
;; )
;;)

; H1 is just a GENERALIZED sysd, and our A2 lemmas should still be 
; true. The following were (Sugar) generated by:
; (vp (bma2sysd-aux 'sy-H1 'sy-H1 '(x) '(and or not))) %%NOT-DONE

(prove-lemma Handrec-is-H1 (rewrite)
(equal (sy-HANDREC 'Yhear Xcall Xm)
       (sy-H1 'Yhear Xcall Xm))
((induct (induct-P2 Xcall Xm))
 (expand (sy-HANDREC 'Yhear Xcall Xm)      ; taken straight from Dummy!
	 (SY-HANDREC 'Y3 (P XCALL) (P XM))
	 (SY-HANDREC 'Y2 (P XCALL) (P XM))
	 (SY-HANDREC 'Y0 (P XCALL) (P XM))
	 (SY-HANDREC 'Y1 (P XCALL) (P XM))

	 (sy-H1 'Yhear Xcall Xm)
	 )
 (disable a2-ic-s-not)
 )
)

; then we could prove the same stuff as what we did for SY-HANDREC, 
; but that's a rather backward way to go!


; eof: handrec.bm
))  |#

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