[Om] POPCORN for OpenMath

Alberto Gonz ález Palomo Alberto.Gonzalez at matracas.org
Mon Apr 14 21:42:58 CEST 2008


On Mon, 14 Apr 2008 14:47:49 +0200
Peter Horn <hornp at mathematik.uni-kassel.de> wrote:

>[...]
> To simplify my life within the SCIEnce-Project I implemented a little  
> tool that might be of interest for you, too:
>[...]
> Tired of typing giant XML-strings for testing the OpenMath facilities  
> of your applications? Then POPCORN is the ideal tool for you!
> 
> POPCORN stands for "Possibly Only Practicable Convenient OpenMath  
> Replacement Notation" and it keeps its promise.

      You might want to take a look at QMath and the OpenMath
support in the Computer Algebra System Yacas:

http://www.matracas.org/qmath/index.en.html
http://yacas.sourceforge.net/refchapter28.html#OMForm

      There are two things that are not implemented:
      - Identifiers.
      - Attributions. (You can declare a symbol to be an attribution
operator, but I never added those to the expression grammar)

      Variables don't have to be marked explicitly as in your
grammar: any undefined symbol is assumed to be a variable or,
in the case of QMath, a product of variables if it's more than
one letter long.
      Yacas can also translate back from OpenMath. A new version
of QMath used in Sentido and the new formula editor in MathWebSearch
do translate bidirectionally between linear input and OpenMath, but
there is no display of the OpenMath tree. However this could be
implemented trivially.

>[...]
> > 1+a.b(9)
>
> <OMA><OMS cd="arith1" name="plus" /><OMI>1</OMI><OMA><OMS cd="a"  
> name="b" /><OMI>9</OMI></OMA></OMA>

      In Yacas: 1+OMA(OMS("a", "b"), 9)
      You can also define a symbol:
----------------------------------------------------
In> [ OMDef("a'b", "a", "b"); OMForm(1+a'b(9)); ]
----------------------------------------------------
<OMOBJ>
  <OMA>
    <OMS cd="arith1" name="plus"/>
    <OMI>1</OMI>
    <OMA>
      <OMS cd="a" name="b"/>
      <OMI>9</OMI>
    </OMA>
  </OMA>
</OMOBJ>
Out> True
----------------------------------------------------

      In QMath you would have to define a symbol, and you would
get a wrapper document (typically OMDoc, but that's definable):
----------------------------------------------------
QMATH 1.0  
:en
Context:"Mathematics/Arithmetic"
Symbol: a_b APPLICATION "a:b"
$1+a_b(9)$
----------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<document xml:lang='en'>
  <metadata/>
  <paragraph>
    <text>
      <OMOBJ xmlns='http://www.openmath.org/OpenMath'>
        <OMA>
          <OMS cd='arith1' name='plus'/>
          <OMI>1</OMI>
          <OMA>
            <OMS cd='a' name='b'/>
            <OMI>9</OMI>
          </OMA>
        </OMA>
      </OMOBJ>
    </text>
  </paragraph>
</document>
----------------------------------------------------

      It's not meant for interactive use, but if that's what you
want you cat trick it by putting it in XML mode by feeding it
this input instead:
----------------------------------------------------
<?xml version='1.0'?>       
<?QMath
:en
Context:"Mathematics/Arithmetic"
Symbol: a_b APPLICATION "a:b"
?>
$1+a_b(9)$
----------------------------------------------------
<?xml version='1.0'?>
<OMOBJ><OMA><OMS cd="arith1" name="plus"/><OMI>1</OMI><OMA><OMS cd="a" name="b"/><OMI>9</OMI></OMA></OMA></OMOBJ>
----------------------------------------------------

      Both programs are Free Software distributed under the GPL.

      Apart from that, I also wrote a collection of CAS syntax parsers
for the exercise subsystem I wrote in ActiveMath, which produce OpenMath.
      Those are fixed, though, so you have to regenerate the Java code
with JavaCC and recompile to define new symbols.

http://www.matracas.net/escritos/index.en.html#exercise_system_report

      Section 3.2, "User input", page 8.
      ActiveMath version 1.0 is Free Software distributed under the d-fsl
(which is compatible with the GPL). It can be downloaded here:

http://www.activemath.org/downloads/

      Cheers,
--
	Alberto González Palomo
	Toledo, España / Saarbrücken, Deutschland
	http://www.matracas.org


More information about the Om mailing list