Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions metanorma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ metanorma:
- sources/pm-1006/document.adoc
- sources/pm-1007/document.adoc
- sources/pm-1008/document.adoc
- sources/pm-1009/document.adoc
- sources/pm-1010/document.adoc
- sources/pm-1011/document.adoc
- sources/pm-1012/document.adoc
- sources/pm-1013/document.adoc

collection:
organization: "Plurimath"
Expand Down
1 change: 1 addition & 0 deletions sources/pm-1001/document.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:language: en
:script: Latn
:title: Plurimath specifications -- Math model
:title-fr: Spécifications Plurimath -- Modèle mathématique
:doctype: standard
:status: draft-standard
:committee: Plurimath
Expand Down
1 change: 1 addition & 0 deletions sources/pm-1002/document.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:language: en
:script: Latn
:title: Plurimath specifications -- Uncertainty model
:title-fr: Spécifications Plurimath -- Modèle d'incertitude
:doctype: standard
:status: draft-standard
:committee: Plurimath
Expand Down
1 change: 1 addition & 0 deletions sources/pm-1003/document.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:language: en
:script: Latn
:title: Plurimath specifications -- Format interfaces
:title-fr: Spécifications Plurimath -- Interfaces de format
:doctype: standard
:status: draft-standard
:committee: Plurimath
Expand Down
1 change: 1 addition & 0 deletions sources/pm-1004/document.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:language: en
:script: Latn
:title: Plurimath specifications -- Evaluation
:title-fr: Spécifications Plurimath -- Évaluation
:doctype: standard
:status: draft-standard
:committee: Plurimath
Expand Down
2 changes: 1 addition & 1 deletion sources/pm-1004/sections/12-limits.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Each non-goal is a contract someone will eventually ask for. Stating them keeps

=== The road in

When propagation arrives, it arrives in this document: its operations, its error extensions if any, its corpus, its conformance class — the same structure this edition uses for arithmetic. The uncertainty nodes of PM 1002 were built to carry everything propagation will need: category, fields, exact decimals. Nothing in the model blocks the road; the evaluator simply has not walked it yet.
When propagation arrives, it arrives in this document: its operations, its error extensions if any, its corpus, its conformance class — the same structure this edition uses for arithmetic. The uncertainty nodes of PM 1002 were built to carry everything propagation will need: category, fields, exact decimals. Nothing in the model blocks the road; the evaluator simply has not walked it yet. The successor edition is PM 1011 — the extension it states (the quantity operands, the lifted uncertainty-node refusal, the propagation, the series) amends this document's clauses in place, and PM 1004's contracts hold unchanged for the arithmetic core it covers.
1 change: 1 addition & 0 deletions sources/pm-1005/document.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:language: en
:script: Latn
:title: Plurimath specifications -- The AsciiMath notation
:title-fr: Spécifications Plurimath -- La notation AsciiMath
:doctype: standard
:status: draft-standard
:committee: Plurimath
Expand Down
1 change: 1 addition & 0 deletions sources/pm-1006/document.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:language: en
:script: Latn
:title: Plurimath specifications -- The pma notation
:title-fr: Spécifications Plurimath -- La notation pma
:doctype: standard
:status: draft-standard
:committee: Plurimath
Expand Down
1 change: 1 addition & 0 deletions sources/pm-1007/document.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:language: en
:script: Latn
:title: Plurimath specifications -- The PM LaTeX notation
:title-fr: Spécifications Plurimath -- La notation PM LaTeX
:doctype: standard
:status: draft-standard
:committee: Plurimath
Expand Down
1 change: 1 addition & 0 deletions sources/pm-1008/document.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:language: en
:script: Latn
:title: Plurimath specifications -- The PM UnicodeMath notation
:title-fr: Spécifications Plurimath -- La notation PM UnicodeMath
:doctype: standard
:status: draft-standard
:committee: Plurimath
Expand Down
60 changes: 60 additions & 0 deletions sources/pm-1009/document.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
= The quantity type system
:docnumber: 1009
:edition: 1
:ref-docnumber: PM 1009:2026(E)
:copyright-year: 2026
:revdate: 2026-11-12
:language: en
:script: Latn
:title: Plurimath specifications -- The quantity type system
:title-fr: Spécifications Plurimath -- Système de types de quantités
:doctype: standard
:status: draft-standard
:committee: Plurimath
:committee-type: technical
:mn-document-class: ribose
:docfile: document.adoc
:mn-output-extensions: xml,html,doc
:local-cache:
:data-uri-image:

include::sections/00-foreword.adoc[]

include::sections/00-introduction.adoc[]

include::sections/01-scope.adoc[]

include::sections/02-normrefs.adoc[]

include::sections/03-terms.adoc[]

include::sections/04-conventions.adoc[]

include::sections/01-scope.adoc[]

include::sections/02-normrefs.adoc[]

include::sections/03-terms.adoc[]

include::sections/04-conventions.adoc[]

include::sections/05-quantity-value.adoc[]

include::sections/06-unit-expr.adoc[]

include::sections/07-dimensions.adoc[]

include::sections/08-conversion.adoc[]

include::sections/09-errors.adoc[]

include::sections/10-conformance.adoc[]

include::sections/90-annex-a.adoc[]

include::sections/91-annex-b.adoc[]

include::sections/92-annex-c.adoc[]

include::sections/98-bibliography.adoc[]

29 changes: 29 additions & 0 deletions sources/pm-1009/sections/00-foreword.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
== Foreword

=== General

This document is the ninth document of the Plurimath specifications series. It specifies the quantity type system: the typed values that carry a number, a unit expression and an optional uncertainty; the unit algebra over SI and scaled units; the dimension vectors that state coherence; and the typed errors that make every violation a diagnostic instead of a silent wrong answer.

The system is the semantic plane's foundation. PM 1004's evaluator binds ordinary real numbers and refuses everything else; this document defines what the evaluator binds from the semantic edition onwards — quantities whose arithmetic delegates to the unit algebra and whose numbers obey the accuracy-class discipline of PM 1004, clause 7.

=== Documents in the series

.Documents in the series
[cols="1,3,2", options="headers"]
|===
|Number |Title |Subject

|1001 |Math model |The formula tree, the node classes, the registry, the rendering surfaces
|1002 |Uncertainty model |The uncertainty node, its categories, its encodings
|1003 |Format interfaces |The readers and writers per format
|1004 |Evaluation |Numeric evaluation of trees
|1009 |Quantity type system |This document: quantities, units, dimensions, typed errors
|1010 |Expression language |The closed expression grammar and its typed AST
|1011 |Evaluation processing |Unit-aware evaluation, propagation, series, second-order modes
|1012 |Constraint evaluation |Decision rules, residuals, verdicts
|1013 |Embedded-consumer contract |The serialized request surface and the parity claims
|===

=== Maintainers

This document is maintained by the Plurimath project at https://github.com/plurimath/plurimath.
22 changes: 22 additions & 0 deletions sources/pm-1009/sections/00-introduction.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
== Introduction

A number without a unit is an answer to a different question. `1.2` is a number; `1,2 V` is a measurement — and the questions a measurement answers ("is it within the limit?", "does it combine with this other result?", "what does it render as?") all need the unit, and the coherence rules that guard the unit, to travel with the number.

This document specifies that carrier. A quantity value binds one number — its accuracy class carried per PM 1004 — to one unit expression, and optionally to one uncertainty in the model of PM 1002. The unit expression is an algebra: units multiply, divide and scale, and every unit expression reduces to a dimension vector against which coherence is checked mechanically.

The design centre is the typed refusal. Dimension mismatches, unknown unit codes and impossible conversions are not runtime accidents to be trapped; they are values — diagnostics carrying the expected and the received — produced by the same total-evaluation discipline PM 1004 states for arithmetic. Nothing here computes a plausible answer and hopes.

[example]
Multiplying `3 kV` by `2 A`.
*Expected outcome.* the quantity `6 kW` — the unit algebra reduces `kV·A` through the dimension vectors to the power unit at the kilo scale, and the number multiplies per the accuracy classes.

=== The design forces

* *Coherence is mechanical.* Dimension vectors decide; prose never does.
* *Units are data.* Every unit name resolves through the registered authority (the UnitsML codes); an unregistered unit is a typed error naming the code.
* *The number keeps its class.* The accuracy class of PM 1004 travels on the quantity; the unit algebra multiplies and divides classes exactly as it multiplies and divides units.
* *Errors are values.* The diagnostics of clause 6 are constructed results, raised only at the evaluation boundary — the same boundary discipline as PM 1004's.

=== The precedents

The design descends from systems that carry units through arithmetic: Wolfram Language's `Quantity` composes units through operations and checks coherence mechanically (`CompatibleUnitQ`) — this document's clause 7; its accuracy/precision distinction — digits after the point against total significant digits, tracked through every operation — is the refined form of the accuracy classes this document carries per PM 1004. This document states where it follows that precedent and where it is stricter: the typed refusals of clause 6 replace the message-and-continue behaviour, because a metrology pipeline must not continue into a wrong answer.
16 changes: 16 additions & 0 deletions sources/pm-1009/sections/01-scope.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
== Scope

This document specifies:

* the quantity value: the typed pair of a number (with its accuracy class per PM 1004) and a unit expression, with an optional uncertainty in the model of PM 1002;
* the unit expression algebra: SI base and derived units, scaled units, compound units, and the affine scales handled explicitly;
* the dimension vectors: the reduction of every unit expression to its dimensions and the coherence rules that consume them;
* the conversion contract: the registered factors and offsets, and the affine traps;
* the typed errors of the quantity algebra, stated as data.

This document does not specify:

* the uncertainty model itself (PM 1002) — the uncertainty field references it;
* evaluation and propagation over quantities (PM 1011);
* the numeric contract of exact decimals in the data (CalConnect 36813) — this document binds numbers whose accuracy class is stated, under PM 1004's algebra;
* the expression syntax that constructs quantities (PM 1010).
10 changes: 10 additions & 0 deletions sources/pm-1009/sections/02-normrefs.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[bibliography]
== Normative references

* [[[pm1001,nofetch(PM 1001 (math model))]]] of this series — the formula tree this document's quantities attach to.
* [[[pm1002,nofetch(PM 1002 (uncertainty model))]]] of this series — the uncertainty model referenced by the optional uncertainty field.
* [[[pm1004,nofetch(PM 1004 (evaluation))]]] of this series — the accuracy classes (clause 7) that every number in a quantity value carries.
* [[[sibrochure,nofetch(The International System of Units (SI Brochure))]]], BIPM — the definitions of the SI base and derived units.
* [[[jcgm200,nofetch(JCGM 200 (VIM))]]] — the vocabulary of quantities and units this document's terms follow.
* [[[unitsml,nofetch(UnitsML)]]], NIST — the unit codes this document registers as authority references.
* [[[cc36813,nofetch(CalConnect 36813 (numeric contract))]]] of the UnitsML series — the exact-decimal discipline of the data.
30 changes: 30 additions & 0 deletions sources/pm-1009/sections/03-terms.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
== Terms and definitions

For the purposes of this document, the following terms and definitions apply.

=== quantity value
a typed pair of a number and a unit expression, with an optional uncertainty

=== unit expression
an algebraic composition of units — products, quotients, integer powers, scale prefixes — that reduces to one dimension vector and one scale factor

=== base unit
one of the SI base units, the identity elements of the unit algebra

=== scaled unit
a unit multiplied by a scale prefix (kilo, milli, …); the scale is a factor, not a distinct dimension

=== affine unit
a unit whose conversion to its dimension's canonical unit carries a non-zero offset (degree Celsius, degree Fahrenheit); an affine unit breaks the multiplication ring and is handled explicitly, never implicitly

=== dimension vector
the exponent tuple over the SI base dimensions a unit expression reduces to

=== coherence
the rule that an operation's operands carry the dimensions the operation defines; coherence is checked on dimension vectors, mechanically

=== conversion
the registered mapping between two unit expressions of the same dimension, by factor, or by factor and offset for affine units

=== typed error
one of the diagnostic values of clause 6, constructed with the identifying data and raised at the evaluation boundary
13 changes: 13 additions & 0 deletions sources/pm-1009/sections/04-conventions.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
== Conventions

=== General

Quantities are written as number, space, unit: `3 kV`. Unit expressions are written in the ordinary notation (`kg/m^3`, `V·A`, `kW`) with `^` for integer powers and `/` for quotients.

=== Examples

Examples carry an *Expected outcome* paragraph stating the constructed quantity, the reduced dimension, or the typed error with its data.

=== Units

Unit names in examples are the SI spellings and symbols; the authority reference is the UnitsML code, written `unitsml(m)` where the code matters.
35 changes: 35 additions & 0 deletions sources/pm-1009/sections/05-quantity-value.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
== The quantity value

=== The model

[source,lml]
----
lml "1.0"

models QuantitySystem {

class QuantityValue {
attribute value, Number[1]
attribute unit, UnitExpr[1]
attribute uncertainty, Uncertainty[0..1]
}
}
----

The `value` is a number with its accuracy class per PM 1004, clause 7: exact (integer, rational) or limited (float, guard-digit decimal). The `unit` is a unit expression of clause 6. The `uncertainty`, where present, is one node of PM 1002 — its category, its fields and its exact decimals as that document defines them; this document adds no uncertainty form of its own.

=== Construction

A quantity value is constructed from a number and a unit expression, or refused with a typed error of clause 6: an unregistered unit code constructs `UnknownUnit{code}` as the value's diagnostic — the diagnostic is the constructed result, not an exception in the data path.

[example]
Constructing `1,2 V` with an uncertainty of `0,06 V` standard.
*Expected outcome.* one quantity value: `1,2` (limited, per its stated accuracy), unit `V`, uncertainty the PM 1002 standard-category node carrying `0,06` at unit `V`.

=== The number is never unitless by default

A quantity value's unit is stated. There is no implicit unitless quantity: a bare number in the expression language of PM 1010 constructs a dimensionless quantity (unit expression `1`), which is a stated unit, not an absence.

=== Equality and comparison

Two quantity values compare only at the same dimension. Comparison across scales of the same dimension converts one operand to the other's scale first (`3 km` compared to `2500 m` converts the kilometre value), and the numeric comparison follows PM 1004's accuracy classes: comparisons at a stated boundary are evaluated exactly where the operands are exact, per PM 1004's boundary rule.
28 changes: 28 additions & 0 deletions sources/pm-1009/sections/06-unit-expr.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
== The unit expression algebra

=== The forms

A unit expression is one of:

* a **base or derived unit symbol** — `m`, `kg`, `s`, `A`, `K`, `mol`, `cd`, and the registered derived units (`V`, `W`, `Hz`, `N`, `Pa`, …);
* a **scaled unit** — a scale prefix (kilo, milli, micro, …) applied to a unit symbol (`kV`, `mm`, `µm`);
* a **product** — `UnitExpr · UnitExpr`;
* a **quotient** — `UnitExpr / UnitExpr`;
* an **integer power** — `UnitExpr^n`, n a non-zero integer; the zero power is the dimensionless unit `1`;
* the **dimensionless unit** — `1`.

=== The algebra

Unit expressions form a commutative ring over the dimension vectors and a multiplicative group over the scale factors, with one stated exception: the affine units of clause 7 are excluded from implicit multiplication and division. Multiplying `degC` by anything is a typed error (`AffineUnitInAlgebra`), not a silent treatment of the offset as a factor.

=== Reduction

Every unit expression reduces to a canonical pair: one dimension vector (clause 7) and one scale factor relative to the coherent SI unit of that dimension (`kV` reduces to `V·10^3`). Two unit expressions are the same unit exactly when their canonical pairs are equal; `V·A` and `W` are the same unit at the same scale only when the registered derived-unit relation says so, and otherwise they are different units of the same dimension — stated, never silently normalised.

[example]
Reducing `kV·A`.
*Expected outcome.* dimension vector `[1, 1, −3, −1, …]` (the power dimension), scale factor `10^3` relative to `W` — the quantity is a kilowatt-class quantity.

=== The registry

Every unit symbol resolves through the registered authority — the UnitsML codes. An unregistered symbol constructs `UnknownUnit{code}`. Registration is data: the register carries the symbol, its dimension contribution, its scale and its authority code, and nothing else about the unit.
26 changes: 26 additions & 0 deletions sources/pm-1009/sections/07-dimensions.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
== Dimension vectors and coherence

=== The dimensions

The dimension vector is the exponent tuple over the seven SI base dimensions — length, mass, time, electric current, thermodynamic temperature, amount of substance, luminous intensity. The dimensionless unit `1` is the zero vector.

=== The operation rules

* multiplication adds the vectors; division subtracts them; an integer power scales them;
* comparison and addition require equal vectors — the coherence rule. The check is mechanical and precedes the numeric comparison;
* a quantity's unit and its uncertainty's unit (where an uncertainty is present) must share the dimension; the uncertainty field states its unit per PM 1002, and this document requires equality of dimension with the value's unit.

[example]
Adding `3 m` and `2 s`.
*Expected outcome.* `DimensionMismatch{expected: [1,0,0,…], got: [0,0,1,…]}` — the diagnostic carries both vectors, constructed as the result. Nothing adds.

[example]
Dividing `6 kW` by `2 A`.
*Expected outcome.* the quantity `3 kV`: the vectors subtract to the voltage dimension, the scales divide, the numbers divide per the accuracy classes.

=== Affine units

An affine unit converts to its dimension's canonical unit by factor and offset. Two rules hold without exception:

* *differences are not values*: the difference of two quantities in an affine unit is a quantity in the affine unit's difference unit (a temperature difference in `degC` is a plain difference quantity — its dimension is temperature, its conversion is by factor alone, no offset);
* *affine units do not enter the algebra silently*: multiplication, division and powers over affine operands are the typed error `AffineUnitInAlgebra`. Conversion to the canonical unit first, then the algebra, is the stated path.
25 changes: 25 additions & 0 deletions sources/pm-1009/sections/08-conversion.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
== Conversion

=== The registered conversions

A conversion is registered between two unit expressions of the same dimension: by factor, or by factor and offset for the affine pairs. The register is data — the factor, the offset where present, and the authority reference (the UnitsML code) — and an unregistered conversion request is the typed error `UnitNotConvertible{from, to}`.

=== The contract

Conversion multiplies the number by the factor and, for affine targets, adds the offset to the converted magnitude — the offset applies to the value, never to a difference. The accuracy class of the result follows PM 1004's contamination rule: a limited operand converts to a limited result at its declared precision; an exact operand converts exactly when the factor is exact (a rational), and to a limited result at the stated guard precision when the factor is irrational.

[example]
Converting `3 km` to `m`.
*Expected outcome.* `3000 m`, exact — the factor is the exact rational `1000`.

[example]
Converting a difference of `5 degC` to `K`.
*Expected outcome.* `5 K` — the difference converts by factor alone; no offset applies.

[example]
Converting the absolute quantity `25 degC` to `K`.
*Expected outcome.* `278,15 K` at the stated precision — the offset applies to the value.

=== The traps, stated

The affine traps are normative, not advisory: adding an offset to a difference, or applying a factor where an offset is registered, are the wrong answers this document exists to prevent. The corpus carries a vector for each trap.
Loading
Loading