% $OpenXM: OpenXM/doc/calc2000/design-outline.tex,v 1.4 2000/04/24 07:17:13 noro Exp $ \section{Integration of Mathematical Software} As Schefstr\"om clarified in \cite{schefstrom}, integration of software tools has three dimensions: data, control, and user interface. Data integration concerns with the exchange of data between different software or same software. OpenMath \cite{OpenMath} and MP (Multi Protocol) \cite{GKW} are, for example, general purpose mathematical data protocols. They provide standard ways to express mathematical objects. For example, \begin{verbatim} 123 \end{verbatim} means the (OpenMath) integer $123$ in OpenMath/XML expression. Control integration concerns with the establishment and management of inter-software communications. Control involves, for example, a way to ask computations to other processes and a method to interrupt computations on servers from a client. RPC, HTTP, MPI, PVM are regarded as a general purpose control protocols or infrastructures. MCP (Mathematical Communication Protocol) by Wang \cite{iamc} is such a protocol for mathematics. Although data and control are orthogonal to each other, real world requires both. The best way to evaluate and to improve such integration schemes is to implement and to use them on various plaftforms. Dalmas et al. \cite{omimp} shows an implementation of OpenMath API, where several systems such as Maple, REDUCE and AXIOM/Aldor are made as servers. MP$+$MCP \cite{iamc} shows a design of server inferface suited for interactive use and its limited implementation on MAXIMA is reported. Lakshman et al. \cite{pseware} proposes functionalities which a server should have and Maple has been encapsulated as a server. These are all attempts to justify thier designs of protocols or architectures, but little is shown about their practical usefulness, especially for developing real applications of distributed computation. In this paper we propose a unified server interface fitting for both interactive use and efficient batch processing. We hope to show its usability by implementing and using it on various platforms. %NetSolve \cite{netsolve}, OpenMath$+$MCP, MP$+$MCP \cite{iamc}, %and MathLink \cite{mathlink} provide both data and control integration. %Each integration method has their own features determined by their %own design goals. \section{Design Outline of OpenXM} %OpenXM (Open message eXchange protocol for Mathematics) %is a project aiming to integrate data, control and user interfaces %with design goals motivated by the followings. %\begin{enumerate} %\item Noro has been involved in the development of %a computer algebra system Risa/Asir \cite{asir}. %An interface for interactive distributed computations was introduced %to Risa/Asir %%% version 950831 released %in 1995. %The model of computation was RPC (remote procedure call). %A robust interruption protocol was provided %by two communication channels %like the File Transfer Protocol (ftp). %As an application of this protocol, %a parallel speed-up was achieved for a Gr\"obner basis computation %to determine all odd order replicable functions %(Noro and McKay \cite{noro-mckay}). %However, the protocol was local in Asir and we thought that we should %design an open protocol. %\item Takayama has developed %a special purpose system Kan/sm1 \cite{kan}, %which is a Gr\"obner engine for the ring of differential operators $D$. %In order to implement algorithms in $D$-modules due to Oaku %(see, e.g., \cite{sst-book}), %factorizations and primary ideal decompositions are necessary. %Kan/sm1 does not have an implementation for these and called %Risa/Asir as a UNIX external program. %This approach was not satisfactory. %Especially, we could not write a clean interface code between these %two systems. %We thought that it is necessary to provide a data and control protocol %for Risa/Asir to work as a server of factorization and primary ideal %decomposition. %\item We have been profited from increasing number %of mathematical software tools. %These are usually ``expert'' systems in one area of mathematics %such as ideals, groups, numbers, polytopes, and so on. %They have their own interfaces and data formats, %which are fine for intensive users of these systems. %However, a unified system will be more convenient %for users who want to explore a new area of mathematics with these %software tools or users who need these systems only occasionally. % %\item We believe that an open integrated system is a future of mathematical %software. %However, it might be just a dream without realizability. %We want to build a prototype of such an open system by using %existing standards, technologies and several mathematical software tools. %We want to see how far we can go with this approach. %\end{enumerate} % %Motivated with these, we started the OpenXM project with the following %fundamental architecture. OpenXM (Open message eXchange protocol for Mathematics) is a project aiming to integrate data, control and user interfaces with the following design goals. \begin{enumerate} \item Communication is an exchange of messages. The messages are classified into three types: DATA, COMMAND, and SPECIAL. They are called OX (OpenXM) messages. Among the three types, {\it OX data messages} wrap mathematical data. We use standards of mathematical data formats such as OpenMath and MP as well as our own data format {\it CMO} ({\it Common Mathematical Object format}). \item Servers, which provide services to other processes, are stack machines. The stack machine is called the {\it OX stack machine}. Existing mathematical software tools are wrapped with this stack machine. Minimal requirements for a target wrapped with the OX stack machine are as follows: \begin{enumerate} \item The target must have a serialized interface such as a character based interface. \item An output of the target must be understandable for computer programs; it should follow a grammar that can be parsed with other software tools. \end{enumerate} \item Any server may have a hybrid interface; it may accept and execute not only stack machine commands, but also its original command sequences. For example, if we send the following string to the {\tt ox\_asir} server (OpenXM server based on Risa/Asir \cite{asir}) \\ \verb+ " fctr(x^100-y^100); " + \\ and call the stack machine command \\ \verb+ SM_executeStringByLocalParser + \\ then the server executes the asir command \\ \verb+ fctr(x^100-y^100); + (factorize $x^{100}-y^{100}$ over ${\bf Q}$) and pushes the result onto the stack. \end{enumerate} OpenXM package is implemented on above fundamental architecture. Currently the following servers are available in the OpenXM package \cite{openxm-web}. \begin{description} \item{\tt ox\_asir} A server for Risa/Asir, a general-purpose computer algebra system. It provides almost all functinalities of Risa/Asir such as polynomial factorization, Gr\"obner basis computation and primary ideal decomposition. \item{\tt ox\_sm1} A server for Kan/sm1 \cite{kan}, a system for computation in the ring of differential operators including computation of Gr\"obner bases and cohomology groups. \item {\tt ox\_phc} A server for PHC pack \cite{phc}, a general-purpose solver for polynomial systems by homotopy continuation. \item {\tt ox\_tigers} A server for TiGERS \cite{tigers}, a system to enumerate all Gr\"obner bases of affine toric ideals. It can be used to determine the state polytope of a given affine toric ideal. \item {\tt ox\_gnuplot} A server for GNUPLOT, a famous plotting tool. \item {\tt ox\_math} A server for Mathematica. \item {\tt OMproxy} A server for translation between CMO and OpenMath/XML expressions. It is written in Java. This module provides Java classes OXmessage, CMO, and SM for the OpenXM protocol, too. \end{description} In addition to these servers, Risa/Asir, Kan/sm1 and Mathematica can act as clients. For example, the following is a command sequence to ask $1+1$ from the Asir client to the {\tt ox\_sm1} server: \begin{verbatim} P = sm1_start(); ox_push_cmo(P,1); ox_push_cmo(P,1); ox_execute_string(P,"add"); ox_pop_cmo(P); \end{verbatim} The OpenXM package is implemented on the OpenXM for TCP/IP, which uses the client-server model. The OpenXM on MPI \cite{MPI} is currently running on Risa/Asir as we will see in Section \ref{section:homog}. In this paper, we discuss only on systems for TCP/IP to concentrate on the core part of our design. Note that a C library interface is available for some servers.