<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet  type="text/xsl" href="pmathml.xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:m="http://www.w3.org/1998/Math/MathML" xml:space="preserve">


<head>
<title>OpenMath Compliance</title>
<style>

body {
margin-left: 1em;
margin-right: 1em;
}

div.mdata {
margin-top: .5em;
margin-bottom: .5em;
margin-left: 5em;
}

span.mdatahead {
font-weight: bold;
}

div.minitoc {
border-width: thin;
border-style: solid;
border-color: blue;
font-size: 90%;
margin-top: 1em;
margin-bottom: 1em;
padding: 1em 1em 1em 1em;
}

p {text-align:justify;	   
  }
code {font-size: 125%;
      font-family: monospace; 
     }
.figure {
border-width:thin;
border-style: solid;
border-color: black;
margin: 0.5em 0.5em 0.5em 0.5em;
padding: 0.5em 0.5em 0.5em 0.5em;
}

div.caption {
margin-top: 1em;
}

.footnote{
font-size: 75%;
font-style: italic;
}
.delliteral {
font-size: 75%;
background-color: #efefef;
border-color: black;
border-style: solid;
border-width: 1px;
padding: 1em;
color: red;
text-decoration: line-through;
}
.newliteral {
font-size: 75%;
background-color: #efefef;
border-color: black;
border-style: solid;
border-width: 1px;
padding: 1em;
color: green;
}
.literal {
font-size: 75%;
background-color: #efefef;
border-color: black;
border-style: solid;
border-width: 1px;
padding: 1em;
margin:bottom: 1em;
}
.del {
color: red;
text-decoration: line-through;
}
.new {
color: green;
}
.chg {
color: blue;
}
.changetoc {
border-style: solid;
border-color: black;
border-width: 1px;
margin: 2em 2em 2em 2em;
background-color: yellow;
}

.lowerroman {
list-style-type: lower-roman;
}
</style>
</head>
<body>
  <div class="minitoc"><a href="omstd20html-0.xml">OpenMath 2</a> <a href="omstd20html-0.xml#toc">Table of Contents</a><br/><br/><a href="omstd20html-4.xml">Previous: 4 Content Dictionaries</a><br/><a href="#cha_comp">This: 5 <i>OpenMath</i> Compliance</a><br/>
    <a href="omstd20html-5.xml#sec_compl_encoding">5.1 Encodings</a><br/>
        <a href="omstd20html-5.xml#sec_compl_xml_encoding">5.1.1 The XML Encoding</a><br/>
            <a href="omstd20html-5.xml#sec_compl_xml_encoding_val">5.1.1.1 Generating Valid XML</a><br/>
            <a href="omstd20html-5.xml#sec_compl_xml_encoding_float">5.1.1.2 Decimal versus Hexadecimal Float Representation</a><br/>
    <a href="omstd20html-5.xml#sec_compl_omforeign">5.2 <i>OpenMath</i> Foreign Objects</a><br/>
    <a href="omstd20html-5.xml#sec_compl_cd">5.3 Content Dictionaries</a><br/>
    <a href="omstd20html-5.xml#sec_comp_lex">5.4 Lexical Errors</a><br/>
    <a href="omstd20html-5.xml#sec_compl_om1">5.5 <i>OpenMath</i> 1 Objects</a><br/><a href="omstd20html-a.xml">Next: A CD Files</a><br/></div>
  <div><h1 name="cha_comp" id="cha_comp">
  Chapter 5<br/><i>OpenMath</i> Compliance</h1>



<p>Applications that meet the requirements specified in this chapter may
label themselves as <i>OpenMath compliant</i>. <i>OpenMath</i> compliance is
defined so as to maximize the potential for interoperability amongst
<i>OpenMath</i> applications.</p>

<div><h2 name="sec_compl_encoding" id="sec_compl_encoding">5.1 Encodings</h2>

<p>This standard defines two reference encodings for <i>OpenMath</i>, the binary
encoding and <acronym>XML</acronym> encoding,  defined in <a href="omstd20html-3.xml#cha_enco">Chapter 3</a>.</p>

<p>As a minimum, an <i>OpenMath</i> compliant application, which accepts or generates
<i>OpenMath</i> objects, <i>must</i> be capable of doing so using  the <acronym>XML</acronym> encoding.
The ability to use other encodings is optional.</p>

<div><h3 name="sec_compl_xml_encoding" id="sec_compl_xml_encoding">5.1.1 The XML Encoding</h3>


<div><h4 name="sec_compl_xml_encoding_val" id="sec_compl_xml_encoding_val">5.1.1.1 Generating Valid XML</h4>


<p>

All <i>OpenMath</i> objects generated by a compliant <i>OpenMath</i> application must validate
against the Relax NG Schema given in <a href="omstd20html-b.xml#app_openmath.rng">Appendix B</a>.

</p>

</div>

<div><h4 name="sec_compl_xml_encoding_float" id="sec_compl_xml_encoding_float">5.1.1.2 Decimal versus Hexadecimal Float Representation</h4>


<p>
In the <acronym>XML</acronym> encoding, floating-point numbers may be defined using
either decimal or hexadecimal notation.  For numerical values, plus the
two infinities, the two representations may be used interchangeably since
there is a one-to-one correspondence between them.  The exceptional case
is that of <i>not a number</i> (NaN) which is defined in the
IEEE standard <a href="omstd20html-g.xml#ieee754_85">[6]</a> to be any number whose
exponent has the maximum possible value (in this case the exponent is 11
bits so the maximum value is 2047) and whose mantissa is non-zero.  The
standard explicitly notes the use of the 52 bits in the mantissa (and
also the sign bit) to store information about how the NaN was generated
in a system-specific way.  Thus in some cases the exact representation
of the NaN is significant.
</p>

<p>
The semantics of the <i>OpenMath</i> object
<small><code>&lt;OMF dec="NaN"/&gt;</code></small> is that it represents
<i>any</i> NaN, and a phrasebook may substitute any
specific NaN value when processing it.  The semantics of a NaN in
hexadecimal notation however, such as 
<small><code>&lt;OMF hex="FFF8000000000001"/&gt;</code></small>,
is that this is a specific NaN, as distinct from all others.
If a phrasebook author substitutes
another value for the NaN or maps all NaNs to a single object then he or
she must recognise that this process is not an identity transformation. 
</p>


</div>
</div>

</div>

<div><h2 name="sec_compl_omforeign" id="sec_compl_omforeign">5.2 <i>OpenMath</i> Foreign Objects</h2>


<p> An <i>OpenMath</i> Foreign Object may be attributed with a string indicating
the format of its contents.  Although this information is optional, an
<i>OpenMath</i>-compliant application which generates <i>OpenMath</i> Foreign Objects should
always include it where possible (see the discussion of MathML conversion
below for an example of a situation where it is not always possible).  It is
recommended that, where the contents of the Foreign Object are in an
<acronym>XML</acronym> dialect, the namespace <a href="omstd20html-g.xml#xmlns">[14]</a> of the
<acronym>XML</acronym> dialect is used as the value of the encoding.  For example
(using the <acronym>XML</acronym> encoding):
<div class="literal"><pre>&lt;OMATTR&gt;
  &lt;OMATP&gt;
    &lt;OMS cd="annotations1" name="description"/&gt;
    &lt;OMFOREIGN encoding="http://www.w3.org/1999/xhtml"&gt;
      &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
        &lt;head&gt;&lt;title&gt;E&lt;/title&gt;&lt;/head&gt;
        &lt;body&gt;
          &lt;p&gt;
            The base of the natural logarithms, approximately 2.71828.
          &lt;/p&gt;
        &lt;/body&gt;
      &lt;/html&gt;
    &lt;/OMFOREIGN&gt;
  &lt;/OMATP&gt;
  &lt;OMS cd="nums1" name="e"/&gt;
&lt;/OMATTR&gt;</pre></div>
Where the contents of the Foreign Object is a format other than <acronym>XML</acronym>,
it is recommended that its MIME type <a href="omstd20html-g.xml#rfc2046">[2]</a> is
used as the value of the encoding.
For example (again using the <acronym>XML</acronym> encoding):
<div class="literal"><pre>&lt;OMATTR&gt;
  &lt;OMATP&gt;
    &lt;OMS cd="annotations1" name="description"/&gt;
    &lt;OMFOREIGN encoding="text/latex"&gt;
      \documentclass{article}
      \begin{document}
      \title{E}
      \maketitle
      The base of the natural logarithms, approximately 2.71828.
      \end{document}
    &lt;/OMFOREIGN&gt;
  &lt;/OMATP&gt;
  &lt;OMS cd="nums1" name="e"/&gt;
&lt;/OMATTR&gt;</pre></div>
</p>

<p> An exception to the above guidelines occurs when a MathML object
is converted to <i>OpenMath</i>.  MathML also has an
<small><code>encoding</code></small> attribute which can appear in various
places and whose format is a string.  Only two values are predefined,
<small><code>MathML-Content</code></small> and
<small><code>MathML-Presentation</code></small>, and these may appear in
the resulting <i>OpenMath</i> object despite the fact that they are not namespaces
as recommended above. For example the following MathML expression:
<div class="literal"><pre>&lt;semantics xmlns="xmlns="http://www.w3.org/1998/Math/MathML"&gt;
  &lt;apply&gt;
    &lt;sin/&gt;
    &lt;ci&gt;x&lt;/ci&gt;
  &lt;/apply&gt;
  &lt;annotation encoding="MathML-Presentation"&gt;
    &lt;math&gt;
      &lt;mi&gt;sin&lt;/mi&gt;&lt;mfenced&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mfenced&gt;
    &lt;/math&gt;
  &lt;/annotation&gt;
&lt;/semantics&gt;</pre></div>
is equivalent to the <i>OpenMath</i> expression:
<div class="literal"><pre>&lt;OMATTR&gt;
  &lt;OMATP&gt;
    &lt;OMS cd="altenc" name="MathML_encoding"/&gt;
    &lt;OMFOREIGN encoding="MathML-Presentation"&gt;
      &lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;
        &lt;mi&gt;sin&lt;/mi&gt;&lt;mfenced&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mfenced&gt;
      &lt;/math&gt;
    &lt;/OMFOREIGN&gt;
  &lt;/OMATP&gt;
  &lt;OMA&gt;
   &lt;OMS cd="transc1" name="sin"/&gt;
   &lt;OMV name="x"/&gt;
  &lt;/OMA&gt;
&lt;/OMATTR&gt;</pre></div>

Since in MathML the <small><code>encoding</code></small> attribute is in
effect optional (its default value is the empty string), a convertor
program may not in fact be able to provide a value for the <i>OpenMath</i>
<small><code>encoding</code></small> attribute.  This is unfortunate but
unavoidable.

</p>

</div>

<div><h2 name="sec_compl_cd" id="sec_compl_cd">5.3 Content Dictionaries</h2>


<p>An <i>OpenMath</i> compliant application <i>must</i> be able
to support the error Content Dictionary defined in <a href="omstd20html-a.xml#errorcd">Appendix A.5</a>.</p>

<p>A compliant application must declare the names and version numbers of
the Content Dictionaries that it supports. Equivalently it may declare
the Content Dictionary Group (or groups) and major version number (not
revision number), rather than listing individual Content Dictionaries.
Applications that support all Content Dictionaries (e.g. renderers)
should refer to the implicit CD Group <small><code>all</code></small>.</p>

<p>If a compliant application supports a Content Dictionary then it must
explicitly declare any symbols in the Content Dictionaries that are not
supported. Phrasebooks are encouraged to support every symbol in the 
Content Dictionaries.</p>

<p>Symbols which are not listed as unsupported are
<i>supported</i> by the application. The meaning of
<i>supported</i> will depend on the application
domain. For example an <i>OpenMath</i> renderer should provide a default display
for any <i>OpenMath</i> object that only references supported symbols, whereas a
Computer Algebra System will be expected to map such an object to a
suitable internal representation, in this system, of this mathematical
object. It is expected that the application's
<i>phrasebooks</i> for supported Content Dictionaries
will be constructed such that properties of the symbol expressed in the
Content Dictionary are respected as far as possible for the given
application domain. However <i>OpenMath</i> compliance does
<i>not</i> imply any guarantee by the <i>OpenMath</i> Society on
the accuracy of these representations.</p>


<p>Content Dictionaries available from the official <i>OpenMath</i> repository
at www.openmath.org need only be referenced by name, other Content
Dictionaries <i>should</i> be referenced  <span/> using the
<small><code>CDBase</code></small> and the
<small><code>CDName</code></small>.  </p>

<p>When receiving an <i>OpenMath</i> symbol, e.g. <m:math><m:mi>s</m:mi></m:math>,
 that is not 

<span>defined in</span>
a supported Content Dictionary, a
 compliant application will act as if it had received the <i>OpenMath</i> object
 <m:math display="block"><m:mi mathvariant="bold">error</m:mi><m:mo>(</m:mo><m:mi>unhandled_symbol</m:mi><m:mo separator="true">,</m:mo><m:mi>s</m:mi><m:mo>)</m:mo></m:math> where
 <small><code>unhandled_symbol</code></small> is the symbol from the
 error Content Dictionary.</p>


<p>Similarly if it receives a symbol, e.g. <m:math><m:mi>s</m:mi></m:math>,
from an unsupported Content Dictionary, it will act as if it had
received the <i>OpenMath</i> object <m:math display="block"><m:mi mathvariant="bold">error</m:mi><m:mo>(</m:mo><m:mi>unsupported_cd</m:mi><m:mo separator="true">,</m:mo><m:mi>s</m:mi><m:mo>)</m:mo></m:math></p>

<p>Finally if the compliant application receives a symbol from a
supported Content Dictionary but with an unknown name, then this must
either be an incorrect object, or possibly the object has been built
using a later version of the Content Dictionary. In either case, the
application will act as if it had received the <i>OpenMath</i> object <m:math display="block"><m:mi mathvariant="bold">error</m:mi><m:mo>(</m:mo><m:mi>unexpected_symbol</m:mi><m:mo separator="true">,</m:mo><m:mi>s</m:mi><m:mo>)</m:mo></m:math></p>
</div>

<div><h2 name="sec_comp_lex" id="sec_comp_lex">5.4 Lexical Errors</h2>


<p>The previous section defines the behaviour of a compliant
application upon receiving well formed <i>OpenMath</i> objects containing
unexpected symbols.  This standard does not specify any behaviour for
an application upon receiving ill-formed objects.</p>
</div>


<div><h2 name="sec_compl_om1" id="sec_compl_om1">5.5 <i>OpenMath</i> 1 Objects</h2>

<p>
Compliant <i>OpenMath</i> 2 documents and Content Dictionary files using the
reference <acronym>XML</acronym> encodings must be valid
according to the specified schema, and so will use the namespaces
<small><code>http://www.openmath.org/OpenMath</code></small>
and 
<small><code>http://www.openmath.org/OpenMathCD</code></small>
respectively. Similarly CD Group and Signature files will use
<small><code>http://www.openmath.org/OpenMathCDG</code></small>
and
<small><code>http://www.openmath.org/OpenMathCDS</code></small>.
</p>

<p> Applications may also support <i>OpenMath</i> 1.
<acronym>XML</acronym>-encoded <i>OpenMath</i> 1 documents may be in either the 
<small><code>http://www.openmath.org/OpenMath</code></small>
namespace or in no-namespace (i.e., do not have any xmlns
declarations).
An application may accept either of
these forms. Note however that <i>OpenMath</i>  documents that have a version attribute
should validate against the schema for <i>OpenMath</i> 2 (or later versions) and
so should always use the <i>OpenMath</i> namespace.
<acronym>XML</acronym>-encoded <i>OpenMath</i> 1 CD files, CD Group files and CD Signature
files must be in no-namespace. An <i>OpenMath</i> 2 application may support
these files by implicitly converting the documents to their respective
namespace. Apart from this change of namespace (and the addition of a
version attribute on <small><code>OMOBJ</code></small>) the <i>OpenMath</i> 1
documents should conform to the schema specified in this standard.
</p>

<p>The use of documents in no-namespace should be
restricted to reading existing  <i>OpenMath</i> 1 files.
No <i>OpenMath</i> 2 application should generate documents in this form.
</p>
</div>

</div>
  <div class="minitoc"><a href="omstd20html-0.xml">OpenMath 2</a> <a href="omstd20html-0.xml#toc">Table of Contents</a><br/><br/><a href="omstd20html-4.xml">Previous: 4 Content Dictionaries</a><br/><a href="#cha_comp">This: 5 <i>OpenMath</i> Compliance</a><br/><a href="omstd20html-a.xml">Next: A CD Files</a><br/></div>
</body>
</html>