Appendix A: Summary of Content MathML

 

This summary gives a streamlined yet complete list of grammar rules for well-formed Content MathML elements, along with explanations.

 

Notation:

·                    All the grammar variables start with a capital initial.

·                    All grammar terminal strings begin with a lower-case letter.

·                    X? means zero or one occurrence of X.

·                    X* means zero or more occurrences of X

 

The top element Math:

Math                ::=        <math> Declare* Mmlexpr* </math>

 

This states that every math element consists of zero or more declarations followed by zero or more MathML expressions.

 

The declaration rule:

Declare            ::=        <declare> Ci Constructor? </declare>

 

This defines a declaration element to be a content identifier element (Ci) with optional attributes, followed by an optional constructor element (i.e., a set, list, interval, vector, matrix, matrix row, or a user-defined function). If a constructor is provided, the declaration effectively defines the identifier to be the stated constructor; otherwise, the identifier is declared to have the properties provided in the attributes.

 

The Mmlexpr entity stands for any content MathML expression:

Mmlexpr          ::=        Operator | Constantsymbol | Constructor |  Token | Semantics

 

The rules for Operator and Constantsymbol:

For each operator/function and constant symbol xyz in the next two tables, we have:

Xyz                              ::=        </xyz>

Operator                      ::=        Xyz                  // if xyz is an operator/function

Constantsymbol            ::=        Xyz                  // if xyz is a constant symbol

UnaryOperator             ::=        Xyz                  // if xyz is a unary operator/function

BinaryOperator            ::=        Xyz                  // if xyz is a binary operator/function

N-aryOperator             ::=        Xyz                  // if xyz is an n-ary operator/function

 

For example, Operator generates Divide. Divide generates </divide>, the division operator element, which, whenever used, is followed by two elements: the dividend and the divisor. Each element operator must be the child of an <apply> element.

 

As another example, Constantsymbol generates Integers and Exponentiale. Integers generates </integers>, which stands for the set Z of all integers, and Exponentiale generates </exponentiale>, which stands for the base e of natural logarithm.

 

Table 1: Content MathML Functions and Operators (all are empty elements)

Category

Unary Operators

Binary Operators

n-ary Operators

Arithmetic

abs, conjugate, factorial, minus, arg, real, imaginary, floor, ceiling

quotient, divide, minus, rem, power,  root

plus, times, max, min, gcd, lcm

Logic

Not

implies, equivalent

And, or, xor

Vector Calculus

divergence, grad, curl, laplacian

 

 

Set Theory

Card

Setdiff

union, intersect, cartesianproduct

Linear Algebra

determinant, transpose

vectorproduct, scalar-product, outerproduct

Selector

Functional Operators

inverse, ident, domain, codomain, image

 

fn (deprecated),

compose

Relational

 

ne, approx,

eq, leq, lt, geq, gt

Set Relational Operators

 

notsubset, notin, notprsubset, in

Subset, prsubset

Sequence Relational

 

Tendsto

 

Calculus

int, diff, partialdiff:           they take one operand and optional qualifiers

Sequences

sum, product, limit:          they take one operand and optional qualifiers

Elementary Functions

(all unary)

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

Statistics

(all n-ary)

median, mode, mean, sdev, variance.

moment (takes optional qualifiers)

 

Table 2:  Constant Symbol Elements (all empty elements)

Category

Elements

Standard Notation

Standard Math Sets

integers, rationals, reals, naturalnumbers, complexes, primes

Z, Q, N,

C, P

Standard Constants

exponentiale, imaginaryi, notanumber,

true, false, pi, eulergamma, infinity

e, i, NaN,

T, F, π, γ, ∞

 

Constructors, tokens, and semantics are called container elements, listed in the next table.

Table 3: Containers (non-empty elements)

Category

Elements

Tokens

ci, cn, csymbol

Constructors[1]

interval, list, set, vector, matrix, matrixrow,  piecewise, piece, otherwise, apply, lambda

Semantics and

Annotations

semantics, annotation, annotation-xml

 

The rules for Constructor:

A constructor is an element that defines a container of values, or that defines a function, or that applies a function/operator to argument(s)/operand(s).

 

Constructor      ::=        Interval | Set | List | Vector | Matrixrow | Matrix | Piecewise |

                                    Piece | Otherwise | Lambda  | Apply

Interval             ::=        <interval> Mmlexpr Mmlexpr </interval>          // left and right ends

Set                   ::=        <set>   Mmlexpr* |                                           // enumerated set

(Bvar* Domainofapp Mmlexpr)            // specified set

</set>

List                   ::=        <list> Mmlexpr* | (Bvar* Domainofapp Mmlexpr) </list>  

// ordered set

Vector              ::=        <vector> Mmlexpr* </vector>          // a column sequence of terms

Matrixrow        ::=        <matrixrow> Mmlexpr* </matrixrow>  // a row sequence of terms

Matrix              ::=        <matrix> Matrixrow* </matrix>                // several equal-sized rows

 

Piecewise         ::=        <piecewise> Piece* Otherwise? </piecewise>    

// for piecewise definitions of functions

Piece                ::=        <piece> Mmlexpr Mmlexpr </piece>       // a value-condition pair

Otherwise         ::=        <otherwise> Mmlexpr </otherwise>

 

Lambda            ::=        <lambda> Bvar* Domainofapp? Mmlexpr </lambda>

            // for defining functions using the λ-calculus notation. The Bvar* specifies the

// bound variables (i.e., arguments). The Domainofapp, if present, specifies the

// domain of the function. Finally, Mmlexpr gives the expression of the function.

 

Apply               ::=        <apply> Applybody </apply>    

// applies functions/operators to arguments/operands

Applybody       ::=        // any of the following possibilities, one per line: 

UnaryOperator Mmlexpr          // unary operator applied at operand Mmlexpr

BinaryOperator Mmlexpr Mmlexpr       // binary operator applied at 2 operands           

N-aryOperator  Mmlexpr*       // n-ary operand applied at the provided operands        

            N-aryOperator Bvar* Domainofapp? Mmlexpr   // n-ary operator applied at the set

// of operands specified by Bvar* Domainofapp? Mmlexpr

            (Diff | Partialdiff) Bvar* Mmlexpr         

                        // derivative of Mmlexpr wrt to the bound variable(s) specified in Bvar*            

            Log Logbase? Mmlexpr            // log with an optional base       

            Moment Degree? Momentabout? Mmlexpr*       // statistical moment    

            Root Degree? Mmlexpr            // the n-th root, where n is specified by Degree 

            Limit Bvar* Lowlimit? Condition? Mmlexpr                 

            (Int | Sum | Product) Bvar* Domainofapp? Mmlexpr     // integral, sum and product

            (Exists | Forall) Bvar* Domainofapp? Mmlexpr // logical quantifiers

            // the next two are for applying user-defined functions to arguments

            (Apply | Lambda | Semantics | Ci | Csymbol) Mmlexpr* 

            (Apply | Lambda | Semantics | Ci | Csymbol) Bvar* Domainofapp? Mmlexpr   

 

The rule for  Domainofapp:

Domainofapp    ::=        Domainofapplication | Interval | Lowlimit Uplimit | Lowlimit |

Uplimit | Condition

 

These and Momentabout, Degree, and Logbase are called qualifiers. They serve as parameters for certain functions and operators. For example, intervals (or up/low limits) are needed for definite integrals; degree for higher order roots, moments, and derivatives; and conditions for defining sets, function domains, scopes of logical quantifiers, etc.

 

The rules for qualifiers:

Domainofapplication     ::=        <domainofapplication> Mmlexpr </domainofapplication>

Lowlimit                       ::=        <lowlimit> Mmlexpr </ lowlimit>

Uplimit                         ::=        <uplimit> Mmlexpr </uplimit>

Degree                         ::=        <degree> Mmlexpr </degree>

Momentabout               ::=        <momentabout> Mmlexpr </momentabout>

Logbase                       ::=        <logbase> Mmlexpr </logbase>

Condition                     ::=        <condition> Apply | Set </condition>

      // here, the operator after Apply is a relational operator to qualify the bound variable

 

The rules for Token:

Token                          ::=        Ci | Csymbol | Cn

Ci                                 ::=        <ci> (#PCDATA | presentation-tags)* </ci>

Csymbol                       ::=        <csymbol> (#PCDATA | presentation-tags)* </csymbol>

Cn                                ::=        <cn> (#PCDATA | </sep> | presentation-tags)* </cn>

 

A ci specifies the name of an identifier, either as a string or as Presentation-MathML markup. A csymbol is like a ci except that it has an attribute pointing to an external location for defining semantics. A cn specifies a numerical value with an optional base attribute and an optional numeric-data-type attribute. If the number has several components, as with complex numbers, </sep> separates between the components.

 

The semantics and annotation rules:

Semantics          ::=   <semantics> Mmlexpr (Annotation | Annotation-xml) </semantics>

Annotation          ::=  <annotation> #PCDATA </annotation>

Annotation-xml   ::= <annotation-xml>  well-formed XML fragment  </annotation-xml>

 

An annotation is an unrestricted description in that it can be unstructured text or coded in some computer language. Annotation-xml provides XML-formatted annotations. 

 

The bound variable rules:

Bvar                             ::=        <bvar> (Ci | Ci-with-semantics) Degree? </bvar>

Ci-with-semantics         ::=        <semantics>(Ci | Ci-with-semantics)

(Annotation | Annotation-xml)* </semantics>

 

A Bvar is a ci identifier, with an optional Degree-coupling, and possibly wrapped inside a descriptive semantics element.

 

Attributes of Content MathML elements:

Each element has attributes that specify it further. The following tables presents all the attributes, the elements to which they apply, the values they can take, and their default value.  The names of the attributes, along with the names of the elements and values, make the table self-explanatory.

 

Table 4: Attributes of Content MathML Elements

Attribute

Elements

Values

Default Value

Base

cn

any numeric string

10

Closure

interval

closed, open, open-closed, closed-open

closed

Nargs

declare

nary, any numeric string

1

Occurrence

declare

prefix, infix, function-model

Function-model

Order

list

lexicographic, numeric

numeric

 

 

 

Type

cn

integer, rational, real, complex-polar, complex-cartesian, constant, e-notation

Real

ci

integer, rational, real, complex-polar, complex-cartesian, complex, constant, function

“”

declare

Whatever values appropriate to the first child element of <declare>

“”

set

normal, multiset (allows duplicates)

normal

tendsto

above, below, two-sided

two-sided

 

definitionURL 

csymbol, declare, semantics,

all operators

Any URL, which specifies the location where defining or modifying semantics can be found

None

 

Encoding

annotation, annotation-xml, csymbol, semantics, all operators

MathML-Presentation, MathML-Content, TeX, OpenMath, …

“”

class/style/

id/other

all content elements

Used for rendering and compatibility with Cascading Style Sheets

“”

 



[1] reln and fn are two additional constructors, carried over from MathML 1.0, but deprecated.