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

\begin{MInfo}
\eng{MinMax semiring}
\de{}
\end{MInfo}

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

\begin{MIntro}
\eng{\Mthis\ creates a domain for the MinMax semiring.}
\end{MIntro}

\begin{MDetails}
\eng{The domain element \Mthis\Mex{(x)} represents the constant $x$ in the 
MinMax semiring if $x$ is a real number or real constant, or $\pm\infty$ if 
$x$ is infinity or -infinity.}
\de{}
\end{MDetails}

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

\begin{MParameters}
\param{x}
\eng{real number, infinity or -infinity.}
\de{}
\end{MParameters}

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

\MRelatedDomains{Dom::MaxMinSemiRing, Dom::MaxPlusSemiRing, 
Dom::MinPlusSemiRing}

\begin{MDomEntries}
\MDomEntry{zero}
\eng{the constant infinity.}
\de{}
\MDomEntry{one}
\eng{the constant -infinity.}
\de{}
\end{MDomEntries}

\MMathMethods

\begin{MMethodDetails}{_plus}
  \infoEng{sum of MinMax}
    \infoDe{}  
\call{\Mseq{\Mtype{dom} a1}}
\eng{The sum \Mex{a1+a2+\ldots+ak} is defined to be the smallest 
of real numbers, infinity or -infinity \Mex{a1,a2,\ldots,ak}.}
\de{}
\eng{This method overloads the function \Mup{_plus}.}
\end{MMethodDetails}

\begin{MMethodDetails}{_mult}
  \infoEng{product of MinMax}
    \infoDe{}  
\call{\Mseq{\Mtype{dom} a1}}
\eng{The product \Mex{a1*a2*\Mseq{}*ak} is defined to be the biggest of real 
numbers, infinity or -infinity \Mex{a1,a2,\ldots,ak}.}
\de{}
\eng{This method overloads the function \Mup{_mult}.}
\end{MMethodDetails}

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

\MConvMethods

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

\call{\Mtype{any} x}
\eng{This method tries to convert \Mex{x} into a MinMax scalar. This is
only possible if \Mex{x} is a real number, infinity or -infinity.}
\de{}
  \end{MMethodDetails}

\begin{MMethodDetails}{convert_to}
    \infoEng{conversion of a MinMax scalar 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 MinMax scalar into a real number, infinity or -infinity.}
\infoDe{}
\call{\Mtype{dom} a}
\eng{ This method returns a real number, infinity or -infinity such that 
generating a MinMax scalar from that real number, infinity or -infinity would 
result in \Mex{a}.}
\de{}
\end{MMethodDetails}

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

 \begin{Mexin}
T:=Dom::MinMaxSemiRing:
  \end{Mexin}

 \begin{Mexin}
T(infinity) + T(infinity);
T(3) + T(3)
  \end{Mexin}
 
  \begin{Mexout}
                           infinity

                               3
  \end{Mexout}
\begin{Mexin}
T(6) + T(infinity);
T(6) + T(3);
T(6)*T(-infinity);
T(6)*T(3)
  \end{Mexin}
\begin{Mexout}
                               6

                               3

                               6

                               6
  \end{Mexout}
\end{MExample}

\begin{MExample}{ex2}
\eng{We can use real number and constants:}

  \begin{Mexin}
T(sin(2)) + T(-2.15)*T(PI)
  \end{Mexin}
  \begin{Mexout}
                            sin(2)
  \end{Mexout}
\end{MExample}

\begin{MExample}{ex3}
\eng{We can change the domain of scalars:}

  \begin{Mexin}
T::convert_to(T(1), Dom::Integer) + T::convert_to(T(2), Dom::Integer)
  \end{Mexin}
  \begin{Mexout}
                               3     
  \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}
