% generated by GAPDoc2LaTeX from XML source (Frank Luebeck)
\documentclass[11pt]{report}
\usepackage{a4wide}
\sloppy
\pagestyle{myheadings}
\usepackage{amssymb}
\usepackage[latin1]{inputenc}
\usepackage{makeidx}
\makeindex
\usepackage{color}
\definecolor{DarkOlive}{rgb}{0.1047,0.2412,0.0064}
\definecolor{FireBrick}{rgb}{0.5812,0.0074,0.0083}
\definecolor{RoyalBlue}{rgb}{0.0236,0.0894,0.6179}
\definecolor{RoyalGreen}{rgb}{0.0236,0.6179,0.0894}
\definecolor{RoyalRed}{rgb}{0.6179,0.0236,0.0894}
\definecolor{LightBlue}{rgb}{0.8544,0.9511,1.0000}
\definecolor{Black}{rgb}{0.0,0.0,0.0}
\definecolor{FuncColor}{rgb}{1.0,0.0,0.0}
%% strange name because of pdflatex bug:
\definecolor{Chapter }{rgb}{0.0,0.0,1.0}

\usepackage{fancyvrb}

\usepackage{pslatex}

\usepackage[
        a4paper=true,bookmarks=false,pdftitle={Written with GAPDoc},
        colorlinks=true,backref=page,breaklinks=true,linkcolor=RoyalBlue,
        citecolor=RoyalGreen,filecolor=RoyalRed,
        urlcolor=RoyalRed,pagecolor=RoyalBlue]{hyperref}

% write page numbers to a .pnr log file for online help
\newwrite\pagenrlog
\immediate\openout\pagenrlog =\jobname.pnr
\immediate\write\pagenrlog{PAGENRS := [}
\newcommand{\logpage}[1]{\protect\write\pagenrlog{#1, \thepage,}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\F}{\mathbb{F}}

\newcommand{\GAP}{\textsf{GAP}}

\newsavebox{\backslashbox}
\sbox{\backslashbox}{\texttt{\symbol{92}}}
\newcommand{\bs}{\usebox{\backslashbox}}

\begin{document}

\logpage{[ 0, 0, 0 ]}
\begin{titlepage}
\begin{center}{\Huge \textbf{ResClasses}}\\[1cm]
\markright{\scriptsize \mbox{}\hfill ResClasses \hfill\mbox{}}
{\Large \textbf{ Computations with Residue Classes and their Set-Theoretic Unions }}\\[1cm]
{ ( Version 1.1.1 ) }\\[1cm]
{February 3, 2004}\\[1cm]
\mbox{}\\[2cm]
{\large \textbf{ Stefan Kohl    }}\\
\end{center}\vfill

\mbox{}\\
{\mbox{}\\
\small \noindent \textbf{ Stefan Kohl    } --- Email: \href{mailto://kohl@mathematik.uni-stuttgart.de}{\texttt{kohl@mathematik.uni-stuttgart.de}}\\
 --- Homepage: \href{http://www.cip.mathematik.uni-stuttgart.de/~kohlsn}{\texttt{http://www.cip.mathematik.uni-stuttgart.de/\~{}kohlsn}}\\
 --- Address: \begin{minipage}[t]{8cm}\noindent
 Institut für Geometrie und Topologie \\
 Universität Stuttgart \\
 70550 Stuttgart \\
 Germany \end{minipage}
}\\
\end{titlepage}

\newpage\setcounter{page}{2}
{\small 
\section*{Abstract}
\logpage{[ 0, 0, 2 ]}
 This package for \textsf{GAP} 4 (at least version 4.4) implements set-theoretic unions of residue classes of
the ring $\mathbb{Z}$ of the integers, of its semilocalisations $\Z_{(\pi)}$ at some finite set of primes $\pi$ and of the polynomial rings GF($q$)[$x$] for some prime power $q$ as \textsf{GAP} domains and provides basic functionality for computing with these sets
(intersection, union, difference etc., any of these also when one of the
operands is a finite set of elements). It also implements the above-mentioned
rings $\Z_{(\pi)}$ as \textsf{GAP} domains. }\\[1cm]
{\small 
\section*{Copyright}
\logpage{[ 0, 0, 1 ]}
 {\copyright} 2003 by Stefan Kohl 

 We adopt the copyright regulations of \textsf{GAP} as detailed in the copyright notice in the \textsf{GAP} manual. }\\[1cm]
\newpage

\def\contentsname{Contents\logpage{[ 0, 0, 3 ]}}

\tableofcontents
\newpage

        
\chapter{\textcolor{Chapter }{Preface}}\label{ch:preface}
\logpage{[ 1, 0, 0 ]}
{
  Although all functionality provided by this package is mathematically trivial,
the author thinks that having available a nice and easy-to-use implementation
of residue classes as sets which permits to form unions, intersections and
differences and which interacts smoothly with finite sets of elements w.r.t.
these operations is often useful. The functionality of this package is used in
a group theoretical context by the \textsf{RCWA} package written by the same author. 

 I would be grateful for any bug reports, comments or suggestions.    \vfill \hfill Stefan Kohl   }

         
\chapter{\textcolor{Chapter }{Semilocalizations of the Integers}}\label{ch:Z_pi}
\logpage{[ 2, 0, 0 ]}
{
  In the following we need the semilocalizations $\Z_{(\pi)}$ of the ring of integers as base rings for unions of residue classes. Since
these rings are not already implemented as domains in the \textsf{GAP} library, we had to implement them in this package.  
\section{\textcolor{Chapter }{Defining semilocalizations of the integers}}\label{sec:DefiningZ_pi}
\logpage{[ 2, 1, 0 ]}
{
  

\subsection{\textcolor{Chapter }{Z{\_}pi}}
\logpage{[ 2, 1, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Z{\_}pi( pi )\index{Zpi@\texttt{Z{\_}pi}}
\label{Zpi}
}\hfill{\scriptsize (function)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Z{\_}pi( p )\index{Zpi@\texttt{Z{\_}pi}}
\label{Zpi}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:\ }
the ring $\Z_{(\pi)}$.



 The function also accepts a single prime \mbox{\texttt{p}} instead of the one-element list \texttt{\mbox{\texttt{pi}} = [ \mbox{\texttt{p}} ]} as argument. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> R := Z_pi(2);
  Z_( 2 )
  gap> S := Z_pi([2,5,7]);
  Z_( 2, 5, 7 )
  gap> T := Z_pi([3,11]);
  Z_( 3, 11 )
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsZ{\_}pi}}
\logpage{[ 2, 1, 2 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsZ{\_}pi( R )\index{IsZpi@\texttt{IsZ{\_}pi}}
\label{IsZpi}
}\hfill{\scriptsize (property)}}\\


 Indicates whether \mbox{\texttt{R}} is a ring $\Z_{(\pi)}$ for some set of primes $\pi$. }

 

\subsection{\textcolor{Chapter }{NoninvertiblePrimes}}
\logpage{[ 2, 1, 3 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{NoninvertiblePrimes( R )\index{NoninvertiblePrimes@\texttt{NoninvertiblePrimes}}
\label{NoninvertiblePrimes}
}\hfill{\scriptsize (attribute)}}\\


 The noninvertible primes \mbox{\texttt{pi}} in the semilocalization \mbox{\texttt{R}} of the integers. }

 }

  
\section{\textcolor{Chapter }{Methods for semilocalizations of the integers}}\label{sec:MethodsForZ_pi}
\logpage{[ 2, 2, 0 ]}
{
  

\subsection{\textcolor{Chapter }{\texttt{\symbol{92}}in}}
\logpage{[ 2, 2, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{\texttt{\symbol{92}}in( x, R )\index{in@\texttt{\texttt{\symbol{92}}in}}
\label{in}
}\hfill{\scriptsize (method)}}\\


 Checks whether \mbox{\texttt{x}} is an element of the semilocalization \mbox{\texttt{R}} of the integers. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> 4/7 in R;
  true
  gap> 3/2 in R;
  false
  gap> 17/35 in S;
  false
  gap> 3/17 in S;
  true
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Intersection}}
\logpage{[ 2, 2, 2 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Intersection( R, S )\index{Intersection@\texttt{Intersection}}
\label{Intersection}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the intersection of the semilocalizations \mbox{\texttt{R}} and \mbox{\texttt{S}} of the integers. 



 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> U := Intersection(R,S,T);
  Z_( 2, 3, 5, 7, 11 )
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsSubset}}
\logpage{[ 2, 2, 3 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsSubset( R, S )\index{IsSubset@\texttt{IsSubset}}
\label{IsSubset}
}\hfill{\scriptsize (method)}}\\


 Checks whether \mbox{\texttt{S}} is a subring of \mbox{\texttt{R}}, where \mbox{\texttt{R}} and \mbox{\texttt{S}} are semilocalizations of the integers. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> IsSubset(R,U);
  true
  gap> IsSubset(T,R);
  false
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{StandardAssociate}}
\logpage{[ 2, 2, 4 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{StandardAssociate( R, x )\index{StandardAssociate@\texttt{StandardAssociate}}
\label{StandardAssociate}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the standard associate of \mbox{\texttt{x}} in the semilocalization \mbox{\texttt{R}} of the integers. 



 We define the standard associate of an element of $\Z_{(\pi)}$ by the product of the non-invertible prime factors of its numerator. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> StandardAssociate(R,-6/7);
  2
  gap> StandardAssociate(R,36/5);
  4
  gap> StandardAssociate(U,37/13);
  1
  gap> StandardAssociate(U,36/13);
  36
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{GcdOp}}
\logpage{[ 2, 2, 5 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{GcdOp( R, x, y )\index{GcdOp@\texttt{GcdOp}}
\label{GcdOp}
}\hfill{\scriptsize (method)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Gcd( R, x, y )\index{Gcd@\texttt{Gcd}}
\label{Gcd}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the greatest common divisor of \mbox{\texttt{x}} and \mbox{\texttt{y}} in the semilocalization \mbox{\texttt{R}} of the integers. 



 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> GcdOp(S,-10/3,8/13);
  2
  gap> Gcd(S,90/3,60/17,120/33);
  10
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{LcmOp}}
\logpage{[ 2, 2, 6 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{LcmOp( R, x, y )\index{LcmOp@\texttt{LcmOp}}
\label{LcmOp}
}\hfill{\scriptsize (method)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Lcm( R, x, y )\index{Lcm@\texttt{Lcm}}
\label{Lcm}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the least common multiple of \mbox{\texttt{x}} and \mbox{\texttt{y}} in the semilocalization \mbox{\texttt{R}} of the integers. 



 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> LcmOp(S,-10/3,8/13);
  40
  gap> Lcm(S,90/3,60/17,120/33);
  40
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Factors}}
\logpage{[ 2, 2, 7 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Factors( R, x )\index{Factors@\texttt{Factors}}
\label{Factors}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 a prime factorization of \mbox{\texttt{x}} in the semilocalization \mbox{\texttt{R}} of the integers. 



 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> Factors(U,840);
  [ 2, 2, 2, 3, 5, 7 ]
  gap> Factors(R,840);
  [ 105, 2, 2, 2 ]
  gap> Factors(R,-2/3);
  [ -1/3, 2 ]
  gap> Factors(S,60/17);
  [ 3/17, 2, 2, 5 ]
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsUnit}}
\logpage{[ 2, 2, 8 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsUnit( R, x )\index{IsUnit@\texttt{IsUnit}}
\label{IsUnit}
}\hfill{\scriptsize (method)}}\\


 Checks whether \mbox{\texttt{x}} is a unit in the semilocalization \mbox{\texttt{R}} of the integers. The method returns \texttt{fail} if \mbox{\texttt{x}} is not an element of \mbox{\texttt{R}}. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> IsUnit(S,3/11);
  true
  gap> IsUnit(T,-2);
  true
  gap> IsUnit(T,0);
  false
  gap> IsUnit(T,3);
  false
  gap> IsUnit(T,3/11);
  fail
  
\end{Verbatim}
 }

  }

  }

         
\chapter{\textcolor{Chapter }{Unions of Residue Classes}}\label{ch:UnionsOfResidueClasses}
\logpage{[ 3, 0, 0 ]}
{
   
\section{\textcolor{Chapter }{Defining unions of residue classes}}\label{sec:DefiningUnionsOfResidueClasses}
\logpage{[ 3, 1, 0 ]}
{
  

\subsection{\textcolor{Chapter }{ResidueClass}}
\logpage{[ 3, 1, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{ResidueClass( R, m, r )\index{ResidueClass@\texttt{ResidueClass}}
\label{ResidueClass}
}\hfill{\scriptsize (function)}}\\


 The residue class \mbox{\texttt{r}} mod \mbox{\texttt{m}} of the ring \mbox{\texttt{R}}. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> A := ResidueClass(Integers,3,2);
  The residue class 2(3) of Z
  gap> B := ResidueClass(Z_pi([2,5]),2,1);
  The residue class 1(2) of Z_( 2, 5 )
  gap> B = ResidueClass(Integers,2,1);
  false
  gap> R := PolynomialRing(GF(7),1);;
  gap> x := Indeterminate(GF(7),1);; SetName(x,"x");
  gap> C := ResidueClass(R,x+One(R),3*One(R));
  The residue class Z(7) ( mod x+Z(7)^0 ) of GF(7)[x]
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{ResidueClassUnion}}
\logpage{[ 3, 1, 2 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{ResidueClassUnion( R, m, r )\index{ResidueClassUnion@\texttt{ResidueClassUnion}}
\label{ResidueClassUnion}
}\hfill{\scriptsize (function)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{ResidueClassUnion( R, m, r, included, excluded )\index{ResidueClassUnion@\texttt{ResidueClassUnion}}
\label{ResidueClassUnion}
}\hfill{\scriptsize (function)}}\\


 The union of the residue classes \mbox{\texttt{r}}[ $i$ ] mod \mbox{\texttt{m}} of the ring \mbox{\texttt{R}}. If the arguments \mbox{\texttt{included}} and \mbox{\texttt{excluded}} are given, they denote lists of elements to be added to resp. to be taken away
from the union. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> D := ResidueClassUnion(Integers,6,[2,4]);
  Union of the residue classes 2(6) and 4(6) of Z
  gap> F := ResidueClassUnion(Integers,5,[1,2],[3,8],[-4,1]);
  (Union of the residue classes 1(5) and 2(5) of Z) U [ 3, 8 ] \ [ -4, 1 ]
  gap> G := ResidueClassUnion(R,x,[One(R),5*One(R),6*One(R)],[Zero(R)],[One(R)]);
  <union of 3 residue classes (mod x) of GF(7)[x]> U [ 0*Z(7) ] \ [ Z(7)^0 ]
  gap> H := ResidueClassUnion(Z_pi([2,3]),8,[3,5]);
  <union of 2 residue classes (mod 8) of Z_( 2, 3 )>
  
\end{Verbatim}
 }

 The components of a residue class union as given as arguments in \texttt{ResidueClassUnion} (\ref{ResidueClassUnion}) can be extracted as follows. 

\subsection{\textcolor{Chapter }{Modulus}}
\logpage{[ 3, 1, 3 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Modulus( U )\index{Modulus@\texttt{Modulus}}
\label{Modulus}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
the modulus \mbox{\texttt{m}} of \mbox{\texttt{U}}.

}

 

\subsection{\textcolor{Chapter }{Residues}}
\logpage{[ 3, 1, 4 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Residues( U )\index{Residues@\texttt{Residues}}
\label{Residues}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
the set of residues \mbox{\texttt{r}} of \mbox{\texttt{U}}.



 If an element \mbox{\texttt{el}} of the underlying ring of \mbox{\texttt{U}} is congruent to one of the residues of \mbox{\texttt{U}} modulo the modulus of \mbox{\texttt{U}}, it is contained in \mbox{\texttt{U}}, provided that it is not excluded explicitly ( see \texttt{ExcludedElements} (\ref{ExcludedElements}) ). }

 

\subsection{\textcolor{Chapter }{IncludedElements}}
\logpage{[ 3, 1, 5 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IncludedElements( U )\index{IncludedElements@\texttt{IncludedElements}}
\label{IncludedElements}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
 the set \mbox{\texttt{included}} of single elements of \mbox{\texttt{U}}. 

}

 

\subsection{\textcolor{Chapter }{ExcludedElements}}
\logpage{[ 3, 1, 6 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{ExcludedElements( U )\index{ExcludedElements@\texttt{ExcludedElements}}
\label{ExcludedElements}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
 the set \mbox{\texttt{excluded}} of single elements explicitly not contained in \mbox{\texttt{U}}. 

}

 }

  
\section{\textcolor{Chapter }{Methods for unions of residue classes}}\label{sec:MethodsForResidueClassUnions}
\logpage{[ 3, 2, 0 ]}
{
  

\subsection{\textcolor{Chapter }{String}}
\logpage{[ 3, 2, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{String( U )\index{String@\texttt{String}}
\label{String}
}\hfill{\scriptsize (method)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{String( U, lng )\index{String@\texttt{String}}
\label{String}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 a string representation of the residue class union \mbox{\texttt{U}}. 



 If the argument \mbox{\texttt{lng}} is given its absolute value denotes the length of the returned string; if \mbox{\texttt{lng}} is negative, the result is flushed left, otherwise it is flushed right. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> String(C);
  "ResidueClassUnion( GF(7)[x], x+Z(7)^0, [ Z(7) ] )"
  gap> String(F);
  "ResidueClassUnion( Integers, 5, [ 1, 2 ], [ 3, 8 ], [ -4, 1 ] )"
  gap> String(H);
  "ResidueClassUnion( Z_( 2, 3 ), 8, [ 3, 5 ] )"
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Print}}
\logpage{[ 3, 2, 2 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Print( U )\index{Print@\texttt{Print}}
\label{Print}
}\hfill{\scriptsize (method)}}\\


 Prints the residue class union \mbox{\texttt{U}} in a way similar to what a user has to write in order to create this object. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> Print(C,"\n");
  ResidueClassUnion( GF(7)[x], x+Z(7)^0, [ Z(7) ] )
  gap> Print(F,"\n");
  ResidueClassUnion( Integers, 5, [ 1, 2 ], [ 3, 8 ], [ -4, 1 ] )
  gap> Print(H,"\n");
  ResidueClassUnion( Z_( 2, 3 ), 8, [ 3, 5 ] )
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Display}}
\logpage{[ 3, 2, 3 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Display( U )\index{Display@\texttt{Display}}
\label{Display}
}\hfill{\scriptsize (method)}}\\


 Displays the residue class union \mbox{\texttt{U}} in a nice, human-readable form. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> Display(F);
  
  The union of the residue classes r ( mod 5 ) of Z for r =
  
   1 2
  
  and the elements
  
   3 8
  
  without the elements
  
   -4  1
  
  gap> Display(G);
  
  The union of the residue classes r ( mod x ) of GF(7)[x] for r =
  
  Z(7)^0  -Z(7)^0 Z(7)^5  
  
  and the element
  
  0*Z(7) 
  
  without the element
  
  Z(7)^0 
  
  gap> Display(H);
  
  The union of the residue classes r ( mod 8 ) of Z_( 2, 3 ) for r =
  
   3 5
  
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{\texttt{\symbol{92}}in}}
\logpage{[ 3, 2, 4 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{\texttt{\symbol{92}}in( el, U )\index{in@\texttt{\texttt{\symbol{92}}in}}
\label{in}
}\hfill{\scriptsize (method)}}\\


 Tests whether \mbox{\texttt{el}} is an element of the residue class union \mbox{\texttt{U}}. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> 20 in A;
  true
  gap> -20 in A;
  false
  gap> 1/3 in B;
  true
  gap> 1/5 in B;
  false
  gap> x in G;
  false
  gap> Zero(R) in G;
  true
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsSubset}}
\logpage{[ 3, 2, 5 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsSubset( U1, U2 )\index{IsSubset@\texttt{IsSubset}}
\label{IsSubset}
}\hfill{\scriptsize (method)}}\\


 Checks whether the residue class union \mbox{\texttt{U2}} is a subset of the residue class union \mbox{\texttt{U1}}. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> IsSubset(A,D);
  false
  gap> IsSubset(H,ResidueClass(Z_pi([2,3]),16,11));
  true
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Density}}
\logpage{[ 3, 2, 6 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Density( U )\index{Density@\texttt{Density}}
\label{Density}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
 the natural density of \mbox{\texttt{U}} as a subset of the underlying ring. 



 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> G;
  <union of 3 residue classes (mod x) of GF(7)[x]> U [ 0*Z(7) ] \ [ Z(7)^0 ]
  gap> Density(G);
  3/7
  gap> ResidueClassUnion(Integers,12,[3,5,9]);
  Union of the residue classes 3(6) and 5(12) of Z
  gap> Density(last);
  1/4
  gap> 2*last2;
  Union of the residue classes 6(12) and 10(24) of Z
  gap> Density(last);
  1/8
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Union}}
\logpage{[ 3, 2, 7 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Union( U1, U2 )\index{Union@\texttt{Union}}
\label{Union}
}\hfill{\scriptsize (method)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Union( U, S )\index{Union@\texttt{Union}}
\label{Union}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the union of two residue class unions \mbox{\texttt{U1}} and \mbox{\texttt{U2}} resp. of the residue class union \mbox{\texttt{U}} and the finite set \mbox{\texttt{S}} of elements of the ring \mbox{\texttt{U}} is defined over. 



 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> I := ResidueClassUnion(Integers,6,[1,5]);
  Union of the residue classes 1(6) and 5(6) of Z
  gap> J := ResidueClassUnion(Integers,5,[1,2,3,4]);
  Union of the residue classes 1(5), 2(5), 3(5) and 4(5) of Z
  gap> K := Union(I,J);
  <union of 26 residue classes (mod 30) of Z>
  gap> Residues(K);
  [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24, 
    25, 26, 27, 28, 29 ]
  gap> Union(K,[0]);
  <union of 26 residue classes (mod 30) of Z> U [ 0 ]
  gap> Union(D,I);
  Union of the residue classes 1(3) and 2(3) of Z
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Intersection}}
\logpage{[ 3, 2, 8 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Intersection( U1, U2 )\index{Intersection@\texttt{Intersection}}
\label{Intersection}
}\hfill{\scriptsize (method)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Intersection( U, S )\index{Intersection@\texttt{Intersection}}
\label{Intersection}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the intersection of two residue class unions \mbox{\texttt{U1}} and \mbox{\texttt{U2}} resp. of the residue class union \mbox{\texttt{U}} and the finite set \mbox{\texttt{S}} of elements of the ring \mbox{\texttt{U}} is defined over. 



 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> L := Intersection(I,J);
  <union of 8 residue classes (mod 30) of Z>
  gap> Display(L);
  
  The union of the residue classes r ( mod 30 ) of Z for r =
  
    1  7 11 13 17 19 23 29
  
  gap> cl := List([1..25],i->ResidueClass(Integers,Primes[i],i));;
  gap> cl_int := Intersection(cl);
  The residue class 941584379775558526136539054851975983(
  2305567963945518424753102147331756070) of Z
  gap> List(Primes{[1..25]},p->Representative(cl_int) mod p);
  [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 
    22, 23, 24, 25 ]
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Difference}}
\logpage{[ 3, 2, 9 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Difference( U1, U2 )\index{Difference@\texttt{Difference}}
\label{Difference}
}\hfill{\scriptsize (method)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Difference( U, S )\index{Difference@\texttt{Difference}}
\label{Difference}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the difference of two residue class unions \mbox{\texttt{U1}} and \mbox{\texttt{U2}} resp. of the residue class union \mbox{\texttt{U}} and the finite set \mbox{\texttt{S}} of elements of the ring \mbox{\texttt{U}} is defined over. 



 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> M := Difference(I,J);
  Union of the residue classes 5(30) and 25(30) of Z
  gap> N := Difference(J,I);
  <union of 16 residue classes (mod 30) of Z>
  gap> Display(N);
  
  The union of the residue classes r ( mod 30 ) of Z for r =
  
    2  3  4  6  8  9 12 14 16 18 21 22 24 26 27 28
  
  gap> Difference(Integers,[1,2,3]);
  Z \ [ 1, 2, 3 ]
  gap> Difference(Z_pi([2,3,7]),[1/5,1/55]);
  Z_( 2, 3, 7 ) \ [ 1/55, 1/5 ]
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Iterator}}
\logpage{[ 3, 2, 10 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Iterator( U )\index{Iterator@\texttt{Iterator}}
\label{Iterator}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 an iterator of the residue class union \mbox{\texttt{U}}. 



 Currently, iterators are only implemented for residue class unions of the
integers. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> it := Iterator(F);
  <iterator of a residue class union of Z>
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{NextIterator}}
\logpage{[ 3, 2, 11 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{NextIterator( iter )\index{NextIterator@\texttt{NextIterator}}
\label{NextIterator}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the next element delivered by the iterator \mbox{\texttt{iter}} of some residue class union. 



 Currently, iterators are only implemented for residue class unions of the
integers. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> l := List([1..16],i->NextIterator(it));
  [ 3, 8, 2, -3, 6, -9, 7, -8, 11, -14, 12, -13, 16, -19, 17, -18 ]
  gap> Difference(l,Intersection(F,[-20..20]));
  [  ]
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{\texttt{\symbol{92}}+}}
\logpage{[ 3, 2, 12 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{\texttt{\symbol{92}}+( U, x )\index{+@\texttt{\texttt{\symbol{92}}+}}
\label{+}
}\hfill{\scriptsize (method)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{\texttt{\symbol{92}}+( x, U )\index{+@\texttt{\texttt{\symbol{92}}+}}
\label{+}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the set of sums $u + x$, $u \in U$. 



 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> Display(L+1);
  
  The union of the residue classes r ( mod 30 ) of Z for r =
  
    0  2  8 12 14 18 20 24
  
  gap> L+30 = L;
  true
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{\texttt{\symbol{92}}-}}
\logpage{[ 3, 2, 13 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{\texttt{\symbol{92}}-( U, x )\index{-@\texttt{\texttt{\symbol{92}}-}}
\label{-}
}\hfill{\scriptsize (method)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{\texttt{\symbol{92}}-( x, U )\index{-@\texttt{\texttt{\symbol{92}}-}}
\label{-}
}\hfill{\scriptsize (method)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{\texttt{\symbol{92}}-( U )\index{-@\texttt{\texttt{\symbol{92}}-}}
\label{-}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the set of differences $u - x$, $u \in U$ resp. the set of differences $x - u$, $u \in U$ resp. the set of the additive inverses of the elements of $U$. 



 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> F-7;
  (Union of the residue classes 0(5) and 4(5) of Z) U [ -4, 1 ] \ [ -11, -6 ]
  gap> -L = L;
  true
  gap> -C;
  The residue class Z(7)^4 ( mod x+Z(7)^0 ) of GF(7)[x]
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{\texttt{\symbol{92}}*}}
\logpage{[ 3, 2, 14 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{\texttt{\symbol{92}}*( U, x )\index{*@\texttt{\texttt{\symbol{92}}*}}
\label{*}
}\hfill{\scriptsize (method)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{\texttt{\symbol{92}}*( x, U )\index{*@\texttt{\texttt{\symbol{92}}*}}
\label{*}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the set of products $x \cdot u$, $u \in U$. 



 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> 2*A;
  The residue class 4(6) of Z
  gap> D*17;
  Union of the residue classes 34(102) and 68(102) of Z
  gap> x^3*C;
  The residue class Z(7)*x^3 ( mod x^4+x^3 ) of GF(7)[x]
  gap> 2*Difference(Integers,[1,2,3]);
  (The residue class 0(2) of Z) \ [ 2, 4, 6 ]
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{\texttt{\symbol{92}}/}}
\logpage{[ 3, 2, 15 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{\texttt{\symbol{92}}/( U, x )\index{/@\texttt{\texttt{\symbol{92}}/}}
\label{/}
}\hfill{\scriptsize (method)}}\\
\textbf{\indent Returns:\ }
 the set of quotients $u/x$, $u \in U$. 



 If the result is not a subset of the underlying ring, the method gives up. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> D/2;
  Union of the residue classes 1(3) and 2(3) of Z
  gap> M/5;
  Union of the residue classes 1(6) and 5(6) of Z
  
\end{Verbatim}
 }

 }

  
\section{\textcolor{Chapter }{The categories and families of unions of residue classes}}\label{sec:CategoriesOfUnionsOfResidueClasses}
\logpage{[ 3, 3, 0 ]}
{
  

\subsection{\textcolor{Chapter }{IsUnionOfResidueClasses}}
\logpage{[ 3, 3, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsUnionOfResidueClasses( U )\index{IsUnionOfResidueClasses@\texttt{IsUnionOfResidueClasses}}
\label{IsUnionOfResidueClasses}
}\hfill{\scriptsize (filter)}}\\


 The category of all unions of residue classes. }

 

\subsection{\textcolor{Chapter }{IsUnionOfResidueClassesOfZ}}
\logpage{[ 3, 3, 2 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsUnionOfResidueClassesOfZ( U )\index{IsUnionOfResidueClassesOfZ@\texttt{IsUnionOfResidueClassesOfZ}}
\label{IsUnionOfResidueClassesOfZ}
}\hfill{\scriptsize (filter)}}\\


 The category of all unions of residue classes of $\Z$. }

 

\subsection{\textcolor{Chapter }{IsUnionOfResidueClassesOfZ{\_}pi}}
\logpage{[ 3, 3, 3 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsUnionOfResidueClassesOfZ{\_}pi( U )\index{IsUnionOfResidueClassesOfZpi@\texttt{IsUnionOfResidueClassesOfZ{\_}pi}}
\label{IsUnionOfResidueClassesOfZpi}
}\hfill{\scriptsize (filter)}}\\


 The category of all unions of residue classes of some semilocalization $\Z_{(\pi)}$ of the integers. }

 

\subsection{\textcolor{Chapter }{IsUnionOfResidueClassesOfZorZ{\_}pi}}
\logpage{[ 3, 3, 4 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsUnionOfResidueClassesOfZorZ{\_}pi( U )\index{IsUnionOfResidueClassesOfZorZpi@\texttt{IsUnionOfResidueClassesOfZorZ{\_}pi}}
\label{IsUnionOfResidueClassesOfZorZpi}
}\hfill{\scriptsize (filter)}}\\


 The category of all unions of residue classes of $\Z$ or $\Z_{(\pi)}$. }

 

\subsection{\textcolor{Chapter }{IsUnionOfResidueClassesOfGFqx}}
\logpage{[ 3, 3, 5 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsUnionOfResidueClassesOfGFqx( U )\index{IsUnionOfResidueClassesOfGFqx@\texttt{IsUnionOfResidueClassesOfGFqx}}
\label{IsUnionOfResidueClassesOfGFqx}
}\hfill{\scriptsize (filter)}}\\


 The category of all unions of residue classes of some polynomial ring GF( $q$ )[ $x$ ]. }

 

\subsection{\textcolor{Chapter }{ResidueClassUnionsFamily}}
\logpage{[ 3, 3, 6 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{ResidueClassUnionsFamily( R )\index{ResidueClassUnionsFamily@\texttt{ResidueClassUnionsFamily}}
\label{ResidueClassUnionsFamily}
}\hfill{\scriptsize (function)}}\\


 The family of unions of residue classes of the ring \mbox{\texttt{R}}. 

 The ring \mbox{\texttt{R}} can be accessed as \texttt{UnderlyingRing( ResidueClassUnionsFamily( \mbox{\texttt{R}} ) )}. }

 }

  }

         
\chapter{\textcolor{Chapter }{Installation and auxiliary functions}}\label{ch:InstallationAndAuxiliaryFunctions}
\logpage{[ 4, 0, 0 ]}
{
   
\section{\textcolor{Chapter }{Installation}}\label{sec:Installation}
\logpage{[ 4, 1, 0 ]}
{
  Like any other \textsf{GAP} package, \textsf{ResClasses} must be installed in the \texttt{pkg} subdirectory of the \textsf{GAP} distribution. This is done by extracting the distribution file in this
directory. By default, the package \textsf{ResClasses} is autoloaded, otherwise you can load it via \texttt{LoadPackage( "resclasses" );}. The \textsf{ResClasses} Package needs at least version 4.4 of \textsf{GAP}, is completely written in the \textsf{GAP} language and does neither contain nor require external binaries. For the
documentation the package \textsf{GAPDoc} \cite{GAPDoc} is needed. }

  
\section{\textcolor{Chapter }{Building the manual}}\label{sec:BuildingTheManual}
\logpage{[ 4, 2, 0 ]}
{
  

\subsection{\textcolor{Chapter }{ResClassesBuildManual}}
\logpage{[ 4, 2, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{ResClassesBuildManual(  )\index{ResClassesBuildManual@\texttt{ResClassesBuildManual}}
\label{ResClassesBuildManual}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:\ }
Nothing.



 This function builds the manual of the \textsf{ResClasses} package in the file formats {\LaTeX}, DVI, Postscript, PDF, HTML and ASCII text. This is done using the \textsf{GAPDoc} package by Frank Lübeck and Max Neunhöffer. }

 }

  
\section{\textcolor{Chapter }{The testing routine}}\label{sec:TheTestingRoutine}
\logpage{[ 4, 3, 0 ]}
{
  

\subsection{\textcolor{Chapter }{ResClassesTest}}
\logpage{[ 4, 3, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{ResClassesTest(  )\index{ResClassesTest@\texttt{ResClassesTest}}
\label{ResClassesTest}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:\ }
Nothing.



 Performs tests of the \textsf{ResClasses} package. This function makes use of an adaptation of the test file \texttt{tst/testall.g} of the \textsf{GAP} library to this package. }

 }

  
\section{\textcolor{Chapter }{Changing the viewing format for residue class unions}}\label{sec:ChangingTheClassUnionViewingFormat}
\logpage{[ 4, 4, 0 ]}
{
  

\subsection{\textcolor{Chapter }{ResidueClassUnionViewingFormat}}
\logpage{[ 4, 4, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{ResidueClassUnionViewingFormat( format )\index{ResidueClassUnionViewingFormat@\texttt{ResidueClassUnionViewingFormat}}
\label{ResidueClassUnionViewingFormat}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:\ }
Nothing.



 Switches between a longer and more descriptive (\mbox{\texttt{format}} = \texttt{"long"}) and a shorter and less bulky (\mbox{\texttt{format}} = \texttt{"short"}) viewing format for unions of residue classes. 

 The former is the default and should be used when not many residue classes
have to be displayed or residue classes of different rings are used, but the
latter is usually preferable if it is always clear which the base ring is and
if the printed representation of many residue classes should fit on one
screen. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> ResidueClassUnionViewingFormat("short");
  gap> ResidueClassUnion(Integers,12,[1,4,5,7,10,11]);
  1(3) U 5(6)
  gap> ResidueClassUnionViewingFormat("long");
  gap> ResidueClassUnion(Integers,12,[1,4,5,7,10,11]);
  Union of the residue classes 1(3) and 5(6) of Z
  
\end{Verbatim}
 }

  }

  }

  \def\bibname{References\logpage{[ "Bib", 0, 0 ]}}

\bibliographystyle{alpha}
\bibliography{resclasses.bib}

\def\indexname{Index\logpage{[ "Ind", 0, 0 ]}}


\printindex

\newpage
\immediate\write\pagenrlog{["End"], \arabic{page}];}
\immediate\closeout\pagenrlog
\end{document}
