# CellML Secondary Specification for Differential Algebraic Equations with Events : Unofficial working draft

Abstract

This document is an unofficial working draft. The below describes the intended status of the specification, and not the current status right now.

This document is the CellML Secondary Specification for Differential-Algebraic Equations with Events. It provides additional constraints on top of those specified in the CellML 1.2 specification; to be compliant with this secondary specification, processing software MUST be able to correctly process every model that is compliant with this specification.

This is the normative specification of a secondary specification. It is intended to provide the minimum amount of information needed to accurately describe the class of models allowed by this secondary specification.

## 1. CellML Secondary Specification - DAEs with Optional Resets

### 1.1. Preliminary matters

1. This specification is a secondary specification to the CellML 1.2 Specification, and so should be read together with the CellML 1.2 specification. It acts to further narrow the CellML 1.2 specification. Models and software implementations must comply with the CellML 1.2 specification to comply with this specification.

2. The rules provided in this specification are against the MathML 3 Strict form; the rules in this document apply to content MathML after all possible transformations to strict MathML defined in the MathML 3 specification have been applied.

3. Except where stated otherwise, references to variables in this specification refer to model variables, and not to individual variable element information items.

### 1.2. Requirements for compliant models

1. Compliant models MUST NOT contain any variables, constants, or expressions unless the type is either real or boolean, except where explicitly stated otherwise in this specification.

2. Every child of a math element information item in the MathML namespace must comply with one of following rules:

1. The child of the MathML math element information item is an apply element information item, and the first MathML element information item child of that apply element is a symbol from the relation1 content dictionary.

2. The rules described in Section 1.6, “Rules for top-level piecewise expressions”, where a child of the MathML math element is an apply element information item, and the first MathML element information child of that apply element is the piecewise symbol from the piece1 content dictionary.

3. All csymbol elements in the model must have a cd attribute and text child value matching a symbol on either the Generally Available List given in Section 1.7, “Generally Available List” or the Specific Uses list given in Section 1.8, “Specific Uses List”. In this section, rules about the type of the result of an application also apply to type of a symbol that takes no arguments.

4. Symbols defined in Section 1.7, “Generally Available List” MAY be used anywhere where the use is not inconsistent with other rules in this specification or the primary specification.

Symbols defined in Section 1.8, “Specific Uses List” MUST NOT be used anywhere except where specifically allowed in this specification.

5. Where an OpenMath symbol takes an argument of STS type Boolean, the CellML type of that argument MUST be boolean.

6. Where the application of an OpenMath symbol produces a result of STS type Boolean, the CellML type of that result SHALL be boolean.

7. Where an OpenMath symbol takes an argument of an STS type given in Section 1.4, “OpenMath STS types equivalent to CellML type real”, the CellML type of that argument MUST be real.

8. Where the application of an OpenMath symbol produces a result of an STS type given in Section 1.4, “OpenMath STS types equivalent to CellML type real”, the CellML type of that result SHALL be real.

9. The piece symbol in content dictionary piece1 shall produce a result of type piece-real if given a first argument of type real, and a result of type piece-boolean if given a first argument of type boolean.

10. The otherwise symbol in content dictionary piece1 shall produce a result of type piece-real if given an argument of type real, and a result of type piece-boolean if given an argument of type boolean.

11. The types piece-bool and piece-real MUST NOT be used anywhere in the model (not as a variable type, a constant type, or as the inferred type of expressions) except where explicitly allowed in this specification.

12. All arguments to an application of the piecewise symbol in content dictionary piece1 MUST be of the same type, and that type must be either piece-real or piece-boolean. Where the type is piece-real, the result of the application SHALL be of type real. Where the type is piece-boolean, the result of the application SHALL be of type boolean.

13. Both arguments to an application of the eq or neq symbol in the relation1 content dictionary SHALL be of the same type.

14. Let n be the number of variables of type real in the model. For a model to be valid under this secondary specification, it MUST be possible to divide up the variables of type real into one independent variable and n-1 dependent variables. There must be precisely n-1 real constraint equations (as defined in section Section 1.3, “Meaning of real constraint equations” that do not contain initial value expressions (as defined later in this section).

15. There MUST NOT be any subset of the real constraint equations that do not contain initial value expressions, of size greater than some i, but which collectively only involve i real variables (not counting references to variables where the reference occurs inside infinitesimally delayed expressions).

16. Application of the oriented_interval symbol in content dictionary interval1 MUST take two real arguments, and SHALL produce a value of type oriented-real-interval. The type oriented-real-interval MUST NOT be used anywhere in the model (not as a variable type, a constant type, or as the inferred type of expressions) except where specifically allowed in this specification.

17. Binding to the lambda symbol in content dictionary fns1 MUST be over an expression of type real, the bound variable introduced SHALL be of type real, and the binding SHALL produce a value of type real-real-lambda. The type real-real-lambda MUST NOT be used anywhere in the model (not as a variable type, a constant type, or as the inferred type of expressions) except where specifically allowed in this specification.

18. The defint symbol in content dictionary calculus1 MAY be applied to a first argument of type oriented-real-interval, and a second argument of type real-real-lambda.

19. The diff symbol in content dictionary calculus1 MAY be applied to a first argument of type real-real-lambda, giving a value of type real-real-lambda-applyonly.

20. The nthdiff symbol in content dictionary calculus1 MAY be applied to a first argument of type real, and a second argument of type real-real-lambda, giving a value of type real-real-lambda-applyonly. The first argument MUST be defined using the Low Complexity Subset defined in Section 1.5, “Rules for low complexity subset expressions”, and MUST have a value that is a positive integer.

21. Values of type real-real-lambda-applyonly MUST only occur as the operator to a MathML apply expression, and the second argument MUST be a ci reference to the independent variable. Such an expression (application of the independent variable to the diff or nthdiff of a lambda) is referred to as a derivative in this specification.

22. The evaluatedAt symbol in the content dictionary cellml1 MUST NOT be used, except as explicitly allowed in this specification.

23. The evaluatedAt operator MAY be used in an arbitrary number of expressions where the first argument is a reference to the independent variable, the second argument is a low complexity subset expression, and the third argument is a dependent variable, or an application of the diff or nthdiff symbol to a dependent variable. The second argument MUST evaluate to the same value each time this rule is relied upon. The term initial value expression SHALL refer to this form of expression.

24. The evaluatedAt operator MAY be applied as the first argument of a binding of the lambda symbol in content dictionary fns1, where the first argument of the evaluatedAt operator is the independent variable, and the second is an application of the plus operator from arith1 with the first argument to plus being the independent variable, and the second being bound variable of the lambda binding. The lambda binding MUST be the third argument of an application of the limit operator from limit1, with the first argument to the limit being a constant zero, and the second argument being the symbol below from limit1. Such expressions SHALL be referred to as infinitesimally delayed expressions within this specification.

25. An equation containing initial value expression MUST NOT involve the diff or nthdiff symbols from the calculus1 content dictionary other than within initial value expressions.

26. Where an initial value expression is used in a model, the model MUST also contain a top-level equation or top-level piecewise expression that involves the dependent variable or derivative (as the case may be) from the initial value expression, or which involves the first derivative of that dependent variable or derivative, but which does not contain any initial value expressions. Note: to avoid doubt, for the purposes of this rule, an initial value expression which involves the derivative of a dependent variable SHALL be taken to involve the derivative but to not involve the dependent variable.

27. Let n be the number of real variables in the model, and ${k}_{i}$ be the highest degree of differentiation found in the model for the ith real variable (${k}_{i}=0$ if no derivatives are found). Let ${d}_{0}={\sum }_{i=1}^{n}{k}_{i}$. Then the total number of real constraint equations in the model MUST equal ${d}_{0}$.

28. Let t be the independent variable, ${v}_{i}$ be the ith variable, and $S=\left\{{v}_{1},\frac{{\mathrm{dv}}_{1}}{\mathrm{dt}},\frac{{d}^{2}{v}_{1}}{{\mathrm{dt}}^{2}},...,\frac{{d}^{{k}_{1}}{v}_{1}}{{\mathrm{dt}}^{{k}_{1}}},...,{v}_{n},\frac{{\mathrm{dv}}_{n}}{\mathrm{dt}},...,\frac{{d}^{{k}_{n}}{v}_{n}}{{\mathrm{dt}}^{{k}_{n}}}\right\}$. There MUST NOT be any subset of the real constraint equations, of size greater than some i, but which collectively only involve i members of S (not counting references to members of S that occur inside infinitesimally delayed expressions)).

29. For every boolean variable in the model, there MUST be an eq relation with a reference to the boolean variable as the first argument, and an arbitrary boolean expression as the second argument.

30. There MUST be an ordering of boolean variables such that the expression for each boolean variable only uses boolean variables earlier in the ordering.

### 1.3. Meaning of real constraint equations

A top-level equality SHALL be real constraint equation if the two parts being equated are of type real.

A top-level piecewise SHALL be a real constraint equation.

No other expressions in the model SHALL be considered real constraint equations.

### 1.4. OpenMath STS types equivalent to CellML type real

1. For the purposes of this secondary specification, the following OpenMath STS types SHALL correspond to the CellML type real:

1. OrderedSet

2. NumericalValue in the sts content dictionary

3. SemiGroup

4. AbelianSemiGroup

5. AbelianGroup

6. PositiveInteger

7. C in the setname1 content dictionary

8. R in the setname1 content dictionary

9. Z in the setname1 content dictionary

10. N in the setname1 content dictionary

### 1.5. Rules for low complexity subset expressions

The following rules apply only to expressions that are required to be expressed in the low complexity subset:

1. Variables MUST NOT be referenced within a low complexity subset expression unless there is a top-level eq operator in the model equating that variable to a low complexity subset expression.

2. A low complexity subset expression which does not refer to any variables SHALL be defined to be a level 0 low complexity subset expression.

3. It MUST be possible to assign each low complexity subset expression a non-negative level i such that every low complexity subset expression only refers to variables that have been equated to a low complexity subset expression of a lower level.

4. Symbols from the calculus1 content dictionary MUST NOT be used within a low complexity subset expression.

5. The evaluatedAt symbol MUST NOT be used in a low complexity subset expression.

### 1.6. Rules for top-level piecewise expressions

1. Each top-level piecewise expression MUST have exactly two piece-boolean arguments.

2. Within the rules in this section, the value of a piece SHALL mean the only argument of an application of otherwise from the piece1 content dictionary, and the first argument of an application of piece from the piece1 content dictionary.

3. The value of each piece MUST consist of an application of the eq symbol from content dictionary relation1.

4. One piece MUST contain one or more instances of a derivative of exactly one dependent variable, such that the derivative (or any derivative of the same variable to a higher degree) does not appear anywhere else in the model (other than as a descendant of an evaluatedAt application), and the derivative to one degree less (the dependent variable itself in the case of first-order differentiation) appears in the other piece.

### 1.7. Generally Available List

The Generally Available List of symbols is enumerated below, by naming the content dictionary, and then specifying which of symbols in the content dictionary that are on the Generally Available List:

1. logic1 - all symbols in the logic1 content dictionary

2. piece1 - all symbols in the piece1 content dictionary

3. relation1 - all symbols in the relation1 content dictionary except approx

4. arith1 - all symbols in the arith1 content dictionary except product or sum

5. transc1 - all symbols in the transc1 content dictionary

6. rounding1 - all symbols in the rounding1 content dictionary

7. nums1 - the symbols e, gamma, and pi in the nums1 content dictionary

8. integer1 - all symbols in the integer1 content dictionary

### 1.8. Specific Uses List

The Specific Uses List of symbols is enumerated below, by naming the content dictionary, and then specifying which of symbols in the content dictionary that are on the Specific Uses List:

1. cellml1 - the symbol evaluatedAt

2. limit1 - the symbols limit and below

3. calculus1 - the symbols defint, diff, and nthdiff

4. interval1 - the symbol oriented_interval

5. fns1 - the symbol lambda