Semantic MathML

From semanticweb.org
Jump to: navigation, search

This is an approach to rewrite Content MathML so that it is expressable as RDF. If needed it is also possible to develop a completly new Ontology without respect to MathML. Comments, alternative Solutions and Corrections are welcome.

Contents

[edit] Authors

[edit] Version 0.1

[edit] Elementary Types

[edit] Numbers

The Number -485.487×107 will get expressed as:

<number rdf:type="&xsd;float">-485.487E7</number>

Or more explicit as:

<function rdf:resource="times"
   <function rdf:resource="negation">
      <number rdf:type="&xsd;integer">485487</number>
   </function>
   <function rdf:resource="sup">
      <rdf:_1><number rdf:type="&xsd;integer">10</number></rdf:_1>
      <rdf:_2><number rdf:type="&xsd;integer">4</number></rdf:_2>
   </function>
</function>

[edit] Complex Numbers, Quaternions

The Quaternion (4-dimensional complex number) 3+i4+j5+k6 could get expressed as:

<variable rdf:type="vector">
   <rdf:_1><number>3</number><rdf:_1>
   <rdf:_2><number>4</number><rdf:_2>
   <rdf:_3><number>5</number><rdf:_3>
   <rdf:_4><number>6</number><rdf:_4>
</variable>

or simpler:

<variable rdf:type="vector">
   <number>3</number>
   <number>4</number>
   <number>5</number>
   <number>6</number>
</variable>

Where (Vector, rdfs:subClassOf, rdf:Seq). Because a Vector is a imprecise Description of a Quaternion you can also write more precise this Quaternion as:

<function rdf:resource="add">
   <number rdf:type="&xsd;integer">3</number>
   <function rdf:resource="times">
      <constant rdf:resource="complexI" />
      <number rdf:type="&xsd;integer">4</number>
   </function>
   <function rdf:resource="times">
      <constant rdf:resource="complexJ" />
      <number rdf:type="&xsd;integer">5</number>
   </function>
   <function rdf:resource="times">
      <constant rdf:resource="complexK" />
      <number rdf:type="&xsd;integer">6</number>
   </function>
</function>

[edit] Functions

[edit] (Typed) Parameters

<parameter rdf:type="vector" rdf:ID="x" />

[edit] Aliasing Functions

Original Version:

<function rdf:resource="add">
  <number>3</number>
  <function rdf:resource="add">
     <number>4</number>
     <number>5</number>
  </function>
</function>

Definition of new Class (Element):

<rdf:about="add" rdf:type="function" />
<rdf:about="plus" owl:isSameAs="add" />

Use:

<add>
  <number>3</number>
  <plus>
    <number>4</number>
    <number>5</number>
  </plus>
</add>

[edit] Lamda Construct

λ(x, sin(x+1)) becomes:

<define rdf:ID="foo" rdf:type="function">
   <parameters>
      <variable rdf:ID="foo-x">
   </parameters>
   <to>
      <function rdf:resource="sin">
         <function rdf:resource="add">
            <variable rdf:resource="foo-x" />
            <number>1</number>
         </function>
      </function>
   </to>
</define>

[edit] Functions with multiple Parameters

Functions with multiple Parameters can get either constructed as

<define rdf:ID="foo" rdf:type="function">
   <parameters>
      <variable rdf:ID="x" />
   </parameters>
   <to>
      <define rdf:ID="bar" rdf:type="function">
         <variable rdf:ID="y" />
         <to>
            <function rdf:resource="sin">
               <function rdf:resource="add">
                  <variable rdf:resource="x" />
                  <variable rdf:resource="y" />
               </function>
            </function>
         </to>
      </define>
   </to>
</define>

or as:

<define rdf:ID="foo" rdf:type="function">
   <parameters rdf:type="&rdf;Seq">
      <variable rdf:ID="foo-x" />
      <variable rdf:ID="foo-y" />
   <parameters>
   <to>
      <function rdf:resource="sin">
         <function rdf:resource="add">
            <variable rdf:resource="foo-x" />
            <variable rdf:resource="bar-y" />
         </function>
      </function>
   </to>
</define>

If the order of the varialbes doesn't matter you can write:

<define rdf:ID="foo" rdf:type="function">
   <parameters rdf:type="&rdf;Bag">
      <variable rdf:ID="foo-x" />
      <variable rdf:ID="foo-y" />
   </parameters>
   <to>
      <function rdf:resource="sin">
         <function rdf:resource="add">
            <variable rdf:resource="foo-x" />
            <variable rdf:resource="bar-y" />
         </function>
      </function>
   </to>
</define>

[edit] Functions with named Parameters

A function which needs named parameters like:

<function rdf:resource="int"><!-- integral -->
   <variable rdf:type="variable">...</variable>
   <variable rdf:type="int-uplimit">...</variable>
   <variable rdf:type="int-lowlimit">...</variable>
   <variable rdf:type="function">...</variable>
</function>

could get defined as:

<define rdf:ID="int">
   <parameters rdf:type="&rdf;Bag">
      <variable rdf:type="variable" rdf:ID="int-x" />
      <variable rdf:type="function" rdf:ID="int-fun" />
      <variable rdf:ID="int-uplimit" />
      <variable rdf:ID="int-lowlimit" />
   </parameters>
   <to>...</to>
</define>

[edit] Predefined Functions

Taken from [1]:

unary arithmetic factorial, minus, abs, conjugate, arg, real, imaginary, floor, ceiling
unary logical not
unary functional inverse, ident, domain, codomain, image
unary elementary classical functions sin, cos, tan, sec, csc, cot, sinh, cosh, tanh, sech, csch, coth, arcsin, arccos, arctan, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsinh, arctanh, exp, ln, log
unary linear algebra determinant, transpose
unary calculus and vector calculus divergence, grad, curl, laplacian
unary set-theoretic card
binary arithmetic quotient, divide, minus, power, rem
binary logical implies, equivalent, approx
binary set operators setdiff
binary linear algebra vectorproduct, scalarproduct, outerproduct
n-ary arithmetic plus, times, max, min, gcd, lcm
n-ary statistical mean, sdev, variance, median, mode
n-ary logical and, or, xor
n-ary linear algebra selector
n-ary set operator union, intersect, cartesianproduct
n-ary functional compose
integral, sum, product operators int, sum, product
differential operator diff, partialdiff
quantifier forall, exists

(can abbreviate forall as "all", exists as "ex")

[edit] General Constructs

[edit] Inverse

<function rdf:ID="arcsin" rdf:resource="inverse">
   <function rdf:resouce="sin" />
</function>

[edit] Declarations

<function rdf:resource="&eq;"
   <variable rdf:ID="V" />
   <vector><!-- aliased from <variable rdf:type="vector" /> -->
      <rdf:_1><variable rdf:ID="a" /></rdf:_1>
      <rdf:_2><variable rdf:ID="b" /></rdf:_2>
      <rdf:_3><variable rdf:ID="c" /></rdf:_3>
   </vector>
</function>

[edit] Conditions

<if>
   <condition>...</condition>
   <then>...</then>
   <else>...</else>
</if>


[edit] Transformations

To be able to define functions properly it is needed to state which transformations are possible when a specific pattern occurs.

Examples:

  • x/y = x*y^(-1)
  • x-y = x+(-y)
  • x+y = y+x
  • x*(-y) = -(x*y)
  • x*y = y*x
  • (x+y)*z = (x*z)+(x*z)
  • (x^z)+(y^z) = (x+y)^z

See Addition,Subtraction,Multiplication,Division,Equality

Also there can be transformations which are working in the one direction, but not into the other direction.

<!-- transformation is rdfs:subClassOf="rdf:Property" -->
<define rdf:ID="commutative" rdf:type="transformation">
   <parameters>
      <function rdfs:range="function" rdf:type="&rdf;Seq" />
         <parameter rdfs:range="variable" rdf:ID="transitive-x" />
         <parameter rdfs:range="variable" rdf:ID="transitive-y" />
      </function>
   </parameters>
   <to>
      <function rdfs:range="function" rdf:type="&rdf;Seq">
         <parameter rdf:resource="transitive-y" />
         <parameter rdf:resource="transitive-x" />
      </function>
   </to>
</define>
<!-- transformation is rdfs:subClassOf="rdf:Property" -->
<define rdf:type="transformation">
   <owl:SymmetricProperty /><!-- working in both directions -->
   <parameters>
      <function rdfs:range="div">
         <parameter rdfs:range="variable" rdf:ID="transitive-x" />
         <parameter rdfs:range="variable" rdf:ID="transitive-y" />
      </function>
   </parameters>
   <to>
      <function rdfs:range="times" />
         <parameter rdf:resource="transitive-x" />
         <function rdf:resource="sup">
            <rdf:_1><parameter rdf:resource="transitive-y" /></rdf:_1>
            <rdf:_2><number rdf:type="&xsd;integer;">1</number></rdf:_2>
         </function>
      </function>
   </to>
</define>

[edit] Version 0.2

Mathematical Expressions can get understood as Function-graphs. In that sense, each mathematical Operator, Variable, and Value is representet as a Node. The relations between this node creates the formula.

Example:

The formula C = A*(B+2) = D - C; B=5; D=7 can get understood as this graph.

To solve such a system you need to find a way go get from the Constants to the Variables. Because not all Graphs are directing in the proper direction you need to transform these "false" directing graphs into their Counterpart. (Picture)

Example:

g(+,x) g(-,x)
g(*,x) g(1/x,x)
g(e^,x) g(ln,x)

Such Transformations can get very complex. An Example is the Transformation of the Pattern ln(x*x) = ln x + ln y. (Picture) or the Transformation of ln x = e^x. In that examples the Graph is not changing its direction, but is translated from one Pattern to another. A simple change in the direction of a graph might be the Transformation (y=x+z) = (y-x=z) which says, that if you can move x from the one graph of = to the other, you have to negate x. The transformation can't get represented directly as plain math formula, so look at this Picture showing both, a graph transformation and a graph redirection.

[edit] Basic Ontoloty

rdf:ID Definition
rdfs:comment
Variable (Variable, owl:equivalentClass, rdfs:Class)
Variables are the most basic element in Math. Variables can get every Value.
Constant (Constant, rdfs:subClassOf, Variable)
Constants are mostly Literals, so rdfs:Literal derive from this Class too.
Operator (Operator, rdfs:subClassOf, Variable)
Operators are representing mathematical Operations.
isParameterOf (isParameterOf, rdfs:subPropertyOf, rdf:Property)
Applies a Parameter to a function. Some Operators may define different Subclasses from this. As Example the Divide-Operator may define the Subclasses "isDivisorOf" and "isDividendOf".
hasParameter (isParameterOf, owl:inverseOf, isResultOf)
This is the inverse of "isParameterOf".
isResultOf (isResultOf, rdfs:subPropertyOf, rdf:Property)
Defines, that the given Value is the Result of a Operation.
hasResult (hasResult, owl:inverseOf, isResultOf)
This is the inverse of "isResultOf".

[edit] Elementary Relations

Equality is a Relation, so you might model it using the symmetric isEqualTo-Relation. Implementing a Equal-Operator is quite simple, just by deriving it from the Operator Class and allow only the isEqualTo-Relation on it. This will force the same Value to all the Variables which are linked to that specific Equality-Instance. This is because of the definition:

(isEqualTo, rdf:type, owl:SymmetricProperty)

Therefore if (x, isEqualTo, var1) and (x, isEqualTo, var2), then (var1, isEqualTo, var2) is semantically solveable.

In the same way all other mathematical relations are represented directly by Properties.

Examples
Relation Schema
isEqualTo Lite
isLessThan Lite
isGreaterThan Lite
isLessOrEqual Lite
isGreaterOrEqual Lite
isProportionalTo DL
isAbsoluteOf DL
isNormOf DL
isFactorialOf DL
isNot DL
isNegationOf DL
isImplicitOf DL
isEquivalentOf DL
isPartOf DL
isDerivateOf DL
isDefinedBy Full
inferencesWith Full
isPictureOf Full
isPerpendicularTo Full

Note that "Semantic MathML Lite" hould be as small than possible and supports besides that only the most common Syntax. Because RDF is extensible other Schemes calles ie. "Semantic MathML DL" or "Semantic MathML Full" can extend this to very complex algebra sets. The Full Version of this Ontology supports also the negation of this Relations like isNotEqualTo. Also Users are able to define there own extensions, because RDF is extensible. Anyway, a practical Semantic MathML Document should use only the most basic syntax that is possible for compatibility reasons.

[edit] Defining Functions

Defining a Function with one Parameter
<define>
   <function rdf:ID="Square">
      <Exp>
         <Base><Parameter rdf:range="&smml;Variable" /></Base>
         <Exponent rdf:type="&xsd;int">2</Exponent>
      </Exp>
   </function>
</define>

Use:

<Square>x</Square>
Defining a Function with a List of Parameters
<define>
   <function rdf:ID="Mean2">
      <Frac>
         <Dividend>
            <Sum>
               <ParameterList min-lenght="2" max-lenght="2" rdf:type="Number" />
            </Sum>
         </Dividend>
         <Divisor rdf:type="&xsd;int">2</Divisor>
      </Frac>
   </function>
</define>

Use:

<Mean2>
   <Parameter rdf:type="int">7883</Parameter>
   <Parameter rdf:type="int">483</Parameter>
</Mean2>
Using Named Parameters
<define>
   <function rdf:ID="ConvolutionFilter">
      <Multiply>
         <Parameter Name="Filter" rdf:type="Vector" />
         <Transpose>
            <Parameter Name="Signal" rdf:type="Vector" />
         <Transpose>
      </Multiply>
   </function>
</define>

Use:

<ConvolutionFilter>
   <Filter>
      <Vector>
         <Scalar rdf:type="&xsd;int">45</Scalar>
         ...
      <Vector>
   </Filter>
   <Signal>
      <Vector>
         <Scalar rdf:type="&xsd;int">5</Scalar>
         ...
      <Vector>
   </Signal>
</ConvolutionFilter>

[edit] Defining Transformation Rules

Tranformations are used to define possible calculation-operations on a specific function. Therefore ie. the Add-Function can transformed into a Subtraction.

<transformation>
   <Parameter Name="z">
      <Add>
         <Parameter Name="x">
         <Parameter Name="y">
      </Add>
   </Parameter>
   <Parameter Name="z">
      <Add>
         <Parameter Name="y">
         <Parameter Name="x">
      </Add>
   </Parameter>
</transformation>

<transformation>
   <Parameter Name="z">
      <Add>
         <Parameter Name="x">
         <Parameter Name="y">
      </Add>
   </Parameter>
   <Parameter Name="y">
      <Add>
         <Parameter Name="z">
         <Negate><Parameter Name="x"></Negate>
      </Add>
   </Parameter>
</transformation>

...

Instead of transformations there should be used properties to apply the most used transformation-rules to functions. The most common rules are:

  • Commutativity
  • Associativity
  • Distributivity
  • Flexibility

[edit] Draft

[edit] See also

Personal tools
Namespaces

Variants
Actions
Navigation
services
Toolbox