\begin{Mhelppage}{BooleanSemiRing}{E.~Laugerotte}
  [ImplState=stable,TestState=alpha,DocState=stable]
%\Mproofread{...}{...}{...}

\begin{MInfo}
\eng{boolean semi-ring}
\de{}
\end{MInfo}

%\begin{todo}
%\end{todo}

\begin{MIntro}
\eng{\Mthis\ creates a domain for the semi-ring of booleans.}
\end{MIntro}

\begin{MDetails}
\eng{The domain element \Mthis\Mex{(n)} represents the boolean constant $0$ 
for FALSE if $n=0$, or $1$ for TRUE otherwise.}
  \de{}
\end{MDetails}

\begin{MDomElConst}
\MCall[\Mthis]{n}
\end{MDomElConst}

\begin{MParameters}
\param{n}
\eng{integer.}
\de{}
\end{MParameters}

\begin{MCategories}
\Mup{Cat::SemiRing}
\end{MCategories}

\MRelatedDomains{}

\begin{MDomEntries}
\MDomEntry{zero}
\eng{the boolean constant $0$.}
\de{}
\MDomEntry{one}
\eng{the boolean constant $1$.}
\de{}
\end{MDomEntries}

\MMathMethods

\begin{MMethodDetails}{_plus}
  \infoEng{sum of booleans}
    \infoDe{}  
\call{\Mseq{\Mtype{dom} a1}}
\eng{The sum \Mex{a1+a2+\ldots{}+ak} of booleans is defined to be the boolean 
value $0$ if \Mex{a1=a2=\ldots{}=ak=0}, the boolean value $1$ otherwise.}
\de{}
\eng{This method overloads the function \Mup{_plus}.}
\end{MMethodDetails}

\begin{MMethodDetails}{_mult}
  \infoEng{product of booleans}
    \infoDe{}  
\call{\Mseq{\Mtype{dom} a1}}
\eng{The sum \Mex{a1*a2*\ldots{}*ak} of booleans is defined to be the boolean 
value $1$ if \Mex{a1=a2=\ldots{}=ak=1}, the boolean value $0$ otherwise.}
\de{}
\eng{This method overloads the function \Mup{_mult}.}
\end{MMethodDetails}

\begin{MMethodDetails}{_power}
\infoEng{power of a boolean}
\infoDe{}
\call{\Mtype{dom} a,\Mtype{Dom::Integer} n}
\eng{ The n-th power \Mex{a^n} of the boolean \Mex{a}.}
\de{}
\eng{This method overloads the function \Mup{_power}.}
\end{MMethodDetails}

\MConvMethods

\begin{MMethodDetails}{convert}  
  \infoEng{conversion of an object into a boolean}
  \infoDe{}

\call{\Mtype{any} x}
\eng{This method tries to convert \Mex{x} into a boolean. This is
only possible if \Mex{x} is an integer.}
\de{}
  \end{MMethodDetails}

\begin{MMethodDetails}{convert_to}
    \infoEng{conversion of a boolean into another type}
    \infoDe{}
\call{\Mtype{dom} a, \Mtype{any} T}
\eng{ Tries to convert \Mex{a} into type \Mex{T}. Currently, only a 
conversion into a type of scalars.}
\de{}
\end{MMethodDetails}

\begin{MMethodDetails}{expr}
\infoEng{convert a boolean into an integer}
\infoDe{}
\call{\Mtype{dom} a}
\eng{ This method returns a integer such that generating a boolean from that 
integer would result in \Mex{a}.}
\de{}
\end{MMethodDetails}

\begin{MExample}{ex1}
\eng{This example shows the idempotency of the boolean semi-ring:}
 

\begin{Mexin}
B:=Dom::BooleanSemiRing:
  \end{Mexin}
  \begin{Mexout}
  \end{Mexout}
  \begin{Mexin}
B(0) + B(0);
B(1) + B(1)
  \end{Mexin}
  \begin{Mexout}
                               0

                               1
  \end{Mexout}
\end{MExample}

\begin{MExample}{ex1}
\eng{We can change the domain of scalars:}
  \begin{Mexin}
B::convert_to(B(1), Dom::Integer) + B::convert_to(B(1), Dom::Integer)
  \end{Mexin}
  \begin{Mexout}
                               2
  \end{Mexout}

\end{MExample}

\MSuperDomain{Dom::BaseDomain}

\begin{MAxioms}
  \Mup{Ax::canonicalRep, Ax::normalRep}
\end{MAxioms}

\begin{MChanges}
  \version{3.0}
  \new
\end{MChanges}

\end{Mhelppage}
