% generated by GAPDoc2LaTeX from XML source (Frank Luebeck)
\documentclass[a4paper,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[pdftex=true,
        a4paper=true,bookmarks=false,pdftitle={Written with GAPDoc},
        pdfcreator={LaTeX with hyperref package / 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,}}
%% were never documented, give conflicts with some additional packages


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

\begin{document}

\logpage{[ 0, 0, 0 ]}
\begin{titlepage}
\begin{center}{\Huge \textbf{\textsf{OpenMath}\mbox{}}}\\[1cm]
\hypersetup{pdftitle=\textsf{OpenMath}}
\markright{\scriptsize \mbox{}\hfill \textsf{OpenMath} \hfill\mbox{}}
{\Large \textbf{\textsf{OpenMath} functionality in GAP\mbox{}}}\\[1cm]
{Version 10.1.0\mbox{}}\\[1cm]
{30 March 2010\mbox{}}\\[1cm]
\mbox{}\\[2cm]
{\large \textbf{Marco Costantini    \mbox{}}}\\
{\large \textbf{Alexander Konovalov    \mbox{}}}\\
{\large \textbf{Andrew Solomon    \mbox{}}}\\
\hypersetup{pdfauthor=Marco Costantini    ; Alexander Konovalov    ; Andrew Solomon    }
\end{center}\vfill

\mbox{}\\
{\mbox{}\\
\small \noindent \textbf{Marco Costantini    } --- Email: \href{mailto://costanti at science dot unitn dot it} {\texttt{costanti at science dot unitn dot it}}\\
 --- Address: \begin{minipage}[t]{8cm}\noindent
 Department of Mathematics\\
 University of Trento\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{Alexander Konovalov    } --- Email: \href{mailto://alexk at mcs dot st-andrews dot ac dot uk} {\texttt{alexk at mcs dot st-andrews dot ac dot uk}}\\
 --- Homepage: \href{http://www.cs.st-andrews.ac.uk/~alexk/} {\texttt{http://www.cs.st-andrews.ac.uk/\texttt{\symbol{126}}alexk/}}\\
 --- Address: \begin{minipage}[t]{8cm}\noindent
 School of Computer Science\\
 University of St Andrews\\
 Jack Cole Building, North Haugh,\\
 St Andrews, Fife, KY16 9SX, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{Andrew Solomon    } --- Email: \href{mailto://andrew at illywhacker dot net} {\texttt{andrew at illywhacker dot net}}\\
 --- Homepage: \href{http://www.illywhacker.net/} {\texttt{http://www.illywhacker.net/}}\\
 --- Address: \begin{minipage}[t]{8cm}\noindent
 Faculty of IT\\
 University of Technology, Sydney\\
 Broadway, NSW 2007\\
 Australia\\
 \end{minipage}
}\\
\end{titlepage}

\newpage\setcounter{page}{2}
{\small 
\section*{Abstract}
\logpage{[ 0, 0, 1 ]}
 \index{SCSCP package@\textsf{OpenMath} package} The \textsf{OpenMath} package provides an \textsf{OpenMath} phrasebook for \textsf{GAP}: it allows \textsf{GAP} users to import and export mathematical objects encoded in \textsf{OpenMath}, for the purpose of exchanging them with other \textsf{OpenMath}-enabled applications. \mbox{}}\\[1cm]
{\small 
\section*{Copyright}
\logpage{[ 0, 0, 2 ]}
 The \textsf{OpenMath} package is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version. For details, see the FSF's own site \href{http://www.gnu.org/licenses/gpl.html} {\texttt{http://www.gnu.org/licenses/gpl.html}}. 

 Additionally, the \textsf{OpenMath} package contains code developed at INRIA (copyright INRIA), under the ESPRIT
project number 24969 (\textsf{OpenMath}). The user may not use the library in commercial products without seeking
permission from the \textsf{GAP} group (support@gap-system.org) and the CAFE team at INRIA SA
(stephane.dalmas@sophia.inria.fr). \mbox{}}\\[1cm]
{\small 
\section*{Acknowledgements}
\logpage{[ 0, 0, 3 ]}
 On various stages the development of the \textsf{OpenMath} package was supported by: 
\begin{itemize}
\item European Commission through ESPRIT grant EP 24969 ``Accessing and Using Mathematical Information Electronically'' (see 

 \href{http://web.archive.org/web/20040416013945/http://www.nag.co.uk/projects/OpenMath.html} {\texttt{http://web.archive.org/web/20040416013945/http://www.nag.co.uk/projects/OpenMath.html}}).
\item EU FP6 Programme project 026133 ``SCIEnce - Symbolic Computation Infrastructure for Europe'' (see \href{http://www.symbolic-computation.org/} {\texttt{http://www.symbolic-computation.org/}}).
\end{itemize}
 We acknowledge with gratitude this support.

 \mbox{}}\\[1cm]
\newpage

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

\tableofcontents
\newpage

  
\chapter{\textcolor{Chapter }{Introduction and installation}}\label{Intro}
\logpage{[ 1, 0, 0 ]}
\hyperdef{L}{X17FE7D77A82FEB4AB}{}
{
  
\section{\textcolor{Chapter }{Brief description of the package}}\label{IntroIntro}
\logpage{[ 1, 1, 0 ]}
\hyperdef{L}{X17DECBB1287D90D79}{}
{
  The \textsf{GAP} package \textsf{OpenMath} provides an \textsf{OpenMath} phrasebook for \textsf{GAP}: it allows \textsf{GAP} users to import and export mathematical objects encoded in \textsf{OpenMath} for the purpose of exchanging them with other \textsf{OpenMath}-enabled applications. 

 This manual describes: 
\begin{itemize}
\item how to view \textsf{OpenMath} representation of an object;
\item how to read \textsf{OpenMath} object from stream or write it to stream for the purposes of exchange with
another \textsf{OpenMath}-enabled application;
\item how to find which objects can be converted to/from \textsf{OpenMath} using this package;
\item how to extend the package to support private \textsf{OpenMath} content dictionaries.
\end{itemize}
 For the detailed information about \textsf{OpenMath} standard and content dictionaries see the \textsf{OpenMath} homepage \href{http://www.openmath.org} {\texttt{http://www.openmath.org}}. 

 For practical purposes, the \textsf{OpenMath} package will be most efficient if used in conjunction with the \textsf{GAP} package \textsf{SCSCP} (\cite{SCSCPpkg}) which implements the Symbolic Computation Software Composability protocol (\cite{SCSCPspec}). This protocol specifies an \textsf{OpenMath}-based remote procedure call framework, in which all messages (procedure calls
and returns of results of successful computation or error messages) are
encoded in \textsf{OpenMath} using content dictionaries \textsf{scscp1} and \textsf{scscp2} (\cite{scscp1cd}, \cite{scscp2cd}). Using the \textsf{SCSCP} package, \textsf{GAP} can communicate locally or remotely with any other \textsf{OpenMath}-enabled \textsf{SCSCP}-compliant application which may be not only another computer algebra system
but also another instance of the \textsf{GAP} system or even, for example, an external C/C++ or Java application. Such
communication will go into a seamless manner with the \textsf{GAP}/\textsf{OpenMath} conversion going in the background. }

 
\section{\textcolor{Chapter }{Installation of the package}}\label{IntroInstall}
\logpage{[ 1, 2, 0 ]}
\hyperdef{L}{X179E1ED1617D631DCC}{}
{
  To use the \textsf{OpenMath} package it is required to install the \textsf{GAPDoc} package \cite{GAPDoc} to use the help system and parse \textsf{OpenMath} objects in the XML format. 

 To install the \textsf{OpenMath} package, unpack the archive and place the \texttt{openmath} directory in the \texttt{pkg} subdirectory of your \textsf{GAP}4.4 installation. When you don't have write access to the directory of your
main \textsf{GAP} installation, you can also install the package \emph{outside the \textsf{GAP} main directory} by unpacking it inside a directory \texttt{MYGAPDIR/pkg}. Then to be able to load \textsf{OpenMath} you need to call GAP with the \texttt{-l ";MYGAPDIR"} option. 

 The package comes together with the \textsf{OpenMath} C library developed at INRIA and the program \texttt{gpipe} which should be compiled to parse the binary \textsf{OpenMath} format. The compilation should be performed in two stages: first the INRIA
library, and then \texttt{gpipe}. To do this, change to the package directory \texttt{gap4r4/pkg/openmath} and enter the following commands: 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  cd OMCv1.3c/src/
  ./configure
  make
  cd ../../
  ./configure ../../
  make
  
\end{Verbatim}
 However, it is possible to ignore this step if the binary \textsf{OpenMath} format will not be used. }

 }

  
\chapter{\textcolor{Chapter }{\textsf{OpenMath} functionality in \textsf{GAP}}}\label{OpenMathFunctionality}
\logpage{[ 2, 0, 0 ]}
\hyperdef{L}{X17FE774BE829841A0}{}
{
  
\section{\textcolor{Chapter }{Loading the package}}\label{OpenMath}
\logpage{[ 2, 1, 0 ]}
\hyperdef{L}{X87B74F4A17E059AED}{}
{
  The package is loaded as shown below (possibly loading required packages at
the same time). 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> LoadPackage("openmath");
  -----------------------------------------------------------------------------
  Loading  openmath 10.1.0 (OpenMath functionality in GAP)
  by Marco Costantini (costanti@science.unitn.it),
     Alexander Konovalov (http://www.cs.st-andrews.ac.uk/~alexk/), and
     Andrew Solomon (http://www.illywhacker.net/).
  -----------------------------------------------------------------------------
  true
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Viewing \textsf{OpenMath} representation of an object}}\label{ViewOpenMath}
\logpage{[ 2, 2, 0 ]}
\hyperdef{L}{X817CD83817FEDF873}{}
{
  

\subsection{\textcolor{Chapter }{OMPrint}}
\logpage{[ 2, 2, 1 ]}\nobreak
\hyperdef{L}{X17B1815F0178D8312B}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{OMPrint({\slshape obj})\index{OMPrint@\texttt{OMPrint}}
\label{OMPrint}
}\hfill{\scriptsize (function)}}\\


 OMPrint writes the default XML \textsf{OpenMath} encoding of \textsf{GAP} object \mbox{\texttt{\slshape obj}} to the standard output. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> OMPrint( [ 1, 1/2 ] );     
  <OMOBJ>
  	<OMA>
  		<OMS cd="list1" name="list"/>
  		<OMI>1</OMI>
  		<OMA>
  			<OMS cd="nums1" name="rational"/>
  			<OMI>1</OMI>
  			<OMI>2</OMI>
  		</OMA>
  	</OMA>
  </OMOBJ>
  gap> OMPrint( "This is a string" );
  <OMOBJ>
  	<OMSTR>This is a string</OMSTR>
  </OMOBJ>
  gap> OMPrint( 1-2*E(4) );      
  <OMOBJ>
  	<OMA>
  		<OMS cd="complex1" name="complex_cartesian"/>
  		<OMI>1</OMI>
  		<OMI>-2</OMI>
  	</OMA>
  </OMOBJ>
  gap> x:=Indeterminate(Rationals,"x");;
  gap> OMPrint(x^2+1);    
  <OMOBJ>
  	<OMA>
  		<OMS cd="polyd1" name="DMP"/>
  		<OMR href="#polyringepTkNya5l8qdhAmO" />
  		<OMA>
  			<OMS cd="polyd1" name="SDMP"/>
  			<OMA>
  				<OMS cd="polyd1" name="term"/>
  				<OMI>1</OMI>
  				<OMI>2</OMI>
  			</OMA>
  			<OMA>
  				<OMS cd="polyd1" name="term"/>
  				<OMI>1</OMI>
  				<OMI>0</OMI>
  			</OMA>
  		</OMA>
  	</OMA>
  </OMOBJ>
  gap> OMPrint( Group(1,2,3) );
  <OMOBJ>
  	<OMA>
  		<OMS cd="group1" name="group_by_generators"/>
  		<OMA>
  			<OMS cd="permut1" name="permutation"/>
  			<OMI>2</OMI>
  			<OMI>3</OMI>
  			<OMI>1</OMI>
  		</OMA>
  	</OMA>
  </OMOBJ>
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{OMString}}
\logpage{[ 2, 2, 2 ]}\nobreak
\hyperdef{L}{X876AD5BC17A8812C3}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{OMString({\slshape obj})\index{OMString@\texttt{OMString}}
\label{OMString}
}\hfill{\scriptsize (function)}}\\


 OMString returns a string with the default XML \textsf{OpenMath} encoding of \textsf{GAP} object \mbox{\texttt{\slshape obj}}. If used with the \texttt{noomobj} option, then initial and final {\textless}OMOBJ{\textgreater} tags will be
omitted. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> OMString(42);
  "<OMOBJ> <OMI>42</OMI> </OMOBJ>"
  gap> OMString((1,2):noomobj);
  "<OMA> <OMS cd=\"permut1\" name=\"permutation\"/> <OMI>2</OMI> <OMI>1</OMI> </OMA>"
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Writing and reading \textsf{OpenMath} code to/from streams}}\label{ExchangeOpenMath}
\logpage{[ 2, 3, 0 ]}
\hyperdef{L}{X178D84A6517BEFB775}{}
{
  

\subsection{\textcolor{Chapter }{OMGetObject}}
\logpage{[ 2, 3, 1 ]}\nobreak
\hyperdef{L}{X17FBDCB3C83BBB115}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{OMGetObject({\slshape stream})\index{OMGetObject@\texttt{OMGetObject}}
\label{OMGetObject}
}\hfill{\scriptsize (function)}}\\


 \mbox{\texttt{\slshape stream}} is an input stream (see \texttt{InputTextFile} (\textbf{Reference: InputTextFile}), \texttt{InputTextUser} (\textbf{Reference: InputTextUser}), \texttt{InputTextString} (\textbf{Reference: InputTextString}), \texttt{InputOutputLocalProcess} (\textbf{Reference: InputOutputLocalProcess}), \texttt{InputOutputTCPStream} (\textbf{SCSCP: InputOutputTCPStream (for client)}), \texttt{InputOutputTCPStream} (\textbf{SCSCP: InputOutputTCPStream (for server)})) with an \textsf{OpenMath} object on it. \texttt{OMGetObject} takes precisely one object off \mbox{\texttt{\slshape stream}} and returns it as a GAP object. Both XML and binary \textsf{OpenMath} encoding are supported: autodetection is used. This function requires either
that the \textsf{GAP} package \textsf{GAPDoc} is available (for XML \textsf{OpenMath}), or that the external program \texttt{gpipe}, included in this package, has been compiled (for both XML and binary \textsf{OpenMath}). This may be used to retrieve objects from a file, for example: 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> test3:=Filename(DirectoriesPackageLibrary("openmath","tst"),"test3.omt");;
  gap> stream := InputTextFile( test3 );;
  gap> OMGetObject(stream);
  912873912381273891
  gap> OMGetObject(stream);
  E(4)
  gap> CloseStream(stream);
  
\end{Verbatim}
 or it can be used to retrieve them from standard input - one may paste an \textsf{OpenMath} object directly into standard input after issuing GAP with the following
commands: 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> stream := InputTextUser();;
  gap> g := OMGetObject(stream);CloseStream(stream);
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{OMPutObject}}
\logpage{[ 2, 3, 2 ]}\nobreak
\hyperdef{L}{X84FC6AD5872CBF33}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{OMPutObject({\slshape stream, obj})\index{OMPutObject@\texttt{OMPutObject}}
\label{OMPutObject}
}\hfill{\scriptsize (function)}}\\


 \texttt{OMPutObject} writes (appends) the XML \textsf{OpenMath} encoding of the \textsf{GAP} object \mbox{\texttt{\slshape obj}} to output stream \mbox{\texttt{\slshape stream}} (see \texttt{InputTextFile} (\textbf{Reference: InputTextFile}), \texttt{OutputTextUser} (\textbf{Reference: OutputTextUser}), \texttt{OutputTextString} (\textbf{Reference: OutputTextString}), \texttt{InputOutputTCPStream} (\textbf{SCSCP: InputOutputTCPStream (for client)}), \texttt{InputOutputTCPStream} (\textbf{SCSCP: InputOutputTCPStream (for server)})). 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> g := [[1,2],[1,0]];;
  gap> t := "";
  ""
  gap> s := OutputTextString(t, true);;
  gap> OMPutObject(s, g);
  gap> CloseStream(s);
  gap> Print(t);
  <OMOBJ>
  	<OMA>
  		<OMS cd="linalg2" name="matrix"/>
  		<OMA>
  			<OMS cd="linalg2" name="matrixrow"/>
  			<OMI>1</OMI>
  			<OMI>2</OMI>
  		</OMA>
  		<OMA>
  			<OMS cd="linalg2" name="matrixrow"/>
  			<OMI>1</OMI>
  			<OMI>0</OMI>
  		</OMA>
  	</OMA>
  </OMOBJ>
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{OMPlainString}}
\logpage{[ 2, 3, 3 ]}\nobreak
\hyperdef{L}{X85297E7081470DDF}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{OMPlainString({\slshape string})\index{OMPlainString@\texttt{OMPlainString}}
\label{OMPlainString}
}\hfill{\scriptsize (function)}}\\


 \texttt{OMPlainString} wraps the string into a \textsf{GAP} object of a special kind called an \textsf{OpenMath} plain string. Internally such object is represented as a string, but \texttt{OMPutObject} (\ref{OMPutObject}) threat it in a different way: instead of converting it into a
{\textless}OMSTR{\textgreater} object, an \textsf{OpenMath} plain string will be plainly substituted into the output (this explains its
name) without decorating it with {\textless}OMSTR{\textgreater} tags. 

 It is assumed that \textsf{OpenMath} plain string contains valid \textsf{OpenMath} code; no actual validation is performed during its creation. Such
functionality may be useful to compose some \textsf{OpenMath} code at the \textsf{GAP} level to communicate it to the other system, in particular, to send there
symbols which are not supported by \textsf{GAP}, for example: 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> s:=OMPlainString("<OMS cd=\"nums1\" name=\"pi\"/>");
  <OMS cd="nums1" name="pi"/>
  gap> OMPrint(s);                                       
  <OMOBJ>
  	<OMS cd="nums1" name="pi"/>
  </OMOBJ>
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Utilities}}\label{Utilities}
\logpage{[ 2, 4, 0 ]}
\hyperdef{L}{X17DFC90B817DC503A1}{}
{
  

\subsection{\textcolor{Chapter }{OMTest}}
\logpage{[ 2, 4, 1 ]}\nobreak
\hyperdef{L}{X851F202484C56D67}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{OMTest({\slshape obj})\index{OMTest@\texttt{OMTest}}
\label{OMTest}
}\hfill{\scriptsize (function)}}\\


 Converts \mbox{\texttt{\slshape obj}} to \textsf{OpenMath} and back. Returns true iff \mbox{\texttt{\slshape obj}} is unchanged (as a GAP object) by this operation. The \textsf{OpenMath} standard does not stipulate that converting to and from \textsf{OpenMath} should be the identity function so this is a useful diagnostic tool. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> OMTest( [ [1..10],[1/2,2+E(4)], ZmodnZObj(2,6), (1,2), true, "string" ] );     
  true
  
\end{Verbatim}
 }

 }

 }

  
\chapter{\textcolor{Chapter }{Extending the \textsf{OpenMath} package}}\label{ExtendingOpenMath}
\logpage{[ 3, 0, 0 ]}
\hyperdef{L}{X1795882BD17DC3B2E4}{}
{
  
\section{\textcolor{Chapter }{Exploring the range of supported symbols}}\label{Available}
\logpage{[ 3, 1, 0 ]}
\hyperdef{L}{X85022B8D17CFA7B03}{}
{
  \index{OMsymRecord@\texttt{OMsymRecord}} The \textsf{OpenMath} package supports such basic \textsf{OpenMath} objects as integers ( {\textless}OMI{\textgreater} ), character strings (
{\textless}OMSTR{\textgreater} ) and variables (
{\textless}OMVAR{\textgreater} ). Besides that, it supports a number of \textsf{OpenMath} content dictionaries (some of them only partially, dependently on their
relevance to \textsf{GAP}). To see which symbols from which content dictionaries are supported for the
conversion from \textsf{OpenMath} to \textsf{GAP}, explore the global record \texttt{OMsymRecord}. Its components have names of appropriate CDs, and subcomponents of each
component have names of symbols from the corresponding CD. If the value of the
component is not equal to \texttt{fail}, then it contains the function or the object which is used for conversion.
The following example of the entry for the nums1 CD demonstrates a combination
of all possible cases: 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> Print(OMsymRecord.nums1,"\n");
  rec(
    e := fail,
    i := E(4),
    pi := fail,
    based_integer := fail,
    gamma := fail,
    infinity := infinity,
    NaN := fail,
    rational := function ( x )
          return OMgapId( [ OMgap2ARGS( x ), x[1] / x[2] ] )[2];
      end )
  
\end{Verbatim}
 \texttt{OMsymRecord} contains all symbols for which conversion from \textsf{OpenMath} to \textsf{GAP} is supported except some special symbols related with errors and special
procedures from the \textsf{SCSCP} package which are treated separately. 

 To check quickly if \textsf{GAP} can parse a given \textsf{OpenMath} object, copy the \textsf{OpenMath} code and paste it directly into standard input after the following commands: 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> stream := InputTextUser();;
  gap> g := OMGetObject(stream);CloseStream(stream);
  
\end{Verbatim}
 The main tool for the conversion from \textsf{GAP} to \textsf{OpenMath} is \texttt{OMPut( {\textless}stream{\textgreater}, {\textless}object{\textgreater} )}. A number of methods for \texttt{OMPut} are installed in the file \texttt{openmath/gap/omput.gi}. 

 To check quickly whether the object may be converted to \textsf{OpenMath}, call \texttt{OMprint} for that object, for example: 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  
  gap> OMPrint( [ [1..10], ZmodnZObj(2,6), (1,2) ] );                
  <OMOBJ>
  	<OMA>
  		<OMS cd="list1" name="list"/>
  		<OMA>
  			<OMS cd="interval1" name="integer_interval"/>
  			<OMI> 1</OMI>
  			<OMI> 10</OMI>
  		</OMA>
  		<OMA>
  			<OMS cd="integer2" name="class"/>
  			<OMI> 2</OMI>
  			<OMI> 6</OMI>
  		</OMA>
  		<OMA>
  			<OMS cd="permut1" name="permutation"/>
  			<OMI> 2</OMI>
  			<OMI> 1</OMI>
  		</OMA>
  	</OMA>
  </OMOBJ>
  
\end{Verbatim}
 The package is in the continuous development and will support even more
symbols in the future. In the meantime, if you will have any requests for the
support for particular symbols, please write to Alexander Konovalov who
currently develops and maintains the package. }

 
\section{\textcolor{Chapter }{Adding support for private content dictionaries and symbols}}\label{Private}
\logpage{[ 3, 2, 0 ]}
\hyperdef{L}{X17BF61AF183A25921}{}
{
  There is also a way for the user to extend the package adding support for
private and experimental CDs or separate symbols. We allocated the directory \texttt{openmath/private} for this purposes, and currently it contain the file \texttt{private.g} for conversions from \textsf{OpenMath} to \textsf{GAP} and the file \texttt{private.gi} for conversions from \textsf{GAP} to \textsf{OpenMath} for some symbols from private CDs contained in the \texttt{openmath/cds} directory. 

 In particular, we extended the package with the following private \textsf{OpenMath} symbols: 
\begin{itemize}
\item  \texttt{group1.group{\textunderscore}by{\textunderscore}generators} which allows us to input and output groups given by their generators as this
is a natural way to create groups in \textsf{GAP}; 
\item  \texttt{semigroup1.semigroup{\textunderscore}by{\textunderscore}generators} and \texttt{monoid1.monoid{\textunderscore}by{\textunderscore}generators} following the same considerations for semigroups and monoids; 
\item  \texttt{pcgroup1.pcgroup{\textunderscore}by{\textunderscore}pcgscode} for PcGroups given by their pcgs code and order; 
\item  \texttt{record1.record} for records as they are important data structures which we want to pass in a
straightforward manner between different \textsf{GAP} instances; 
\item  \texttt{transform1.transformation} to support transformations, transformation semigroups and their automorphism
groups. 
\end{itemize}
 The file \texttt{private.g} is loaded from \texttt{openmath/gap/new.g}, and the \texttt{private.gi} is loaded from \texttt{openmath/gap/read.g}. If the user would like to add own code, this may be done either by adding it
to these files or by placing additional files in \texttt{openmath/private} directory and load them similarly to \texttt{private.g} and \texttt{private.gi}. We will welcome user's contributions in the form of the code to support
existing content dictionaries from the \textsf{OpenMath} web site or private content dictionaries, if they may be interesting for a
wider community. }

 }

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

\bibliographystyle{alpha}
\bibliography{manual}

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


\printindex

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