Those of you who were at last year's OpenMath workshop may recall I held a talk about "Literate Sources for Content Dictionaries" and pretty much promised I would be able to do all sorts of nifty things once a bit of technical infrastructure had been established.

Well, this week I reached the point where I can have LaTeX generate a *valid* (I checked) .ocd file from a reasonably-looking .tex source. From here on, it's mostly going to be the downward slope of adding features one by one... (Oh, there so many little things to try.)

Attached (because I'm afraid I'm a bit website-challenged at the moment) is a .tex source file and the .ocd content dictionary generated from it. They're based on polyd.ocd, which had a nice piece of explanatory text in the beginning that well befits the Literate paradigm, but the choice is mostly arbitrary and I'm just looking at that content dictionary for the purpose of experimenting. (To be clearly distinct, the generated content dictionary is named "polyd-not".) Things not yet reflected in the generated file are commented out, but there aren't all that much of those anymore.

The typeset version can be viewed at
http://www.mdh.se/polopoly_fs/1.55840!/Menu/general/column-content/attachment/om-polyd.pdf (unfortunately my local university website only allows uploading attachments with a few "blessed" extensions, among which .ocd and .tex are not). Though it may look like much of the formal material in the typeset form are just verbatim renderings of the generated XML, that is not quite true; the underlying machinery is quite a bit more sophisticated than that.

Lars Hellström
<CD xmlns="http://www.openmath.org/OpenMathCD";>
<CDName>polyd-not</CDName>
<CDComment>
  This document is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  
  The copyright holder grants you permission to redistribute this
  document freely as a verbatim copy. Furthermore, the copyright
  holder permits you to develop any derived work from this document
  provided that the following conditions are met.
    a) The derived work acknowledges the fact that it is derived from
       this document, and maintains a prominent reference in the
       work to the original source.
    b) The fact that the derived work is not the original OpenMath
       document is stated prominently in the derived work. Moreover if
       both this document and the derived work are Content Dictionaries
       then the derived work must include a different CDName element,
       chosen so that it cannot be confused with any works adopted by
       the OpenMath Society. In particular, if there is a Content
       Dictionary Group whose name is, for example, `math' containing
       Content Dictionaries named `math1', `math2' etc., then you should
       not name a derived Content Dictionary `mathN' where N is an integer.
       However you are free to name it `private_mathN' or some such. This
       is because the names `mathN' may be used by the OpenMath Society
       for future extensions.
    c) The derived work is distributed under terms that allow the
       compilation of derived works, but keep paragraphs a) and b)
       intact. The simplest way to do this is to distribute the derived
       work under the OpenMath license, but this is not a requirement.
  If you have questions about this license please contact the OpenMath
  society at http://www.openmath.org.
</CDComment>
<CDDate>2004-03-30</CDDate>
<CDStatus>experimental</CDStatus>
<CDVersion>4</CDVersion> <CDRevision>1</CDRevision>
<CDDefinition>
  <Name>DMP</Name>
  <Role>application</Role>
  <Description> The constructor of DMPs. The first argument is the polynomial 
ring containing the polynomial and the second is a &#x22;SDMP&#x22;. Should be 
of the form DMP(PolyRingD(...), SDMP(...)) </Description>
</CDDefinition>
<CDDefinition>
  <Name>DMPL</Name>
  <Role>application</Role>
  <Description> The constructor for lists of multivariate polynomial members of 
the same polynomial ring. The first argument is a polynomial ring and the rest 
are &#x22;SDMP&#x22;s. DMPL can be attributed with the &#x22;ordering&#x22; 
symbol to indicate a particular ordering for monomials of all its polynomials. 
Should be of the form DMPL(PolyRingD(...), SDMP(...)+) </Description>
</CDDefinition>
<CDDefinition>
  <Name>SDMP</Name>
  <Role>application</Role>
  <Description> The constructor for multivariate polynomials without any 
indication of variables or domain for the coefficients. Its arguments are just 
&#x22;term&#x22;s. No terms should differ only by the coefficient (i.e it is 
not permitted to have both &#x22;2*x*y&#x22; and &#x22;x*y&#x22; as terms in a 
SDMP). SDMP can be attributed with the &#x22;ordering&#x22; symbol to indicate 
a particular ordering of its terms. This attribute shall not be set if the SDMP 
is part of DMPL that has this attribute set. If the SDMP is ordered, explicitly 
or implicitly via an outer ordering, the terms must be in decreasing order with 
respect to this order. The zero polynomial is represented by an SDMP with no 
terms. </Description>
</CDDefinition>
<CDDefinition>
  <Name>term</Name>
  <Role>application</Role>
  <Description> The constructor of terms. Valid applications are of the form 
Term(coeff, exp1, exp2, ... expn) which represents the term coeff * 
var1&#x5E;exp1*...varn&#x5E;expn where n is the number of variables, expi are 
non-negative integers. coeff should be non-zero. </Description>
</CDDefinition>
<CDDefinition>
  <Name>poly&#x5F;ring&#x5F;d</Name>
  <Role>application</Role>
  <Description> The constructor of polynomial ring. The first argument is a 
ring (the ring of the coefficients), the second is the number of variables as 
an integer. </Description>
</CDDefinition>
<CDDefinition>
  <Name>poly&#x5F;ring&#x5F;d&#x5F;named</Name>
  <Role>application</Role>
  <Description> The constructor of polynomial ring. The first argument is a 
ring (the ring of the coefficients), the remaining arguments are the names of 
the variables. The first variable given is the most important from the point of 
view of lexicographic ordering, then the second, and so on. </Description>
</CDDefinition>
<CDDefinition>
  <Name>anonymous</Name>
  <Role>constant</Role>
  <Description> Indicates a variable that we do not want to name </Description>
</CDDefinition>
<CDDefinition>
  <Name>ordering</Name>
  <Role>semantic-attribution</Role>
  <Description> Used as an attribute to indicate an ordering of the terms in a 
polynomial or list of polynomials. The value of this attribute should be one of 
the constructors specifying ordering. </Description>
</CDDefinition>
<CDDefinition>
  <Name>lexicographic</Name>
  <Role>constant</Role>
  <Description> The lexicographic ordering of terms. Note that, if a 
poly&#x5F;ring&#x5F;d&#x5F;named is used, lexigographic refers to the order of 
the variables in the poly&#x5F;ring&#x5F;d&#x5F;named, not to their order as 
strings. </Description>
</CDDefinition>
<CDDefinition>
  <Name>reverse&#x5F;lexicographic</Name>
  <Role>constant</Role>
  <Description> The reverse lexicographic ordering of terms. Note that, if a 
poly&#x5F;ring&#x5F;d&#x5F;named is used, lexigographic refers to the order of 
the variables in the poly&#x5F;ring&#x5F;d&#x5F;named, not to their order as 
strings. </Description>
</CDDefinition>
<CDDefinition>
  <Name>graded&#x5F;lexicographic</Name>
  <Role>constant</Role>
  <Description> Total degree order, graded with the lexicographic ordering. 
Note that, if a poly&#x5F;ring&#x5F;d&#x5F;named is used, lexigographic refers 
to the order of the variables in the poly&#x5F;ring&#x5F;d&#x5F;named, not to 
their order as strings. </Description>
</CDDefinition>
<CDDefinition>
  <Name>graded&#x5F;reverse&#x5F;lexicographic</Name>
  <Role>constant</Role>
  <Description> Total degree order, graded with the reverse lexicographic 
ordering. Note that, if a poly&#x5F;ring&#x5F;d&#x5F;named is used, 
lexigographic refers to the order of the variables in the 
poly&#x5F;ring&#x5F;d&#x5F;named, not to their order as strings. </Description>
</CDDefinition>
<CDDefinition>
  <Name>elimination</Name>
  <Role>constant</Role>
  <Description> This is an ordering, which is partially in terms of one 
ordering, and partially in terms of another. First argument is a number of 
variables. Second is ordering to apply on the first so many variables. Third is 
an ordering on the rest, to be used to break ties. </Description>
  <Example>
     
    <OMOBJ xmlns="http://www.openmath.org/OpenMath";>
      <OMA>
        <OMS cd="polyd-not" name="elimination"/>
        <OMI>1</OMI>
        <OMS cd="polyd-not" name="lexicographic"/>
        <OMS cd="polyd-not" name="graded&#x5F;reverse&#x5F;lexicographic"/>
      </OMA>
    </OMOBJ>
     
  </Example>
</CDDefinition>
<CDDefinition>
  <Name>matrix&#x5F;ordering</Name>
  <Role>application</Role>
  <Description> The argument is a matrix with as many columns as indeterminates 
(= rank). Each row in turm is multiplied by the column vector of exponents to 
produce a weighting for comparison purposes. </Description>
</CDDefinition>
<CDDefinition>
  <Name>weighted</Name>
  <Role>application</Role>
  <Description> The first argument is a list of integers to act as variable 
weights, and the second is an ordering. The result is an ordering. 
</Description>
</CDDefinition>
<CDDefinition>
  <Name>weighted&#x5F;degree</Name>
  <Role>application</Role>
  <Description> The total degree of its argument, taking into account any 
weights declared. The value returned is an integer: non-negative if the weights 
are. We note that the degree of 0 is undefined. </Description>
  <Example>
     The following formula states essentially that if x, y, and z are variables 
with weighted degrees 1, 2, and 3 respectively, then the weighted degree of the 
polynomial 1z + 2x&#x5E;2 + 3y + 4x is 3. 
    
    <OMOBJ xmlns="http://www.openmath.org/OpenMath";>
      <OMA>
        <OMS cd="relation1" name="eq"/>
        <OMA>
          <OMS cd="polyd-not" name="weighted&#x5F;degree"/>
          <OMA>
            <OMS cd="polyd-not" name="DMP"/>
            <OMA>
              <OMS cd="polyd-not" name="poly&#x5F;ring&#x5F;d"/>
              <OMS cd="setname1" name="Q"/>
              <OMI>3</OMI>
            </OMA>
            <OMATTR>
              <OMATP>
                <OMS cd="polyd-not" name="ordering"/>
                <OMA>
                  <OMS cd="polyd-not" name="weighted"/>
                  <OMA>
                    <OMS cd="list1" name="list"/>
                    <OMI>1</OMI>
                    <OMI>2</OMI>
                    <OMI>3</OMI>
                  </OMA>
                  <OMS cd="polyd-not" name="graded&#x5F;lexicographic"/>
                </OMA>
              </OMATP>
              <OMA>
                <OMS cd="polyd-not" name="SDMP"/>
                <OMA>
                  <OMS cd="polyd-not" name="term"/>
                  <OMI>1</OMI>
                  <OMI>0</OMI>
                  <OMI>0</OMI>
                  <OMI>1</OMI>
                </OMA>
                <OMA>
                  <OMS cd="polyd-not" name="term"/>
                  <OMI>2</OMI>
                  <OMI>2</OMI>
                  <OMI>0</OMI>
                  <OMI>0</OMI>
                </OMA>
                <OMA>
                  <OMS cd="polyd-not" name="term"/>
                  <OMI>3</OMI>
                  <OMI>0</OMI>
                  <OMI>1</OMI>
                  <OMI>0</OMI>
                </OMA>
                <OMA>
                  <OMS cd="polyd-not" name="term"/>
                  <OMI>4</OMI>
                  <OMI>1</OMI>
                  <OMI>0</OMI>
                  <OMI>0</OMI>
                </OMA>
              </OMA>
            </OMATTR>
          </OMA>
        </OMA>
        <OMI>3</OMI>
      </OMA>
    </OMOBJ>
     
  </Example>
</CDDefinition>
<CDDefinition>
  <Name>groebnered</Name>
  <Role>application</Role>
  <Description> The constructor for a Gro&#x0308;bner basis (reduced, minimal). 
The first argument is an ordering, the second is the Gro&#x0308;bner Basis 
itself (with respect to the ordering) that should be represented as a DMPL. 
</Description>
</CDDefinition>
<CDDefinition>
  <Name>completely&#x5F;reduced</Name>
  <Role>semantic-attribution</Role>
  <Description> This attribute, attached to a groebnered object, says 'true' if 
the base is fully reduced, i.e. no monomial is divisible by the leading 
monomial of any other polynomial. </Description>
</CDDefinition>
<CDDefinition>
  <Name>plus</Name>
  <Role>application</Role>
  <Description> The sum. The argument is a DMPL. The sum lies within the same 
&#x22;PolyRingD&#x22; i.e. a program implementing this operation should return 
a DMP with the same &#x22;poly&#x5F;ring&#x5F;d&#x22; (or 
&#x22;poly&#x5F;ring&#x5F;d&#x5F;named&#x22;). </Description>
</CDDefinition>
<CDDefinition>
  <Name>times</Name>
  <Role>application</Role>
  <Description> The product. The argument is a DMPL. The product lies within 
the same &#x22;PolyRingD&#x22; i.e. a program implementing this operation 
should return a DMP with the same &#x22;poly&#x5F;ring&#x5F;d&#x22; (or 
&#x22;poly&#x5F;ring&#x5F;d&#x5F;named&#x22;). </Description>
</CDDefinition>
<CDDefinition>
  <Name>power</Name>
  <Role>application</Role>
  <Description> The power. First argument is a DMP, second argument is the 
integer power. The power lies within the same &#x22;PolyRingD&#x22; i.e. a 
program implementing this operation should return a DMP with the same 
&#x22;poly&#x5F;ring&#x5F;d&#x22; (or 
&#x22;poly&#x5F;ring&#x5F;d&#x5F;named&#x22;). </Description>
</CDDefinition>
<CDDefinition>
  <Name>groebner</Name>
  <Role>application</Role>
  <Description> The Gro&#x0308;bner basis (lt-reduced, minimal) of a set of 
polynomials, with respect to a given ordering. First argument is an ordering, 
the second is a list of polynomials. A program that can compute the basis is 
required to return a &#x22;groebnered&#x22; object. </Description>
</CDDefinition>
<CDDefinition>
  <Name>reduce</Name>
  <Role>application</Role>
  <Description> The reduction of a polynomial with respect to a Gro&#x0308;bner 
basis. First argument is a DMP, the second argument is a &#x22;groebnered&#x22; 
object. i.e. a program implementing this operation should return a DMP which 
represents the polynomial reduced with respect to the Gro&#x0308;bner basis. 
</Description>
</CDDefinition>
<CDComment>
  This file was generated from om-polyd.tex.
</CDComment>
</CD>

Attachment: om-polyd.tex
Description: TeX document

_______________________________________________
Om mailing list
[email protected]
http://openmath.org/mailman/listinfo/om

Reply via email to