# 4 Content Markup

## 4.1 Introduction

### 4.1.1 The Intent of Content Markup

The intent of Content Markup is to provide an explicit encoding of the underlying mathematical meaning of an expression, rather than any particular rendering for the expression. Mathematics is distinguished both by its use of rigorous formal logic to define and analyze mathematical concepts, and by the use of a (relatively) formal notational system to represent and communicate those concepts. However, mathematics and its presentation should not be viewed as one and the same thing. Mathematical notation, though more rigorous than natural language, is nonetheless at times ambiguous, context-dependent, and varies from community to community. In some cases, heuristics may adequately infer mathematical semantics from mathematical notation. But in many others cases, it is preferable to work directly with the underlying, formal, mathematical objects. Content Markup provides a rigorous, extensible semantic framework and a markup language for this purpose.

The difficulties in inferring semantics from a presentation stem from the fact that there are many to one mappings from presentation to semantics and vice versa. For example the mathematical construct "H multiplied by e" is often encoded using an explicit operator as in H × e. In different presentational contexts, the multiplication operator might be invisible "H e", or rendered as the spoken word "times". Generally, many different presentations are possible depending on the context and style preferences of the author or reader. Thus, given "H e" out of context it may be impossible to decide if this is the name of a chemical or a mathematical product of two variables H and e. Mathematical presentation also changes with culture and time: some expressions in combinatorial mathematics today have one meaning to a Russian mathematician, and quite another to a French mathematician. Notations may lose currency, for example the use of musical sharp and flat symbols to denote maxima and minima [Chaundy1954]. A notation in use in 1644 for the multiplication mentioned above was He [Cajori1928].

By encoding the underlying mathematical structure explicitly, without regard to how it is presented aurally or visually, it is possible to interchange information more precisely between systems that semantically process mathematical objects. In the trivial example above, such a system could substitute values for the variables H and e and evaluate the result. Important application areas include computer algebra systems, automatic reasoning system, industrial and scientific applications, multi-lingual translation systems, mathematical search, and interactive textbooks.

The organization of this chapter is as follows. In Section 4.2 Content MathML Elements Encoding Expression Structure, a core collection of elements comprising Strict Content Markup are described. Strict Content Markup is sufficient to encode general expression trees in a semantically rigorous way. It is in one-to-one correspondence with OpenMath element set. OpenMath is a standard for representing formal mathematical objects and semantics through the use of extensible Content Dictionaries. Strict Content Markup defines a mechanism for associating precise mathematical semantics with expression trees by referencing OpenMath Content Dictionaries. In Section 4.3 Content MathML for Specific Structures, markup is introduced for representing a small number of mathematical idioms, such as limits on integrals, sums and product. These constructs may all be rewritten as Strict Content Markup expressions, and rules for doing so are given. In Section 4.4 Content MathML for Specific Operators and Constants, elements are introduced for many common function, operators and constants. This section contains many examples, including equivalent Strict Content expressions. Section 4.5 Deprecated Content Elements is a minor section. Finally, Section 4.6 The Strict Content MathML Translation summarizes the alrogrithm for translating arbitrary Content Markup into Strict Content Markup. It collects together in sequence all the rewrite rules introduced throughout the rest of the chapter.

### 4.1.2 The Structure and Scope of Content MathML Expressions

Content MathML represents mathematical objects as expression trees. The notion of constructing a general expression tree is e.g. that of applying an operator to sub-objects. For example, the sum "x+y" can be thought of as an application of the addition operator to two arguments x and y. And the expression "cos(π)" as the application of the cosine function to the number π.

As a general rule, the terminal nodes in the tree represent basic mathematical objects such as numbers, variables, arithmetic operations and so on. The internal nodes in the tree represent function application or other mathematical constructions that build up a compound objects. Function application provides the most important example; an internal node might represent the application of a function to several arguments, which are themselves represented by the nodes underneath the internal node.

The semantics of general mathematical expressions is not a matter of consensus. It would be an enormous job to systematically codify most of mathematics – a task that can never be complete. Instead, MathML makes explicit a relatively small number of commonplace mathematical constructs, chosen carefully to be sufficient in a large number of applications. In addition, it provides a mechanism for associating semantics with new notational constructs. In this way, mathematical concepts that are not in the base collection of elements can still be encoded.

The base set of content elements is chosen to be adequate for simple coding of most of the formulas used from kindergarten to the end of high school in the United States, and probably beyond through the first two years of college, that is up to A-Level or Baccalaureate level in Europe.

While the primary role of the MathML content element set is to directly encode the mathematical structure of expressions independent of the notation used to present the objects, rendering issues cannot be ignored. There are different approaches for rendering Content MathML formulae, ranging from from native implementations of the MathML elements to declarative notation definitions, to XSLT style sheets. The MathML 3 Recommendation will not make one of these normative, but only specify sample notations by way of examples.

### 4.1.3 Strict Content MathML

In MathML 3, a subset, or profile, of Content MathML is defined: Strict Content MathML. This uses a minimal set of elements to represent the meaning of a mathematical expression in a uniform structure, while the full Content MathML grammar is backward compatible with MathML 2.0, and generally tries to strike a more pragmatic balance between verbosity and formality.

Content MathML provides a large number of predefined functions encoded as empty elements (e.g. sin, log, etc.) and a variety of constructs for forming compound objects (e.g. set, interval, etc.). By contrast, Strict Content MathML uses a single element (csymbol) with an attribute pointing to an external definition in extensible content dictionaries to represent all functions, and uses only apply and bind for building up compound objects. The token elements such as ci and cn are also considered part of Strict Content MathML, but with a more restricted set of attributes and with content restricted to text.

In particular, Strict Content MathML is designed to be compatible with OpenMath (in fact it is an XML encoding of OpenMath Objects in the sense of [OpenMath2004]). OpenMath is a standard for representing formal mathematical objects and semantics through the use of extensible Content Dictionaries. The table below gives an element-by-element correspondence between the OpenMath XML encoding of OpenMath objects and Strict Content MathML.

Strict Content MathML OpenMath
cn OMI, OMF
csymbol OMS
ci OMV
cs OMSTR
apply OMA
bind OMBIND
bvar OMBVAR
share OMR
semantics OMATTR
annotation, annotation-xml OMATP, OMFOREIGN
error OME
cbytes OMB

In MathML 3, formal semantics for general Content MathML expressions are given by specifying equivalent Strict Content MathML expressions, so that they inherit their semantics. To make the correspondence exact, a transformation algorithm is given in terms of transformation rules that are applied in order to rewrite particular MathML constructs into a strict equivalents. The individual rules are introduce in context throughout the chapter. In Section 4.6 The Strict Content MathML Translation, the algorithm as a whole is described.

As most transformation rules relate to classes of MathML elements that have similar argument structure, they are introduced in Section 4.3.4 Operator Classes where these classes are defined. Some special case rules for specific elements are given in Section Section 4.4 Content MathML for Specific Operators and Constants. Transformations in Section 4.2 Content MathML Elements Encoding Expression Structure concern extended usages of the core Content MathML elements, those in Section 4.3 Content MathML for Specific Structures concern the rewriting of some additional structures not supported in Strict Content MathML.

The transformation algorithm from Section 4.6 The Strict Content MathML Translation is complete: it gives every Content MathML expression a specific meaning in terms of a Strict Content MathML expression. This means it has to give specific strict interpretations to some expressions whose meaning was insufficiently specified in MathML2. The intention of this algorithm is to be faithful to mathematical intuitions. However edge cases may remain where the normative interpretation of the algorithm may break earlier intuitions.

A conformant MathML processor need not implement this transformation. The existence of these transformation rules does not imply that a system must treat equivalent expressions identically. In particular systems may give different presentation renderings for expresssions that the transformation rules imply are mathematically equivalent.

### 4.1.4 Content Dictionaries

Due to the nature of mathematics, any method for formalizing the meaning of the mathematical expressions must be extensible. The key to extensibility is the ability to define new functions and other symbols to expand the terrain of mathematical discourse. To do this, two things are required: a mechanism for representing symbols not already defined by Content MathML, and a means of associating a specific mathematical meaning with them in an unambiguous way. In MathML 3, the csymbol element provides the means to represent new symbols, while Content Dictionaries are the way in which mathematical semantics are described. The association is accomplished via attributes of the csymbol element that point at a definition in a CD. The syntax and usage of these attributes are described in detail in Section 4.2.3 Content Symbols <csymbol>.

Content Dictionaries are structured documents for the definition of mathematical concepts; see the OpenMath standard, [OpenMath2004]. To maximize modularity and reuse, a Content Dictionary typically contains a relatively small collection of definitions for closely related concepts. The OpenMath Society maintains a large set of public Content Dictionaries including the MathML CD group that including contains definitions for all pre-defined symbols in MathML. There is a process for contributing privately developed CDs to the OpenMath Society repository to facilitate discovery and reuse. MathML 3 does not require CDs be publicly available, though in most situations the goals of semantic markup will be best served by referencing public CDs available to all user agents.

In the text below, descriptions of semantics for predefined MathML symbols refer to the Content Dictionaries developed by the OpenMath Society in conjunction with the W3C Math Working Group. It is important to note, however, that this information is informative, and not normative. In general, the precise mathematical semantics of predefined symbols are not not fully specified by the MathML 3 Recommendation, and the only normative statements about symbol semantics are those present in the text of this chapter. The semantic definitions provided by the OpenMath Content CDs are intended to be sufficient for most applications, and are generally compatible with the semantics specified for analogous constructs in the MathML 2.0 Recommendation. However, in contexts where highly precise semantics are required (e.g. communication between computer algebra systems, within formal systems such as theorem provers, etc.) it is the responsibility of the relevant community of practice to verify, extend or replace definitions provided by OpenMath CDs as appropriate.

## 4.2 Content MathML Elements Encoding Expression Structure

In this section we will present the elements for encoding the structure of content MathML expressions. These elements are the only ones used for the Strict Content MathML encoding. Concretely, we have

Full Content MathML allows further elements presented in Section 4.3 Content MathML for Specific Structures and Section 4.4 Content MathML for Specific Operators and Constants, and allows a richer content model presented in this section. We will contrast the strict and full content models in syntax tables at the beginning of the element specifications.

In these tables, the Content, Attributes, and Attribute Values rows specify the XML encoding. Where applicable, the Class row specifies the operator class, which indicate how many arguments the operator represented by this element takes, and also in many cases determines the mapping to Strict Content MathML, as described in Section 4.3.4 Operator Classes. Finally, the Qualifiers row clarifies whether the operator takes qualifiers and if so, which. Both specify how many siblings may follow the operator element in an apply; see Section 4.2.5 Function Application <apply> and Section 4.3.3 Qualifiers for details).

### 4.2.1 Numbers <cn>

Schema Fragment (Strict) Schema Fragment (Full)
Class Cn Cn
Attributes CommonAtt, type CommonAtt, type?, base?
type Attribute Values "integer" | "real" | "double" | "hexdouble" |     "integer" | "real" | "double" | "hexdouble" | "e-notation" | "rational" | "complex-cartesian" | "complex-polar" | "constant" real
base Attribute Values integer 10
Content text (text |mglyph |sep | PresentationExp)*

The cn element is the Content MathML element used to represent numbers. Strict Content MathML supports integers, real numbers, and double precision floating point numbers. In these types of numbers, the content of cn is text. Additionally, cn supports rational numbers and complex numbers in which the different parts are separated by use of the sep element. Constructs using sep may be rewritten in Strict Content MathML as constructs using apply as described below.

The type attribute specifies which kind of number is represented in the cn element. The default value is "real". Each type implies that the content be of a certain form, as detailed below.

#### 4.2.1.1 Rendering <cn>-Represented Numbers

The default rendering of the text content of cn is the same as that of the Presentation element mn, with suggested variants in the case of attributes or sep being used, as listed below.

#### 4.2.1.2 Strict Content MathML

In Strict Content MathML, the type attribute is mandatory, and may only take the values "integer", "real", "hexdouble" or "double":

integer
An integer is represented by an optional sign followed by a string of one or more decimal "digits".
real
A real number is presented in radix notation. Radix notation consists of an optional sign ("+" or "-") followed by a string of digits possibly separated into an integer and a fractional part by a "decimal point". Some examples are 0.3, 1, and -31.56.
double
This type is used to mark up those double-precision floating point numbers that can be represented in the IEEE 754 standard format [IEEE754]. This includes a subset of the (mathematical) real numbers, negative zero, positive and negative real infinity and a set of "not a number" values. The lexical rules for interpreting the text content of a cn as an IEEE double are specified by Section 3.1.2.5 of XML Schema Part 2: Datatypes Second Edition [XMLSchemaDatatypes]. For example, -1E4, 1267.43233E12, 12.78e-2, 12 , -0, 0 and INF are all valid doubles in this format.
hexdouble

This type is used to directly represent the the 64 bits of an IEEE 754 double-precision floating point number as a 16 digit hexadecimal number. Thus the number represents mantissa, exponent, and sign from lowest to highest bits using a least significant byte ordering. This consists of a string of 16 digits 0-9, A-F. The following example represents a NaN value. Note that certain IEEE doubles, such as the preceding NaN, cannot be represented in the lexical format for the "double" type.

 7F800000 $7F800000$

Sample Presentation

 0x7F800000 $0x7F800000$

#### 4.2.1.3 Extended uses of <cn>

The base attribute is used to specify how the content is to be parsed. The attribute value is a base 10 positive integer giving the value of base in which the text content of the cn is to be interpreted. The base attribute should only be used on elements with type "integer" or "real". Its use on cn elements of other type is deprecated. The default value for base is "10".

Additional values for the type attribute element for supporting e-notations for real numbers, rational numbers, complex numbers and selected important constants. As with the "integer", "real", "double" and "hexdouble" types, each of these types implies that the content be of a certain form. If the type attribute is omitted, it defaults to "real".

integer

Integers can be represented with respect to a base different from 10: If base is present, it specifies (in base 10) the base for the digit encoding. Thus base='16' specifies a hexadecimal encoding. When base > 10, Latin letters (A-Z, a-z) are used in alphabetical order as digits. The case of letters used as digits is not significant. The following example encodes the number written as 32736 in base ten.

 7FE0 $7FE0$

Sample Presentation

 7FE016 ${7FE0}_{16}$

When base > 36, some integers cannot be represented using numbers and letters alone. For example, while

 10F $10F$

arguably represents the number written in base 10 as 1,000,015, the number written in base 10 as 1,000,037 cannot be represented using letters and numbers alone when base is 1000. Consequently, it is up to applications to specify what additional characters (if any) may be used for digits when base > 36.

real
Real numbers can be represented with respect to a base different than 10. If a base attribute is present, then the digits are interpreted as being digits computed relative to that base (in the same way as described for type "integer").
e-notation

A real number may be presented in scientific notation using this type. Such numbers have two parts (a significand and an exponent) separated by a <sep/> element. The first part is a real number, while the second part is an integer exponent indicating a power of the base.

For example, <cn type="e-notation">12.3<sep/>5</cn> represents 12.3 times 105. The default presentation of this example is 12.3e5. Note that this type is primarily useful for backwards compatibility with MathML 2, and in most cases, it is preferable to use the "double" type, if the number to be represented is in the range of IEEE doubles:

rational

A rational number is given as two integers to be used as the numerator and denominator of a quotient. The numerator and denominator are separated by <sep/>.

 227 $22/7$

Sample Presentation

 22/7 $22/7$

complex-cartesian

A complex cartesian number is given as two numbers specifying the real and imaginary parts. The real and imaginary parts are separated by the <sep/> element, and each part has the format of a real number as described above.

  12.3 5  $12.3+5i$

Sample Presentation

  12.3+5i  $12.3+5i$

complex-polar

A complex polar number is given as two numbers specifying the magnitude and angle. The magnitude and angle are separated by the <sep/> element, and each part has the format of a real number as described above.

  2 3.1415  $2e^{i 3.1415}$

Sample Presentation

  2 e i3.1415  $2{e}^{i3.1415}$

  Polar 23.1415  $\mathrm{Polar}\left(2,3.1415\right)$

constant

If the value type is "constant", then the content should be Unicode representations of a well-known constant. Some important constants and their common Unicode representations are listed below.

This cn type is primarily for backward compatibility with MathML 1.0. MathML 2.0 introduced many empty elements, such as <pi/> to represent constants, and the empty element representations are preferred.

Mapping to Strict Content MathML

If a base attribute is present, it specifies the base used for the digit encoding of both integers. The use of base with "rational" numbers is deprecated.

##### Rewrite: cn sep

If there are sep children of the cn, then intervening text may be rewritten as cn elements. If the cn element containing sep also has a base attribute, this is copied to each of the cn arguments of the resulting symbol, as shown below.

 nd $n/d$

is rewritten to

 rational n d  $\mathrm{rational}(n_{b}, d_{b})$

The symbol used in the result depends on the type attribute according to the following table:

type attribute OpenMath Symbol
e-notation bigfloat
rational rational
complex-cartesian complex_cartesian
complex-polar complex_polar

Note: In the case of bigfloat the symbol takes three arguments, <cn type="integer">10</cn> should be inserted as the second argument, denoting the base of the exponent used.

If the type attribute has a different value, or if there is more than one <sep/> element, then the intervening expressions are converted as above, but a system-dependent choice of symbol for the head of the application must be used.

If a base attribute has been used then the resulting expression is not Strict Content MathML, and each of the arguments needs to be recursively processed.

##### Rewrite: cn based_integer

A cn element with a base attribute other than 10 is rewritten as follows. (A base attribute with value 10 is simply removed) .

 FF60 $FF60_{16}$
 based_integer 16 FF60  $\mathrm{based_integer}(16, FF60)$

If the original element specified type "integer" or if there is no type attribute, but the the content of the element just consists of the characters [a-zA-Z0-9] and white space then the symbol used as the head in the resulting application should be based_integer as shown. Otherwise it should be should be based_float.

##### Rewrite: cn constant

In Strict Content MathML, constants should be represented using csymbol elements. A number of important constants are defined in the nums1 content dictionary. An expression of the form

 c $c$

has the Strict Content MathML equivalent

 c2 $\mathrm{c2}$

where c2 corresponds to c as specified in the following table.

Content Description OpenMath Symbol
U+03C0 (&pi;) The usual π of trigonometry: approximately 3.141592653... pi
U+2147 (&ExponentialE; or &ee;) The base for natural logarithms: approximately 2.718281828... e
U+2148 (&ImaginaryI; or &ii;) Square root of -1 i
U+03B3 (&gamma;) Euler's constant: approximately 0.5772156649... gamma
U+221E (&infin; or &infty;) Infinity. Proper interpretation varies with context infinity

### 4.2.2 Content Identifiers <ci>

Schema Fragment (Strict) Schema Fragment (Full)
Class Ci Ci
Attributes CommonAtt, type? CommonAtt, type?
type Attribute Values "integer", "rational", "real", "complex", "complex-polar" "complex-cartesian", "constant", "function", "vector", "list", "set", "matrix" string
Qualifiers BvarQ, DomainQ, degree, momentabout, logbase
Content text StringMglyph | PresentationExp

Content identifiers represent "mathematical variables" which have properties, but no fixed value, e.g. x and y in the sum expression "x+y" above. Mathematically, we distinguish "bound variables" which are in the scope of a binding construct from "free variables" i.e. ones that are not; see Section 4.2.6.1 Bindings for details.

#### 4.2.2.1 Strict Content MathML

Content MathML uses the ci element (mnemonic for "content identifier") to construct a variable, i.e. an identifier that is not a symbol. In the sum expression "x+y" above, the variable x would be represented as

 x $x$

After white space normalization the content of a ci element is interpreted as a name that identifies it. Two variables are considered equal, if and only if their names are identical and in the same scope (see Section 4.2.6 Bindings and Bound Variables <bind> and <bvar> for a discussion).

The ci element uses the type attribute to specify the basic type of object that it represents. In Strict Content MathML, the set of permissible values is "integer", "rational", "real", "complex", "complex-polar", "complex-cartesian", "constant", "function", vector, list, set, and matrix. These values correspond to the symbols integer_type, rational_type, real_type, complex_polar_type, complex_cartesian_type, constant_type, fn_type, vector_type, list_type, set_type, and matrix_type in the mathmltypes Content Dictionary: In this sense the following two expressions are considered equivalent:

 n $n$
  n integer_type  $n$

#### 4.2.2.2 Extended uses of <ci>

The ci element allows any string value for the type attribute, in particular any of the names of the MathML container elements or their type values.

Mapping to Strict Content MathML

##### Rewrite: ci type annotation

In Strict Content, type attributes are represented via semantic attribution. An expression of the form

 n $n$

is rewritten to

  n T  $n$

For a more advanced treatment of types, the type attribute is inappropriate. Advanced types require significant structure of their own (for example, vector(complex)) and are probably best constructed as mathematical objects and then associated with a MathML expression through use of the semantics element. See Section 4.2.8.1 Semantic annotations for an example and [MathMLTypes] for more examples.

In addition to the forms described above, the ci and element can contain mglyph elements to refer to characters not currently available in Unicode, or a general presentation construct (see Section 3.1.9 Summary of Presentation Elements), which is used for rendering (see Section 4.1.2 The Structure and Scope of Content MathML Expressions).

##### Rewrite: ci presentation mathml

An ci expression with non-text content of the form

 P $P$

is transformed to Strict Content MathML by rewriting it to

  p P  $p$

Where the identifier name (which has to be a text string) should be determined from the presentation MathML content, in a system defined way, perhaps as in the above example by taking the character data of the element, ignoring any element markup. Systems doing such rewriting should ensure that constructs using the same Presentation MathML content are rewritten to semantics elements using the same ci, and that conversely constructs that use different MathML should be rewritten to different identifier names (even if the Presentation MathML has the same character data).

The following example encodes an atomic symbol that displays visually as C2 and that, for purposes of content, is treated as a single symbol

  C2  ${C}^{2}$

The Strict Content MathML equivalent is

  C2 C2  $\mathrm{C2}$

Sample Presentation

  C2 ${C}^{2}$

#### 4.2.2.3 Rendering Content Identifiers

If the content of a ci element consists of Presentation MathML, that presentation is used. If no such tagging is supplied then the text content is rendered as if it were the content of an mi element. If an application supports bidirectional text rendering, then the rendering follows the Unicode bidirectional rendering.

The type attribute can be interpreted to provide rendering information. For example in

 V $V$

a renderer could display a bold V for the vector.

### 4.2.3 Content Symbols <csymbol>

Schema Fragment (Strict) Schema Fragment (Full)
Class Csymbol Csymbol
Attributes CommonAtt, cd CommonAtt, TypeAtt?, cd?,
Content Name StringMglyph | PresentationExp
Qualifiers BvarQ, DomainQ, degree, momentabout, logbase

Content MathML makes a crucial semantic distinction between a function itself and the expression resulting from applying that function to zero or more arguments. This is addressed by making functions self-contained objects with their own properties and providing an explicit apply construct corresponding to function application. We will consider the apply construct in the next section.

In the sum expression "x+y" above, x and y are typically taken to be "variables", since they have properties, but no fixed value, whereas the addition function is a "constant" or "symbol" as it denotes a specific function, which is defined somewhere externally. Note that the term "symbol" is used here in the abstract sense and has no connection with any presentation of the construct on screen or paper. These are handled by the infrastructure in Chapter 3 Presentation Markup.

#### 4.2.3.1 Strict Content MathML

A csymbol is used to refer to a specific, mathematically-defined concept with an external definition referenced via attributes. Conceptually, a reference to an external definition is merely a URI, i.e. a label uniquely identifying the definition. However, to be useful for communication between user agents, external definitions must be shared. For this reason, over the years several efforts have been organized to develop systematic, public repositories of mathematical definitions. Of these, the ongoing development of OpenMath Content Dictionaries (CDs) is the most open and extensive, and in MathML 3, OpenMath CDs are the preferred source of external definitions. In particular, the definitions of pre-defined MathML 3 operators and functions are given in terms of OpenMath CDs.

MathML 3 provides two mechanisms for referencing external definitions or content dictionaries. The first, using the cd attribute, follows conventions established by OpenMath specifically for referencing CDs. The second, using the definitionURL attribute, is backward compatible with MathML 2, and can be used to reference CDs or any other source of definitions that can be identified by a URI.

When referencing OpenMath CDs, the preferred method is to use the cd attribute as follows. Abstractly, OpenMath symbol definitions are identified by a triple of values: a symbol name, a CD name, and a CD base, which is a URI that disambiguates CDs of the same name. To associate such a triple with a csymbol, the content of the csymbol specifies the symbol name, and the name of the Content Dictionary is given using the cd attribute. The CD base is determined either from the document embedding the math element which contains the csymbol by a mechanism given by the embedding document format, or by system defaults, or by the cdgroup attribute , which is optionally specified on the enclosing math element; see Section 2.2.1 Attributes. In the absence of specific information http://www.openmath.org/cd is assumed as the CD base for all csymbol elements annotation, and annotation-xml. This is the CD base for the collection of standard CDs maintained by the OpenMath Society.

The cdgroup specifies a URL to an OpenMath CD Group file. For a detailed description of the format of a CD Group file, see Section 4.4.2 (CDGroups) in [OpenMath2004]. Conceptually, a CD group file is a list of pairs consisting of a CD name, and a corresponding CD base. When a csymbol references a CD name using the cd attribute, the name is looked up in the CD Group file, and the associated CD base value is used for that csymbol. When a CD Group file is specified, but a referenced CD name does not appear in the group file, or there is an error in retrieving the group file, the referencing csymbol is not defined. However, the handling of the resulting error is not defined, and is the responsibility of the user agent.

While references to external definitions are URIs, it is strongly recommended that CD files be retrievable at the location obtained by interpreting the URI as a URL. In particular, other properties of the symbol being defined may be available by inspecting the Content Dictionary specified. These include not only the symbol definition, but also examples and other formal properties. Note, however, that there are multiple encodings for OpenMath Content Dictionaries, and it is up to the user agent to correctly determine the encoding when retrieving a CD.

#### 4.2.3.2 Extended uses of <csymbol>

In addition to the forms described above, the csymbol and element can contain mglyph elements to refer to characters not currently available in Unicode, or a general presentation construct (see Section 3.1.9 Summary of Presentation Elements), which is used for rendering (see Section 4.1.2 The Structure and Scope of Content MathML Expressions).

External definitions (in OpenMath CDs or elsewhere) may also be specified directly for a csymbol using the definitionURL attribute. When used to reference OpenMath symbol definitions, the abstract triple of (symbol name, CD name, CD base) is mapped to a fully-qualified URI as follows:

URI = cdbase + '/' + cd-name + '#' + symbol-name

For example,

(plus, arith1, http://www.openmath.org/cd)

is mapped to

http://www.openmath.org/cd/arith1#plus
 Editorial note MiKo: I thought we got rid of cdbase (David: it's not an attribute, but is in the abstract openmath model)

The resulting URI is specified as the value of the definitionURL attribute.

This form of reference is useful for backwards compatibility with MathML2 and to facilitate the use of Content MathML within URI-based frameworks (such as RDF [rdf] in the Semantic Web or OMDoc [OMDoc1.2]). Another benefit is that the symbol name in the CD does not need to correspond to the content of the csymbol element. However, in general, this method results in much longer MathML instances. Also, in situations where CDs are under development, the use of a CD Group file allows the locations of CDs to change without a change to the markup. A third drawback to definitionURL is that unlike the cd attribute, it is not limited to referencing symbol definitions in OpenMath content dictionaries. Hence, it is not in general possible for a user agent to automatically determine the proper interpretation for definitionURL values without further information about the context and community of practice in which the MathML instance occurs.

Both the cd and definitionURL mechanisms of external reference may be used within a single MathML instance. However, when both a cd and a definitionURL attribute are specified on a single csymbol, the cd attribute takes precedence.

#### 4.2.3.3 Rendering Symbols

If the content of a csymbol element is tagged using presentation tags, that presentation is used. If no such tagging is supplied then the text content is rendered as if it were the content of an mi element. In particular if an application supports bidirectional text rendering, then the rendering follows the Unicode bidirectional rendering.

### 4.2.4 String Literals <cs>

Schema Fragment
Class Cs
Attributes CommonAtt
Content text

The cs element encodes "string literals" which may be used in Content MathML expressions.

The content of cs is text. Unlike other token elements cs may not contain mglyph or other Presentation MathML constructs, and the content does not undergo white space normalisation.

Content MathML

  AB  $\{A, B, \}$

Sample Presentation

  { A , B ,    } 

### 4.2.5 Function Application <apply>

Schema Fragment (Strict) Schema Fragment (Full)
Class Apply Apply
Attributes CommonAtt CommonAtt
Content ContExp+ ContExp+ | ContExp, BVar, Qualifier?, ContExp+

The most fundamental way of building a compound object in mathematics is by applying a function or an operator to some arguments.

#### 4.2.5.1 Strict Content MathML

In MathML, the apply element is used to build an expression tree that represents the result of applying a function or operator to its arguments. The resulting tree corresponds to a complete mathematical expression. Roughly speaking, this means a piece of mathematics that could be surrounded by parentheses or "logical brackets" without changing its meaning.

For example, (x + y) might be encoded as

 plusxy $\mathrm{plus}(x, y)$

The opening and closing tags of apply specify exactly the scope of any operator or function. The most typical way of using apply is simple and recursive. Symbolically, the content model can be described as:

<apply> op [ ab ...] </apply>

where the operands a, b, ... are MathML expression trees themselves, and op is a MathML expression tree that represents an operator or function. Note that apply constructs can be nested to arbitrary depth.

An apply may in principle have any number of operands. For example, (x + y + z) can be encoded as

 plus x y z  $\mathrm{plus}(x, y, z)$

Note that MathML also allows applications without operands, e.g. to represent functions like random(), or current-date().

Mathematical expressions involving a mixture of operations result in nested occurrences of apply. For example, a x + b would be encoded as

 plus times a x b  $\mathrm{plus}(\mathrm{times}(a, x), b)$

There is no need to introduce parentheses or to resort to operator precedence in order to parse expressions correctly. The apply tags provide the proper grouping for the re-use of the expressions within other constructs. Any expression enclosed by an apply element is well-defined, coherent object whose interpretation does not depend on the surrounding context. This is in sharp contrast to presentation markup, where the same expression may have very different meanings in different contexts. For example, an expression with a visual rendering such as (F+G)(x) might be a product, as in

 times plus F G x  $\mathrm{times}(\mathrm{plus}(F, G), x)$

or it might indicate the application of the function F + G to the argument x. This is indicated by constructing the sum

 plusFG $\mathrm{plus}(F, G)$

and applying it to the argument x as in

  plus F G x  $\mathrm{plus}(F, G)(x)$

In both cases, the interpretation of the outer apply is explicit and unambiguous, and does not change regardless of where the expression may be reused.

The preceding example also illustrates that in an apply construct, both the function and the arguments may be simple identifiers or more complicated expressions.

The apply element is conceptually necessary in order to distinguish between a function or operator, and an instance of its use. The expression constructed by applying a function to 0 or more arguments is always an element from the codomain of the function. Proper usage depends on the operator that is being applied. For example, the plus operator may have zero or more arguments, while the minus operator requires one or two arguments in order to be properly formed.

#### 4.2.5.2 Rendering Applications

Strict Content MathML applications are rendered as mathematical function applications:

If <mi>F</mi> is the rendering of <ci>f</ci> and <mi>Ai</mi> those of <ci>ai</ci>.

 f a1 a2 ... an  $f(\mathrm{a1}, \mathrm{a2}, \mathrm{...}, \mathrm{an})$

Sample Presentation

  F ( A1 , ... , A2 , An )  $F\left(\mathrm{A1},\mathrm{...},\mathrm{A2},\mathrm{An}\right)$

MathML applications may be used with qualifiers. In the absence of any more specific rendering rules, the proposed presentation in such cases is to follow the layout used for sum. So for example:

Content MathML

 op x d expression-in-x  $\mathrm{op}(x, , \mathrm{expression-in-x})$

Sample Presentation

  OP XD ( Expression-in-X )  $\underset{X\in D}{\mathrm{OP}}\left(\mathrm{Expression-in-X}\right)$

### 4.2.6 Bindings and Bound Variables <bind> and <bvar>

Many complex mathematical expressions are constructed with the use of bound variables, and bound variables are an important concept of logic and formal languages. Variables become bound in the scope of an expression through the use of a quantifier. Informally, they can be thought of as the "dummy variables" in expressions such as integrals, sums, products, and the logical quantifiers "for all" and "there exists". A bound variable is characterized by the property that systematically renaming the variable (to a name not already appearing in the expression) does not change the meaning of the expression.

#### 4.2.6.1 Bindings

Schema Fragment (Strict) Schema Fragment (Full)
Class Bind Bind
Attributes CommonAtt CommonAtt
Content ContExp, BVar*, ContExp ContExp, BVar*, Qualifier*, ContExp+

Binding expressions are represented as MathML expression trees using the bind element. Its first child is a MathML expression that represents a binding operator (the integral operator in our example). This is followed by a non-empty list of bvar elements denoting the bound variables, and then the final child which is a general Content MathML expression, known as the body of the binding.

#### 4.2.6.2 Bound Variables

Schema Fragment (Strict) Schema Fragment (Full)
Class BVar BVar
Attributes CommonAtt CommonAtt
Content AnnVar AnnVar,degree | degree,AnnVar

The bvar element is used to denote the bound variable of a binding expression, e.g. in sums, products, and quantifiers or user defined functions.

The content of a bvar element is an annotated variable, i.e. either a content identifier represented by a ci element or a semantics element whose first child is an annotated variable. The name of an annotated variable of the second kind is the name of its first child. The name of a bound variable is that of the annotated variable in the bvar element.

Bound variables are identified by comparing their names. Such identification can be made explicit by placing an id on the ci element in the bvar element and referring to it using the xref attribute on all other instances. An example of this approach is

 forall x lt x 1  $\mathrm{forall}x\mathrm{lt}(x, 1)$

This id based approach is especially helpful when constructions involving bound variables are nested.

It is sometimes necessary to associate additional information with a bound variable. The information might be something like a detailed mathematical type, an alternative presentation or encoding or a domain of application. Such associations are accomplished in the standard way by replacing a ci element (even inside the bvar element) by a semantics element containing both the ci and the additional information. Recognition of an instance of the bound variable is still based on the actual ci elements and not the semantics elements or anything else they may contain. The id based-approach outlined above may still be used.

The following example encodes forall x. x+y=y+x.

 forall x eq plusxy plusyx  $\mathrm{forall}x\mathrm{eq}(\mathrm{plus}(x, y), \mathrm{plus}(y, x))$

In non-Strict Content markup, the bvar element is used in a number of idiomatic constructs. These are described in Section 4.3.3 Qualifiers and Section 4.4 Content MathML for Specific Operators and Constants.

#### 4.2.6.3 Renaming Bound Variables

It is a defining property of bound variables that they can be renamed consistently in the scope of their parent bind element. This operation, sometimes known as α-conversion, preserves the semantics of the expression.

A bound variable x may be renamed to say y so long as y does not occur free in the body of the binding, or in any annotations of the bound variable, x to be renamed, or later bound variables.

If a bound variable x is renamed, all free occurrences of x in annotations in its bvar element, any following bvar children of the bind and in the expression in the body of the bind should be renamed.

In the example in the previous section, note how renaming x to z produces the equivalent expression forall z. z+y=y+z, whereas x may not be renamed to y, as y is free in the body of the binding and would be captured, producing the expression forall y. y+y=y+y which is not equivalent to the original expression.

#### 4.2.6.4 Rendering Binding Constructions

If <ci>b</ci> and <ci>s</ci> are Content MathML expressions that render as the Presentation MathML expressions <mi>B</mi> and <mi>S</mi> then the sample rendering of a binding element is as follows:

Content MathML

 b x1 ... xn s  $b\mathrm{x1}, \mathrm{...}, \mathrm{xn}s$

Sample Presentation

  B x1 , ... , xn . S  $B\mathrm{x1},\mathrm{...},\mathrm{xn}.S$

### 4.2.7 Structure Sharing <share>

To conserve space in the XML encoding, MathML expression trees can make use of structure sharing.

#### 4.2.7.1 The share element

Schema Fragment
Class Share
Attributes CommonAtt, href
href Attribute Values URI
Content Empty

The share element has an href attribute used to to reference a MathML expression tree. The value of the href attribute is a URI specifying the id attribute of the root node of the expression tree. When building a MathML expression tree, the share element is replaced by a copy of the MathML expression tree referenced by the href attribute. Note that this copy is structurally equal, but not identical to the element referenced. The values of the share will often be relative URI references, in which case they are resolved using the base URI of the document containing the share element.

For instance, the mathematical object f(f(f(a,a),f(a,a)),f(f(a,a),f(a,a))) can be encoded as either one of the following representations (and some intermediate versions as well).

 f f f a a f a a f f a a f a a  $f(f(f(a, a), f(a, a)), f(f(a, a), f(a, a)))$
 f f f a a  $f(f(f(a, a), ), )$

#### 4.2.7.2 An Acyclicity Constraint

Say that an element dominates all its children and all elements they dominate. Say also that a share element dominates its target, i.e. the element that carries the id attribute pointed to by the href attribute. For instance in the representation on the right above, the apply element with id="t1" and also the second share (with href="t11") both dominate the apply element with id="t11".

The occurrences of the share element must obey the following global acyclicity constraint: An element may not dominate itself. For example, the following representation violates this constraint:

<apply id="badid1"><csymbol cd="arith1">divide</csymbol>
<cn>1</cn>
<apply><csymbol cd="arith1">plus</csymbol>
<cn>1</cn>
</apply>
</apply>

Here, the apply element with id="foo" dominates its third child, which dominates the share element, which dominates its target: the element with id="foo". So by transitivity, this element dominates itself. By the acyclicity constraint, the example is not a valid MathML expression tree. It might be argued that such an expression could be given the interpretation of the continued fraction . However, the procedure of building an expression tree by replacing share element does not terminate for such an expression, and hence such expressions are not allowed by Content MathML.

Note that the acyclicity constraints is not restricted to such simple cases, as the following example shows:

<apply id="bar">                        <apply id="baz">
<csymbol cd="arith1">plus</csymbol>     <csymbol cd="arith1">plus</csymbol>
<cn>1</cn>                              <cn>1</cn>
<share href="#baz"/>                    <share href="#bar"/>
</apply>                                </apply>

Here, the apply with id="bar" dominates its third child, the share with href="#baz". That element dominates its target apply (with id="baz"), which in turn dominates its third child, the share with href="#bar". Finally, the share with href="#bar" dominates its target, the original apply element with id="bar". So this pair of representations ultimately violates the acyclicity constraint.

#### 4.2.7.3 Structure Sharing and Binding

Note that the share element is a syntactic referencing mechanism: a share element stands for the exact element it points to. In particular, referencing does not interact with binding in a semantically intuitive way, since it allows a phenomenon called variable capture to occur. Consider an example:

 lambda x f lambda x gx  $\mathrm{lambda}xf(\mathrm{lambda}x, g(x))$

This represents a term which has two sub-terms of the form , one with id="orig" (the one explicitly represented) and one with id="copy", represented by the share element. In the original, explicitly-represented term, the variable x is bound by the outer bind element. However, in the copy, the variable x is bound by the inner bind element. One says that the inner bind has captured the variable x.

Using references that capture variables in this way can easily lead to representation errors, and is not recommended. For instance, using α-conversion to rename the inner occurrence of x into, say, y leads to the semantically equivalent expression . However, in this form, it is no longer possible to share the expression . Replacing x with y in the inner bvar without replacing the share element results in a change in semantics.

#### 4.2.7.4 Rendering Expressions with Structure Sharing

The default rendering of a share is that of the MathML element pointed to by the URI in the href attribute.

### 4.2.8 Attribution via semantics

Schema Fragment (Strict) Schema Fragment (content MathML)
Class Semantics Semantics
Attributes definitionURL?, encoding?
Content ContExp, (annotation | annotation-xml)* ContExp, (annotation | annotation-xml)*

Content elements can be adorned with additional information via the semantics element. An annotation decorates a Content MathML expression with a sequence of one or more semantic annotations. MathML uses the semantics element to wrap the annotated element and the annotation-xml and annotation elements for representing the annotations themselves.

Schema Fragment (Strict) Schema Fragment (content MathML)
Class Annotation Annotation
Attributes cd name href? definitionURL? encoding? cd? name? href? clipboardflavor?
Content text text
Schema Fragment (Strict) Schema Fragment (content MathML)
Class AnnotationXML AnnotationXML
Attributes cd name href? definitionURL? encoding? cd? name? href? clipboardflavor?
Content ANY ANY

As such, the semantics element should be considered part of both presentation MathML and Content MathML. MathML considers a semantics element (strict) Content MathML, if and only if its first child is (strict) Content MathML. All MathML processors should process the semantics element, even if they only process one of those subsets.

Each annotation has cd, and name attributes to specify the key, i.e. a symbol that specifies the relation between the annotated object and the annotation; See Section 5.1 Semantic Annotations for details.

An annotation acts as either adornment annotation or as semantic annotation, depending on the role of the key symbol is given by its content dictionary

#### 4.2.8.1 Semantic annotations

When the key has role "semantic-attribution" then the annotated object is modified by the annotation and dropping it changes the semantics.

An example of the use of a semantic attribution would be to indicate the type of an object. For example the following expression associates with an identifier F the information that it represents an operator that takes real numbers as input and returns natural numbers as values (the absolute value function is an example of such a function).

  F fun_type Z N  $F$

Here we have assumed the existence of a content dictionary types that provides a key symbol type that specifies that the attributed expression is of the type specified by the Content MathML expression in the annotation-xml element. The key is specified by the cd and name attributes in the attribution-xml element. The encoding attribute on the annotation-xml element specifies the format of the XML data.

When the key symbol has role "attribution" in the content dictionary, then an annotation with this key is an adornment annotation and dropping the annotation is not harmful and preserves the semantics. If the key symbol lacks the role specification then attribution is acting as adornment annotation.

An example of the use of an adornment attribution would be to indicate the color in which a Content MathML expression A should be displayed, for example

  A red  $A$

Note red are arbitrary representations whereas the key is a symbol.

#### 4.2.8.3 Rendering Annotations

The default rendering of a semantics element is the default rendering of its first child possibly augmented with default renderings of the semantic annotations depending on the key symbol; adornment annotations are not rendered by default.

When a Presentation MathML annotation is provided, a MathML renderer may optionally use this information to render the MathML construct. This would typically be the case when the first child is a MathML content construct and the annotation is provided to give a preferred rendering differing from the default for the content elements.

### 4.2.9 Error Markup <cerror>

Schema Fragment (Strict)
Class Error
Attributes CommonAtt
Content Symbol, ContExp*

A content error expression is made up of a symbol and a sequence of zero or more MathML expression trees. The initial symbol indicates the kind of error. The cerror object has no direct mathematical meaning. Errors occur as the result of some action performed on an expression tree and are thus of real interest only when some sort of communication is taking place. Errors may occur inside other objects and also inside other errors.

As an example, to encode a division by zero error, one might employ a hypothetical aritherror Content Dictionary with a DivisionByZero symbol, as in the following expression tree:

  DivisionByZero dividex0  $\mathrm{DivisionByZero}\mathrm{divide}(x, 0)$

Note that error markup generally should enclose only the smallest erroneous sub-expression. Thus a cerror will often be a sub-expression of a bigger one, e.g.

 eq DivisionByZero dividex0 0  $\mathrm{eq}(\mathrm{DivisionByZero}\mathrm{divide}(x, 0), 0)$

If an application wishes to signal that a Content MathML expression it has received is syntactically invalid or is not well-formed, the offending data must be encoded as a string. For example:

  invalid_XML <apply><cos> <ci>v</ci> </apply>  $\mathrm{invalid_XML}\text{ v }$

Note that the < and > characters have been escaped as is usual in an XML document.

The default presentation of a cerror element is a merror expression, where the first child of the merror is a presentation of the first child of the cerror expression and and the remaining children are passed on for reference. For instance the presentation of the example above could be

  Division by zero dividex0  $\text{Division by zero}\mathrm{divide}(x, 0)$
 Editorial note David: shouldn't this be as below, with slight wording changes in the above para to match? should probably be made into a "boxed triple, cerror, merror and an image so the pmml and image can be mechanically checked.
  Division by zero: <apply><csymbol cd="arith1">divide</csymbol><ci>x</ci><cn>0</cn> </apply>  $\text{Division by zero: dividex0 }$

### 4.2.10 Encoded Bytes <cbytes>

Schema Fragment
Class Cbytes
Attributes CommonAtt
Content base64

The content of cbytes represents a stream of bytes as a sequence of characters in Base64 encoding, that is it matches the base64Binary data type defined in [XMLSchemaDatatypes]. All white space is ignored.

The cbytes element is mainly used for OpenMath compatibility, but may be used, as in OpenMath, to encapsulate output from a system that may be hard to encode in MathML, such as binary data relating to the internal state of a system, or image data.

The rendering of cbytes is not expected to represent the content and the proposed rendering is that of an empty mrow. Typically cbytes is used in an annotation-xml or is itself annotated with Presentation MathML, so this default rendering should rarely be used.

## 4.3 Content MathML for Specific Structures

The elements of Strict Content MathML described in the previous section are sufficient to encode logical assertions and expression structure, and they do so in a way that closely models the standard constructions of mathematical logic that underlie the foundations of mathematics. As a consequence, Strict markup can be used to represent all of mathematics, and is ideal for providing consistent mathematical semantics for all Content MathML expressions.

At the same time, many notational idioms of mathematics are not straightforward to represent directly with Strict Content markup. For example, standard notations for sums, integrals, sets, piecewise functions and many other common constructions require non-obvious technical devices, such as the introduction of lambda functions, to rigorously encode them using Strict markup. Consequently, in order to make Content MathML easier to use, a range of additional elements have been provided for encoding such idiomatic constructs more directly. This section discusses the general approach for encoding such idiomatic constructs, and their Strict Content equivalents. Specific constructions are discussed in detail in Section 4.4 Content MathML for Specific Operators and Constants.

Most idiomatic constructions which Content markup addresses fall into about a dozen classes. Some of these classes, such as container elements, have their own syntax. Similarly, a small number of non-Strict constructions involve a single element with an exceptional syntax, for example partialdiff. These exceptional elements are discussed on a case-by-case basis in Section 4.4 Content MathML for Specific Operators and Constants. However, the majority of constructs consist of classes of operator elements which all share a particular usage of qualifiers. These classes of operators are described in Section 4.3.4 Operator Classes.

In all cases, non-Strict expressions may be rewritten using only Strict markup. In most cases, the transformation is completely algorithmic, and may be automated. Rewrite rules for classes of non-Strict constructions are introduced and discussed later in this section, and rewrite rules for exceptional constructs involving a single operator are given in Section 4.4 Content MathML for Specific Operators and Constants. The complete algorithm for rewriting arbitrary Content MathML as Strict Content markup is summarized at the end of the Chapter in Section 4.6 The Strict Content MathML Translation.

### 4.3.1 Container Markup

Many mathematical structures are constructed from subparts or parameters. The motivating example is a set. Informally, one thinks of a set as a certain kind of mathematical object that contains a collection of elements. Thus, it is intuitively natural for the markup for a set to contain, in the XML sense, the markup for its constituent elements. This style of representation is termed container markup in MathML. By contrast, Strict markup typically represents an instance of a set as the result of applying a function (or more generally a constructor symbol) to arguments.

While the two approaches are formally equivalent, container markup is generally more intuitive for non-expert authors to use, while Strict markup is preferable is contexts where semantic rigor is paramount. In addition, MathML 2 relied on container markup, and thus container markup is necessary in cases where backward compatibility is required.

MathML provides container markup for the following mathematical constructs: sets, lists, intervals, vectors, matrices (two elements), piecewise functions (three elements) and lambda functions. There are corresponding constructor symbols in Strict markup for each of these, with the exception of lambda functions, which correspond to binding symbols in Strict markup. Note that in MathML 2, the term "container markup" was also taken to include token elements, and the deprecated declare, fn and reln elements, but MathML 3 limits usage of the term to the above constructs.

The rewrite rules for obtaining equivalent Strict Content markup from container markup depend on the operator class of the particular operator involved. For details about a specific container element, obtain its operator class (and any applicable special case information) by consulting the syntax table and discussion for that element in Section 4.4 Content MathML for Specific Operators and Constants. Then apply the rewrite rules for that specific operator class as described in Section 4.3.4 Operator Classes.

#### 4.3.1.1 Container Markup for Constructor Symbols

The arguments to container elements corresponding to constructors may either be explicitly given as a sequence of child elements, or they may be specified by a rule using qualifiers. The only exceptions are the piecewise, piece, and otherwise elements used for representing functions with piecewise definitions. The arguments of these elements must always be specified explicitly.

Here is an example of container markup with explicitly specified arguments:

 abc $\{a, b, c\}$

This is equivalent to the following Strict Content MathML expression:

 setabc $\mathrm{set}(a, b, c)$

Another example of container markup, where the list of arguments is given indirectly as an expression with a bound variable. The container markup for the set of even integers is:

  x 2x  $\{x, , 2x\}$

This may be written as follows in Strict Content MathML:

 map lambda x times 2 x Z  $\mathrm{map}(\mathrm{lambda}x\mathrm{times}(2, x), Z)$

#### 4.3.1.2 Container Markup for Binding Constructors

The lambda element is a container element corresponding to the lambda symbol in the fns1 Content Dictionary. However, unlike the container elements of the preceding section, which purely construct mathematical objects from arguments, the lambda element performs variable binding as well. Therefore, the child elements of lambda have distinguished roles. In particular, a lambda element must have at least one bvar child, optionally followed by qualifier elements, followed by a Content MathML element. This basic difference between the lambda container and the other constructor container elements is also reflected in the OpenMath symbols to which they correspond. The constructor symbols have an OpenMath role of "application", while the lambda symbol has a role of "bind".

This example shows the use of lambda container element and the equivalent use of bind in Strict Content MathML

 xx $\mathrm{lambda}\: x.\: x$
 lambda xx  $\mathrm{lambda}xx$

### 4.3.2 Bindings with <apply>

MathML allows the use of the apply element to perform variable binding in non-Strict constructions instead of the bind element. This usage conserves backwards compatibility with MathML 2. It also simplifies the encoding of several constructs involving bound variables with qualifiers as described below.

Use of the apply element to bind variables is allowed in two situations. First, when the operator to be applied is itself a binding operator, the apply element merely substitutes for the bind element. The logical quantifiers <forall/>, <exists/> and the container element lambda are the primary examples of this type.

The second situation arises when the operator being applied allows the use of bound variables with qualifiers. The most common examples are sums and integrals. In most of these cases, the variable binding is to some extent implicit in the notation, and the equivalent Strict representation requires the introduction of auxiliary constructs such as lambda expressions for formal correctness.

Because expressions using bound variables with qualifiers are idiomatic in nature, and do not always involve true variable binding, one cannot expect systematic renaming (alpha-conversion) of variables "bound" with apply to preserve meaning in all cases. An example for this is the diff element where the bvar term is technically not bound at all.

The following example illustrates the use of apply with a binding operator. In these cases, the corresponding Strict equivalent merely replaces the apply element with a bind element:

  x xx  $\forall x\colon x\ge x$

The equivalent Strict expression is:

 forall x geqxx  $\mathrm{forall}x\mathrm{geq}(x, x)$

In this example, the sum operator is not itself a binding operator, but bound variables with qualifiers are implicit in the standard notation, which is reflected in the non-Strict markup. In the equivalent Strict representation, it is necessary to convert the summand into a lambda expression, and recast the qualifiers as an argument expression:

  i 0 100 xi  $\sum_{i=0}^{100} x^{i}$

The equivalent Strict expression is:

 sum integer_interval 0 100 lambda i power x i  $\mathrm{sum}(\mathrm{integer_interval}(0, 100), \mathrm{lambda}i\mathrm{power}(x, i))$

### 4.3.3 Qualifiers

Many common mathematical constructs involve an operator together with some additional data. The additional data is either implicit in conventional notation, such as a bound variable, or thought of as part of the operator, as is the case with the limits of a definite integral. MathML 3 uses qualifier elements to represent the additional data in such cases.

Qualifier elements are always used in conjunction with operator or container elements. Their meaning is idiomatic, and depends on the context in which they are used. When used with an operator, qualifiers always follow the operator and precede any arguments that are present. In all cases, if more than one qualifier is present, they appear in the order bvar, lowlimit, uplimit, interval, condition, domainofapplication, degree, momentabout, logbase.

The precise function of qualifier elements depends on the operator or container that they modify. The majority of use cases fall into one of several categories, discussed below, and usage notes for specific operators and qualifiers are given in Section 4.4 Content MathML for Specific Operators and Constants.

#### 4.3.3.1 Uses of <domainofapplication>, <interval>, <condition>, <lowlimit> and <uplimit>

The primary use of domainofapplication, interval, uplimit, lowlimit and condition is to restrict the values of a bound variable. The most general qualifier is domainofapplication. It is used to specify a set (perhaps with additional structure, such as an ordering or metric) over which an operation is to take place. The interval qualifier, and the pair lowlimit and uplimit also restrict a bound variable to a set in the special case where the set is an interval. The condition qualifier, like domainofapplication, is general, and can be used to restrict bound variables to arbitrary sets. However, unlike the other qualifiers, it restricts the bound variable by specifying a Boolean-valued function of the bound variable. Thus, condition qualifiers always contain instances of the bound variable, while the other qualifier usually do not. The other qualifiers may even be used when no variables are being bound, e.g. to indicate the restriction of a function to a subdomain.

In most cases, any of the qualifiers capable of representing the domain of interest can be used interchangeably. The most qualifier general is domainofapplication, and it has a priveledged role. It is the preferred form, unless there are particular idiomatic reasons to use one of the other qualifier, e.g. limits for an integral. In MathML 3, the other forms are treated as shorthand notations domainofapplication, because they may all be rewritten as equivalent domainofapplication constructions. The rewrite rules to do this given below. The other qualifer elements are provided because they correspond to common notations and map more easily to familiar presentations. Therefore, in the situations where they naturally arise, they may be more convenient and direct than domainofapplication. Note, however, that only one of domainofapplication, interval,condition or the pair uplimit and lowlimit should be used in a single expression, since these qualifiers all serve essentially the same purpose.

To illustrate these ideas, consider the following examples showing alternative representations of a definite integral. Let C denote the interval from 0 to 1, and f(x) = x2. Then domainofapplication could be used express the integral of a f over C in this way:

  C f  $\int f\,d$

Note that no explicit bound variable is identified in this encoding. Alternatively, the interval qualifier could be used with an explicit bound variable:

  x 01 x2  $\int_{0}^{1} x^{2}\,d x$

The pair lowlimit and uplimit can also be used. This is perhaps the most "standard" representation of this integral:

  x 0 1 x2  $\int_{0}^{1} x^{2}\,d x$

Finally, here is the same integral, represented using a condition on the bound variable:

  x 0x x1 x2  $\int_{(0\le x)\land (x\le 1)} x^{2}\,d x$

Note the use of the explicit bound variable within the condition term.

The general technique of using a condition element together with domainofapplication is quite powerful. For example, to extend the previous example to a multivariate domain, one may use an extra bound variable and a domain of application corresponding to a cartesian product:

  x y t u 0t t1 0u u1 tu x2 y3  $\int x^{2}y^{3}\,d x, y$

Note that the order of the inner and outer bound variables is significant.

Mappings to Strict Content MathML

When rewriting expressions to Strict Content MathML, qualifier elements are removed via a series of rules described in this section. The general algorithm for rewriting a MathML expression involving qualifiers proceeds in two steps. First, constructs using the interval, condition, uplimit and lowlimit qualifiers are converted to constructs using only domainofapplication. Second, domainofapplication expressions are then rewritten as Strict Content markup.

##### Rewrite: interval qualifier
 H x a b C  $H(x, , , C)$
 H x interval a b C  $H(x, , C)$

The symbol used in this translation depends on the head of the application, denoted by <ci>H</ci> here. By default interval should be used (which is explictly for intervals of underdefined properties). However for the predefined eleents on MathML, more specific interval symbols can be used. If the head is int then ordered_interval, for sum and product integer_interval should be used.

The above technique for replacing lowlimit and uplimit qualifiers with a domainofapplication element is also used for replacing the interval qualifier.

The condition qualifier restricts a bound variable by specifying a Boolean-valued expression on a larger domain, specifying whether a given value is in the restricted domain. The condition element contains a single child that represents the truth condition. Compound conditions are formed by applying Boolean operators such as and in the condition.

##### Rewrite: condition

To rewrite an expression using the condition qualifier as one using domainofapplication,

<bvar><ci>x1</ci></bvar>
<bvar><ci>xn</ci></bvar>
<condition><ci>P</ci></condition>

is rewritten to

<domainofapplication>
<apply><csymbol cd="set1">suchthat</csymbol>
<ci>R</ci>
<bind><csymbol cd="fns1">lambda</csymbol>
<bvar><ci>x1</ci></bvar>
<bvar><ci>xn</ci></bvar>
<ci>P</ci>
</bind>
</apply>
</domainofapplication>

If the apply has a domainofapplication (perhaps originally expressed as interval or an uplimit/lowlimit pair) then that is used for <ci>R</ci>. Otherwise <ci>R</ci> is a set determined by the type attribute of the bound variable as specified in Section 4.2.2.2 Extended uses of <ci>, if that is present. If the type is unspecified, the translation introduces an unspecified domain via content identifier <ci>R</ci>.

By applying the rules above, expression using the interval, condition, uplimit and lowlimit can be rewritten using only domainofapplication. Once a domainofapplication has been obtained, the final mapping to Strict markup is accomplished using the following rules:

##### Rewrite: restriction

An application of a function that is qualified by the domainofapplication qualifier (expressed by an apply element without bound variables) is converted to an application of a function term constructed with the restriction symbol.

 F C a1 an  $F(, \mathrm{a1}, \mathrm{an})$

may be written as:

  restriction F C a1 an  $\mathrm{restriction}(F, C)(\mathrm{a1}, \mathrm{an})$

In general, an application involving bound variables and (possibly) domainofapplication is rewritten using the following rule, which makes the domain the first positional argument of the application, and uses the lambda symbol to encode the variable bindings. Certain classes of operator have alternative rules, as described below.

##### Rewrite: apply bvar domainofappliction

A content MathML expression with bound variables and domainofapplication

<apply><ci>H</ci>
<bvar><ci>v1</ci></bvar>
...
<bvar><ci>vn</ci></bvar>
<domainofapplication><ci>D</ci></domainofapplication>
<ci>A1</ci>
...
<ci>Am</ci>
</apply>

is rewritten to

<apply><ci>H</ci>
<ci>D</ci>
<bind><csymbol cd="fns1">lambda</csymbol>
<bvar><ci>v1</ci></bvar>
...
<bvar><ci>vn</ci></bvar>
<ci>A1</ci>
</bind>
...
<bind><csymbol cd="fns1">lambda</csymbol>
<bvar><ci>v1</ci></bvar>
...
<bvar><ci>vn</ci></bvar>
<ci>Am</ci>
</bind>
</apply>

If there is no domainofapplication qualifier the <ci>D</ci> child is omitted.

#### 4.3.3.2 Uses of <degree>

The degree element is a qualifier used to specify the "degree" or "order" of an operation. MathML uses the degree element in this way in three contexts: to specify the degree of a root, a moment, and in various derivatives. Rather than introduce special elements for each of these families, MathML provides a single general construct, the degree element in all three cases.

Note that the degree qualifier is not used to restrict a bound variable in the same sense of the qualifiers discussed above. Indeed, with roots and moments, no bound variable is involved at all, either explicitly or implicitly. In the case of differentiation, the degree element is used in conjunction with a bvar, but even in these cases, the variable may not be genuinely bound.

For the usage of degree with the root and moment operators, see the discussion of those operators below. The usage of degree in differentiation is more complex. In general, the degree element indicates the order of the derivative with respect to that variable. The degree element is allowed as the second child of a bvar element identifying a variable with respect to which the derivative is being taken. Here is an example of a second derivative using the degree qualifier:

  x 2 x4  $\frac{d^{2}x^{4}}{dx^{2}}$

#### 4.3.3.3 Uses of <momentabout> and <logbase>

The qualifiers momentabout and logbase are specialized elements specifically for use with the moment and log operators respectively. See the descriptions of those operators below for their usage.

### 4.3.4 Operator Classes

The Content MathML elements described in detail in the next section may be broadly separated into classes. The class of each element is shown in the syntax table that introduces the element in Section 4.4 Content MathML for Specific Operators and Constants. The class gives an indication of the general intended mathematical usage of the element, and also determines its usage as determined by the schema. The class also determines the applicable rewrite rules for mapping to Strict Content MathML. This section presents the rewrite rules for each of the operator classes.

The rules in this section cover the use cases applicable to specific operator classes. Special-case rewrite rules for individual elements are discussed in the sections below. However, the most common usage pattern is generic, and is used by operators from almost all operator classes. It consists of applying an operator to an explicit list of arguments using an apply element. In these cases, rewriting to Strict Content MathML is simply a matter of replacing the empty element with an appropriate csymbol, as listed in the syntax tables in Section 4.4 Content MathML for Specific Operators and Constants. This is summarized in the following rule.

##### Rewrite: element

For example,

  

is equivalent to the Strict form

 plus $\mathrm{plus}$

The corresponding OpenMath symbols for elements in these classes also take an arbitrary number of arguments.

#### 4.3.4.1 N-ary Operators (classes nary-arith, nary-functional, nary-logical, nary-linag, nary-set, nary-constructor)

Many MathML operators may be used with an arbitrary number of arguments. In all such cases, either the arguments my be given explictly as children of the apply or bind element, or the list may be specified implictly via the use of qualifier elements.

If the argument list is given explictly, the Rewrite: element rule applies.

Any use of qualifier elements is expressed in Strict Content MathML, via explictly applying the function to a list of arguments using the apply_to_list symbol as shown in the following rule. The rule only considers the domainofapplication qualifier as other qualifiers may be rewritten to domainofapplication as described earlier.

##### Rewrite: n-ary domainofapplication

An expression of the following form, where <union/> represents any element of the relevant class and <ci>expression-in-x</ci> is an arbitrary expression involving the bound variable(s)

  x D expression-in-x  $x\cup \cup \mathrm{expression-in-x}$

is rewritten to

 apply_to_list union map lambda x expression-in-x D  $\mathrm{apply_to_list}(\mathrm{union}, \mathrm{map}(\mathrm{lambda}x\mathrm{expression-in-x}, D))$

The above rule applies to all symbols in the listed classes. In the case of nary-set the choice of Content Dictionary to use depends on the type attribute on the symbol, defaulting to set1, but multiset1 should be used if type="multiset".

Note: The above rules apply to n-ary constructors such as vector with the syntactic variation that the MathML element uses constructor syntax where the arguments and qualifiers are given as children of the element rather than as children of a containing apply.

#### 4.3.4.2 N-ary Constructors for set and list (class nary-setlist-constructor)

The use of set and list follows the same format as other n-ary constructors, however when rewriting to Strict Content MathML a variant of the above rule is used. This is because the map symbol implicitly constructs the required set or list, and apply_to_list is not needed in this case.

##### Rewrite: n-ary setlist domainofapplication

An expression of the following form, where <set/> is either of the elements set or list and <ci>expression-in-x</ci> is an arbitrary expression involving the bound variable(s)

  x D expression-in-x  $\{x, , \mathrm{expression-in-x}\}$

is rewritten to

 map lambda x expression-in-x D  $\mathrm{map}(\mathrm{lambda}x\mathrm{expression-in-x}, D)$

#### 4.3.4.3 N-ary Relations (classes nary-reln, nary-set-reln)

MathML allows allows transative relations to be used with multiple arguments, to give a natural expression to "chains" of relations such as a < b < c < d. However unlike the case of the arithmetic operators, the underlying symbols used in the Strict Content MathML are classed as binary, so it is not possible to use apply_to_list as in the previous section, but instead a similar function predicate_on_list is used, the semantics of which is essentially to take the conjunction of applying the predicate to elements of the domain two at a time.

##### Rewrite: n-ary relations

An expression of the form

  abcd  $a< b< c< d$

rewrites to Strict Content MathML

 predicate_on_list lt list abcd  $\mathrm{predicate_on_list}(\mathrm{lt}, \mathrm{list}(a, b, c, d))$
##### Rewrite: n-ary relations bvar

An expression of the form

  x R expression-in-x  $x< < \mathrm{expression-in-x}$

where <ci>expression-in-x</ci> is an arbitrary expression invloving the bound variable, rewrites to the Strict Content MathML

 predicate_on_list lt map R lambda x expression-in-x  $\mathrm{predicate_on_list}(\mathrm{lt}, \mathrm{map}(R, \mathrm{lambda}x\mathrm{expression-in-x}))$

The above rules apply to all symbols in classes nary-reln and nary-set-reln. In the latter case the choice of Content Dictionary to use depends on the type attribute on the symbol, defaulting to set1, but multiset1 should be used if type="multiset".

#### 4.3.4.4 N-ary/Unary Operators (classes nary-minmax, nary-stats)

The MathML elements, max, min and some satistical elements such as mean may be used as a n-ary function as in the above classes, however a special interpretation is given in the case that a single argument is supplied. If a single argument is supplied the function is applied to the elements represented by the argument.

The underlying symbol used in Strict Content MathML for these elements is Unary and so if the MathML is used with 0 or more than 1 arguments, the function is applied to the set constructed from the explictly supplied arguments acording to the following rule.

##### Rewrite: n-ary unary set

When an element, <max/>, of class nary-stats or nary-minmax is applied to an explicit list of 0 or 2 or more arguments, <ci>a1</ci><ci>a2</ci><ci>an</ci>

 a1a2an $\max\{\mathrm{a1} , \mathrm{a2} , \mathrm{an}\}$

It is is translated to the unary application of the symbol <csymbol cd="minmax1" name="max"/> as specified in the syntax table for the element to the set of arguments, constructed using the <csymbol cd="set1" name="set"/> symbol.

 max set a1a2an  $\mathrm{max}(\mathrm{set}(\mathrm{a1}, \mathrm{a2}, \mathrm{an}))$

Like all MathML n-ary operators, The list of arguments may be specified implictly using qualifier elements. This is expressed in Strict Content MathML using the following rule, which is similar to the rule Rewrite: n-ary domainofapplication but differs in that the symbol can be directly applied to the constructed set of arguments and it is not necessary to use apply_to_list.

##### Rewrite: n-ary unary domainofapplication

An expression of the following form, where <max/> represents any element of the relevant class and <ci>expression-in-x</ci> is an arbitrary expression involving the bound variable(s)

  x D expression-in-x  $\max\{x , , \mathrm{expression-in-x}\}$

is rewritten to

 max map lambda x expression-in-x D  $\mathrm{max}(\mathrm{map}(\mathrm{lambda}x\mathrm{expression-in-x}, D))$

If the element is applied to a single argument the set symbol is not used and the symbol is applied directly to the argument.

##### Rewrite: n-ary unary single

When an element, <max/>, of class nary-stats or nary-minmax is applied to a single argument,

 a $\max\{a\}$

It is is translated to the unary application of the symbol in the syntax table for the element.

 max a  $\mathrm{max}(a)$

Note: Earlier versions of MathML were not explict about the correct interpretation of elements in this class, and left it undefined as to whether an expression such as max(X) was a trivial application of max to a singleton, or whether it should be interpretted as meaning the maximum of values of the set X. Applications finding that the rule Rewrite: n-ary unary single can not be applied as the supplied argument is a scalar may wish to use the rule Rewrite: n-ary unary set as an error recovery. As a further complication, in the case of the statistical functions the Content Dictionary to use in this case depends on the desired interpretation of the argument as a set of explict data or a random variable representing a distribution.

#### 4.3.4.5 Binary Operators (classes binary-arith, binary-logical, binary-reln, binary-linalg, binary-set, binary-constructor)

Binary operators take two arguments and simply map to OpenMath symbols without the need of any special rewrite rules. The binary constructor interval is similar but uses constructor syntax in which the arguments are children of the element, and the symbol used depends on the type element as described in Section 4.4.1.1 Interval <interval>

#### 4.3.4.6 Unary Operators (classes unary-arith, unary-functional, unary-set, unary-elementary, unary-veccalc)

Binary operators take a single arguments and map to OpenMath symbols without the need of any special rewrite rules.

#### 4.3.4.7 Constants (classes constant-arith, constant-set)

Constant symbols relate to mathematical constants such as e and true and also to names of sets such as the Real Numbers, and Integers. In most cases they rewrite simply to a single symbol in Strict Content MathML.

#### 4.3.4.8 Quantifiers (class quantifier)

The Quantifier class is used for the forall and exists quantifiers of predicate calculus. If used with bind and no qualifiers, then the interpretation in Strict Content MathML is simple. In general if used with apply or qualifiers, the interpretation in Strict Content MathML is via the following rule.

##### Rewrite: quantifier

An expression of following form where <exists/> denotes an element of class quantifier and <ci>expression-in-x</ci> is an arbitrary expression involving the bound variable(s)

  x D expression-in-x  $\exists x\colon \mathrm{expression-in-x}$

is rewritten to an expression

 exists x and inxD expression-in-x  $\mathrm{exists}x\mathrm{and}(\mathrm{in}(x, D), \mathrm{expression-in-x})$

where the symbols <csymbol cd="quant1">exists</csymbol> and <csymbol cd="logic1">and</csymbol> are as specified in the syntax table of the element. (The additional symbol being and in the case of exists and implies in the case of forall.)

#### 4.3.4.9 Other Operators (classes lambda, interval, int, partialdiff, sum, product, limit)

Special purpose classes, described in the sections for the appropriate elements

## 4.4 Content MathML for Specific Operators and Constants

This section presents elements representing a core set of mathematical operators, functions and constants. Most are empty elements, covering the subject matter of standard mathematics curricula up to the level of calculus. The remaining elements are container elements for sets, intervals, vectors and so on. For brevity, all elements defined in this section are sometimes called operator elements.

Each subsection below discusses a specific operator element, beginning with a syntax table, giving the elements operator class. Special case rules for rewritting as Strict Markup are introduced as needed. However, in most cases, the generic rewrite rules for the appropriate operator class is sufficient. In particular, unless otherwise indicated, elements are to be rewritten using the default Rewrite: element rule. Note, however, that all elements in this section must be rewritten in some fashion, since they are not allowed in Strict Content markup.

In MathML 2, the definitionURL attribute could be used to redefine or modify the meaning of an operator element. This use of the definitionURL attribute is deprecated in MathML 3. Instead a csymbol element should be used. In general, the value of cd attribute on the csymbol will correspond to the definitionURL value.

### 4.4.1 Functions and Inverses

#### 4.4.1.1 Interval <interval>

Class interval CommonAtt,closure? ContExp,ContExp interval_cc, interval_oc, interval_co, interval_oo

The interval element is a container element used to represent simple mathematical intervals of the real number line. It takes an optional attribute closure, with a default value of "closed".

Content MathML

 x1 $\left(x , 1\right)$
 01 $\left[0 , 1\right]$
 01 $\left(0 , 1\right]$
 01 $\left[0 , 1\right)$

Sample Presentation

 x1 $\left(x,1\right)$

 01 $\left[0,1\right]$

 01 $\left(0,1\right]$

 01 $\left[0,1\right)$

Mapping to Strict Content MathML

In Strict markup, the interval element corresponds to one of four symbols from the interval1 content dictionary. If closure has the value "open" then interval corresponds to the interval_oo. With the value "closed" interval corresponds to the symbol interval_cc, with value "open-closed" to interval_oc, and with "closed-open" to interval_co.

#### 4.4.1.2 Inverse <inverse>

Class unary-functional CommonAtt Empty inverse

The inverse element is applied to a function in order to construct a generic expression for the functional inverse of that function. The inverse element may either be applied to arguments, or it may appear alone, in which case it represents an abstract inversion operator acting on other functions.

Content MathML

  f  $f^{(-1)}$

Sample Presentation

 f(-1) ${f}^{\left(-1\right)}$

Content MathML

  A a  $A^{(-1)}(a)$

Sample Presentation

  A(-1) a  ${A}^{\left(-1\right)}\left(a\right)$

#### 4.4.1.3 Lambda <lambda>

Class lambda CommonAtt BvarQ, DomainQ, ContExp BvarQ,DomainQ lambda

The lambda element is used to construct a user-defined function from an expression, bound variables, and qualifiers. In a lambda construct with n (possibly 0) bound variables, the first n children are bvar elements that identify the variables that are used as placeholders in the last child for actual parameter values. The bound variables can be restricted by an optional domainofapplication qualifier or one of its shorthand notations. The meaning of the lambda construct is an n-ary function that returns the expression in the last child where the bound variables are replaced with the respective arguments.

The domainofapplication child restricts the possible values of the arguments of the constructed function. For instance, the following lambda construct represents a function on the integers.

  x x  $\mathrm{lambda}\: x.\: \sin x$

If a lambda construct does not contain bound variables, then the lambda construct is superfluous and may be removed, unless it also contains a domainofapplication construct. In that case, if the last child of the lambda construct is itself a function, then the domainofapplication restricts it's existing functional arguments, as in this example, which is a variant representation for the function above.

   $\mathrm{lambda}\: .\: \sin$

Otherwise, if the last child of the lambda construct is not a function, say a number, then the lambda construct will not be a function, but the same number, and any domainofapplication is ignored.

Content MathML

  x x1  $\mathrm{lambda}\: x.\: \sin (x+1)$

Sample Presentation

  λ x . sin (x+1)  $\lambda x.\left(\mathrm{sin}\left(x+1\right)\right)$

  x sin (x+1)  $x↦\mathrm{sin}\left(x+1\right)$

Mapping to Strict Markup

##### Rewrite: lambda

If the lambda element does not contain qualifiers, the lambda expression is directly translated into a bind expression.

  x1xn expression-in-x1-xn  $\mathrm{lambda}\: \mathrm{x1}\mathrm{xn}.\: \mathrm{expression-in-x1-xn}$

rewrites to the Strict Content MathML

 lambda x1xn expression-in-x1-xn  $\mathrm{lambda}\mathrm{x1}, \mathrm{xn}\mathrm{expression-in-x1-xn}$
##### Rewrite: lambda domainofappliction

If the lambda element does contain qualifiers, the qualifier may be rewritten to domainofapplication and then the lambda expression is translated to a function term constructed with lambda and restricted to the specified domain using restriction.

  x1xn D expression-in-x1-xn  $\mathrm{lambda}\: \mathrm{x1}\mathrm{xn}.\: \mathrm{expression-in-x1-xn}$

rewrites to the Strict Content MathML

 restriction lambda x1xn expression-in-x1-xn D  $\mathrm{restriction}(\mathrm{lambda}\mathrm{x1}, \mathrm{xn}\mathrm{expression-in-x1-xn}, D)$

#### 4.4.1.4 Function composition <compose/>

Class nary-functional CommonAtt Empty BvarQ,DomainQ left_compose

The compose element represents the function composition operator. Note that MathML makes no assumption about the domain and codomain of the constituent functions in a composition; the domain of the resulting composition may be empty.

The compose element is a commutative n-ary operator. Consequently, it may be lifted to the induced operator defined on a collection of arguments indexed by a (possibly infinite) set by using qualifier elements as described in Section 4.3.4.1 N-ary Operators.

Content MathML

 fgh $f\circ g\circ h$

Sample Presentation

 fgh $f\circ g\circ h$

Content MathML

  fg x fgx  $(f\circ g)(x)=f(g(x))$

Sample Presentation

  (fg) x = f g x  $\left(f\circ g\right)\left(x\right)=f\left(g\left(x\right)\right)$

#### 4.4.1.5 Identity function <ident/>

Class unary-functional CommonAtt Empty identity

The ident element represents the identity function. Note that MathML makes no assumption about the domain and codomain of the represented identity function, which depends on the context in which it is used.

Content MathML

  f f  $f\circ f^{(-1)}=\mathrm{id}$

Sample Presentation

  f f(-1) = id  $f\circ {f}^{\left(-1\right)}=\mathrm{id}$

#### 4.4.1.6 Domain <domain/>

Class unary-functional CommonAtt Empty domain

The domain element represents the domain of the function to which it is applied. The domain is the set of values over which the function is defined.

Content MathML

  f  $\mathop{\mathrm{domain}}(f)=\mathbb{R}$

Sample Presentation

  domainf = R  $\mathrm{domain}\left(f\right)=\mathbb{R}$

#### 4.4.1.7 codomain <codomain/>

Class unary-functional CommonAtt Empty range

The codomain represents the codomain, or range, of the function to which is is applied. Note that the codomain is not necessarily equal to the image of the function, it is merely required to contain the image.

Content MathML

  f  $\mathop{\mathrm{codomain}}(f)=\mathbb{Q}$

Sample Presentation

  codomainf = Q  $\mathrm{codomain}\left(f\right)=\mathbb{Q}$

#### 4.4.1.8 Image <image/>

Class unary-functional CommonAtt Empty image

The image element represent the image of the function to which it is applied. The image of a function is the set of values taken by the function. Every point in the image is generated by the function applied to some point of the domain.

Content MathML

  -1 1  $\mathop{\mathrm{image}}(\sin )=\left[-1 , 1\right]$

Sample Presentation

  imagesin = -11  $\mathrm{image}\left(\mathrm{sin}\right)=\left[-1,1\right]$

#### 4.4.1.9 Piecewise declaration (<piecewise>, <piece>, <otherwise>)

Class Constructor CommonAtt piece* otherwise? piecewise
Syntax Table for Piecewise
Class Constructor CommonAtt ContExp ContExp piece
Syntax Table for piece
Class Constructor CommonAtt ContExp otherwise
Syntax Table for otherwise

The piecewise, piece, and otherwise elements are used to represent "piecewise" function definitions of the form " H(x) = 0 if x less than 0, H(x) = 1 otherwise".

The declaration is constructed using the piecewise element. This contains zero or more piece elements, and optionally one otherwise element. Each piece element contains exactly two children. The first child defines the value taken by the piecewise expression when the condition specified in the associated second child of the piece is true. The degenerate case of no piece elements and no otherwise element is treated as undefined for all values of the domain.

The otherwise element allows the specification of a value to be taken by the piecewise function when none of the conditions (second child elements of the piece elements) is true, i.e. a default value.

It should be noted that no "order of execution" is implied by the ordering of the piece child elements within piecewise. It is the responsibility of the author to ensure that the subsets of the function domain defined by the second children of the piece elements are disjoint, or that, where they overlap, the values of the corresponding first children of the piece elements coincide. If this is not the case, the meaning of the expression is undefined.

Mapping to Strict Markup

In Strict Content MathML, the container elements piecewise, piece and otherwise are mapped to applications of the constructor symbols of the same names in the piece1 CD. Apart from the fact that these three elements (respectively symbols) are used together, the mapping to Strict markup is straightforward:

Content MathML

  0 x0 1 x1 x  $\begin{cases}0() & \text{if x< 0}\\ 1 & \text{if x> 1}\\ x & \text{otherwise}\end{cases}$

Strict Content MathML equivalent

 piecewise piece 0 ltx0 piece 1 gtx1 otherwise x  $\mathrm{piecewise}(\mathrm{piece}(0, \mathrm{lt}(x, 0)), \mathrm{piece}(1, \mathrm{gt}(x, 1)), \mathrm{otherwise}(x))$

Here is an example that doesn't use the optional otherwise element:

Content MathML

  x x0 0 x0 x x0  $\begin{cases}-x & \text{if x< 0}\\ 0 & \text{if x=0}\\ x & \text{if x> 0}\end{cases}$

Sample Presentation

  { x   if   x<0 0   if   x=0 x   if   x>0 

### 4.4.2 Arithmetic, Algebra and Logic

#### 4.4.2.1 Quotient <quotient/>

Class binary-arith CommonAtt Empty quotient

The quotient element represents the integer division operator. When the operator is applied to integer arguments a and b, the result is the "quotient of a divided by b". That is, the quotient of integers a and b, is the integer q such that a = b * q + r, with |r| less than |b| and a * r positive. In common usage, q is called the quotient and r is the remainder.

Content MathML

 ab $\left\lfloor\frac{a}{b}\right\rfloor$

Sample Presentation

 a/b $⌊a/b⌋$

#### 4.4.2.2 Factorial <factorial/>

Class unary-arith CommonAtt Empty factorial

This element represents the unary factorial operator on non-negative integers.

The factorial of an integer n is given by n! = n*(n-1)* ... * 1

Content MathML

 n $n!$

Sample Presentation

 n! $n!$

#### 4.4.2.3 Division <divide/>

Class binary-arith CommonAtt Empty divide

The divide element represents the division operator in a number field.

Content MathML

  a b  $\frac{a}{b}$

Sample Presentation

 a/b $a/b$

#### 4.4.2.4 Maximum <max/>

Class nary-minmax CommonAtt Empty BvarQ, DomainQ max

The max element denotes the maximum function, which returns the largest of the arguments to which it is applied. Its arguments may be explicitly specified in the enclosing apply element, or specified using qualfier elements as described in Section 4.3.4.4 N-ary/Unary Operators. Note that when applied to infinite sets of arguments, no maximal argument may exist.

Content MathML

 235 $\max\{2 , 3 , 5\}$

Sample Presentation

  max {2,3,5}  $\mathrm{max}\left\{2,3,5\right\}$

Content MathML

  y y 01 y3  $\max\{y^{3}, y\in \left[0 , 1\right]\}$

Sample Presentation

  max {y| y 01 }  $\mathrm{max}\left\{y|y\in \left[0,1\right]\right\}$

#### 4.4.2.5 Minimum <min/>

Class nary-minmax CommonAtt Empty BvarQ,DomainQ min

The min element denotes the minimum function, which returns the smallest of the arguments to which it is applied. Its arguments may be explicitly specified in the enclosing apply element, or specified using qualfier elements as described in Section 4.3.4.4 N-ary/Unary Operators. Note that when applied to infinite sets of arguments, no minimal argument may exist.

Content MathML

 ab $\min\{a , b\}$

Sample Presentation

  min {a,b}  $\mathrm{min}\left\{a,b\right\}$

Content MathML

  x xB x2  $\min\{x^{2}, x\notin B\}$

Sample Presentation

  min {x| xB }  $\mathrm{min}\left\{x|x\notin B\right\}$

#### 4.4.2.6 Subtraction <minus/>

Class unary-arith, binary-arith CommonAtt Empty unary_minus, minus

The minus element can be used as a unary arithmetic operator (e.g. to represent - x), or as a binary arithmetic operator (e.g. to represent x- y).

If it is used with one argument, minus corresponds to the unary_minus symbol.

Content MathML

 3 $-3$

Sample Presentation

 3 $-3$

If it is used with two arguments, minus corresponds to the minus symbol

Content MathML

 xy $x-y$

Sample Presentation

 xy $x-y$

In both cases, the translation to Strict Content markup is direct, as described in Rewrite: element. It is merely a matter of choosing the symbol that reflects the actual usage.

#### 4.4.2.7 Addition <plus/>

Class nary-arith CommonAtt Empty BvarQ,DomainQ plus

The plus element represents the addition operator. Its arguments are normally specified explicitly in the enclosing apply element. As an n-ary commutative operator, it can be used with qualifiers to specify arguments, however, this is discouraged, and the sum operator should be used to represent such expressions instead.

Content MathML

 xyz $x+y+z$

Sample Presentation

 x+y+z $x+y+z$

#### 4.4.2.8 Exponentiation <power/>

Class binary-arith CommonAtt Empty power

The power element represents the exponentiation operator. The first argument is raised to the power of the second argument.

Content MathML

 x3 $x^{3}$

Sample Presentation

 x3 ${x}^{3}$

#### 4.4.2.9 Remainder <rem/>

Class binary-arith CommonAtt Empty remainder

The rem element represents the modulus operator, which returns the remainder that results from dividing the first argument by the second. That is, when applied to integer arguments a and b, it returns the unique integer r such that a = b * q + r, with |r| less than |b| and a * r positive.

Content MathML

  a b  $a\mod b$

Sample Presentation

 amodb $amodb$

#### 4.4.2.10 Multiplication <times/>

Class nary-arith CommonAtt Empty BvarQ,DomainQ times

The times element represents the n-ary multiplication operator. Its arguments are normally specified explicitly in the enclosing apply element. As an n-ary commutative operator, it can be used with qualifiers to specify arguments by rule, however, this is discouraged, and the product operator should be used to represent such expressions instead.

Content MathML

 ab $ab$

Sample Presentation

 ab $ab$

#### 4.4.2.11 Root <root/>

Class unary-arith, binary-arith CommonAtt Empty degree root

The root element is used to extract roots. The kind of root to be taken is specified by a "degree" element, which should be given as the second child of the apply element enclosing the root element. Thus, square roots correspond to the case where degree contains the value 2, cube roots correspond to 3, and so on. If no degree is present, a default value of 2 is used.

Content MathML

  n a  $\sqrt[n]{a}$

Sample Presentation

 an $\sqrt[n]{a}$

Mapping to Strict Content Markup

In Strict Content markup, the root symbol is always used with two arguments, with the second indicating the degree of the root being extracted.

Content MathML

 x $\sqrt{x}$

Strict Content MathML equivalent

 root x 2  $\mathrm{root}(x, 2)$

Content MathML

  n a  $\sqrt[n]{a}$

Strict Content MathML equivalent

 root a n  $\mathrm{root}(a, n)$

#### 4.4.2.12 Greatest common divisor <gcd/>

Class nary-arith CommonAtt Empty BvarQ,DomainQ gcd

The gcd element represents the n-ary operator which returns the greatest common divisor of its arguments. Its arguments may be explicitly specified in the enclosing apply element, or specified by rule as described in Section 4.3.4.1 N-ary Operators.

Content MathML

 abc $\gcd (a, b, c)$

Sample Presentation

  gcd abc  $\mathrm{gcd}\left(a,b,c\right)$

This default rendering is English-language locale specific: other locales may have different default renderings.

When the gcd element is applied to an explicit list of arguments, the translation to Strict Content markup is direct, using the gcd symbol, as described in Rewrite: element. However, when qualifiers are used, the equivalent Strict markup is computed via Rewrite: n-ary domainofapplication.

#### 4.4.2.13 And <and/>

Class nary-logical CommonAtt Empty BvarQ,DomainQ and

The and element represents the logical "and" function which is an n-ary function taking Boolean arguments and returning a Boolean value. It is true if all arguments are true, and false otherwise. Its arguments may be explicitly specified in the enclosing apply element, or specified by rule as described in Section 4.3.4.1 N-ary Operators.

Content MathML

 ab $a\land b$

Sample Presentation

 ab $a\wedge b$

Content MathML

  i 0 n ai 0  $i\land \land \land (a_{i}> 0)$

Strict Content MathML

 apply_to_list and map lambda i gt vector_selectoria 0 integer_interval 0 n  $\mathrm{apply_to_list}(\mathrm{and}, \mathrm{map}(\mathrm{lambda}i\mathrm{gt}(\mathrm{vector_selector}(i, a), 0), \mathrm{integer_interval}(0, n)))$

Sample Presentation

  i=0 n ( ai > 0 )  $\underset{i=0}{\overset{n}{\bigwedge }}\left({a}_{i}>0\right)$

#### 4.4.2.14 Or <or/>

Class nary-logical CommonAtt Empty BvarQ,DomainQ or

The or element represents the logical "or" function. It is true if any of the arguments are true, and false otherwise.

Content MathML

 ab $a\lor b$

Sample Presentation

 ab $a\vee b$

#### 4.4.2.15 Exclusive Or <xor/>

Class nary-logical CommonAtt Empty BvarQ,DomainQ xor

The xor element represents the logical "xor" function. It is true if there are an odd number of true arguments or false otherwise.

Content MathML

 ab $a\mathop{\mathrm{xor}}b$

Sample Presentation

 axorb $axorb$

#### 4.4.2.16 Not <not/>

Class unary-logical CommonAtt Empty not

The note element represents the logical not function which takes one Boolean argument, and returns the opposite Boolean value.

Content MathML

 a $\neg a$

Sample Presentation

 ¬a $¬a$

#### 4.4.2.17 Implies <implies/>

Class binary-logical CommonAtt Empty implies

The implies element represents the logical implication function which takes two Boolean expressions as arguments. It evaluates to false if the first argument is true and the second argument is false, otherwise it evaluates to true.

Content MathML

 AB $A\implies B$

Sample Presentation

 AB $A⇒B$

#### 4.4.2.18 Universal quantifier <forall/>

Class quantifier CommonAtt Empty BvarQ,DomainQ forall, implies

The forall element represents the universal ("for all") quantifier which takes one or more bound variables, and an argument which specifies the asserion being quantified. In addition, condition or other qualifiers may be used as described in Section 4.3.4.8 Quantifiers to limit the domain of the bound variables.

Content MathML

  x xx 0  $xx-x=0$

Sample Presentation

  x . xx = 0  $\forall x.\left(x-x=0\right)$

When the forall element is used with a condition qualifier the strict equivalent is constructed with the help of logical implication. Thus by the rules above:

  p q p q pq p q2  $p, qp\in \mathbb{Q}\land q\in \mathbb{Q}\land (p< q)p< q^{2}$

translates to

 forall p q implies and in p Q in q Q ltpq lt p power q 2  $\mathrm{forall}p, q\mathrm{implies}(\mathrm{and}(\mathrm{in}(p, Q), \mathrm{in}(q, Q), \mathrm{lt}(p, q)), \mathrm{lt}(p, \mathrm{power}(q, 2)))$

Sample Presentation

  pQ qQ (p<q) . p<q2  $\forall p\in \mathbb{Q}\wedge q\in \mathbb{Q}\wedge \left(p

  pq . ( pQ qQ (p<q) ) ( p < q2 )  $\forall pq.\left(\left(p\in \mathbb{Q}\wedge q\in \mathbb{Q}\wedge \left(p

#### 4.4.2.19 Existential quantifier <exists/>

Class quantifier CommonAtt Empty BvarQ,DomainQ exists, and

The exists element represents the existential ("there exists") quantifier which takes one or more bound variables, and an argument which specifies the assertion being quantified. In addition, condition or other qualifiers may be used as described in Section 4.3.4.8 Quantifiers to limit the domain of the bound variables.

Content MathML

  x fx 0  $xf(x)=0$

Sample Presentation

  x . fx = 0  $\exists x.\left(f\left(x\right)=0\right)$

Content MathML

  x fx 0  $\exists x\colon f(x)=0$

Strict MathML equivalent:

 exists x and in x Z eq fx 0  $\mathrm{exists}x\mathrm{and}(\mathrm{in}(x, Z), \mathrm{eq}(f(x), 0))$

Sample Presentation

  x . xZ fx = 0  $\exists x.\left(x\in \mathbb{Z}\wedge f\left(x\right)=0\right)$

#### 4.4.2.20 Absolute Value <abs/>

Class unary-arith CommonAtt Empty abs

The abs element represents the absolute value function. The argument should be numerically valued. When the argument is a complex number, the absolute value is often referred to as the modulus.

Content MathML

 x $\left|x\right|$

Sample Presentation

 |x| $|x|$

#### 4.4.2.21 Complex conjugate <conjugate/>

Class unary-arith CommonAtt Empty conjugate

The conjugate element represents the function defined over the complex numbers with returns the complex conjugate of its argument.

Content MathML

  x y  $\overline{x+iy}$

Sample Presentation

  x + y ¯  $\overline{x+iy}$

#### 4.4.2.22 Argument <arg/>

Class unary-arith CommonAtt Empty argument

The arg element represents the unary function which returns the angular argument of a complex number, namely the angle which a straight line drawn from the number to zero makes with the real line (measured anti-clockwise).

Content MathML

  x y  $\mathop{\mathrm{arg}}(x+iy)$

Sample Presentation

  arg x + iy  $\mathrm{arg}\left(x+iy\right)$

#### 4.4.2.23 Real part <real/>

Class unary-arith CommonAtt Empty real

The real element represents the unary operator used to construct an expression representing the "real" part of a complex number, that is, the x component in x + iy.

Content MathML

  x y  $\Re (x+iy)$

Sample Presentation

  x + iy  $ℛ\left(x+iy\right)$

#### 4.4.2.24 Imaginary part <imaginary/>

Class unary-arith CommonAtt Empty imaginary

The imaginary element represents the unary operator used to construct an expression representing the "imaginary" part of a complex number, that is, the y component in x + iy.

Content MathML

  x y  $\Im (x+iy)$

Sample Presentation

  x + iy  $\Im \left(x+iy\right)$

#### 4.4.2.25 Lowest common multiple <lcm/>

Class nary-arith CommonAtt Empty BvarQ,DomainQ lcm

The lcm element represents the n-ary operator used to construct an expression which represents the least common multiple of its arguments. If no argument is provided, the lcm is 1. If one argument is provided, the lcm is that argument. The least common multiple of x and 1 is x.

Content MathML

 abc $\mathop{\mathrm{lcm}}(a, b, c)$

Sample Presentation

  lcm abc  $\mathrm{lcm}\left(a,b,c\right)$

This default rendering is English-language locale specific: other locales may have different default renderings.

#### 4.4.2.26 Floor <floor/>

Class unary-arith CommonAtt Empty floor

The floor element represents the operation that rounds down (towards negative infinity) to the nearest integer. This function takes one real number as an argument and returns an integer.

Content MathML

 a $\lfloor a\rfloor$

Sample Presentation

 a $⌊a⌋$

#### 4.4.2.27 Ceiling <ceiling/>

Class unary-arith CommonAtt Empty ceiling

The ceiling element represents the operation that rounds up (towards positive infinity) to the nearest integer. This function takes one real number as an argument and returns an integer.

Content MathML

 a $\lceil a\rceil$

Sample Presentation

 a $⌈a⌉$

### 4.4.3 Relations

#### 4.4.3.1 Equals <eq/>

Class nary-reln CommonAtt Empty BvarQ,DomainQ eq

The eq elements represents the equality relation.

Content MathML

  24 12  $2/4=1/2$

Sample Presentation

  2/4 = 1/2  $2/4=1/2$

#### 4.4.3.2 Not Equals <neq/>

Class binary-reln CommonAtt Empty neq

The neq element represents the binary inequality relation, i.e. the relation "not equal to" which returns true unless the two arguments are equal.

Content MathML

 34 $3\neq 4$

Sample Presentation

 34 $3\ne 4$

#### 4.4.3.3 Greater than <gt/>

Class nary-reln CommonAtt Empty BvarQ,DomainQ gt

The gt element represents the "greater than" function which returns true if the first argument is greater than the second, and returns false otherwise. While this is a binary relation, gt may be used with more than two arguments, denoting a chain of inequalities, as described in Section 4.3.4.3 N-ary Relations.

Content MathML

 32 $3> 2$

Sample Presentation

 3>2 $3>2$

#### 4.4.3.4 Less Than <lt/>

Class nary-reln CommonAtt Empty BvarQ,DomainQ lt

The lt element represents the "less than" function which returns true if the first argument is less than the second, and returns false otherwise. While this is a binary relation, lt may be used with more than two arguments, denoting a chain of inequalities, as described in Section 4.3.4.3 N-ary Relations.

Content MathML

 234 $2< 3< 4$

Sample Presentation

 2<3<4 $2<3<4$

#### 4.4.3.5 Greater Than or Equal <geq/>

Class nary-reln CommonAtt Empty BvarQ,DomainQ geq

The geq element represents the "greater than or equal to" function which returns true if the first argument is greater than or equal to the second, and returns false otherwise. While this is a binary relation, geq may be used with more than two arguments, denoting a chain of inequalities, as described in Section 4.3.4.3 N-ary Relations.

Content MathML

 433 $4\ge 3\ge 3$

Strict Content MathML

 predicate_on_list geq list 433  $\mathrm{predicate_on_list}(\mathrm{geq}, \mathrm{list}(4, 3, 3))$

Sample Presentation

 433 $4\ge 3\ge 3$

#### 4.4.3.6 Less Than or Equal <leq/>

Class nary-reln CommonAtt Empty BvarQ,DomainQ leq

The leq element represents the "less than or equal to" function which returns true if the first argument is less than or equal to the second, and returns false otherwise. While this is a binary relation, leq may be used with more than two arguments, denoting a chain of inequalities, as described in Section 4.3.4.3 N-ary Relations.

Content MathML

 334 $3\le 3\le 4$

Sample Presentation

 334 $3\le 3\le 4$

#### 4.4.3.7 Equivalent <equivalent/>

Class binary-logical CommonAtt Empty equivalent

The equivalent element represents the relation that asserts two Boolean expressions are logically equivalent, that is have the same Boolean value for any inputs.

Content MathML

  a a  $a\equiv \neg \neg a$

Sample Presentation

  a ¬¬a  $a\equiv ¬¬a$

#### 4.4.3.8 Approximately <approx/>

Class binary-reln CommonAtt Empty approx

The approx element represent the relation that asserts the approximate equality of its arguments.

Content MathML

  227  $\pi \approx 22/7$

Sample Presentation

  π 22/7  $\pi \simeq 22/7$

#### 4.4.3.9 Factor Of <factorof/>

Class binary-reln CommonAtt Empty factorof

The factorof element is used to indicate the mathematical relationship that the first argument "is a factor of" the second. This relationship is true if and only if b mod a = 0.

Content MathML

 ab $a | b$

Sample Presentation

 a|b $a|b$

### 4.4.4 Calculus and Vector Calculus

#### 4.4.4.1 Integral <int/>

Class int CommonAtt Empty BvarQ,DomainQ int defint

The int element is the operator element for a definite or indefinite integral over a function or a definite over an expression with a bound variable.

Content MathML

   $\int \sin \,d =\cos$

Sample Presentation

 sin=cos $\int \mathrm{sin}=\mathrm{cos}$

Content MathML

  ab  $\int_{a}^{b} \cos \,d$

Sample Presentation

 abcos ${\int }_{a}^{b}\mathrm{cos}$

The int element can also be used with bound variables serving as the integration variables.

Content MathML

Here, definite integrals are indicated by providing qualifier elements specifying a domain of integration (here a lowlimit/uplimit pair). This is perhaps the most "standard" representation of this integral:

  x 0 1 x2  $\int_{0}^{1} x^{2}\,d x$

Sample Presentation

  01 x2 d x  ${\int }_{0}^{1}{x}^{2}dx$

Mapping to Strict Markup

As an indefinite integral applied to a function, the int element corresponds to the int symbol from the calculus1 content dictionary. As a definite integral applied to a function, the int element corresponds to the defint symbol from the calculus1 content dictionary. For the case of bound variables the situation is more complicated in general, and the following rule is used.

##### Rewrite: int

Translate a definite integral, where <ci>expression-in-x</ci> is an arbitrary expression involving the bound variable(s) <ci>x</ci>

  x D expression-in-x  $\int \mathrm{expression-in-x}\,d x$

to the expression

  defint D lambda x expression-in-x x  $\mathrm{defint}(D, \mathrm{lambda}x\mathrm{expression-in-x})(x)$

For the indefinite integral, where the domainofapplication element is missing, the defint is used instead and the <ci>D</ci> is dropped. Note that as x is not bound in the original indefinite integral, the integrated function is applied to the variable x making it an explicit free variable in Strict Content Markup expression, even though it is bound in the subterm used as an argument to defint.

For instance, the expression

  x x  $\int \cos x\,d x$

has the Strict Content MathML equivalent

  int lambda x x x  $\mathrm{int}(\mathrm{lambda}x\cos x)(x)$

But the definite integral with an lowlimit/uplimit pair carries the strong intuition that the range of integration is oriented, and thus swapping lower and upper limits will change the sign of the result. To accomodate this, use the following special translation rule:

##### Rewrite: int limits
  x a b expression-in-x  $\int_{a}^{b} \mathrm{expression-in-x}\,d x$

where <ci>expression-in-x</ci> is an expression in the variable x is translated to to the expression:

  defint ordered_interval a b lambda x E x  $\mathrm{defint}(\mathrm{ordered_interval}(a, b), \mathrm{lambda}xE)(x)$

The case for multiple integrands is treated analogously.

Note that use of the condition element extends to multivariate domains by using extra bound variables and a domain corresponding to a cartesian product as in:

  x y 0x x1 0y y1 x2 y3  $x, y(0\le x)\land (x\le 1)\land (0\le y)\land (y\le 1)x^{2}y^{3}$

Strict Content MathML equivalent

 defint x y suchthat cartesianproduct R R and leq0x leqx1 leq0y leqy1 times powerx2 powery3  $\mathrm{defint}x, y\mathrm{suchthat}(\mathrm{cartesianproduct}(R, R), \mathrm{and}(\mathrm{leq}(0, x), \mathrm{leq}(x, 1), \mathrm{leq}(0, y), \mathrm{leq}(y, 1)), \mathrm{times}(\mathrm{power}(x, 2), \mathrm{power}(y, 3)))$

#### 4.4.4.2 Differentiation <diff/>

Class Differential Operator CommonAtt Empty diff

The diff element is the differentiation operator element for functions or expressions of a single variable. It may be applied directly to an actual function thereby denoting a function which is the derivative of the original function, or it can be applied to an expression involving a single variable.

Content MathML

 f $f^\prime$

Sample Presentation

 f ${f}^{\prime }$

Content MathML

  x x x  $\frac{d \sin x}{d x}}=\cos x$

Sample Presentation

  dsinx dx = cosx  $\frac{d\mathrm{sin}x}{dx}=\mathrm{cos}x$

The bvar element may also contain a degree element, which specifies the order of the derivative to be taken.

Content MathML

  x2 x4  $\frac{d^{2}x^{4}}{dx^{2}}$

Sample Presentation

  d2 x4 dx2  $\frac{{d}^{2}{x}^{4}}{d{x}^{2}}$

Mapping to Strict Markup

For the translation to strict Markup it is crucial to realize that in the expression case, the variable is actually not bound by the differentiation operator.

##### Rewrite: diff

Translate an expression

  x expression-in-x  $\frac{d \mathrm{expression-in-x}}{d x}}$

where <ci>expression-in-x</ci> is an expression in the variable x to the expression

  diff lambda x E x  $\mathrm{diff}(\mathrm{lambda}xE)(x)$

Note that the the differentiated function is applied to the variable x making its status as a free variable explicit in strict markup. Thus the strict equivalent of

  x x  $\frac{d \sin x}{d x}}$

is

  diff lambda x sinx x  $\mathrm{diff}(\mathrm{lambda}x\mathrm{sin}(x))(x)$

If the bvar element contains a degree element, use the nthdiff symbol.

##### Rewrite: nthdiff
  xn expression-in-x  $\frac{d^{n}\mathrm{expression-in-x}}{dx^{n}}$

where <ci>expression-in-x</ci> is an is an expression in the variable x is translated to to the expression:

  nthdiff n lambda x expression-in-x x  $\mathrm{nthdiff}(n, \mathrm{lambda}x\mathrm{expression-in-x})(x)$

For example

  2x x  $\frac{d^{2}\sin x}{dx^{2}}$

Strict Content MathML equivalent

  nthdiff 2 lambda x sinx x  $\mathrm{nthdiff}(2, \mathrm{lambda}x\mathrm{sin}(x))(x)$

#### 4.4.4.3 Partial Differentiation <partialdiff/>

Class partialdiff CommonAtt Empty partialdiff partialdiffdegree

The partialdiff element is the partial differentiation operator element for functions or expressions in several variables.

For the case of partial differentiation of a function, the containing partialdiff takes two arguments: firstly a list of indices indicating by position which function arguments are involved in constructing the partial derivatives, and secondly the actual function to be partially differentiated. The indices may be repeated.

Content MathML

  113 f  $D_{1, 1, 3}f$

Sample Presentation

  D 1,1,3 f  ${D}_{1,1,3}f$

Content MathML

  113 x y f fxyf  $\frac{\partial^{0}\mathrm{lambda}\: xyf.\: f(x, y, f)}{}$

Sample Presentation

  3 fxyz x2 z  $\frac{{\partial }^{3}f\left(x,y,z\right)}{\partial {x}^{2}\partial z}$

In the case of algebraic expressions, the bound variables are given by bvar elements, which are children of the containing apply element. The bvar elements may also contain degree element, which specify the order of the partial derivative to be taken in that variable.

Content MathML

  x y fxy  $\frac{\partial^{2}f(x, y)}{\partial x\partial y}$

Sample Presentation

  2 f xy x y  $\frac{{\partial }^{2}f\left(x,y\right)}{\partial x\partial y}$

Where a total degree of differentiation must be specified, this is indicated by use of a degree element at the top level, i.e. without any associated bvar, as a child of the containing apply element.

Content MathML

  xm yn k f x y  $\frac{\partial^{k}f(x, y)}{\partial x^{m}\partial y^{n}}$

Sample Presentation

  k fxy xm yn  $\frac{{\partial }^{k}f\left(x,y\right)}{\partial {x}^{m}\partial {y}^{n}}$

Mapping to Strict Markup

When applied to a function, the partialdiff element corresponds to the partialdiff symbol from the calculus1 content dictionary. No special rules are necessary as the two arguments of partialdiff translate directly to the two arguments of partialdiff.

##### Rewrite: partialdiffdegree

If partialdiff is used with an expression and bvar qualifiers it is rewritten to Strict Content MathML using the partialdiffdegree symbol.

  x1n1 xknk total-n1-nk expression-in-x1-xk  $\frac{\partial^{\mathrm{total-n1-nk}}\mathrm{expression-in-x1-xk}}{\partial \mathrm{x1}^{\mathrm{n1}}\partial \mathrm{xk}^{\mathrm{nk}}}$

<ci>expression-in-x1-xk</ci> is an arbitrary expression involving the bound variables.

  partialdiffdegree list n1 nk total-n1-nk lambda x1 xk A x1 xk  $\mathrm{partialdiffdegree}(\mathrm{list}(\mathrm{n1}, \mathrm{nk}), \mathrm{total-n1-nk}, \mathrm{lambda}\mathrm{x1}, \mathrm{xk}A)(\mathrm{x1}, \mathrm{xk})$

If any of the bound variables do not use a degree qualifier, <cn>1</cn> should be used in place of the degree. If the original expression did not use the total degree qualifier then the second argument to partialdiffdegree should be the sum of the degrees, for example

 plus n1 nk  $\mathrm{plus}(\mathrm{n1}, \mathrm{nk})$

With this rule, the expression

  xn ym xy  $\frac{\partial^{n+m}\sin (xy)}{\partial x^{n}\partial y^{m}}$

is translated into

  partialdiffdegree list nm plus nm lambda x y sin times xy x y  $\mathrm{partialdiffdegree}(\mathrm{list}(n, m), \mathrm{plus}(n, m), \mathrm{lambda}x, y\mathrm{sin}(\mathrm{times}(x, y)), x, y)()$

#### 4.4.4.4 Divergence <divergence/>

Class unary-veccalc CommonAtt Empty divergence

The divergence element is the vector calculus divergence operator, often called div. It represents the divergence function which takes one argument which should be a vector of scalar-valued functions, intended to represent a vector-valued function, and returns the scalar-valued function giving the divergence of the argument.

Content MathML

 a $\mathop{\mathrm{div}}(a)$

Sample Presentation

 diva $\mathrm{div}\left(a\right)$

Content MathML

  E  $\mathop{\mathrm{div}}(E)$

Sample Presentation

 divE $\mathrm{div}\left(E\right)$

 E $\nabla \cdot E$

The functions defining the coordinates may be defined implicitly as expressions defined in terms of the coordinate names, in which case the coordinate names must be provided as bound variables.

Content MathML

  x y z xy xz zy  $\mathop{\mathrm{div}}(x, , y, , z, \left(\begin{array}{c}x+y\\ x+z\\ z+y\end{array}\right))$

Sample Presentation

  div ( x x+y y x+z z z+y )  $\mathrm{div}\left(\begin{array}{c}x↦x+y\\ y↦x+z\\ z↦z+y\end{array}\right)$

#### 4.4.4.5 Gradient <grad/>

The grad element is the vector calculus gradient operator, often called grad. It is used to represent the grad function, which takes one argument which should be a scalar-valued function and returns a vector of functions.

Content MathML

 f $\mathop{\mathrm{grad}}(f)$

Sample Presentation

 gradf $\mathrm{grad}\left(f\right)$

 f $\nabla \left(f\right)$

The functions defining the coordinates may be defined implicitly as expressions defined in terms of the coordinate names, in which case the coordinate names must be provided as bound variables.

Content MathML

  x y z xyz  $\mathop{\mathrm{grad}}(x, , y, , z, xyz)$

Sample Presentation

  grad ( xyz xyz )  $\mathrm{grad}\left(\left(x,y,z\right)↦xyz\right)$

#### 4.4.4.6 Curl <curl/>

Class unary-veccalc CommonAtt Empty curl

The curl element is used to represent the curl function of vector calculus. It takes one argument which should be a vector of scalar-valued functions, intended to represent a vector-valued function, and returns a vector of functions.

Content MathML

 a $\mathop{\mathrm{curl}}(a)$

Sample Presentation

 curla $\mathrm{curl}\left(a\right)$

 ×a $\nabla ×a$

The functions defining the coordinates may be defined implicitly as expressions defined in terms of the coordinate names, in which case the coordinate names must be provided as bound variables.

#### 4.4.4.7 Laplacian <laplacian/>

Class unary-veccalc CommonAtt Empty Laplacian

The laplacian element represents the Laplacian operator of vector calculus. The Laplacian takes a single argument which is a vector of scalar-valued functions representing a vector-valued function, and returns a vector of functions.

Content MathML

 E $\nabla^2 (E)$

Sample Presentation

  2 E  ${\nabla }^{2}\left(E\right)$

The functions defining the coordinates may be defined implicitly as expressions defined in terms of the coordinate names, in which case the coordinate names must be provided as bound variables.

Content MathML

  x y z fxy  $\nabla^2 (x, , y, , z, f(x, y))$

Sample Presentation

  2 ( xyz fxy )  ${\nabla }^{2}\left(\left(x,y,z\right)↦f\left(x,y\right)\right)$

### 4.4.5 Theory of Sets

#### 4.4.5.1 Set <set>

Class nary-setlist-constructor CommonAtt ContExp* BvarQ,DomainQ set, multiset

The set represents a function which constructs mathematical sets from its arguments. It is an n-ary function. The members of the set to be constructed may be given explicitly as child elements of the constructor, or specified by rule as described in Section 4.3.1.1 Container Markup for Constructor Symbols. There is no implied ordering to the elements of a set.

Content MathML

  abc  $\{a, b, c\}$

Sample Presentation

  {a,b,c}  $\left\{a,b,c\right\}$

In general, a set can be constructed by providing a function and a domain of application. The elements of the set correspond to the values obtained by evaluating the function at the points of the domain.

Content MathML

  x x5 x  $\{x\colon x< 5\}$

Sample Presentation

  { x | x<5 }  $\left\{x|x<5\right\}$

Content MathML

  S ST S  $\{S\colon S\in T\}$

Sample Presentation

  { S | ST }  $\left\{S|S\in T\right\}$

Content MathML

  x x5 x x  $\{x\colon (x< 5)\land x\in \mathbb{N}\}$

Sample Presentation

  { x | (x<5) xN }  $\left\{x|\left(x<5\right)\wedge x\in \mathbb{N}\right\}$

#### 4.4.5.2 List <list>

Class nary-setlist-constructor CommonAtt ContExp* BvarQ,DomainQ interval_cc, list

The list elements represents the n-ary function which constructs a list from its arguments. Lists differ from sets in that there is an explicit order to the elements.

The list entries and order may be given explicitly.

Content MathML

  abc  $\left[a, b, c\right]$

Sample Presentation

  (a,b,c)  $\left(a,b,c\right)$

In general a list can be constructed by providing a function and a domain of application. The elements of the list correspond to the values obtained by evaluating the function at the points of the domain. When this method is used, the ordering of the list elements may not be clear, so the kind of ordering may be specified by the order attribute. Two orders are supported: lexicographic and numeric.

Content MathML

  x x5  $\left[x\colon x< 5\right]$

Sample Presentation

  ( x | x<5 )  $\left(x|x<5\right)$

#### 4.4.5.3 Union <union/>

Class nary-set CommonAtt Empty BvarQ,DomainQ union

The union element is used to denote the n-ary union of sets. It takes sets as arguments, and denotes the set that contains all the elements that occur in any of them.

Arguments may be explicitly specified.

Content MathML

 AB $A\cup B$

Sample Presentation

 AB $A\cup B$

Arguments may also be specified using qualfier elements as described in Section 4.3.4.1 N-ary Operators. operator element can be used as a binding operator to construct the union over a collection of sets.

Content MathML

  S L S  $S\cup \cup S$

Sample Presentation

 LS $\bigcup _{L}S$

#### 4.4.5.4 Intersect <intersect/>

Class nary-set CommonAtt Empty BvarQ,DomainQ intersect

The intersect element is used to denote the n-ary intersection of sets. It takes sets as arguments, and denotes the set that contains all the elements that occur in all of them. Its arguments may be explicitly specified in the enclosing apply element, or specified using qualfier elements as described in Section 4.3.4.1 N-ary Operators.

Content MathML

  A B  $A\cap B$

Sample Presentation

 AB $A\cap B$

Content MathML

  S L S  $S\cap \cap S$

Sample Presentation

 LS $\bigcap _{L}S$

#### 4.4.5.5 Set inclusion <in/>

Class binary-set CommonAtt Empty in

The in element represents the set inclusion relation. It has two arguments, an element and a set. It is used to denote that the element is in the given set.

Content MathML

 aA $a\in A$

Sample Presentation

 aA $a\in A$

When translating to Strict Content Markup, if the type has value "multiset", then the in from the multiset1 should be used instead.

#### 4.4.5.6 Set exclusion <notin/>

Class binary-set CommonAtt Empty notin

The notin represents the negated set inclusion relation. It has two arguments, an element and a set. It is used to denote that the element is not in the given set.

Content MathML

 aA $a\notin A$

Sample Presentation

 aA $a\notin A$

When translating to Strict Content Markup, if the type has value "multiset", then the in from the multiset1 should be used instead.

#### 4.4.5.7 Subset <subset/>

Class nary-set-reln CommonAtt Empty subset

The subset element represents the subset relation. It is used to denote that the first argument is a subset of the second. As described in Section 4.3.4.3 N-ary Relations, it may also be used as an n-ary operator to express that each argument is a subset of its predecessor.

Content MathML

  A B  $A\subseteq B$

Sample Presentation

 AB $A\subseteq B$

#### 4.4.5.8 Proper Subset <prsubset/>

Class nary-set-reln CommonAtt Empty prsubset

The prsubset element represents the proper subset relation, i.e. that the first argument is a proper subset of the second. As described in Section 4.3.4.3 N-ary Relations, it may also be used as an n-ary operator to express that each argument is a proper subset of its predecessor.

Content MathML

  A B  $A\subset B$

Sample Presentation

 AB $A\subset B$

#### 4.4.5.9 Not Subset <notsubset/>

Class binary-set CommonAtt Empty notsubset

The notsubset element represents the negated subset relation. It is used to denote that the first argument is not a subset of the second.

Content MathML

  A B  $A\nsubseteq B$

Sample Presentation

 AB $A⊈B$

When translating to Strict Content Markup, if the type has value "multiset", then the in from the multiset1 should be used instead.

#### 4.4.5.10 Not Proper Subset <notprsubset/>

Class binary-set CommonAtt Empty notprsubset

The notprsubset element represents the negated proper subset relation. It is used to denote that the first argument is not a proper subset of the second.

Content MathML

  A B  $A\not\subset B$

Sample Presentation

 AB $A\not\subset B$

When translating to Strict Content Markup, if the type has value "multiset", then the in from the multiset1 should be used instead.

#### 4.4.5.11 Set Difference <setdiff/>

Class binary-set CommonAtt Empty setdiff, setdiff

The setdiff element represents set difference operator. It takes two sets as arguments, and denotes the set that contains all the elements that occur in the first set, but not in the second.

Content MathML

  A B  $A\setminus B$

Sample Presentation

 AB $A\setminus B$

When translating to Strict Content Markup, if the type has value "multiset", then the in from the multiset1 should be used instead.

#### 4.4.5.12 Cardinality <card/>

Class unary-set CommonAtt Empty size, size

The card element represents the cardinality function, which takes a set argument and returns its cardinality, i.e. the number of elements in the set. The cardinality of a set is a non-negative integer, or an infinite cardinal number.

Content MathML

  A 5  $|A|=5$

Sample Presentation

  |A| = 5  $|A|=5$

When translating to Strict Content Markup, if the type has value "multiset", then the size from the multiset1 should be used instead.

#### 4.4.5.13 Cartesian product <cartesianproduct/>

Class nary-set CommonAtt Empty BvarQ,DomainQ cartesian_product

The cartesianproduct element is used to represents the Cartesian product operator. It takes sets as arguments, which may be explicitly specified in the enclosing apply element, or specified using qualfier elements as described in Section 4.3.4.1 N-ary Operators.

Content MathML

 AB $A\times B$

Sample Presentation

 A×B $A×B$

### 4.4.6 Sequences and Series

#### 4.4.6.1 Sum <sum/>

Class sum CommonAtt Empty BvarQ,DomainQ sum

The sum element represents the n-ary addition operator. The terms of the sum are normally specified by rule through the use of qualifiers. While it can be used with an explicit list of arguments, this is strongly discouraged, and the plus operator should be used instead in such situations.

The sum operator may be used either with or without explicit bound variables. When a bound variable is used, the sum element is followed by one or more bvar elements giving the index variables, followed by qualifiers giving the domain for the index variables. The final child in the enclosing apply is then an expression in the bound variables, and the terms of the sum are obtained by evaluating this expression at each point of the domain of the index variables. Depending on the structure of the domain, the domain of summation is often given by using uplimit and lowlimit to specify upper and lower limits for the sum.

When no bound variables are explicitly given, the final child of the enclosing apply element must be a function, and the terms of the sum are obtained by evaluating the function at each point of the domain specified by qualifiers.

Content MathML

  x a b fx  $\sum_{x=a}^{b} f(x)$

Sample Presentation

  x=a b fx  $\sum _{x=a}^{b}f\left(x\right)$

Content MathML

  x xB fx  $\sum_{x\in B} f(x)$

Sample Presentation

  xB fx  $\sum _{x\in B}f\left(x\right)$

Content MathML

  B f  $\sum f$

Sample Presentation

 Bf $\sum _{B}f$

Mapping to Strict Content MathML

When no explicit bound variables are used, no special rules are required to rewrite sums as Strict Content beyond the generic rules for rewriting expressions using qualifiers. However, when bound variables are used, it is necessary to introduce a lambda construction to rewrite the expression in the bound variables as a function.

Content MathML

  i 0 100 xi  $\sum_{i=0}^{100} x^{i}$

Strict Content MathML equivalent

 sum integer_interval 0 100 lambda i powerxi  $\mathrm{sum}(\mathrm{integer_interval}(0, 100), \mathrm{lambda}i\mathrm{power}(x, i))$

#### 4.4.6.2 Product <product/>

Class product CommonAtt Empty BvarQ,DomainQ product

The product element represents the n-ary multiplication operator. The terms of the product are normally specified by rule through the use of qualifiers. While it can be used with an explicit list of arguments, this is strongly discouraged, and the times operator should be used instead in such situations.

The product operator may be used either with or without explicit bound variables. When a bound variable is used, the product element is followed by one or more bvar elements giving the index variables, followed by qualifiers giving the domain for the index variables. The final child in the enclosing apply is then an expression in the bound variables, and the terms of the product are obtained by evaluating this expression at each point of the domain. Depending on the structure of the domain, it is commonly given using uplimit and lowlimit qualifiers.

When no bound variables are explicitly given, the final child of the enclosing apply element must be a function, and the terms of the product are obtained by evaluating the function at each point of the domain specified by qualifiers.

Content MathML

  x a b f x  $\prod_{x=a}^{b} f(x)$

Sample Presentation

  x=a b fx  $\prod _{x=a}^{b}f\left(x\right)$

Content MathML

  x x B fx  $\prod_{x\in B} f(x)$

Sample Presentation

  xB fx  $\prod _{x\in B}f\left(x\right)$

Mapping to Strict Content MathML

When no explicit bound variables are used, no special rules are required to rewrite products as Strict Content beyond the generic rules for rewriting expressions using qualifiers. However, when bound variables are used, it is necessary to introduce a lambda construction to rewrite the expression in the bound variables as a function.

Content MathML

  i 0 100 xi  $\prod_{i=0}^{100} x^{i}$

Strict Content MathML equivalent

 product integer_interval 0 100 lambda i powerxi  $\mathrm{product}(\mathrm{integer_interval}(0, 100), \mathrm{lambda}i\mathrm{power}(x, i))$

#### 4.4.6.3 Limits <limit/>

Class limit CommonAtt Empty lowlimit, condition limit, both_sides, above, below, null

The limit element represents the operation of taking a limit of a sequence. The limit point is expressed by specifying a lowlimit and a bvar, or by specifying a condition on one or more bound variables.

Content MathML

  x 0 x  $\lim_{x\to 0}\sin x$

Sample Presentation

  limx0 sinx  $\underset{x\to 0}{\mathrm{lim}}\mathrm{sin}x$

Content MathML

  x x0 x  $\lim_{x\to 0}\sin x$

Sample Presentation

  limx0 sinx  $\underset{x\to 0}{\mathrm{lim}}\mathrm{sin}x$

Content MathML

  x xa x  $\lim_{x\to a}\sin x$

Sample Presentation

  limxa sinx  $\underset{x\to a}{\mathrm{lim}}\mathrm{sin}x$

The direction from which a limiting value is approached is given as an argument limit in Strict Content MathML, which supplies the direction specifier symbols both_sides, above, and below for this purpose. The first correspond to the values "all", "above", and "below" of the type attribute of the tendsto element below. The null symbol corresponds to the case where no type attribute is present. We translate

##### Rewrite: limits condition
  x x0 expression-in-x  $\lim_{x\to 0}\mathrm{expression-in-x}$

Strict Content MathML equivalent

 limit 0 null lambda x expression-in-x  $\mathrm{limit}(0, \mathrm{null}, \mathrm{lambda}x\mathrm{expression-in-x})$

where <ci>expression-in-x</ci> is an arbitrary expression involving the bound variable(s), and the choice of symbol, null depends on the type attribute of the the tendsto element as described above.

#### 4.4.6.4 Tends To <tendsto/>

Class binary-reln CommonAtt Empty limit

The tendsto element is used to express the relation that a quantity is tending to a specified value. While this is used primarily as part of the statement of a mathematical limit, it exists as a construct on its own to allow one to capture mathematical statements such as "As x tends to y," and to provide a building block to construct more general kinds of limits.

The tendsto element takes the attributes type to set the direction from which the limiting value is approached.

Content MathML

  x2 a2  $x^{2}\to a^{2}$

Sample Presentation

  x2 a2  ${x}^{2}\to {a}^{2}$

Content MathML

  xy fxy gxy  $\left(\begin{array}{c}x\\ y\end{array}\right)\to \left(\begin{array}{c}f(x, y)\\ g(x, y)\end{array}\right)$

Sample Presentation

  x y fxy gxy  $\left(\begin{array}{c}x\\ y\end{array}\right)\to \left(\begin{array}{c}f\left(x,y\right)\\ g\left(x,y\right)\end{array}\right)$

Mapping to Strict Content MathML

The usage of tendsto to qualify a limit is formally defined by writing the expression in Strict Content MathML via the rule Rewrite: limits condition. The meanings of other more idiomatic uses of tendsto are not formally defined by this specification. When rewriting these cases to Strict Content MathML, tendsto should be rewritten to an annotated identifier as shown below.

##### Rewrite: tendsto
   

Strict Content MathML equivalent:

  tendsto  $\mathrm{tendsto}$

### 4.4.7 Elementary classical functions

#### 4.4.7.1 Common trigonometric functions

Class unary-elementary CommonAtt Empty sin
 sin cos tan sec csc cot sinh cosh tanh sech csch coth arcsin arccos arctan arccosh arccot arccoth arccsc arccsch arcsec arcsech arcsinh arctanh

These operator elements denote the standard trigonometric and hyperbolic functions and their inverses. Since their standard interpretations are widely known, they are discussed as a group. In the case of inverse functions there are differing definitions in use. For maximum interoperability applications evaluating such expressions should follow the definitions in [Abramowitz1997].

Content MathML

 x $\sin x$

Sample Presentation

 sinx $\mathrm{sin}x$

Content MathML

  x x3  $\sin (\cos x+x^{3})$

Sample Presentation

  sin ( cosx + x3 )  $\mathrm{sin}\left(\mathrm{cos}x+{x}^{3}\right)$

#### 4.4.7.2 Exponential <exp/>

Class unary-arith CommonAtt Empty exp

The exp element represents the exponentiation function associated with the inverse of the ln function. It takes one argument.

Content MathML

 x $e^{x}$

Sample Presentation

 ex ${e}^{x}$

#### 4.4.7.3 Natural Logarithm <ln/>

Class unary-functional CommonAtt Empty ln

The ln element represents the natural logarithm function.

Content MathML

 a $\ln a$

Sample Presentation

 lna $\mathrm{ln}a$

#### 4.4.7.4 Logarithm <log/>

Class unary-functional CommonAtt Empty logbase log

The log elements represents the logarithm function relative to a given base. When present, the logbase qualifier specifies the base. Otherwise, the base is assumed to be 10. apply.

Content MathML

  3 x  $\log_{3}x$

Sample Presentation

 log3x ${\mathrm{log}}_{3}x$

Content MathML

 x $\lg x$

Sample Presentation

 logx $\mathrm{log}x$

Mapping to Strict Content MathML

When mapping log to Strict Content, one uses the log, symbol denoting the function that returns the log of it's second argument with respect to the base specified by the first argument. When logbase is present, it determines the base. Otherwise, the default base of 10 must be explicitly provided in Strict markup. See the following example.

  2 x y  $\log_{2}x+\lg y$

Strict Content MathML equivalent:

  plus log x 2 log y 10  $\mathrm{plus}(\mathrm{log}(x, 2), \mathrm{log}(y, 10))$

### 4.4.8 Statistics

#### 4.4.8.1 Mean <mean/>

Class nary-stats CommonAtt Empty BvarQ,DomainQ mean, mean

The mean element represents the function returning arithmetic mean or average of a data set or random variable. If it is used on a data set, then the mean element corresponds to the mean symbol from the s_data1 content dictionary. When it is applied to a random variable, then it corresponds to the mean symbol from the s_dist1 CD.

Content MathML

  34374  $\langle 3, 4, 3, 7, 4\rangle$

Sample Presentation

  3,4,3 ,7,4  $〈3,4,3,7,4〉$

Content MathML

 X $\langle X\rangle$

Sample Presentation

 X $〈X〉$

 X¯ $\overline{X}$

Mapping to Strict Markup

When the mean element is applied to an explicit list of arguments, the translation to Strict Content markup is direct, using the mean symbol from the s_data1 content dictionary, as described in Rewrite: element. When it is applied to a distribution, then the mean symbol from the s_dist1 content dictionary should be used. In the case with qualifiers use Rewrite: n-ary domainofapplication with the same caveat.

#### 4.4.8.2 Standard Deviation <sdev/>

Class nary-stats CommonAtt Empty BvarQ,DomainQ sdev, sdev

sdev is the operator element representing the standard deviation of a data set or random variable.

Content MathML

  3422  $\sigma (3, 4, 2, 2)$

Sample Presentation

  σ 3422  $\sigma \left(3,4,2,2\right)$

Content MathML

  X  $\sigma (X)$

Sample Presentation

 σX $\sigma \left(X\right)$

Mapping to Strict Markup

When the sdev element is applied to an explicit list of arguments, the translation to Strict Content markup is direct, using the sdev symbol from the s_data1 content dictionary, as described in Rewrite: element. When it is applied to a distribution, then the sdev symbol from the s_dist1 content dictionary should be used. In the case with qualifiers use Rewrite: n-ary domainofapplication with the same caveat.

#### 4.4.8.3 Variance <variance/>

Class nary-stats CommonAtt Empty BvarQ,DomainQ variance, variance

variance is the operator element representing the standard deviation of a data set or random variable. If it is used on a data set, then the variance element corresponds to the variance from the s_data1 content dictionary, if it is used on a random variable, then it corresponds to the variance from the s_dist1 CD.

Content MathML

  3422  $\sigma(3)^2$

Sample Presentation

  σ 3422 2  ${\sigma \left(3,4,2,2\right)}^{2}$

Content MathML

  X  $\sigma(X)^2$

Sample Presentation

  σX 2  ${\sigma \left(X\right)}^{2}$

Mapping to Strict Markup

When the variance element is applied to an explicit list of arguments, the translation to Strict Content markup is direct, using the variance symbol from the s_data1 content dictionary, as described in Rewrite: element. When it is applied to a distribution, then the variance symbol from the s_dist1 content dictionary should be used. In the case with qualifiers use Rewrite: n-ary domainofapplication with the same caveat.

#### 4.4.8.4 Median <median/>

Class nary-stats CommonAtt Empty BvarQ,DomainQ median

This symbol represents an n-ary function denoting the median of its arguments. That is, if the data were placed in ascending order then it denotes the middle one (in the case of an odd amount of data) or the average of the middle two (in the case of an even amount of data).

Content MathML

  3422  $\mathop{\mathrm{median}}(3, 4, 2, 2)$

Sample Presentation

  median 3422  $\mathrm{median}\left(3,4,2,2\right)$

Mapping to Strict Markup

When the median element is applied to an explicit list of arguments, the translation to Strict Content markup is direct, using the median symbol from the s_data1 content dictionary, as described in Rewrite: element.

#### 4.4.8.5 Mode <mode/>

Class nary-stats CommonAtt Empty BvarQ,DomainQ mode

This symbol represents an n-ary function denoting the mode of its arguments. That is the value which occurs with the greatest frequency.

Content MathML

  3422  $\mathop{\mathrm{mode}}(3, 4, 2, 2)$

Sample Presentation

  mode 3422  $\mathrm{mode}\left(3,4,2,2\right)$

Mapping to Strict Markup

When the mode element is applied to an explicit list of arguments, the translation to Strict Content markup is direct, using the mode symbol from the s_data1 content dictionary, as described in Rewrite: element.

#### 4.4.8.6 Moment (<moment/>, <momentabout>)

Class unary-functional CommonAtt Empty degree, momentabout moment, moment

The moment element is used to denote the ith moment of a set of data set or random variable. The moment function accepts the degree and momentabout qualifiers. If present, the degree schema denotes the order of the moment. Otherwise, the moment is assumed to be the first order moment. When used with moment, the degree schema is expected to contain a single child. If present, the momentabout schema denotes the point about which the moment is taken. Otherwise, the moment is assumed to be the moment about zero.

Content MathML

  3 64225  $\langle 5^{3}\rangle_{}$

Sample Presentation

  64225 3 mean  ${〈{\left(6,4,2,2,5\right)}^{3}〉}_{\mathrm{mean}}$

Content MathML

  3 p X  $\langle X^{3}\rangle_{p}$

Sample Presentation

  X3 p  ${〈{X}^{3}〉}_{p}$

Mapping to Strict Markup

When rewriting to Strict Markup, the moment is used. It takes the degreee as the first argument, the point as the second, and the dataset or random variable.

  3 p X  $\langle X^{3}\rangle_{p}$

Strict Content MathML equivalent

 moment 3 p X  $\mathrm{moment}(3, p, X)$

### 4.4.9 Linear Algebra

#### 4.4.9.1 Vector <vector>

Class nary-constructor CommonAtt BvarQ,DomainQ ContExp* vector

A vector is an ordered n-tuple of values representing an element of an n-dimensional vector space. The "values" are all from the same ring, typically real or complex. Where orientation is important, such as for pre or post multiplication by a matrix a vector is treated as a row vector and its transpose is treated a column vector.

For purposes of interaction with matrices and matrix multiplication, vectors are regarded as equivalent to a matrix consisting of a single column, and the transpose of a vector behaves the same as a matrix consisting of a single row. Note that vectors may be rendered either as a single column or row.

vector is a constructor element (see ??? ).

Content MathML

  xy 3 7  $\left(\begin{array}{c}x+y\\ 3\\ 7\end{array}\right)$

Sample Presentation

  ( x+y 3 7 )  $\left(\begin{array}{c}x+y\\ 3\\ 7\end{array}\right)$

  x+y 3 7  $\left(x+y,3,7\right)$

The vector element constructs vectors from an n-dimensional vector space so that its n child elements typically represent real or complex valued scalars as in the three-element vector

In general a vector can be constructed by providing a function and a 1-dimensional domain of application. The entries of the vector correspond to the values obtained by evaluating the function at the points of the domain.

Content MathML

  x 17 x2  $\left(\begin{array}{c}x\\ \\ x^{2}\end{array}\right)$

Sample Presentation

  [ x2 | x 17 ]  $\left[{x}^{2}|x\in \left[1,7\right]\right]$

#### 4.4.9.2 Matrix <matrix>

Class nary-constructor CommonAtt BvarQ,DomainQ ContExp* matrix

A vector is an ordered n-tuple of values representing an element of an n-dimensional vector space. The "values" are all from the same ring, typically real or complex. Where orientation is important, such as for pre or post multiplication by a matrix a vector is treated as a row vector and its transpose is treated a column vector.

For purposes of interaction with matrices and matrix multiplication, vectors are regarded as equivalent to a matrix consisting of a single column, and the transpose of a vector behaves the same as a matrix consisting of a single row. Note that vectors may be rendered either as a single column or row.

Note that the behavior of the matrix and matrixrow elements is substantially different from the mtable and mtr presentation elements.

matrix is a constructor element (see ??? ).

In general a matrix can be constructed by providing a function and a 2-dimensional domain of application. The entries of the matrix correspond to the values obtained by evaluating the function at the points of the domain. The qualifications defined by a domainofapplication element can also be abbreviated in several ways including a condition element placing constraints directly on bound variables and an expression in those variables.

Content MathML

  i j i 15 j 59 ij  $\begin{pmatrix}i, ji\in \left[1 , 5\right]\land j\in \left[5 , 9\right]i^{j}\end{pmatrix}$

Sample Presentation

  [ mi,j | mi,j = ij ; i 15 j 59 ]  $\left[{m}_{i,j}|{m}_{i,j}={i}^{j};i\in \left[1,5\right]\wedge j\in \left[5,9\right]\right]$

#### 4.4.9.3 Matrix row <matrixrow>

Class nary-constructor CommonAtt BvarQ,DomainQ ContExp* matrixrow

This symbol is an n-ary constructor used to represent rows of matrices. Its arguments should be members of a ring.

Matrix rows are not directly rendered by themselves outside of the context of a matrix.

#### 4.4.9.4 Determinant <determinant/>

Class unary-linalg CommonAtt Empty determinant

This symbol denotes the unary function which returns the determinant of its argument, the argument should be a square matrix.

Content MathML

  A  $\det A$

Sample Presentation

 detA $\mathrm{det}A$

#### 4.4.9.5 Transpose <transpose/>

Class unary-linalg CommonAtt Empty transpose

This symbol represents a unary function that denotes the transpose of the given matrix or vector.

Content MathML

  A  $A^T$

Sample Presentation

 AT ${A}^{T}$

#### 4.4.9.6 Selector <selector/>

Class nary-linalg CommonAtt Empty vector_selector, matrix_selector

The selector element is the operator for indexing into vectors matrices and lists. It accepts one or more arguments. The first argument identifies the vector, matrix or list from which the selection is taking place, and the second and subsequent arguments, if any, indicate the kind of selection taking place.

When selector is used with a single argument, it should be interpreted as giving the sequence of all elements in the list, vector or matrix given. The ordering of elements in the sequence for a matrix is understood to be first by column, then by row. That is, for a matrix (ai,j), where the indices denote row and column, the ordering would be a1,1, a1,2, ... a2,1, a2,2 ... etc.

When three arguments are given, the last one is ignored for a list or vector, and in the case of a matrix, the second and third arguments specify the row and column of the selected element.

When two arguments are given, and the first is a vector or list, the second argument specifies an element in the list or vector.

Content MathML

 V1 $V_{1}$

Sample Presentation

 V1 ${V}_{1}$

Content MathML

  12 34 1 12  $\begin{pmatrix}1 & 2\\ 3 & 4\end{pmatrix}_{1}=1 & 2$

Sample Presentation

  ( 12 34 ) 1 = 12  ${\left(\begin{array}{cc}1& 2\\ 3& 4\end{array}\right)}_{1}=\begin{array}{cc}1& 2\end{array}$

#### 4.4.9.7 Vector product <vectorproduct/>

Class binary-linalg CommonAtt Empty vectorproduct

This symbol represents the vector product function. It takes two three dimensional vector arguments and returns a three dimensional vector.

Content MathML

  A B a b θ N  $A\times B=ab\sin \theta N$

Sample Presentation

  A×B = a b sinθ N  $A×B=ab\mathrm{sin}\theta N$

#### 4.4.9.8 Scalar product <scalarproduct/>

Class binary-linalg CommonAtt Empty scalarproduct

This symbol represents the scalar product function. It takes two vector arguments and returns a scalar value.

Content MathML

  A B a b θ  $A\dot B=ab\cos \theta$

Sample Presentation

  A.B = a b cosθ  $A.B=ab\mathrm{cos}\theta$

#### 4.4.9.9 Outer product <outerproduct/>

Class binary-linalg CommonAtt Empty outerproduct

This symbol represents the outer product function. It takes two vector arguments and returns a matrix.

Content MathML

  A B  $A\dot B$

Sample Presentation

 AB $A\otimes B$

### 4.4.10 Constant and Symbol Elements

This section explains the use of the Constant and Symbol elements.

#### 4.4.10.1 integers <integers/>

Class constant-set CommonAtt Empty Z

This symbol represents the set of integers, positive, negative and zero.

Content MathML

  42  $42\in \mathbb{Z}$

Sample Presentation

 42Z $42\in \mathbb{Z}$

#### 4.4.10.2 reals <reals/>

Class constant-set CommonAtt Empty R

This symbol represents the set of real numbers.

Content MathML

  44.997  $44.997\in \mathbb{R}$

Sample Presentation

 44.997R $44.997\in \mathbb{R}$

#### 4.4.10.3 Rational Numbers <rationals/>

Class constant-set CommonAtt Empty Q

This symbol represents the set of rational numbers.

Content MathML

  22 7  $22/7\in \mathbb{Q}$

Sample Presentation

  22/7 Q  $22/7\in \mathbb{Q}$

#### 4.4.10.4 Natural Numbers <naturalnumbers/>

Class constant-set CommonAtt Empty N

This symbol represents the set of natural numbers (including zero).

Content MathML

  1729  $1729\in \mathbb{N}$

Sample Presentation

 1729N $1729\in \mathbb{N}$

#### 4.4.10.5 complexes <complexes/>

Class constant-set CommonAtt Empty C

This symbol represents the set of complex numbers.

Content MathML

  1729  $17+29i\in \mathbb{C}$

Sample Presentation

  17+29i C  $17+29i\in \mathbb{C}$

#### 4.4.10.6 primes <primes/>

Class constant-set CommonAtt Empty P

This symbol represents the set of positive prime numbers.

Content MathML

  17  $17\in \mathbb{P}$

Sample Presentation

 17P $17\in \mathbb{P}$

#### 4.4.10.7 Exponential e <exponentiale/>

Class constant-arith CommonAtt Empty e

This symbol represents the base of the natural logarithm, approximately 2.718.

Content MathML

  1  $\ln e=1$

Sample Presentation

  lne = 1  $\mathrm{ln}e=1$

#### 4.4.10.8 Imaginary i <imaginaryi/>

Class constant-arith CommonAtt Empty i

This symbol represents the mathematical constant which is the square root of -1, commonly written i

Content MathML

  2 -1  $i^{2}=-1$

Sample Presentation

 i2=-1 ${i}^{2}=-1$

#### 4.4.10.9 Not A Number <notanumber/>

Class constant-arith CommonAtt Empty NaN

A symbol to convey the notion of not-a-number. The result of an ill-posed floating computation. See IEEE standard for floating point representations.

Content MathML

  00  $\frac{0}{0}=NaN$

Sample Presentation

  0/0 = NaN  $0/0=\mathrm{NaN}$

#### 4.4.10.10 True <true/>

Class constant-arith CommonAtt Empty true

This symbol represents the Boolean value true, i.e. the logical constant for truth.

Content MathML

  P  $\mbox{true}\lor P=\mbox{true}$

Sample Presentation

  trueP = true  $\mathrm{true}\vee P=\mathrm{true}$

#### 4.4.10.11 False <false/>

Class constant-arith CommonAtt Empty false

This symbol represents the Boolean value false, i.e. the logical constant for falsehood.

Content MathML

  P  $\mbox{false}\land P=\mbox{false}$

Sample Presentation

  falseP = false  $\mathrm{false}\wedge P=\mathrm{false}$

#### 4.4.10.12 Empty Set <emptyset/>

Class constant-set CommonAtt Empty emptyset, emptyset

This symbol is used to represent the empty set, that is the set which contains no members. It takes no parameters.

The emptyset element takes an optional attribute type. If its value is "multiset", then the emptyset corresponds to the emptyset symbol from the multiset1 CD.

Content MathML

   $\mathbb{Z}\neq \emptyset$

Sample Presentation

 Z $\mathbb{Z}\ne \varnothing$

#### 4.4.10.13 pi <pi/>

Class constant-arith CommonAtt Empty pi

A symbol to convey the notion of pi, approximately 3.142. The ratio of the circumference of a circle to its diameter.

Content MathML

  227  $\pi \approx 22/7$

Sample Presentation

  π 22/7  $\pi \simeq 22/7$

#### 4.4.10.14 Euler gamma <eulergamma/>

Class constant-arith CommonAtt Empty gamma

A symbol to convey the notion of the gamma constant. It is the limit of 1 + 1/2 + 1/3 + ... + 1/m - ln m as m tends to infinity, this is approximately 0.5772.

Content MathML

  0.5772156649  $\gamma \approx 0.5772156649$

Sample Presentation

 γ0.5772156649 $\gamma \simeq 0.5772156649$

#### 4.4.10.15 infinity <infinity/>

Class constant-arith CommonAtt Empty infinity

A symbol to represent the notion of infinity.

Content MathML

  $\infty$

Sample Presentation

  $\infty$

## 4.5 Deprecated Content Elements

### 4.5.1 Declare <declare>

 Editorial note: MiKo This should maybe be moved into a general section about changes or deprecated elements. Also Stan thinks the text should be improved.

MathML2 provided the declare element to bind properties like types to symbols and variables and to define abbreviations for structure sharing. This element is deprecated in MathML 3. Structure sharing can obtained via the share element (see Section 4.2.7 Structure Sharing <share> for details).

## 4.6 The Strict Content MathML Translation

This section sketches the meaning-giving translation from full MathML3 into Strict Content MathML as a list of transformation rules which are supposed to be applied in order.

1. Normalize non-strict bind: Change the outer bind tags in binding expressions to apply, if they have qualifiers or multiple children. This simplifies the algorithm by allowing the subsequent rules to be applied to non-strict binding expressions without case distinction. Note that the following rules will change the apply elements introduced in this step back to bind elements.

2. Normalize Container Markup:

1. Sets and lists are rewritten by the rule Section 4.3.4.2 N-ary Constructors for set and list .

2. Interval, vectors, matricies, and matrix rows are rewritten as described in Section 4.4.1.1 Interval <interval>, Section 4.4.9.1 Vector <vector>, Section 4.4.9.2 Matrix <matrix> and Section 4.4.9.3 Matrix row <matrixrow>.

3. Lambda expressions are rewritten by rules Rewrite: lambda

4. Piecewise funtions are rewritten, as described in Section 4.4.1.9 Piecewise declaration (<piecewise>, <piece>, <otherwise>).

3. Special Case Operator Rules: This step deals with the special cases for the operators introduced in Section 4.4 Content MathML for Specific Operators and Constants. There are different classes of special cases to be taken into account here:

1. Quantifiers with condition:: The two quantifiers forall and exists are rewritten to expressions using implication and conjunction by the rule Rewrite: quantifier.

2. Derivatives are rewritten with rules Rewrite: diff, Rewrite: diff, Rewrite: partialdiffdegree that take special care of explicating the binding status of the variables involved.

3. Integrals are rewritten with rules Rewrite: int that take special care of bound/free variables and of the orientation of the range of integration if it is given as a lowlimit/uplimit pair.

4. Limits are rewritten as described in Rewrite: tendsto and Rewrite: limits condition.

5. Sums and products are rewritten as described in Section 4.4.6.1 Sum <sum/> and Section 4.4.6.2 Product <product/>.

6. Logarithms are rewritten as described in Section 4.4.7.4 Logarithm <log/>.

7. Moments are rewriteen as described in Section 4.4.8.6 Moment (<moment/>, <momentabout>).

4. Rewriting Qualifiers: This rule is applied to apply with bvar children and normalizes various cases of qualifiers.

1. Rewriting Intervals: Qualifiers given as interval and lowlimit/uplimit are rewritten to intervals of integers via Rewrite: interval qualifier.

2. Multiple conditions: Multiple condition qualifiers are rewritten to one, by taking their conjunction, then this is rewritten to domainofapplication according to rule Rewrite: condition.

3. Multiple domainofapplication Multiple domainofapplication qualifiers are rewritten to one by taking the intersection of the specified domains.

5. Eliminating domainofapplication: At this stage, any apply has at most one domainofapplication child. As domainofapplication is not Strict Content MathML, it is rewritten

1. into an application of a restricted function via the rule Rewrite: restriction if the apply does not contain a bvar child.

2. into an application of predicate_on_list via the rules Rewrite: n-ary relations and Rewrite: n-ary relations bvar if used with a relation.

3. into a construction with the apply_to_list symbol via the general rule Rewrite: n-ary domainofapplication for general n-ary operators..

4. into a construction using the suchthat symbol from the set1 content dictionary in apply with bound variables via the Rewrite: apply bvar domainofappliction rule

6. Rewriting cn: Numbers represented as cn elements with type is one of "e-notation", "rational", "complex-cartesian", "complex-polar", "constant" are rewritten as strict cn via rules Rewrite: cn sep, Rewrite: cn constant.

7. Rewriting the type attribute: ci and csymbol elements with a type attribute to a strict expression with semantics according to rule Rewrite: ci type annotation.

8. Token Elements containing Presentation MathML: Any ci, csymbol or sep segments of cn containing presentation MathML rewritten to semantics elements with rule Rewrite: ci presentation mathml and its analog for csymbol.

9. rewriting definitionURL and encoding on csymbol: If the definitionURL and encoding attributes on a csymbol element can be interpreted as a reference to a content dictionary (see Section 4.2.3.2 Extended uses of <csymbol> for details), then this content dictionary referenced by the cd attribute instead.

10. rewriting attributes: Any element with attributes that are not allowed in strict markup is rewritten to a semantics construction with the element without these attributes as the first child and the attributes in annotation elements.

##### Rewrite: attributes

For instance,

 x $x$

is rewritten to

  x foo foreign_attribute http://example.com other att bla  $x$

For MathML attributes not allowed in Strict Content MathML the content dictionary mathmlattr is referenced, which provides symbols for all attributes allowed on content MathML elements. For other attributes in other namespaces, the namespace URI is encoded in the definitionURL attribute instead.

11. rewriting operators: Any remaining operator defined in Section 4.4 Content MathML for Specific Operators and Constants is rewritten to a csymbol referencing the symbol identified in the syntax table by the rule Rewrite: element.

Overview: Mathematical Markup Language (MathML) Version 3.0
Previous: 3 Presentation Markup
Next: 5 Mixing Markup Languages