
\ccRefChapter{Algebraic Foundations}
%\label{ChapterRefAlgebraicFoundations}

\ccChapterAuthor{Michael Hemmer}

\section{todo:}
\begin{itemize} 
\item add models to 'has models '
\item Check types in functors 
\item TODO: solve this by using unit normal within text?
      The concept \ccc{FieldWithSqrt} (also FieldWithKthRoot,FieldWithRootOf) 
      implies that the number type is RealEmbeddable, in particular RootOf talks 
      about the real root of an polynomial.\\
      Question: Should FieldWithSqrt refine RealEmbeddable?
      
\end{itemize}

\section{remarks}
\begin{itemize}
\item \ccc{AlgebraicStructureTraits::Is_exact_tag}: 
This tag is provided by \ccc{AlgebraicStructureTraits} since it indicates the 
exactness of algebraic operations, where functors in \ccc{RealEmbeddableTraits}
are considered exact in any case. \\
The exactness covers all functors that are required by the 
algebraic structure concept only. 
That is: an exact \ccc{Field} may have a Sqrt functor that is not exact. \\

\item \ccc{AlgebraicStructureTraits::RootOf} is available as functor only.\\

\item gcd(0,0)=0, in particular gcd(x,0) is allowed now and is the unit normal of x. 
      It fits very well with the definition, 
      \ccc{AlgebraicStructureTraits::Gcd} and avoids handling of special cases. \\

\item \ccc{mod}, \ccc{div}, \ccc{div_mod} and functors:
        It is not that clear, how to choose the sign of the remainder for negative inputs. 
        however, the behavior of div and mod must be consistent: \\
        That is: $ x = qy + r $, where $q= div(x,y)$ and $r = mod(x,y)$.
        
        But, there seems to be no universally observed convention on how to choose 
        the sign. (In particular, the ISO C++ Standard fixes none for the modulo operation 
        on the built-in integral types.)

        Todo: Decide what to do about the sign ambiguity for the Mod operation of Euclidean rings.\\
        Proposal: choose the unit normal (positive) remainder. In other words div is rounded to -oo.\\
        Example: -5 div 3 is -2 rest 1 \\
        This also coincides with the definition of the gcd. 

\item \ccc{AlgebraicStructureTraits::IsSquare}: (is optional)\\
      \ccc{AlgebraicStructureTraits::Sqrt} had a special definition for Integer. \\
        A type may provide this functor even if the set of 
        numbers it models does not contain real square roots in general. 
        The most important example are number types modeling the integers. 
        For them, Sqrt()(x) has to return the largest integer not exceeding 
        the square root of x.\\
        In EXACUS this is used to test an integer to be an perfect square. \\
        \ccc{AlgebraicStructureTraits::IsSquare} has been introduced to avoid this obscure 
        usage of Sqrt.  
\end{itemize}


\section{open questions}
\begin{itemize} 
\item What about \ccc{is_valid}
\item what about \ccc{is_finite}

\item ToInterval vs ToDoubleInterval The old CGAL function \ccc{CGAL::to_interval}
       returns a
      std::pair<double>, we decided to keep the name and interface, since it is not 
      clear yet what is going to happen with the current \ccc{CGAL::Interval_nt}, 
      since there is also boost::interval supporting more than just double as 
      boundary type.\\
      We therefore decided not to use the name ToDoubleInterval in order to keep 
      this name free for more general interval types. \\
      e.g. ToRationalInterval ToBigFloatInterval. \\
      \\ 
      ToDoubleInterval computes for a given real embeddable number $x$ a double interval containing $x$. \\
      NOTE: The type of \ccc{CGAL::Double_interval} is not clear yet. 
      Options are \ccc{CGAL::Interval_nt}, \ccc{boost::interval<double>}
\item What is to be done with the old \ccc{Number_type_traits} ? remove? 
\item What about \ccc{Rational_traits} (EXACUS has a more flexible version called \ccc{Fraction_traits})

\end{itemize}

\section{Classified Reference Pages}

\subsection*{Basics}
\subsubsection*{Basic Concepts}
\ccRefConceptPage{FromSmallIntConstructible}\\
\subsubsection*{Basic Classes}
\ccRefConceptPage{CGAL::Null_tag}\\
\ccRefConceptPage{CGAL::Null_functor}\\


\subsection*{ Algebraic Structure Hierarchy}

\subsubsection*{ Algebraic Structure Concepts}
\ccRefConceptPage{IntegralDomainWithoutDivision}\\
\ccRefConceptPage{IntegralDomain}\\
\ccRefConceptPage{UniqueFactorizationDomain}\\
\ccRefConceptPage{EuclideanRing}\\
\ccRefConceptPage{Field}\\
\ccRefConceptPage{FieldWithSqrt}\\
\ccRefConceptPage{FieldWithKthRoot}\\
\ccRefConceptPage{FieldWithRootOf}

\subsubsection*{Concept AlgebraicStructureTraits}
\ccRefConceptPage{AlgebraicStructureTraits}\\
\ccRefConceptPage{AlgebraicStructureTraits::IsZero}\\
\ccRefConceptPage{AlgebraicStructureTraits::IsOne}\\
\ccRefConceptPage{AlgebraicStructureTraits::Square}\\
\ccRefConceptPage{AlgebraicStructureTraits::Simplify}\\
\ccRefConceptPage{AlgebraicStructureTraits::UnitPart}\\
\ccRefConceptPage{AlgebraicStructureTraits::IntegralDivision}\\
\ccRefConceptPage{AlgebraicStructureTraits::Gcd}\\
\ccRefConceptPage{AlgebraicStructureTraits::DivMod}\\
\ccRefConceptPage{AlgebraicStructureTraits::Div}\\
\ccRefConceptPage{AlgebraicStructureTraits::Mod}\\
\ccRefConceptPage{AlgebraicStructureTraits::Sqrt}\\
\ccRefConceptPage{AlgebraicStructureTraits::IsSquare}\\
\ccRefConceptPage{AlgebraicStructureTraits::KthRoot}\\
\ccRefConceptPage{AlgebraicStructureTraits::RootOf}\\


\subsubsection{Related Classes}
\ccRefIdfierPage{Algebraic_structure_traits}\\

%\subsubsection*{Related Tags }
%\ccRefIdfierPage{CGAL::Integral_domain_without_division_tag}\\
%\ccRefIdfierPage{CGAL::Integral_domain_tag}\\
%\ccRefIdfierPage{CGAL::Field_tag}\\
%\ccRefIdfierPage{CGAL::Field_with_sqrt_tag}\\
%\ccRefIdfierPage{CGAL::Unique_factorization_domain_tag}\\
%\ccRefIdfierPage{CGAL::Euclidean_ring_tag}

\subsubsection{Related Global Functions}

\ccRefIdfierPage{is_zero}\\
\ccRefIdfierPage{is_one}\\
\ccRefIdfierPage{square}\\
\ccRefIdfierPage{simplify}\\
\ccRefIdfierPage{unit_part}\\
\ccRefIdfierPage{integral_division}\\
%\ccRefIdfierPage{is_square}\\
\ccRefIdfierPage{gcd}\\
\ccRefIdfierPage{div_mod}\\
\ccRefIdfierPage{div}\\
\ccRefIdfierPage{mod}\\
\ccRefIdfierPage{sqrt}\\
\ccRefIdfierPage{kth_root}\\
%\ccRefIdfierPage{root_of}\\

\subsection*{Real Embeddable Concept}

\subsubsection{Concept RealEmbeddable}
\ccRefConceptPage{RealEmbeddable}\\

\subsubsection{RealEmbeddableTraits}
\ccRefConceptPage{RealEmbeddableTraits}\\
\ccRefConceptPage{RealEmbeddableTraits::Abs}\\
\ccRefConceptPage{RealEmbeddableTraits::Compare}\\
\ccRefConceptPage{RealEmbeddableTraits::Sign}\\
\ccRefConceptPage{RealEmbeddableTraits::IsZero}\\
\ccRefConceptPage{RealEmbeddableTraits::IsPositive}\\
\ccRefConceptPage{RealEmbeddableTraits::IsNegative}\\
\ccRefConceptPage{RealEmbeddableTraits::ToDouble}\\
\ccRefConceptPage{RealEmbeddableTraits::ToDoubleInterval}\\

\subsubsection{Related Classes}
\ccRefIdfierPage{CGAL::Real_embeddable_traits}

\subsection*{Related Global functions}

\ccRefIdfierPage{abs}\\
\ccRefIdfierPage{compare}\\
\ccRefIdfierPage{sign}\\
\ccRefIdfierPage{is_zero}\\
\ccRefIdfierPage{is_positive}\\
\ccRefIdfierPage{is_negative}\\
\ccRefIdfierPage{to_double}\\
\ccRefIdfierPage{to_interval}\\


\subsection*{Interoperability of Types}
\subsubsection*{Concepts}
\ccRefConceptPage{ExplicitInteroperable}\\
\ccRefConceptPage{ImplicitInteroperable}\\
\subsubsection*{Classes}
\ccRefIdfierPage{Coercion_traits}\\
