<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>New in CoCoA-5.2.2 and CoCoALib-0.99560 for SC-Square</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>John Abbott ?</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Anna M. Bigatti</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dipartimento di Matematica, Universita degli Studi di Genova</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Institut fur Mathematik, Universitat Kassel</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>CoCoA-5 is an interactive Computer Algebra System for Computations in Commutative Algebra, particularly Grobner bases. It o ers a dedicated, mathematician-friendly programming language, with many built-in functions. Its mathematical core is CoCoALib, an opensource C++ library, designed to facilitate integration with other software. We give an overview of the latest developments of the library and of the system, in particular relating to the project SC-Square.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        We brie y recall what is described in [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. The CoCoA project dates back to 1987,
with the rst public release of its interactive system in 1989. The aim has always
been to o er a convenient software laboratory for studying Computational
Commutative Algebra, speci cally ideals of multivariate polynomials (e.g. Grobner
bases).
      </p>
      <p>
        In the last few years the CoCoA software has undergone a profound change
in its internal design: its \mathematical expertise" resides in the C++ software
library [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]; the interactive system [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] uses an interpreter which grants easy access
to CoCoALib's capabilities. All code is free and open source (licence GPL-3).
      </p>
      <p>We give an overview of the latest developments of the library and of the
system (release May 2017). There are some aspects of particular interest to
the project SC2. One is the e cient computation of the minimal polynomial
(Section 3.2) which is the main tool for many operations on 0-dimensional ideals,
and also for studying polynomial systems. Another aspect is rst prototypes in
communication between CoCoA and MathSAT (Section 3.3).</p>
    </sec>
    <sec id="sec-2">
      <title>News about the overall design</title>
      <p>The design of CoCoALib and CoCoA-5 is obviously quite stable (because of their
size and age), so naturally the main changes are the addition of numerous new
functions. There are, nevertheless, a few handy changes in the user experience:
{ verbose mode for printing \internal progress information";
{ clean interrupt handling (including a \timeout" capability).
? J. Abbott is an INdAM-COFUND Marie Curie Fellow
2.1</p>
      <sec id="sec-2-1">
        <title>Verbose mode</title>
        <p>The new function SetVerbosityLevel(N) sets the global verbosity level to N.
Various functions de ned in CoCoALib and in the CoCoA packages print out
some internal progress messages when the global verbosity level is higher than a
certain threshold value. Higher levels trigger greater verbosity, and the manual
entries for each function list the relevant thresholds. This is useful to developers
who want to understand what is happening inside important functions (and also
to the curious).</p>
        <p>
          For instance, the lowest level giving information on the progress of Grobner
bases is 100: everytime a new polynomial is found, a line like this is printed:
myDoGBasis[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]: --New poly in GB: len(GB) = 5 len(pairs) = 2
        </p>
        <p>Besides GBasis, verbose information can be produced by numerous other
functions: for instance, those described in Section 3.2. Indeed, the number of
functions which respond to the verbosity setting is steadily increasing | details
are in the documentation (e.g. in CoCoA-5 type \?verbose").</p>
        <p>Since Grobner Basis computation is quite pervasive in CoCoA its verbosity
threshold level is quite high, whereas in general other functions have levels in the
range 10{99. The values 1-9 are e ectively reserved for user de ned functions,
so that they may be used without triggering any verbosity from CoCoA.</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2 Interrupt handling</title>
        <p>In some hard Grobner basis computations, by setting the verbosity level, one may
see that the number of pairs yet to be processed is unfeasibly high. The user may
then choose to interrupt the computation by typing Ctrl-C: the computation will
be interrupted as soon as the reduction of the current S-polynomial terminates.
The user may instead set a timeout : the calculation is automatically interrupted
after the speci ed computation time.</p>
        <p>This interruption cancels the incomplete Grobner basis computation, and
returns the computer to the state it was in just before the Grobner basis
computation was begun. Doing this correctly is not entirely trivial: thanks to its clean,
exception-safe design, CoCoALib guarantees that no memory has been lost, and
no data has been modi ed.</p>
        <p>The design for doing it is quite simple: it is enough to add a call to the
CoCoALib function CheckForInterrupt in potentially critical loops: this function
checks if the \interrupt ag" has been set, and if so, throws an exception. Thus
it may be used in any function in CoCoALib (even those de ned by users of
CoCoALib, if they have been written in an exception-safe way!), and the number
of interruptible CoCoALib functions is gradually increasing.</p>
        <p>On the other side, all code written in the interpreted CoCoA language is
intrinsically interruptible, with no addition to the code, thanks to the design of
the interpreter of CoCoA-5.</p>
        <p>A small aside: one might like to interrupt a computation, perform some
checks and then decide whether to continue the computation from that stage.
This option is not (yet) implemented.
2.3</p>
      </sec>
      <sec id="sec-2-3">
        <title>Removing old features</title>
        <p>As software develops, sometimes a few old functions become obsolete because a
better design had evolved. For some users this fact is a deterrent to updating to
the latest software release, for fear that their programs would stop working.</p>
        <p>In CoCoA-5 and CoCoAlib we have opted to rst declare such functions
obsolescent, i.e. they will become obsolete in a few years time. We put them into
the special les, obsolescent.cpkg5 for CoCoA-5, and obsolescent.[HC] for
CoCoALib. They still work, but print out a message warning about obsolescence
but also giving useful guidance on the new function to call instead. We use this
approach to allow users time, and provide help, to update their programs.
3</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>News about CoCoA-5 and CoCoALib</title>
      <p>A list of all new functions and features in CoCoA-5 can always be found at the
CoCoA-5 download page, or obtained by running the function RelNotes(). In
addition, a fully detailed description of the work and decisions made for each
release of CoCoA-5 and CoCoALib may be found at the CoCoA Redmine website
https://cocoa.dima.unige.it/redmine.</p>
      <p>Most of the new functions added to CoCoA-5 have actually been added to
CoCoALib, and then made available to CoCoA-5; the remaining few will be
ported to CoCoALib shortly.</p>
      <p>Here we mention some of the more signi cant additions.
Special e ort has always been invested in making the CoCoALib code clean and
portable; it now has a more portable con gure-build-install procedure.</p>
      <p>CoCoALib is currently written using standard C++03; this does mean that
compilation with a C++11 compiler may produce some harmless warnings about
\deprecated" features. A proper update to a newer C++ standard is imminent.
3.2</p>
      <sec id="sec-3-1">
        <title>Minimal polynomials</title>
        <p>It is well-known that if K is a eld and R is a zero-dimensional a ne K-algebra,
i.e. a zero-dimensional algebra of type R = K[x1; : : : ; xn]=I, then R is a
nitedimensional K-vector space. Consequently, it is not surprising that minimal
and characteristic polynomials from Linear Algebra can be successfully used to
detect properties of R. For example, in the quotient ring R = Q[x; y]=(x2; y2)
the minimal polynomial for the residue class of x + y is z3.</p>
        <p>
          This point of view was taken systematically in the book [
          <xref ref-type="bibr" rid="ref12">12</xref>
          ] where the
particular importance of minimal polynomials (rather greater than that of
characteristic polynomials) emerged quite clearly. We studied the theory of minimal
polynomials, developing e cient algorithms to compute them, and nding
practical and e cient applications; here we recall the main results we described in [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ]
and in [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ].
        </p>
        <p>The rst step was to implement in CoCoALib algorithms for computing the
minimal polynomial of an element of R and of a K-endomorphism of R (functions
MinPolyQuotElim, MinPolyQuotMat, MinPolyQuotDef).</p>
        <p>
          For computing minimal polynomials of elements of an algebra over Q we use
a modular approach and the rational reconstruction described in [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]. As always,
various obstacles for termination and correctness had to be overcome. In
particular, we deal with the notion of reduction of an ideal modulo p, introducing the
related notions of ugly, usable, good and bad primes. This is further investigated
in a forthcoming paper [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ].
        </p>
        <p>
          After having made the computation of minimal polynomials quite swift, we
then showed how they can be successfully and e ciently used to compute several
important invariants of zero-dimensional a ne K-algebras. More speci cally,
we described algorithms which determine whether a zero-dimensional ideal is
radical, maximal or primary, and another to compute the radical of a
zerodimensional ideal. (In particular, it is noteworthy that in the case of coe cient
elds of small nite characteristic, Frobenius spaces play a fundamental role,
as described in [
          <xref ref-type="bibr" rid="ref12 ref13">12, 13</xref>
          ]). Finally, we described how to compute the primary
decomposition of a zero-dimensional a ne K-algebra.
        </p>
        <p>
          As we said, all the algorithms described have been implemented in CoCoA.
Their merits are illustrated by the tables of timings in [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ].
        </p>
        <p>The e cient computation of minimal polynomials is also a key ingredient in
solving polynomial systems, and together with the other derived algorithms we
believe we can develop good tools for the SC2community.
3.3</p>
      </sec>
      <sec id="sec-3-2">
        <title>Communication with MathSAT</title>
        <p>
          The philosophy behind CoCoALib prizes ease of use for humans, but also ease
of communication with other systems, as already mentioned in [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ]. There is a
\symbiotic" integration with Normaliz [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ], a system specialized in computations
on a ne monoids, vector con gurations, lattice polytopes, and rational cones.
CoCoALib and CoCoA-5 have functions calling libnormaliz (see [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]), while
NmzIntegrate uses CoCoALib for multivariate polynomial arithmetic.
        </p>
        <p>The rst few steps along these lines have recently been made between
CoCoALib and MathSAT in strict collaboration with Alberto Griggio. In particular,
some practical aspects were discussed, outlining these directions of development:
1. MathSAT using CoCoA's RingTwinFloat arithmetic (instead of arbitrary
precision rationals, GMP mpq);
2. Making a collection of systems of polynomial equalities and inequalities
arising from typical MathSAT computations, to be solved by CoCoALib and
CoCoA-5;
3. enabling CoCoALib to call some of MathSAT's functions;
4. CoCoA-5 o ering a handy interface for MathSAT through CoCoALib;
5. MathSAT using CoCoALib for solving systems of polynomial inequalities.</p>
        <p>The development work since then has reached the following stage:
1. We have a working prototype using just RingTwinFloat which appeared
to make MathSAT faster in those (rare) cases where MathSAT needs very
high precision: MathSAT currently uses a \double arithmetic" adapting to
the computations by using, as necessary, machine integers or GMP mpq; it
is clearly unbeatable when using machine arithmetic, but it's worth further
testing for the cases needing high precision.
2. We made a rst collection of benchmark examples, and tested some of them
in CoCoA-5. Inequalities are not trivially dealt with by CoCoA's algorithms,
but we got very encouraging results in detecting unsat, due to the very
special structure of the examples tested. We now need to design how to make
the conversion to CoCoA-5 of these examples (more) automatic, providing
a wide spectrum of cases to test.
3. The rst prototype of calling MathSAT through CoCoALib is in the
example ex-MathSat1 calling msat solve. This is already part of the
CoCoALib distribution from version 0.99550 (released in May 2017). A more
evolved interface, with a proper CoCoALib C++ wrapper class for the data
type msat env is part of the forthcoming CoCoALib 0.99560 distribution
(September 2017). It still needs some common development with MathSAT
to minimize the overhead of data conversion.
4. The rst prototype of calling MathSAT functionalities via CoCoA-5 is the
function MSatLinSolve. This is part of the CoCoA-5.2.2 distribution (based
on CoCoALib 0.99560, September 2017). Type ? MathSAT in CoCoA-5 for
the latest news and examples.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>J.</given-names>
            <surname>Abbott</surname>
          </string-name>
          ,
          <article-title>Fault-Tolerant Modular Reconstruction of Rational Numbers</article-title>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Symb</surname>
          </string-name>
          . Comp. 80P3, pp.
          <volume>707</volume>
          {
          <issue>718</issue>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>J.</given-names>
            <surname>Abbott</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.M.</given-names>
            <surname>Bigatti</surname>
          </string-name>
          ,
          <article-title>CoCoA and CoCoALib: Fast prototyping and exible C++ library for Computations in Commutative</article-title>
          <source>Algebra Proc. 1st Workshop on Satis - ability Checking and Symbolic Computation, SC-Square</source>
          <year>2016</year>
          ,
          <source>CEUR Workshop Proceedings</source>
          <year>1804</year>
          , pp.
          <volume>1</volume>
          {
          <issue>3</issue>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>J.</given-names>
            <surname>Abbott</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.M.</given-names>
            <surname>Bigatti</surname>
          </string-name>
          , CoCoALib: a C+
          <article-title>+ library for doing Computations in Commutative Algebra Available</article-title>
          at http://cocoa.dima.unige.it/cocoalib
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>J.</given-names>
            <surname>Abbott</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.M.</given-names>
            <surname>Bigatti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Kreuzer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Robbiano</surname>
          </string-name>
          , Computing Ideals of Points,
          <source>Journal of Symbolic Computation</source>
          <volume>30</volume>
          ,
          <year>2000</year>
          , pp.
          <volume>341</volume>
          {
          <fpage>356</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>J.</given-names>
            <surname>Abbott</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bigatti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Palezzato</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Robbiano</surname>
          </string-name>
          ,
          <article-title>Computing and Using Minimal Polynomials</article-title>
          ,
          <source>arXiv:1704.03680</source>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>J.</given-names>
            <surname>Abbott</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bigatti</surname>
          </string-name>
          , L. Robbiano, Ideals modulo p,
          <source>In preparation.</source>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>J.</given-names>
            <surname>Abbott</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.M.</given-names>
            <surname>Bigatti</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Lagorio CoCoA-5: a system for doing Computations in Commutative Algebra Available</article-title>
          at http://cocoa.dima.unige.it
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>J.</given-names>
            <surname>Abbott</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.M.</given-names>
            <surname>Bigatti</surname>
          </string-name>
          ,
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>Soger, Integration of libnormaliz in CoCoALib and CoCoA 5 Proc</article-title>
          .
          <source>ICMS</source>
          <year>2014</year>
          , Springer LNCS 8592, pp.
          <volume>647</volume>
          {
          <issue>653</issue>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>W.</given-names>
            <surname>Bruns</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Ichim</surname>
          </string-name>
          , T. Romer,
          <string-name>
            <given-names>R.</given-names>
            <surname>Sieg</surname>
          </string-name>
          ,
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>Soger Normaliz. Algorithms for rational cones and a ne monoids</article-title>
          . Available from http://www.normaliz.uni-osnabrueck.de
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>Gorgen,</article-title>
          <string-name>
            <given-names>A.M.</given-names>
            <surname>Bigatti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Riccomagno</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Smith</surname>
          </string-name>
          <article-title>Discovery of statistical equivalence classes using computer algebra</article-title>
          arXiv:
          <volume>1705</volume>
          .
          <fpage>09457</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <given-names>A.N.</given-names>
            <surname>Jensen</surname>
          </string-name>
          ,
          <article-title>Gfan, a software system for Grobner fans and tropical varieties</article-title>
          . Available from http://home.math.au.dk/jensen/software/gfan/gfan.html
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <given-names>M.</given-names>
            <surname>Kreuzer</surname>
          </string-name>
          and
          <string-name>
            <given-names>L.</given-names>
            <surname>Robbiano</surname>
          </string-name>
          ,
          <source>Computational Linear and Commutative Algebra</source>
          , Springer, Heidelberg
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13. E. Palezzato, Minimal Polynomials, Sectional Matrices, and Applications ;
          <source>PhD. thesis, Universita degli Studi di Genova</source>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>