From 6377270962f7f7d98f44809e0f8027a957391704 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Thu, 12 Nov 2026 23:59:29 +0800 Subject: [PATCH 1/3] Add French titles to the PM specification parts --- sources/pm-1001/document.adoc | 1 + sources/pm-1002/document.adoc | 1 + sources/pm-1003/document.adoc | 1 + sources/pm-1004/document.adoc | 1 + sources/pm-1005/document.adoc | 1 + sources/pm-1006/document.adoc | 1 + sources/pm-1007/document.adoc | 1 + sources/pm-1008/document.adoc | 1 + 8 files changed, 8 insertions(+) diff --git a/sources/pm-1001/document.adoc b/sources/pm-1001/document.adoc index 34c8925..32405fb 100644 --- a/sources/pm-1001/document.adoc +++ b/sources/pm-1001/document.adoc @@ -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 diff --git a/sources/pm-1002/document.adoc b/sources/pm-1002/document.adoc index 73fec02..0483c9a 100644 --- a/sources/pm-1002/document.adoc +++ b/sources/pm-1002/document.adoc @@ -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 diff --git a/sources/pm-1003/document.adoc b/sources/pm-1003/document.adoc index c85fe95..7500b04 100644 --- a/sources/pm-1003/document.adoc +++ b/sources/pm-1003/document.adoc @@ -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 diff --git a/sources/pm-1004/document.adoc b/sources/pm-1004/document.adoc index e7410e2..a0ab4ec 100644 --- a/sources/pm-1004/document.adoc +++ b/sources/pm-1004/document.adoc @@ -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 diff --git a/sources/pm-1005/document.adoc b/sources/pm-1005/document.adoc index bbf511c..226c0e1 100644 --- a/sources/pm-1005/document.adoc +++ b/sources/pm-1005/document.adoc @@ -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 diff --git a/sources/pm-1006/document.adoc b/sources/pm-1006/document.adoc index 6b46354..8b8077b 100644 --- a/sources/pm-1006/document.adoc +++ b/sources/pm-1006/document.adoc @@ -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 diff --git a/sources/pm-1007/document.adoc b/sources/pm-1007/document.adoc index 5cb38c8..eccaaf1 100644 --- a/sources/pm-1007/document.adoc +++ b/sources/pm-1007/document.adoc @@ -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 diff --git a/sources/pm-1008/document.adoc b/sources/pm-1008/document.adoc index e3d1f5c..b8b7719 100644 --- a/sources/pm-1008/document.adoc +++ b/sources/pm-1008/document.adoc @@ -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 From ee48c3ec8cc927fcf2427451a4a1dbab01f465e6 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Thu, 12 Nov 2026 23:59:48 +0800 Subject: [PATCH 2/3] chore: drop regenerated notfound marker From 0d48f7ae8c1d4bbce5c94d6e457d6657f6959c7f Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Fri, 13 Nov 2026 16:52:03 +0800 Subject: [PATCH 3/3] Add PM 1009-1013: the semantic math and evaluation series Elaborates the semantic-math mandate (plurimath#488) into register documents with the alignment-audit findings incorporated: PM 1009 (the quantity type system), PM 1010 (the expression language under the PARG SSOT), PM 1011 (evaluation processing - the PM 1004 successor edition that lifts the uncertainty-node refusal and states the GUM propagation, the LPU verdict and the GUF2 mode), PM 1012 (constraint evaluation, ILAC-G8 decision rules), PM 1013 (the embedded-consumer contract). PM 1004's clause 12 now names PM 1011 as the successor edition. validate-register.rb green: 13 documents. --- metanorma.yml | 5 ++ sources/pm-1004/sections/12-limits.adoc | 2 +- sources/pm-1009/document.adoc | 60 +++++++++++++++++++ sources/pm-1009/sections/00-foreword.adoc | 29 +++++++++ sources/pm-1009/sections/00-introduction.adoc | 22 +++++++ sources/pm-1009/sections/01-scope.adoc | 16 +++++ sources/pm-1009/sections/02-normrefs.adoc | 10 ++++ sources/pm-1009/sections/03-terms.adoc | 30 ++++++++++ sources/pm-1009/sections/04-conventions.adoc | 13 ++++ .../pm-1009/sections/05-quantity-value.adoc | 35 +++++++++++ sources/pm-1009/sections/06-unit-expr.adoc | 28 +++++++++ sources/pm-1009/sections/07-dimensions.adoc | 26 ++++++++ sources/pm-1009/sections/08-conversion.adoc | 25 ++++++++ sources/pm-1009/sections/09-errors.adoc | 22 +++++++ sources/pm-1009/sections/10-conformance.adoc | 13 ++++ sources/pm-1009/sections/90-annex-a.adoc | 17 ++++++ sources/pm-1009/sections/91-annex-b.adoc | 9 +++ sources/pm-1009/sections/92-annex-c.adoc | 9 +++ sources/pm-1009/sections/98-bibliography.adoc | 7 +++ sources/pm-1010/document.adoc | 58 ++++++++++++++++++ sources/pm-1010/sections/00-foreword.adoc | 29 +++++++++ sources/pm-1010/sections/00-introduction.adoc | 16 +++++ sources/pm-1010/sections/01-scope.adoc | 15 +++++ sources/pm-1010/sections/02-normrefs.adoc | 8 +++ sources/pm-1010/sections/03-terms.adoc | 24 ++++++++ sources/pm-1010/sections/04-conventions.adoc | 9 +++ sources/pm-1010/sections/05-language.adoc | 26 ++++++++ sources/pm-1010/sections/06-grammar-parg.adoc | 13 ++++ sources/pm-1010/sections/07-precedence.adoc | 28 +++++++++ sources/pm-1010/sections/08-types.adoc | 13 ++++ sources/pm-1010/sections/09-round-trip.adoc | 13 ++++ sources/pm-1010/sections/10-conformance.adoc | 12 ++++ sources/pm-1010/sections/90-annex-a.adoc | 20 +++++++ sources/pm-1010/sections/91-annex-b.adoc | 5 ++ sources/pm-1010/sections/98-bibliography.adoc | 6 ++ sources/pm-1011/document.adoc | 60 +++++++++++++++++++ sources/pm-1011/sections/00-foreword.adoc | 29 +++++++++ sources/pm-1011/sections/00-introduction.adoc | 14 +++++ sources/pm-1011/sections/01-scope.adoc | 16 +++++ sources/pm-1011/sections/02-normrefs.adoc | 14 +++++ sources/pm-1011/sections/03-terms.adoc | 24 ++++++++ sources/pm-1011/sections/04-conventions.adoc | 9 +++ .../sections/05-evaluation-extension.adoc | 21 +++++++ sources/pm-1011/sections/06-propagation.adoc | 29 +++++++++ sources/pm-1011/sections/07-second-order.adoc | 21 +++++++ sources/pm-1011/sections/08-series.adoc | 17 ++++++ sources/pm-1011/sections/09-errors.adoc | 26 ++++++++ sources/pm-1011/sections/10-interface.adoc | 13 ++++ sources/pm-1011/sections/11-conformance.adoc | 16 +++++ sources/pm-1011/sections/90-annex-a.adoc | 11 ++++ sources/pm-1011/sections/91-annex-b.adoc | 3 + sources/pm-1011/sections/98-bibliography.adoc | 9 +++ sources/pm-1012/document.adoc | 58 ++++++++++++++++++ sources/pm-1012/sections/00-foreword.adoc | 29 +++++++++ sources/pm-1012/sections/00-introduction.adoc | 16 +++++ sources/pm-1012/sections/01-scope.adoc | 15 +++++ sources/pm-1012/sections/02-normrefs.adoc | 10 ++++ sources/pm-1012/sections/03-terms.adoc | 24 ++++++++ sources/pm-1012/sections/04-conventions.adoc | 9 +++ sources/pm-1012/sections/05-constraints.adoc | 34 +++++++++++ .../pm-1012/sections/06-decision-rules.adoc | 23 +++++++ sources/pm-1012/sections/07-residuals.adoc | 13 ++++ sources/pm-1012/sections/08-guards.adoc | 9 +++ .../sections/09-verdict-rendering.adoc | 9 +++ sources/pm-1012/sections/10-conformance.adoc | 13 ++++ sources/pm-1012/sections/90-annex-a.adoc | 3 + sources/pm-1012/sections/91-annex-b.adoc | 3 + sources/pm-1012/sections/98-bibliography.adoc | 5 ++ sources/pm-1013/document.adoc | 52 ++++++++++++++++ sources/pm-1013/sections/00-foreword.adoc | 27 +++++++++ sources/pm-1013/sections/00-introduction.adoc | 12 ++++ sources/pm-1013/sections/01-scope.adoc | 14 +++++ sources/pm-1013/sections/02-normrefs.adoc | 9 +++ sources/pm-1013/sections/03-terms.adoc | 18 ++++++ sources/pm-1013/sections/04-conventions.adoc | 9 +++ sources/pm-1013/sections/05-boundary.adoc | 13 ++++ .../pm-1013/sections/06-artifact-sharing.adoc | 13 ++++ .../pm-1013/sections/07-request-contract.adoc | 25 ++++++++ sources/pm-1013/sections/08-parity.adoc | 13 ++++ sources/pm-1013/sections/09-conformance.adoc | 11 ++++ sources/pm-1013/sections/98-bibliography.adoc | 6 ++ 81 files changed, 1499 insertions(+), 1 deletion(-) create mode 100644 sources/pm-1009/document.adoc create mode 100644 sources/pm-1009/sections/00-foreword.adoc create mode 100644 sources/pm-1009/sections/00-introduction.adoc create mode 100644 sources/pm-1009/sections/01-scope.adoc create mode 100644 sources/pm-1009/sections/02-normrefs.adoc create mode 100644 sources/pm-1009/sections/03-terms.adoc create mode 100644 sources/pm-1009/sections/04-conventions.adoc create mode 100644 sources/pm-1009/sections/05-quantity-value.adoc create mode 100644 sources/pm-1009/sections/06-unit-expr.adoc create mode 100644 sources/pm-1009/sections/07-dimensions.adoc create mode 100644 sources/pm-1009/sections/08-conversion.adoc create mode 100644 sources/pm-1009/sections/09-errors.adoc create mode 100644 sources/pm-1009/sections/10-conformance.adoc create mode 100644 sources/pm-1009/sections/90-annex-a.adoc create mode 100644 sources/pm-1009/sections/91-annex-b.adoc create mode 100644 sources/pm-1009/sections/92-annex-c.adoc create mode 100644 sources/pm-1009/sections/98-bibliography.adoc create mode 100644 sources/pm-1010/document.adoc create mode 100644 sources/pm-1010/sections/00-foreword.adoc create mode 100644 sources/pm-1010/sections/00-introduction.adoc create mode 100644 sources/pm-1010/sections/01-scope.adoc create mode 100644 sources/pm-1010/sections/02-normrefs.adoc create mode 100644 sources/pm-1010/sections/03-terms.adoc create mode 100644 sources/pm-1010/sections/04-conventions.adoc create mode 100644 sources/pm-1010/sections/05-language.adoc create mode 100644 sources/pm-1010/sections/06-grammar-parg.adoc create mode 100644 sources/pm-1010/sections/07-precedence.adoc create mode 100644 sources/pm-1010/sections/08-types.adoc create mode 100644 sources/pm-1010/sections/09-round-trip.adoc create mode 100644 sources/pm-1010/sections/10-conformance.adoc create mode 100644 sources/pm-1010/sections/90-annex-a.adoc create mode 100644 sources/pm-1010/sections/91-annex-b.adoc create mode 100644 sources/pm-1010/sections/98-bibliography.adoc create mode 100644 sources/pm-1011/document.adoc create mode 100644 sources/pm-1011/sections/00-foreword.adoc create mode 100644 sources/pm-1011/sections/00-introduction.adoc create mode 100644 sources/pm-1011/sections/01-scope.adoc create mode 100644 sources/pm-1011/sections/02-normrefs.adoc create mode 100644 sources/pm-1011/sections/03-terms.adoc create mode 100644 sources/pm-1011/sections/04-conventions.adoc create mode 100644 sources/pm-1011/sections/05-evaluation-extension.adoc create mode 100644 sources/pm-1011/sections/06-propagation.adoc create mode 100644 sources/pm-1011/sections/07-second-order.adoc create mode 100644 sources/pm-1011/sections/08-series.adoc create mode 100644 sources/pm-1011/sections/09-errors.adoc create mode 100644 sources/pm-1011/sections/10-interface.adoc create mode 100644 sources/pm-1011/sections/11-conformance.adoc create mode 100644 sources/pm-1011/sections/90-annex-a.adoc create mode 100644 sources/pm-1011/sections/91-annex-b.adoc create mode 100644 sources/pm-1011/sections/98-bibliography.adoc create mode 100644 sources/pm-1012/document.adoc create mode 100644 sources/pm-1012/sections/00-foreword.adoc create mode 100644 sources/pm-1012/sections/00-introduction.adoc create mode 100644 sources/pm-1012/sections/01-scope.adoc create mode 100644 sources/pm-1012/sections/02-normrefs.adoc create mode 100644 sources/pm-1012/sections/03-terms.adoc create mode 100644 sources/pm-1012/sections/04-conventions.adoc create mode 100644 sources/pm-1012/sections/05-constraints.adoc create mode 100644 sources/pm-1012/sections/06-decision-rules.adoc create mode 100644 sources/pm-1012/sections/07-residuals.adoc create mode 100644 sources/pm-1012/sections/08-guards.adoc create mode 100644 sources/pm-1012/sections/09-verdict-rendering.adoc create mode 100644 sources/pm-1012/sections/10-conformance.adoc create mode 100644 sources/pm-1012/sections/90-annex-a.adoc create mode 100644 sources/pm-1012/sections/91-annex-b.adoc create mode 100644 sources/pm-1012/sections/98-bibliography.adoc create mode 100644 sources/pm-1013/document.adoc create mode 100644 sources/pm-1013/sections/00-foreword.adoc create mode 100644 sources/pm-1013/sections/00-introduction.adoc create mode 100644 sources/pm-1013/sections/01-scope.adoc create mode 100644 sources/pm-1013/sections/02-normrefs.adoc create mode 100644 sources/pm-1013/sections/03-terms.adoc create mode 100644 sources/pm-1013/sections/04-conventions.adoc create mode 100644 sources/pm-1013/sections/05-boundary.adoc create mode 100644 sources/pm-1013/sections/06-artifact-sharing.adoc create mode 100644 sources/pm-1013/sections/07-request-contract.adoc create mode 100644 sources/pm-1013/sections/08-parity.adoc create mode 100644 sources/pm-1013/sections/09-conformance.adoc create mode 100644 sources/pm-1013/sections/98-bibliography.adoc diff --git a/metanorma.yml b/metanorma.yml index b6190ac..cace447 100644 --- a/metanorma.yml +++ b/metanorma.yml @@ -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" diff --git a/sources/pm-1004/sections/12-limits.adoc b/sources/pm-1004/sections/12-limits.adoc index 7d0e6fe..5a7d3e5 100644 --- a/sources/pm-1004/sections/12-limits.adoc +++ b/sources/pm-1004/sections/12-limits.adoc @@ -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. diff --git a/sources/pm-1009/document.adoc b/sources/pm-1009/document.adoc new file mode 100644 index 0000000..180bb2b --- /dev/null +++ b/sources/pm-1009/document.adoc @@ -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[] + diff --git a/sources/pm-1009/sections/00-foreword.adoc b/sources/pm-1009/sections/00-foreword.adoc new file mode 100644 index 0000000..305c1c0 --- /dev/null +++ b/sources/pm-1009/sections/00-foreword.adoc @@ -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. diff --git a/sources/pm-1009/sections/00-introduction.adoc b/sources/pm-1009/sections/00-introduction.adoc new file mode 100644 index 0000000..b3d9bb4 --- /dev/null +++ b/sources/pm-1009/sections/00-introduction.adoc @@ -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. diff --git a/sources/pm-1009/sections/01-scope.adoc b/sources/pm-1009/sections/01-scope.adoc new file mode 100644 index 0000000..0be3c80 --- /dev/null +++ b/sources/pm-1009/sections/01-scope.adoc @@ -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). diff --git a/sources/pm-1009/sections/02-normrefs.adoc b/sources/pm-1009/sections/02-normrefs.adoc new file mode 100644 index 0000000..c0cc074 --- /dev/null +++ b/sources/pm-1009/sections/02-normrefs.adoc @@ -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. diff --git a/sources/pm-1009/sections/03-terms.adoc b/sources/pm-1009/sections/03-terms.adoc new file mode 100644 index 0000000..0fc80c6 --- /dev/null +++ b/sources/pm-1009/sections/03-terms.adoc @@ -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 diff --git a/sources/pm-1009/sections/04-conventions.adoc b/sources/pm-1009/sections/04-conventions.adoc new file mode 100644 index 0000000..2c3dc4b --- /dev/null +++ b/sources/pm-1009/sections/04-conventions.adoc @@ -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. diff --git a/sources/pm-1009/sections/05-quantity-value.adoc b/sources/pm-1009/sections/05-quantity-value.adoc new file mode 100644 index 0000000..d1a6f8d --- /dev/null +++ b/sources/pm-1009/sections/05-quantity-value.adoc @@ -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. diff --git a/sources/pm-1009/sections/06-unit-expr.adoc b/sources/pm-1009/sections/06-unit-expr.adoc new file mode 100644 index 0000000..c9c6ffa --- /dev/null +++ b/sources/pm-1009/sections/06-unit-expr.adoc @@ -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. diff --git a/sources/pm-1009/sections/07-dimensions.adoc b/sources/pm-1009/sections/07-dimensions.adoc new file mode 100644 index 0000000..5065ebb --- /dev/null +++ b/sources/pm-1009/sections/07-dimensions.adoc @@ -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. diff --git a/sources/pm-1009/sections/08-conversion.adoc b/sources/pm-1009/sections/08-conversion.adoc new file mode 100644 index 0000000..a64d2a3 --- /dev/null +++ b/sources/pm-1009/sections/08-conversion.adoc @@ -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. diff --git a/sources/pm-1009/sections/09-errors.adoc b/sources/pm-1009/sections/09-errors.adoc new file mode 100644 index 0000000..e7fae28 --- /dev/null +++ b/sources/pm-1009/sections/09-errors.adoc @@ -0,0 +1,22 @@ + == The typed errors + + === The diagnostics as data + + The quantity algebra's failures are diagnostic values, constructed with their identifying data and carried like results. At the evaluation boundary (PM 1011) they raise as the corresponding typed errors; in construction and reduction they are the returned diagnostic. There is no silent wrong answer. + + === The errors + +.The quantity errors +[cols="2,4", options="headers"] +|=== +|Error |Carries + +|`DimensionMismatch` |`expected`, `got` — the two dimension vectors +|`UnitNotConvertible` |`from`, `to` — the two unit expressions +|`UnknownUnit` |`code` — the unregistered symbol +|`AffineUnitInAlgebra` |`unit`, `operation` — the affine unit and the operation refused +|=== + + === The corpus + + The corpus carries one vector per error per constructible site: construction, reduction, comparison, conversion and (in PM 1011) evaluation. The diagnostic's carried data is asserted in the vector, not just its class. diff --git a/sources/pm-1009/sections/10-conformance.adoc b/sources/pm-1009/sections/10-conformance.adoc new file mode 100644 index 0000000..d51dade --- /dev/null +++ b/sources/pm-1009/sections/10-conformance.adoc @@ -0,0 +1,13 @@ +== Conformance + +=== The conformance class + +An implementation conforms to this document when it constructs, reduces, compares and converts quantity values exactly as clauses 5 to 8 state, produces the typed errors of clause 9 with their carried data, and replays the corpus vectors of this document identically. + +=== The acceptance vectors + +* `kV·A` reduces to the power dimension at the kilo scale; +* `3 km` compares to `2500 m` after conversion, exactly; +* `3 m` and `2 s` refuse with `DimensionMismatch` carrying both vectors; +* the affine traps (difference vs absolute) return the stated answers, and the corpus pins them; +* an unregistered symbol refuses with `UnknownUnit` naming the code. diff --git a/sources/pm-1009/sections/90-annex-a.adoc b/sources/pm-1009/sections/90-annex-a.adoc new file mode 100644 index 0000000..eea2343 --- /dev/null +++ b/sources/pm-1009/sections/90-annex-a.adoc @@ -0,0 +1,17 @@ +== Annex A: the dimension table + +The SI base dimensions and the derived dimensions this document's corpus exercises: + +|=== +|Dimension |Vector entry |Coherent unit + +|length |L |m +|mass |M |kg +|time |T |s +|electric current |I |A +|thermodynamic temperature |Θ |K +|amount of substance |N |mol +|luminous intensity |J |cd +|=== + +Derived units reduce: `V` to `kg·m^2·s^−3·A^−1`; `W` to `kg·m^2·s^−3`; `N` to `kg·m·s^−2`; `Hz` to `s^−1`. diff --git a/sources/pm-1009/sections/91-annex-b.adoc b/sources/pm-1009/sections/91-annex-b.adoc new file mode 100644 index 0000000..2b097f4 --- /dev/null +++ b/sources/pm-1009/sections/91-annex-b.adoc @@ -0,0 +1,9 @@ +== Annex B: the authority codes + +Every unit symbol in the corpus carries its UnitsML authority code. The mapping is data in the register; this annex records the mapping's shape: + +* the symbol (`kV`), the scale (`kilo`), the base (`V`), and the code (`unitsml(V)`); +* the reduction the register carries (the dimension contribution and the factor); +* the authority reference the corpus asserts. + +An implementation that resolves a symbol the register does not carry refuses with `UnknownUnit`; it does not guess spellings. diff --git a/sources/pm-1009/sections/92-annex-c.adoc b/sources/pm-1009/sections/92-annex-c.adoc new file mode 100644 index 0000000..802045b --- /dev/null +++ b/sources/pm-1009/sections/92-annex-c.adoc @@ -0,0 +1,9 @@ +== Annex C: test-suite examples + +Each row is one corpus vector with its expected outcome frozen; the corpus is the checkable form and this annex is its reading guide. + +* *Construction and refusal.* a quantity constructs from a number and a registered unit; an unregistered symbol constructs the `UnknownUnit` diagnostic with the code carried. +* *Reduction.* `kV·A`, `mm·kN` and `V/Hz` reduce to their canonical pairs; the reductions are stated in the corpus with the vectors. +* *Comparison.* same-dimension comparison converts the smaller scale first; cross-dimension comparison refuses with `DimensionMismatch`. +* *Conversion.* factor conversions of exact operands are exact; affine conversions apply the offset to the value and never to the difference; both traps carry corpus vectors. +* *The uncertainty field.* a quantity with a PM 1002 uncertainty node carries the node unchanged — no normalisation, no recomputation; the unit-dimension equality of the uncertainty is checked and refused otherwise. diff --git a/sources/pm-1009/sections/98-bibliography.adoc b/sources/pm-1009/sections/98-bibliography.adoc new file mode 100644 index 0000000..fc6381b --- /dev/null +++ b/sources/pm-1009/sections/98-bibliography.adoc @@ -0,0 +1,7 @@ +[bibliography] +== Bibliography + +* [[[ref-pm-1001-pm-1003-of-this-series,nofetch(*PM 1001, PM 1003 of this series*)]]] — *PM 1001, PM 1003 of this series* +* [[[ref-calconnect-36812-36819-the-unitsml-serie,nofetch(CalConnect 36812–36819)]]] — CalConnect 36812–36819 — the UnitsML series of which 36813 is the numeric contract +* [[[ref-jcgm-100-2008-evaluation-of-measurement,nofetch(JCGM 100:2008)]]] — JCGM 100:2008 — Evaluation of measurement data — Guide to the expression of uncertainty in measurement +* [[[ref-the-si-brochure-bipm-the-definitions-of,nofetch(The SI Brochure, BIPM)]]] — The SI Brochure, BIPM — the definitions of the base units diff --git a/sources/pm-1010/document.adoc b/sources/pm-1010/document.adoc new file mode 100644 index 0000000..95b1715 --- /dev/null +++ b/sources/pm-1010/document.adoc @@ -0,0 +1,58 @@ += The expression language +:docnumber: 1010 +:edition: 1 +:ref-docnumber: PM 1010:2026(E) +:copyright-year: 2026 +:revdate: 2026-11-12 +:language: en +:script: Latn +:title: Plurimath specifications -- The expression language +:title-fr: Spécifications Plurimath -- Le langage d'expressions +: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-language.adoc[] + +include::sections/06-grammar-parg.adoc[] + +include::sections/07-precedence.adoc[] + +include::sections/08-types.adoc[] + +include::sections/09-round-trip.adoc[] + +include::sections/10-conformance.adoc[] + +include::sections/90-annex-a.adoc[] + +include::sections/91-annex-b.adoc[] + +include::sections/98-bibliography.adoc[] + diff --git a/sources/pm-1010/sections/00-foreword.adoc b/sources/pm-1010/sections/00-foreword.adoc new file mode 100644 index 0000000..3fc3e7e --- /dev/null +++ b/sources/pm-1010/sections/00-foreword.adoc @@ -0,0 +1,29 @@ +== Foreword + +=== General + +This document is the tenth document of the Plurimath specifications series. It specifies the expression language: one closed grammar — arithmetic, comparisons, boolean logic with implication, conditionals, iteration and aggregates — compiled through the PARG toolchain into one checksummed artifact per runtime, parsing to one typed AST that renders back to every notation format the series carries. + +The grammar extends the arithmetic precedence chain of PM 1004 with the logical levels above comparison, and carries the quantity types of PM 1009 as its operand types. It is the grammar the mandate names `expressions.parg`: one source, every runtime, no hand-written precedence climbing. + +=== 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 |Quantities, units, dimensions, typed errors +|1010 |Expression language |This document: the closed grammar and the 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. diff --git a/sources/pm-1010/sections/00-introduction.adoc b/sources/pm-1010/sections/00-introduction.adoc new file mode 100644 index 0000000..ba56d2e --- /dev/null +++ b/sources/pm-1010/sections/00-introduction.adoc @@ -0,0 +1,16 @@ +== Introduction + +An expression language that a metrology document can embed has two obligations that general expression languages do not: it must be *closed* — every construct stated, every operator's types and errors stated, nothing implied — and it must be *preserving* — `2.10` is not `2.1`, a quoted unit reads back as a quoted unit, and an expression renders back to every notation format without drift. + +The grammar is written once, in PARG, and compiled: the Ruby runtime, the TypeScript runtime and the wasm runtime parse the same artifact, so acceptance cannot diverge between them. The typed AST carries the accuracy classes of PM 1004 and the quantity types of PM 1009, and the static type-check reports scale and dimension violations before any evaluation runs. + +[example] +The expression `2.10`. +*Expected outcome.* parsed as the exact decimal `2.10` — the trailing zero is preserved as part of the value's statement, per the exact-decimal discipline; the expression does not parse to `2.1`. + +=== The design forces + +* *One grammar, every runtime.* The PARG artifact is the acceptance; no target hand-writes the precedence climbing. +* *Closed.* Every operator, literal and error stated here; a construct outside this document is refused by name. +* *Preserving.* Exact decimals, quoted units and uncertainty markers round-trip. +* *Typed before run.* The static check reports the scale and dimension violations first; evaluation then never sees an incoherent tree. diff --git a/sources/pm-1010/sections/01-scope.adoc b/sources/pm-1010/sections/01-scope.adoc new file mode 100644 index 0000000..bc22fa4 --- /dev/null +++ b/sources/pm-1010/sections/01-scope.adoc @@ -0,0 +1,15 @@ +== Scope + +This document specifies: + +* the closed grammar: the constructs, their precedence chain, and their argument and result types; +* the PARG artifact discipline: one grammar source, checksummed artifacts per runtime, and the conformance suites over the same artifact; +* the typed AST and the static type-check that reports quantity violations before evaluation; +* the exact-decimal literal preservation and the undefined-aware literal; +* the round-trip contract: parse → render identity over the corpus for every notation format. + +This document does not specify: + +* evaluation semantics (PM 1011) — the AST type-checks here, evaluates there; +* the constraint and decision-rule layer (PM 1012); +* the serialized request surface (PM 1013). diff --git a/sources/pm-1010/sections/02-normrefs.adoc b/sources/pm-1010/sections/02-normrefs.adoc new file mode 100644 index 0000000..22327bc --- /dev/null +++ b/sources/pm-1010/sections/02-normrefs.adoc @@ -0,0 +1,8 @@ +[bibliography] +== Normative references + +* [[[pm1001,nofetch(PM 1001 (math model))]]] of this series — the formula tree the AST renders to. +* [[[pm1004,nofetch(PM 1004 (evaluation))]]] of this series — the accuracy classes and the arithmetic contract the types carry. +* [[[pm1009,nofetch(PM 1009 (quantity type system))]]] of this series — the operand types the operators consume. +* [[[parsanol,nofetch(Parsanol)]]] — the PARG grammar language and toolchain compiling this document's grammar. +* [[[cc36813,nofetch(CalConnect 36813 (numeric contract))]]] of the UnitsML series — the exact-decimal discipline the literals preserve. diff --git a/sources/pm-1010/sections/03-terms.adoc b/sources/pm-1010/sections/03-terms.adoc new file mode 100644 index 0000000..a3db3b5 --- /dev/null +++ b/sources/pm-1010/sections/03-terms.adoc @@ -0,0 +1,24 @@ +== Terms and definitions + +For the purposes of this document, the following terms and definitions apply. + +=== expression language +the closed grammar of this document: its constructs, types and errors, stated completely + +=== grammar artifact +the checksummed compiled output of the PARG grammar for one runtime + +=== typed AST +the parse result: a tree whose nodes carry their constructs and their static types + +=== static type-check +the pass that reports scale and dimension violations before evaluation + +=== exact-decimal literal +a decimal literal whose trailing digits are preserved as stated (`2.10`) + +=== undefined-aware literal +the literal form for an explicitly undefined value, distinct from zero and from an error + +=== round trip +parse → render → parse: the property that rendering an AST to a notation format and re-parsing yields an equal AST diff --git a/sources/pm-1010/sections/04-conventions.adoc b/sources/pm-1010/sections/04-conventions.adoc new file mode 100644 index 0000000..30cafae --- /dev/null +++ b/sources/pm-1010/sections/04-conventions.adoc @@ -0,0 +1,9 @@ +== Conventions + +=== General + +Expressions are written in the ordinary notation: `x^2 + 1`, `(a and b) implies c`, `mean_of(series)`. The operator table of Annex A states every operator with its argument types, result type, precedence level and error behaviour. + +=== Examples + +Examples carry an *Expected outcome* paragraph stating the parse, the type-check result, or the round-trip outcome. Grammar excerpts are in PARG form as compiled. diff --git a/sources/pm-1010/sections/05-language.adoc b/sources/pm-1010/sections/05-language.adoc new file mode 100644 index 0000000..d623009 --- /dev/null +++ b/sources/pm-1010/sections/05-language.adoc @@ -0,0 +1,26 @@ +== The constructs + +=== The surface + +The language states exactly these constructs: + +* the literals: exact-decimal numbers, booleans, the undefined-aware literal, quoted unit and string forms; +* the bound names; +* the arithmetic operators over quantities and numbers; +* the comparisons and the boolean operators `and`, `or`, `xor`, `implies`; +* the conditional; +* the iteration over declared ranges with explicit iterators; +* the aggregate functions and the series access of PM 1011; +* the parenthesised group. + +Nothing else parses. A construct outside this list is refused by name — the parser states the nearest accepted construct, not a bare offset. + +=== The literals + +* an exact-decimal literal preserves its written digits: `2.10` parses to a value whose statement carries the trailing zero, and rendering back writes `2.10`; +* the undefined-aware literal parses to the undefined value — distinct from zero, distinct from any error, and refused by every arithmetic operator with the typed error of clause 8; +* quoted forms (`"kg"`, `"µm"`) parse as the quoted content — the unit and string channel of PM 1003. + +=== The conditionals and iteration + +The conditional evaluates its condition's boolean type statically; a non-boolean condition is a static type error. The iteration binds its iterator explicitly for its body's extent; the aggregate functions consume the series of PM 1011 and refuse non-series operands statically. diff --git a/sources/pm-1010/sections/06-grammar-parg.adoc b/sources/pm-1010/sections/06-grammar-parg.adoc new file mode 100644 index 0000000..b7bcee7 --- /dev/null +++ b/sources/pm-1010/sections/06-grammar-parg.adoc @@ -0,0 +1,13 @@ +== The grammar artifact + +=== One source + +The grammar is one PARG source (`expressions.parg`). Parsanol compiles it to one artifact per runtime — ruby, rs, wasm/ts — each checksummed, in the amath artifact discipline. The artifact is the acceptance: two runtimes accept exactly what the artifact accepts. + +=== The suites + +The `.pgtest` suites ride the same artifact: source, AST and result per case, replayed by every runtime. A runtime whose replay drifts from the artifact's AST is non-conforming — the suite is the cross-implementation normative gate, and no implementation hand-writes the precedence climbing. + +=== The checksums + +The artifact checksums are published with the artifact. A consumer pins the checksum; a changed checksum is a changed grammar — a new edition of this document, not a silent update. diff --git a/sources/pm-1010/sections/07-precedence.adoc b/sources/pm-1010/sections/07-precedence.adoc new file mode 100644 index 0000000..f869291 --- /dev/null +++ b/sources/pm-1010/sections/07-precedence.adoc @@ -0,0 +1,28 @@ + == The precedence chain + + === The full chain + + The grammar states one precedence chain, extending PM 1004's arithmetic chain upward with the logical levels: + +.The precedence chain of the expression language +[cols="1,4", options="headers"] +|=== +|Level |Constructs + +|implies +|or +|xor +|and +|comparison (`<=`, `>=`, `<`, `>`, `=`, `≠`) +|additive (`+`, `−`) +|multiplicative (implicit products, `/`, `mod`) +|unary (negation, positive sign) +|power (`^`, right-associative) +|operand (literals, names, calls, groups) +|=== + + Each level parses the next as its operand; every level except the power folds left-associatively. The chain is the superset of PM 1004's: an expression PM 1004 accepts parses to the same arithmetic tree here, and the logical levels above it extend, never reorder. + + [example] + `a <= b and c < d implies ok`. + *Expected outcome.* parsed as `(a <= b) and (c < d)` implies `ok` — the comparison binds tighter than `and`, and `implies` binds loosest, right-associatively. diff --git a/sources/pm-1010/sections/08-types.adoc b/sources/pm-1010/sections/08-types.adoc new file mode 100644 index 0000000..4b34b9b --- /dev/null +++ b/sources/pm-1010/sections/08-types.adoc @@ -0,0 +1,13 @@ +== The static type-check + +=== The pass + +The type-check walks the AST before evaluation: every operator's argument types and result type are stated in the operator table (Annex A), and a violation — a scale mismatch, a dimension mismatch, a non-boolean condition, a non-series aggregate operand — is reported as a static diagnostic carrying the node and the expected types. + +=== The delegation + +Quantity-typed operations delegate to the quantity algebra of PM 1009 — the host adds no arithmetic of its own. The static check calls the same reduction and coherence rules; a violation found statically is the same diagnostic the evaluation would construct, found earlier. + +=== The guarantee + +An AST that passes the static check evaluates without dimension or scale refusals: the dynamic refusals of PM 1011 are the runtime's restatements of static truths, and the corpus carries each static diagnostic as a vector alongside its dynamic counterpart. diff --git a/sources/pm-1010/sections/09-round-trip.adoc b/sources/pm-1010/sections/09-round-trip.adoc new file mode 100644 index 0000000..e8d4133 --- /dev/null +++ b/sources/pm-1010/sections/09-round-trip.adoc @@ -0,0 +1,13 @@ +== The round-trip contract + +=== Parse, render, parse + +Rendering the typed AST to any notation format and re-parsing the render yields an AST equal to the original, for every expression in the corpus. The round-trip is the preservation contract: exact decimals, quoted units, uncertainty markers and the undefined literal survive every format the series carries. + +=== The lossy formats, stated + +Where a notation cannot carry a construct, the render states the loss (the format's interface document of PM 1003 carries the per-format statements); the round-trip claim applies to the formats that carry the construct, and the corpus marks each vector with the formats it round-trips. + +[example] +`2.10 + x` rendered to the formats and re-parsed. +*Expected outcome.* the trailing zero survives the render and the re-parse in every round-tripping format; the corpus asserts the AST equality per format. diff --git a/sources/pm-1010/sections/10-conformance.adoc b/sources/pm-1010/sections/10-conformance.adoc new file mode 100644 index 0000000..c374faa --- /dev/null +++ b/sources/pm-1010/sections/10-conformance.adoc @@ -0,0 +1,12 @@ +== Conformance + +=== The conformance class + +An implementation conforms to this document when it parses exactly the constructs of clause 5 through a checksummed artifact of the PARG grammar, states the precedence chain of clause 7 unchanged, reports the static diagnostics of clause 8 with their carried data, and satisfies the round-trip contract of clause 9 over the corpus. + +=== The acceptance vectors + +* the exact-decimal, quoted-unit and undefined literals parse and round-trip per clause 5; +* the precedence chain parses the Annex A examples to the stated trees; +* every static diagnostic of the corpus carries the node and the expected types; +* the artifact checksums match the published artifacts, per runtime. diff --git a/sources/pm-1010/sections/90-annex-a.adoc b/sources/pm-1010/sections/90-annex-a.adoc new file mode 100644 index 0000000..e5c03ad --- /dev/null +++ b/sources/pm-1010/sections/90-annex-a.adoc @@ -0,0 +1,20 @@ +== Annex A: the operator table + +Every operator, its argument types, result type, precedence level and error behaviour. The table is normative; the grammar artifact compiles it. + +[cols="2,3,2,2,3", options="headers"] +|=== +|Operator |Argument types |Result |Level |Error behaviour + +|`+`, `−` |quantity/quantity, same dimension |quantity, unit per the algebra |additive |`DimensionMismatch` +|`*`, `/` |quantity/quantity, affine excluded |quantity |multiplicative |`AffineUnitInAlgebra` +|`mod` |quantity/quantity, same dimension |quantity, the dividend's unit |multiplicative |`DivisionByZero`, `DimensionMismatch` +|`^` |quantity, integer |quantity, power of the unit |power |`MathDomain` per PM 1004 +|comparisons |quantity/quantity, same dimension |boolean |comparison |`DimensionMismatch` +|`and`, `or`, `xor` |boolean/boolean |boolean |the logical levels |static type error on non-boolean +|`implies` |boolean/boolean |boolean |implies |static type error on non-boolean +|conditional |boolean, T, T |T |— |static type error on non-boolean +|aggregates |series |per PM 1011 |operand |`NotASeries` +|=== + +The undefined literal is refused by every operator with `UndefinedOperand` — the value exists to be tested, not computed with. diff --git a/sources/pm-1010/sections/91-annex-b.adoc b/sources/pm-1010/sections/91-annex-b.adoc new file mode 100644 index 0000000..f05eef4 --- /dev/null +++ b/sources/pm-1010/sections/91-annex-b.adoc @@ -0,0 +1,5 @@ +== Annex B: the pgtest form + +A `.pgtest` case is the triple: the source, the artifact's AST, and the result where the case evaluates. The suites ride the grammar artifact; a runtime replays the triple or refuses. + +The form is data: the source as written, the AST as the artifact's parse states it, the result as PM 1011's evaluation states it — three fields, each checksummed with the artifact version. A case that refuses carries the diagnostic in the third field; refusals replay exactly like results. diff --git a/sources/pm-1010/sections/98-bibliography.adoc b/sources/pm-1010/sections/98-bibliography.adoc new file mode 100644 index 0000000..b49f987 --- /dev/null +++ b/sources/pm-1010/sections/98-bibliography.adoc @@ -0,0 +1,6 @@ +[bibliography] +== Bibliography + +* [[[ref-pm-1004-of-this-series-the-arithmetic-c,nofetch(*PM 1004 of this series*)]]] — *PM 1004 of this series* — the arithmetic chain this grammar extends +* [[[ref-parsanol-ruby-the-parg-toolchain-and-the,nofetch(parsanol-ruby)]]] — parsanol-ruby — the PARG toolchain and the artifact discipline +* [[[ref-calconnect-36813-the-exact-decimal-disci,nofetch(CalConnect 36813)]]] — CalConnect 36813 — the exact-decimal discipline the literals preserve diff --git a/sources/pm-1011/document.adoc b/sources/pm-1011/document.adoc new file mode 100644 index 0000000..868f3a2 --- /dev/null +++ b/sources/pm-1011/document.adoc @@ -0,0 +1,60 @@ += Evaluation processing +:docnumber: 1011 +:edition: 1 +:ref-docnumber: PM 1011:2026(E) +:copyright-year: 2026 +:revdate: 2026-11-12 +:language: en +:script: Latn +:title: Plurimath specifications -- Evaluation processing +:title-fr: Spécifications Plurimath -- Traitement de l'évaluation +: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-evaluation-extension.adoc[] + +include::sections/06-propagation.adoc[] + +include::sections/07-second-order.adoc[] + +include::sections/08-series.adoc[] + +include::sections/09-errors.adoc[] + +include::sections/10-interface.adoc[] + +include::sections/11-conformance.adoc[] + +include::sections/90-annex-a.adoc[] + +include::sections/91-annex-b.adoc[] + +include::sections/98-bibliography.adoc[] + diff --git a/sources/pm-1011/sections/00-foreword.adoc b/sources/pm-1011/sections/00-foreword.adoc new file mode 100644 index 0000000..31af75b --- /dev/null +++ b/sources/pm-1011/sections/00-foreword.adoc @@ -0,0 +1,29 @@ +== Foreword + +=== General + +This document is the eleventh document of the Plurimath specifications series. It specifies evaluation processing: the unit-aware evaluation of quantity-typed trees, the propagation of uncertainty under GUM, the series aggregations that close the type-A loop, the second-order modes the 2026 amendment introduces, and the error extensions that carry the new refusals. + +This document extends PM 1004 and subsumes it: every contract PM 1004 states — the strict error contract, the determinism, the untouched tree, the accuracy classes — holds here unchanged for the arithmetic core, and the extensions below state what PM 1004's clause 6 refusal reserved for this edition: the evaluation of uncertainty nodes and of quantities. + +=== 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 |Quantities, units, dimensions, typed errors +|1010 |Expression language |The closed expression grammar and the typed AST +|1011 |Evaluation processing |This document: the semantic evaluation +|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. diff --git a/sources/pm-1011/sections/00-introduction.adoc b/sources/pm-1011/sections/00-introduction.adoc new file mode 100644 index 0000000..eed7ede --- /dev/null +++ b/sources/pm-1011/sections/00-introduction.adoc @@ -0,0 +1,14 @@ +== Introduction + +PM 1004 built the evaluator and stated, in its clause 6, what it refuses: an uncertainty node makes the whole evaluation raise `UnsupportedExpressionError`. That refusal was the contract of an arithmetic evaluator. This document lifts it — with the semantics the refusal reserved — and adds what the semantic tree needs around it: quantities as operands, uncertainty propagation under GUM, the series that feed the type-A statistics, and the second-order modes the 2026 amendment introduces. + +=== The precedents and the divergences + +The design descends from the systems that evaluate with uncertainty and units. Wolfram's `Around` propagates first-order through arithmetic and displays ± — the presentation and the first-order law are the same here, per clause 6. Python's `uncertainties` and Julia's `Measurements` carry first-order linear propagation through operator overloading — the same linear law with the correlation term omitted, which this document states explicitly and treats as an extension (clause 6.4). MATLAB evaluates on platform doubles and lets `NaN` and `Inf` propagate silently — this document states the divergence deliberately: the strict contract of PM 1004 holds, and no non-finite value leaks (clause 5). Where the systems answer with messages, this document answers with typed diagnostics; the corpus pins each. + +=== The design forces + +* *The strict contract travels.* Quantities, propagation and series follow PM 1004's error discipline: total, typed, deterministic, replayable. +* *The units decide.* Coherence per PM 1009 precedes every numeric fold; the unit algebra supplies the derived units the results carry. +* *The amendment is first-class.* The LPU-adequacy verdict and the second-order mode are results and modes, not warnings. +* *The series close the loop.* Type-A uncertainty computes from the series of PM 1011's clause 8, and the corpus pins the loop end to end. diff --git a/sources/pm-1011/sections/01-scope.adoc b/sources/pm-1011/sections/01-scope.adoc new file mode 100644 index 0000000..93c68fe --- /dev/null +++ b/sources/pm-1011/sections/01-scope.adoc @@ -0,0 +1,16 @@ +== Scope + +This document specifies: + +* the extension of the evaluation to quantity operands: the binding domain, the lifted uncertainty-node evaluation, and the extended precedence chain; +* the propagation of uncertainty under GUM: the standard law, the correlation terms, the coverage factor and the expanded uncertainty; +* the LPU-adequacy verdict and the second-order mode (GUF₂), gated and refused as stated; +* the series value and its aggregations, and the type-A derivation from series to standard uncertainty; +* the error extensions, and the serialized evaluation interface with its parity contract. + +This document does not specify: + +* symbolic algebra — the evaluation is over bound scopes only; +* Bayesian machinery — the MCM of JCGM 101 is referenced as the fallback the verdicts name, not specified; +* the constraint and decision-rule layer (PM 1012); +* the exact-decimal data contract (CalConnect 36813) — the numbers carry PM 1004's accuracy classes under it. diff --git a/sources/pm-1011/sections/02-normrefs.adoc b/sources/pm-1011/sections/02-normrefs.adoc new file mode 100644 index 0000000..5e59259 --- /dev/null +++ b/sources/pm-1011/sections/02-normrefs.adoc @@ -0,0 +1,14 @@ +[bibliography] +== Normative references + +* [[[pm1001,nofetch(PM 1001 (math model))]]] of this series — the formula tree. +* [[[pm1002,nofetch(PM 1002 (uncertainty model))]]] of this series — the uncertainty nodes this document evaluates. +* [[[pm1004,nofetch(PM 1004 (evaluation))]]] of this series — the arithmetic evaluator this document extends; its contracts hold. +* [[[pm1009,nofetch(PM 1009 (quantity type system))]]] of this series — the quantity types, the unit algebra, the coherence checks. +* [[[pm1010,nofetch(PM 1010 (expression language))]]] of this series — the grammar and the typed AST. +* [[[jcgm100,nofetch(JCGM 100:2008 (GUM))]]] — the propagation law, the type A and B evaluations. +* [[[jcgm100amd1,nofetch(JCGM 100:2008/Amd.1:2026)]]] — the nonlinearity note, the second-order terms, the H.1.7 rewrite. +* [[[jcgm101,nofetch(JCGM 101 (MCM))]]] — the Monte Carlo fallback the verdicts name. +* [[[jcgm106,nofetch(JCGM 106)]]] — the decision-rule framing PM 1012 builds on. +* [[[gum6,nofetch(GUM-6:2020)]]] — the LPU-adequacy check (Annex F) and the GUF₂ terminology. +* [[[cc36813,nofetch(CalConnect 36813 (numeric contract))]]] of the UnitsML series — the exact-decimal discipline of the data. diff --git a/sources/pm-1011/sections/03-terms.adoc b/sources/pm-1011/sections/03-terms.adoc new file mode 100644 index 0000000..5c96960 --- /dev/null +++ b/sources/pm-1011/sections/03-terms.adoc @@ -0,0 +1,24 @@ +== Terms and definitions + +For the purposes of this document, the terms and definitions of PM 1004 apply, and the following apply. + +=== quantity evaluation +an evaluation whose operands and results are quantity values of PM 1009 + +=== sensitivity coefficient +the partial derivative of the evaluated expression with respect to one input quantity, evaluated at the bound point + +=== combined standard uncertainty +the standard uncertainty of the result, propagated from the input components under clause 6 + +=== LPU-adequacy verdict +the first-class result stating whether the law of propagation of uncertainty is validated for the evaluation, or that MCM must be used instead + +=== GUF₂ mode +the second-order evaluation mode: the corrected estimate and the second-order correction to the combined standard uncertainty, for declared-normal inputs + +=== series +the ordered quantity values with an optional index axis, per clause 8 + +=== serialized evaluation +the pure-function interface of clause 10: the request in, the response out, no environment diff --git a/sources/pm-1011/sections/04-conventions.adoc b/sources/pm-1011/sections/04-conventions.adoc new file mode 100644 index 0000000..e190b4f --- /dev/null +++ b/sources/pm-1011/sections/04-conventions.adoc @@ -0,0 +1,9 @@ +== Conventions + +=== General + +Evaluations are written as: tree, bindings, result — as in PM 1004, extended by the types of PM 1009. Propagations are written as: expression, input quantities with their uncertainties, result with its combined uncertainty and its verdict. Errors are written as their class names of clause 9 with the identifying data. + +=== Examples + +Examples carry an *Expected outcome* paragraph stating the quantities yielded, the propagated uncertainty, the verdict, or the error raised. Numbers are exact where they are exact; the uncertainty values carry their stated decimals unchanged. diff --git a/sources/pm-1011/sections/05-evaluation-extension.adoc b/sources/pm-1011/sections/05-evaluation-extension.adoc new file mode 100644 index 0000000..dadb32f --- /dev/null +++ b/sources/pm-1011/sections/05-evaluation-extension.adoc @@ -0,0 +1,21 @@ +== The evaluation, extended + +=== The binding domain, extended + +PM 1004 binds names to real numbers. This document extends the binding values to the quantity values of PM 1009, the booleans, and the series of clause 8 — and the binding validation extends with them, per PM 1004's entry-validation discipline: a value outside the stated types raises `InvalidBindingError` carrying the key and the value, before the tree is walked. + +[example] +Binding `V → 1,2 V` (a quantity with a standard uncertainty) and `series → 5 observations`. +*Expected outcome.* accepted; the names bind the quantity and the series. + +=== The uncertainty node evaluates + +PM 1004's clause 6 refusal — an uncertainty node raises `UnsupportedExpressionError` — is lifted by this document. The evaluation of an uncertainty node yields its quantity per PM 1009: the node's category, fields and exact decimals as PM 1002 states them, carried unchanged. The *propagation* of uncertainties through operations is clause 6. + +=== The precedence chain, extended + +The evaluation follows the grammar's chain of PM 1010: the logical levels above the comparison level PM 1004 pins. The arithmetic core folds as PM 1004 states; the logical operators evaluate per their truth tables over the booleans; the conditional evaluates its condition and exactly one branch. + +=== What is still refused + +A `Text` node, a matrix, and every construct outside PM 1010's grammar still raise `UnsupportedExpressionError`. The refusal shrinks to exactly what remains undefined; it does not disappear. diff --git a/sources/pm-1011/sections/06-propagation.adoc b/sources/pm-1011/sections/06-propagation.adoc new file mode 100644 index 0000000..31020a4 --- /dev/null +++ b/sources/pm-1011/sections/06-propagation.adoc @@ -0,0 +1,29 @@ +== The propagation of uncertainty + +=== The law + +For an expression f over the input quantities xᵢ, each carrying a standard uncertainty uᵢ, the combined standard uncertainty of the result is + +`u_c = √( Σᵢ (∂f/∂xᵢ · uᵢ)² + 2 Σᵢ<ⱼ (∂f/∂xᵢ)(∂f/∂xⱼ) u(xᵢ,xⱼ) )` + +— the partials evaluated symbolically over the expression tree or numerically at the bound point, per the stated mode. The independence term is the first sum; the correlation term is stated and carried per clause 6.4. + +=== The inputs + +The input uncertainties arrive as PM 1002 nodes or as the declared components of the serialized request (PM 1013): the standard uncertainty, or the distribution and its parameters for a type B input (rectangular, triangular, normal, U-shaped — the division per R-C2, never inferred from notation per #524), or the series for a type A input (clause 8). The type B standard uncertainty is the distribution's standard uncertainty: `a/√3` rectangular, `a/√6` triangular, per the stated forms of JCGM 100 §4.3. + +=== The degrees of freedom and the coverage factor + +The effective degrees of freedom follow Welch–Satterthwaite over the type A components and the stated dof of the type B components. The coverage factor k is taken from the stated coverage probability and the effective dof; where the probability is not stated, k defaults to 2 and the default is recorded in the result. The expanded uncertainty is `U = k·u_c`. + +=== The result + +The propagated result is a quantity value per PM 1009 carrying the standard uncertainty as a PM 1002 standard-category node, and the expanded form as the stated expanded-category node where k is stated — the categories and their encodings are PM 1002's, unchanged. + +[example] +The GUM budget: the result of an expression over the input quantities with their standard uncertainties. +*Expected outcome.* the propagated quantity: the value per the arithmetic, the combined standard uncertainty per the law, the dimension per the unit algebra — and the verdict of clause 7 attached. + +=== The presentation + +The propagated result renders with its uncertainty through the existing renderers — the `1,15 ± 0,06 V` form — per the rendering surfaces of PM 1003. The rendering adds no rounding: the stated decimals render as stated. diff --git a/sources/pm-1011/sections/07-second-order.adoc b/sources/pm-1011/sections/07-second-order.adoc new file mode 100644 index 0000000..034c2ab --- /dev/null +++ b/sources/pm-1011/sections/07-second-order.adoc @@ -0,0 +1,21 @@ +== The verdict and the second-order mode + +=== The LPU-adequacy verdict + +Every propagation carries a verdict: the law of propagation of uncertainty is adequate for the evaluation, or it is not. The adequacy check is the comparison of the first-order result against a reference — the 2N-point comparison of GUM-6:2020 Annex F, or the MCM validation of JCGM 101 §7.9.5, per the stated mode. Where the check fails, the verdict is `LPU not validated; use MCM` — carried as the result, and the wrong first-order number is not presented as an answer. + +=== The nonlinearity gate + +Per JCGM 100:2008/Amd.1:2026, 4.1.4 NOTE 1: where the nonlinearity of f is significant, the evaluation applies MCM or includes the higher-order terms. The gate is declared: the input normality declarations of the request, checked per clause 6's input forms. + +=== The GUF₂ mode + +The second-order mode (GUF₂ per GUM-5:2026 Example 7): the corrected estimate — the first-order estimate plus the correction `(1/2) Σᵢ (∂²f/∂xᵢ²) u²(xᵢ)` — and the second-order correction to the combined uncertainty squared, per the note to 5.1.2 applied to the expression. The mode is available for **declared-normal inputs only**; the Hessian terms require the second derivatives over the tree. Non-normal inputs refuse the mode with `InputNotNormal` and the verdict names MCM. + +[example] +The H.1.7-class evaluation under GUF₂. +*Expected outcome.* the corrected estimate with the second-order terms stated, and the combined uncertainty carrying both orders — per the derivation the corpus documents. + +=== The MCM boundary + +MCM itself is not specified here — JCGM 101 is the reference. The boundary is stated: the request names MCM, the evaluator refuses the analytic modes and reports the verdict; the Monte Carlo run is the caller's, and its summary returns as the result's uncertainty per PM 1002's encodings. diff --git a/sources/pm-1011/sections/08-series.adoc b/sources/pm-1011/sections/08-series.adoc new file mode 100644 index 0000000..b15e8be --- /dev/null +++ b/sources/pm-1011/sections/08-series.adoc @@ -0,0 +1,17 @@ +== The series and the aggregations + +=== The series value + +A series is the ordered quantity values with an optional index axis (the time, the position, the temperature) and one unit. Every element carries the unit; a mixed-unit series is a construction refusal per PM 1009's coherence. + +=== The aggregations + +The aggregations over a series: `count_of`, `min_of`, `max_of`, `mean_of`, `stddev_of`, and the index access `series.at(t)` with the predicate slice. The statistics follow JCGM 100 §4.2.3: the experimental standard deviation is the n−1 form, and `mean_of` carries the series' unit. + +=== The type-A loop + +The type A standard uncertainty derives from the series: the experimental standard deviation of the mean, `s/√n`, as a PM 1002 standard-category uncertainty at the series' unit. The loop closes in the corpus: a series, its type A uncertainty, and a propagation through the expression — one vector, end to end. + +[example] +`stddev_of(series)` and the type A standard uncertainty of `mean_of(series)`. +*Expected outcome.* the experimental standard deviation per JCGM 100 §4.2.3, and the standard uncertainty `s/√n` — both at the series' unit, both with their accuracy classes per PM 1004. diff --git a/sources/pm-1011/sections/09-errors.adoc b/sources/pm-1011/sections/09-errors.adoc new file mode 100644 index 0000000..6fb64d0 --- /dev/null +++ b/sources/pm-1011/sections/09-errors.adoc @@ -0,0 +1,26 @@ + == The error extensions + + === The new refusals + + The evaluation errors extend PM 1004's set. The new refusals, each with its carried data: + +.The evaluation processing errors +[cols="2,4", options="headers"] +|=== +|Error |Carries + +|`DimensionMismatch` |`expected`, `got` — per PM 1009 +|`UnitNotConvertible` |`from`, `to` — per PM 1009 +|`UnknownUnit` |`code` — per PM 1009 +|`AffineUnitInAlgebra` |`unit`, `operation` — per PM 1009 +|`NonlinearityNotValidated` |the verdict naming MCM — the LPU inadequacy +|`InputNotNormal` |the input whose declared distribution gates GUF₂ out +|`NotASeries` |the non-series operand of an aggregate +|`UndefinedOperand` |the operator that refused the undefined literal +|=== + + PM 1004's eight errors hold unchanged for the arithmetic core. The error corpus of PM 1004's clause 11 extends: one vector per new error per constructible site, the message shapes stable within the edition. + + === The contract travels + + The strict contract of PM 1004 — no NaN, no infinity, no partial evaluation, no second chance — holds for every extension in this document. The propagated result that would be non-finite raises `NonFiniteResultError` at the boundary, per PM 1004. diff --git a/sources/pm-1011/sections/10-interface.adoc b/sources/pm-1011/sections/10-interface.adoc new file mode 100644 index 0000000..cc81610 --- /dev/null +++ b/sources/pm-1011/sections/10-interface.adoc @@ -0,0 +1,13 @@ +== The serialized interface + +=== The request + +The evaluation is a pure function over a serialized request: the expressions, the value bindings, the unit registers, the uncertainty components, the limits — JSON in, JSON out, no filesystem, no environment reads, per R-C5. Identical requests yield byte-identical results across the ruby, typescript and wasm bindings. + +=== The version stamps + +Every result embeds the engine version and the grammar-artifact checksum: a result is reproducible against the versions that produced it, and a drift between runtimes is visible in the result itself. + +=== The parity + +The corpus generations replay identically in every binding; a cross-runtime difference is nonconformance, and the corpus is the arbiter (PM 1013 carries the surface contract). diff --git a/sources/pm-1011/sections/11-conformance.adoc b/sources/pm-1011/sections/11-conformance.adoc new file mode 100644 index 0000000..f2e0bc6 --- /dev/null +++ b/sources/pm-1011/sections/11-conformance.adoc @@ -0,0 +1,16 @@ +== Conformance + +=== The conformance classes + +An implementation conforms to this document at the class its corpus generation pins: + +* the *arithmetic class* — PM 1004's corpus, unchanged; +* the *quantity class* — the construction, coherence and algebra vectors of PM 1009 plus the quantity evaluations of this document's clause 5; +* the *propagation class* — the GUM worked examples (H.1–H.6) reproduced to the documented precision, the correlation vectors, the coverage and dof vectors; +* the *second-order class* — the GUF₂ vectors, the normality-gate refusals, the LPU-adequacy verdicts; +* the *series class* — the aggregations and the type-A loop vectors; +* the *serialized class* — the JSON request/response parity vectors across the runtimes. + +=== The acceptance + +A conformance claim names the classes and the corpus generations. The classes are independent: arithmetic-only conformance is PM 1004's, unchanged; each new class stands on PM 1009 and this document's clauses for that class. diff --git a/sources/pm-1011/sections/90-annex-a.adoc b/sources/pm-1011/sections/90-annex-a.adoc new file mode 100644 index 0000000..dae41be --- /dev/null +++ b/sources/pm-1011/sections/90-annex-a.adoc @@ -0,0 +1,11 @@ +== Annex A: the GUM worked examples + +The mapping of the GUM's worked examples to this document's clauses: + +* H.1 (the gauge block, the type A and B components, the combined and expanded) — clauses 6 and 6.3, at the first order; +* H.2 (the thermometer, the correlation) — clause 6.4, the correlation term stated; +* H.4–H.6 — clause 6 with the mixtures of type A and B inputs; +* the Amd.1 note to H.1.7 — clause 7, the second-order terms derived and documented per the corpus; +* the H.1 comparison against MCM — clause 7, the LPU-adequacy verdict. + +Each example is one corpus vector per the stated precision; the corpus is the checkable form. diff --git a/sources/pm-1011/sections/91-annex-b.adoc b/sources/pm-1011/sections/91-annex-b.adoc new file mode 100644 index 0000000..b4ec55c --- /dev/null +++ b/sources/pm-1011/sections/91-annex-b.adoc @@ -0,0 +1,3 @@ +== Annex B: the error table + +The full error table: PM 1004's eight errors, unchanged, plus this document's extensions of clause 9. Each row: the class, the carried data, the raising clause, and one corpus vector's identifier. The shapes are stable within the edition; the corpus pins each shape with one vector. diff --git a/sources/pm-1011/sections/98-bibliography.adoc b/sources/pm-1011/sections/98-bibliography.adoc new file mode 100644 index 0000000..c4dfcb6 --- /dev/null +++ b/sources/pm-1011/sections/98-bibliography.adoc @@ -0,0 +1,9 @@ +[bibliography] +== Bibliography + +* [[[ref-jcgm-101-2008-supplement-1-the-monte-car,nofetch(JCGM 101:2008)]]] — JCGM 101:2008 — Supplement 1, the Monte Carlo method +* [[[ref-jcgm-106-the-role-of-the-decision-rules,nofetch(JCGM 106)]]] — JCGM 106 — the role of the decision rules +* [[[ref-gum-5-2026-gum-6-2020-the-second-order-t,nofetch(GUM-5:2026, GUM-6:2020)]]] — GUM-5:2026, GUM-6:2020 — the second-order terminology and the LPU-adequacy check +* [[[ref-wolfram-language-documentation-around-th,nofetch(Wolfram Language documentation)]]] — Wolfram Language documentation — `Around`, the uncertainty propagation precedent +* [[[ref-python-uncertainties-julia-measurements,nofetch(Python `uncertainties`, Julia `Measurements`)]]] — Python `uncertainties`, Julia `Measurements` — the first-order linear propagation precedents +* [[[ref-matlab-the-platform-double-evaluation-mo,nofetch(MATLAB)]]] — MATLAB — the platform-double evaluation model this document's strict contract deliberately diverges from diff --git a/sources/pm-1012/document.adoc b/sources/pm-1012/document.adoc new file mode 100644 index 0000000..0db44ca --- /dev/null +++ b/sources/pm-1012/document.adoc @@ -0,0 +1,58 @@ += Constraint evaluation +:docnumber: 1012 +:edition: 1 +:ref-docnumber: PM 1012:2026(E) +:copyright-year: 2026 +:revdate: 2026-11-12 +:language: en +:script: Latn +:title: Plurimath specifications -- Constraint evaluation +:title-fr: Spécifications Plurimath -- Évaluation des contraintes +: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-constraints.adoc[] + +include::sections/06-decision-rules.adoc[] + +include::sections/07-residuals.adoc[] + +include::sections/08-guards.adoc[] + +include::sections/09-verdict-rendering.adoc[] + +include::sections/10-conformance.adoc[] + +include::sections/90-annex-a.adoc[] + +include::sections/91-annex-b.adoc[] + +include::sections/98-bibliography.adoc[] + diff --git a/sources/pm-1012/sections/00-foreword.adoc b/sources/pm-1012/sections/00-foreword.adoc new file mode 100644 index 0000000..541bcbf --- /dev/null +++ b/sources/pm-1012/sections/00-foreword.adoc @@ -0,0 +1,29 @@ +== Foreword + +=== General + +This document is the twelfth document of the Plurimath specifications series. It specifies constraint evaluation: the evaluation of a stated limit against a measured or computed result, the decision rules that turn the comparison into a verdict, the signed residual that is the verdict's evidence, the applicability guards, and the rendering of the whole evaluation trace. + +The document builds on PM 1011: the constraint's operands are the propagated quantities of PM 1011, the uncertainty that feeds the guard band is PM 1011's expanded uncertainty, and the boundary exactness is PM 1004's accuracy-class discipline. + +=== 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 |Quantities, units, dimensions, typed errors +|1010 |Expression language |The closed expression grammar and the typed AST +|1011 |Evaluation processing |Unit-aware evaluation, propagation, series, second-order modes +|1012 |Constraint evaluation |This document: the decision rules and the 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. diff --git a/sources/pm-1012/sections/00-introduction.adoc b/sources/pm-1012/sections/00-introduction.adoc new file mode 100644 index 0000000..d785b16 --- /dev/null +++ b/sources/pm-1012/sections/00-introduction.adoc @@ -0,0 +1,16 @@ +== Introduction + +A limit states a requirement; an evaluation produces a result; the constraint evaluation is the step that turns the pair into a **verdict** — satisfied or not, with the signed residual that shows how far from the boundary, in the limit's own unit, and with the conditional zone stated where the uncertainty leaves the decision in doubt. + +The design centre is the decision rule stated as data. Simple acceptance and guarded acceptance (the guard band = k·U, the ILAC-G8 family) are the two rules this document specifies; the rule travels with the verdict, because the same boundary passes under one rule and lands conditional under the other, and a verdict without its rule is an answer without its question. + +[example] +The limit `L ≤ 100,0 V` against the result `99,7 V ± 0,5 V` under guarded acceptance at k = 2. +*Expected outcome.* the conditional verdict: the result passes the boundary but sits inside the guard band `± 1,0 V` — the conditional zone is a first-class result, never a silent pass. + +=== The design forces + +* *The rule travels with the verdict.* Every verdict names its decision rule and its guard band. +* *The residual is the evidence.* The signed distance to the boundary, in the limit's unit, per the accuracy classes. +* *The conditional is first-class.* The guard-band zone is a verdict kind, not a warning. +* *The trace renders.* The substitution steps render through the existing surfaces — the explanation is the renderer's output too. diff --git a/sources/pm-1012/sections/01-scope.adoc b/sources/pm-1012/sections/01-scope.adoc new file mode 100644 index 0000000..ad7a3d1 --- /dev/null +++ b/sources/pm-1012/sections/01-scope.adoc @@ -0,0 +1,15 @@ +== Scope + +This document specifies: + +* the constraint evaluation: the limit expression, the result operands, and the comparison at the boundary; +* the decision rules: simple acceptance and guarded acceptance (guard band = k·U, the ILAC-G8 family), and the conditional zone as a first-class verdict kind; +* the signed residual: the distance to the boundary in the limit's unit, under the accuracy classes of PM 1004; +* the applicability guards: the `when` expressions evaluated through the same path; +* the verdict rendering: the evaluation trace as a rendered output. + +This document does not specify: + +* the propagation that produces the uncertainty (PM 1011); +* the conformity assessment's sampling plans and population statements — the verdict here is about one evaluated result against one stated limit; +* the legal metrology's acceptance authorities — the rules are stated as data and chosen by the request. diff --git a/sources/pm-1012/sections/02-normrefs.adoc b/sources/pm-1012/sections/02-normrefs.adoc new file mode 100644 index 0000000..0176f1f --- /dev/null +++ b/sources/pm-1012/sections/02-normrefs.adoc @@ -0,0 +1,10 @@ +[bibliography] +== Normative references + +* [[[pm1001,nofetch(PM 1001 (math model))]]] of this series — the formula tree. +* [[[pm1002,nofetch(PM 1002 (uncertainty model))]]] of this series — the uncertainty the guard band carries. +* [[[pm1004,nofetch(PM 1004 (evaluation))]]] of this series — the accuracy classes and the strict error contract. +* [[[pm1009,nofetch(PM 1009 (quantity type system))]]] of this series — the quantities and the coherence. +* [[[pm1011,nofetch(PM 1011 (evaluation processing))]]] of this series — the propagated results and the expanded uncertainty. +* [[[ilacg8,nofetch(ILAC-G8)]], ILAC — the guidelines on decision rules and statements of conformity — the guarded acceptance family. +* [[[jcgm106,nofetch(JCGM 106)]]] — the decision-rule framing. diff --git a/sources/pm-1012/sections/03-terms.adoc b/sources/pm-1012/sections/03-terms.adoc new file mode 100644 index 0000000..9ecce45 --- /dev/null +++ b/sources/pm-1012/sections/03-terms.adoc @@ -0,0 +1,24 @@ +== Terms and definitions + +For the purposes of this document, the terms and definitions of PM 1011 apply, and the following apply. + +=== limit +the stated boundary expression with its comparison direction and its unit + +=== constraint evaluation +one evaluation of a limit against a result under one decision rule, yielding one verdict + +=== verdict +the result of a constraint evaluation: satisfied, not satisfied, or conditional, with the rule and the residual + +=== signed residual +the distance from the result to the limit boundary in the limit's unit — signed to the satisfied side + +=== guard band +the interval k·U subtracted from the limit boundary, per the guarded acceptance rule + +=== conditional +the verdict kind for a result inside the guard band: neither satisfied nor not satisfied — the rule does not decide + +=== applicability guard +the `when` expression that states whether the constraint applies to the current scope diff --git a/sources/pm-1012/sections/04-conventions.adoc b/sources/pm-1012/sections/04-conventions.adoc new file mode 100644 index 0000000..18e19fc --- /dev/null +++ b/sources/pm-1012/sections/04-conventions.adoc @@ -0,0 +1,9 @@ +== Conventions + +=== General + +Constraints are written as the limit against the result: `L ≤ 100,0 V`, the result, the rule. Verdicts are written as the verdict kind, the residual, and the rule. + +=== Examples + +Examples carry an *Expected outcome* paragraph stating the verdict kind, the signed residual, and the rule. diff --git a/sources/pm-1012/sections/05-constraints.adoc b/sources/pm-1012/sections/05-constraints.adoc new file mode 100644 index 0000000..1fcbfad --- /dev/null +++ b/sources/pm-1012/sections/05-constraints.adoc @@ -0,0 +1,34 @@ +== The constraint evaluation + +=== The contract + +`evaluate_constraint(limit, result, rule) → ConstraintResult` — the limit expression evaluated per PM 1011 against the result operands, the comparison at the boundary under the accuracy classes of PM 1004, and the verdict constructed with the rule, the signed residual and the diagnostics. + +[source,lml] +---- +lml "1.0" + +models Constraints { + + class ConstraintResult { + attribute verdict, Verdict[1] + attribute residual, QuantityValue[0..1] + attribute rule, DecisionRule[1] + attribute diagnostics, Diagnostic { cardinality 0..n } + } + + enum Verdict { + value "satisfied" + value "not-satisfied" + value "conditional" + } +} +---- + +=== The comparison at the boundary + +The comparison follows PM 1004's boundary rule: exact operands compare exactly; limited operands compare per their declared precision — `<=` at the limit must be deterministic. A boundary comparison that cannot be decided at the stated precision raises the typed refusal per PM 1004, not a guessed verdict. + +=== The dimension coherence + +The limit and the result must share the dimension: the coherence check of PM 1009 precedes the comparison, and the mismatch is `DimensionMismatch` — the limit's unit is the residual's unit. diff --git a/sources/pm-1012/sections/06-decision-rules.adoc b/sources/pm-1012/sections/06-decision-rules.adoc new file mode 100644 index 0000000..35bf3a9 --- /dev/null +++ b/sources/pm-1012/sections/06-decision-rules.adoc @@ -0,0 +1,23 @@ +== The decision rules + +=== Simple acceptance + +The comparison decides: the result satisfies the limit or it does not. No guard band, no conditional — a boundary-exact comparison yields a boundary-exact verdict. + +=== Guarded acceptance + +The guard band is `k·U` — the coverage factor times the expanded uncertainty of the result (PM 1011). The zone `[L − k·U, L]` for an upper limit (mirrored for a lower) is the conditional zone: + +* the result below `L − k·U`: satisfied; +* the result above `L`: not satisfied; +* the result inside the zone: conditional — the rule does not decide, and the verdict carries the zone. + +The k and the rule travel with the verdict; the conditional verdict's evidence is the residual and the band. + +[example] +The limit `L ≤ 100,0 V` against `99,7 V ± 0,5 V`, guarded at k = 2. +*Expected outcome.* conditional — the result is inside the band `[99,0 V, 100,0 V]`; the signed residual is `−0,3 V` and the band is `1,0 V`. + +[example] +The same limit against `99,0 V ± 0,5 V`, guarded at k = 2. +*Expected outcome.* conditional at the band's edge — the corpus carries the boundary case and its rule's answer; the accuracy classes decide the edge. diff --git a/sources/pm-1012/sections/07-residuals.adoc b/sources/pm-1012/sections/07-residuals.adoc new file mode 100644 index 0000000..e739588 --- /dev/null +++ b/sources/pm-1012/sections/07-residuals.adoc @@ -0,0 +1,13 @@ +== The signed residual + +=== The residual + +The signed residual is `result − L` in the limit's unit, signed to the satisfied side: negative for a result under an upper limit, positive for a result over it. The residual's accuracy class follows PM 1004's contamination rule; the residual is the verdict's evidence — how far from the boundary, in the limit's own unit. + +=== The residual with uncertainty + +Under guarded acceptance the residual carries the propagated uncertainty: the verdict states the residual, its expanded uncertainty, and the band — the three numbers the reader needs to check the decision. + +[example] +The limit `L ≥ 10,00 kΩ` against `10,02 kΩ`. +*Expected outcome.* satisfied; the signed residual `+0,02 kΩ` — exact per the operands' classes. diff --git a/sources/pm-1012/sections/08-guards.adoc b/sources/pm-1012/sections/08-guards.adoc new file mode 100644 index 0000000..20c0239 --- /dev/null +++ b/sources/pm-1012/sections/08-guards.adoc @@ -0,0 +1,9 @@ +== The applicability guards + +=== The guard evaluation + +The `when` expression — the applicability guard — evaluates through the same path as any boolean expression of PM 1011: the same grammar, the same scope, the same typed refusals. A guard that does not evaluate to a boolean is a static refusal per PM 1010; a guard evaluating to false makes the constraint inapplicable — a stated verdict kind of the request layer, not an error. + +[example] +The guard `when { regime == "R 134" }`. +*Expected outcome.* evaluated against the scope; the constraint applies or is recorded inapplicable — the applicability is part of the verdict record either way. diff --git a/sources/pm-1012/sections/09-verdict-rendering.adoc b/sources/pm-1012/sections/09-verdict-rendering.adoc new file mode 100644 index 0000000..c94029d --- /dev/null +++ b/sources/pm-1012/sections/09-verdict-rendering.adoc @@ -0,0 +1,9 @@ +== The verdict rendering + +=== The trace + +The constraint evaluation renders its trace through the existing renderers: the limit as stated, the result as evaluated, the substitution steps of PM 1011's evaluation, the comparison at the boundary, the rule with its guard band, and the verdict with its signed residual. The explanation is the renderer's output — every surface, per PM 1003's interfaces. + +[example] +The rendered trace of a guarded R 60 constraint. +*Expected outcome.* the limit, the propagated result with its uncertainty, the band, the zone, the conditional verdict and the residual — in MathML, LaTeX and UnicodeMath, per the corpus's render vectors. diff --git a/sources/pm-1012/sections/10-conformance.adoc b/sources/pm-1012/sections/10-conformance.adoc new file mode 100644 index 0000000..aaf1c61 --- /dev/null +++ b/sources/pm-1012/sections/10-conformance.adoc @@ -0,0 +1,13 @@ +== Conformance + +=== The conformance class + +An implementation conforms to this document when it evaluates constraints under both stated rules, produces the three verdict kinds with the rule and the signed residual carried, evaluates the guards through the PM 1011 path, renders the trace per clause 9, and replays the corpus vectors identically. + +=== The acceptance vectors + +* the R 60 MPE ranges — each with the stated rule, verdict and residual; +* the R 134 regime laws — the guards and the applicability records; +* the series creeps — the residuals against the creep limits; +* the boundary cases — the exact-edge comparisons per the accuracy classes; +* the conditional-zone cases — the band-edge vectors per the stated k. diff --git a/sources/pm-1012/sections/90-annex-a.adoc b/sources/pm-1012/sections/90-annex-a.adoc new file mode 100644 index 0000000..c8686da --- /dev/null +++ b/sources/pm-1012/sections/90-annex-a.adoc @@ -0,0 +1,3 @@ +== Annex A: the R 60 cases + +The corpus's R 60 constraint cases — the MPE ranges against the propagated results, one row per case: the limit, the result with its uncertainty, the rule, the verdict, the signed residual. The annex is the reading guide; the corpus is the checkable form. diff --git a/sources/pm-1012/sections/91-annex-b.adoc b/sources/pm-1012/sections/91-annex-b.adoc new file mode 100644 index 0000000..bf144ea --- /dev/null +++ b/sources/pm-1012/sections/91-annex-b.adoc @@ -0,0 +1,3 @@ +== Annex B: the regime laws + +The R 134 regime-law cases: the guards, the regimes, and the constraints they apply — each row with the applicability record and the verdict. The laws are the corpus's; this annex is their reading order. diff --git a/sources/pm-1012/sections/98-bibliography.adoc b/sources/pm-1012/sections/98-bibliography.adoc new file mode 100644 index 0000000..8509ce5 --- /dev/null +++ b/sources/pm-1012/sections/98-bibliography.adoc @@ -0,0 +1,5 @@ +[bibliography] +== Bibliography + +* [[[ref-ilac-g8-guidelines-on-decision-rules-and,nofetch(ILAC-G8)]]] — ILAC-G8 — Guidelines on Decision Rules and Statements of Conformity +* [[[ref-jcgm-106-the-decision-rule-framing-the-g,nofetch(JCGM 106)]]] — JCGM 106 — the decision-rule framing the guarded rule follows diff --git a/sources/pm-1013/document.adoc b/sources/pm-1013/document.adoc new file mode 100644 index 0000000..28c3f00 --- /dev/null +++ b/sources/pm-1013/document.adoc @@ -0,0 +1,52 @@ += The embedded-consumer contract +:docnumber: 1013 +:edition: 1 +:ref-docnumber: PM 1013:2026(E) +:copyright-year: 2026 +:revdate: 2026-11-12 +:language: en +:script: Latn +:title: Plurimath specifications -- The embedded-consumer contract +:title-fr: Spécifications Plurimath -- Le contrat du consommateur embarqué +: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-boundary.adoc[] + +include::sections/06-artifact-sharing.adoc[] + +include::sections/07-request-contract.adoc[] + +include::sections/08-parity.adoc[] + +include::sections/09-conformance.adoc[] + +include::sections/98-bibliography.adoc[] + diff --git a/sources/pm-1013/sections/00-foreword.adoc b/sources/pm-1013/sections/00-foreword.adoc new file mode 100644 index 0000000..4c30c0b --- /dev/null +++ b/sources/pm-1013/sections/00-foreword.adoc @@ -0,0 +1,27 @@ +== Foreword + +=== General + +This document is the thirteenth document of the Plurimath specifications series. It specifies the embedded-consumer contract: the serialized request surface over which a host — the Primmel kernel, a document pipeline, a TS application — drives the evaluation, the artifact-sharing discipline that keeps one grammar and one model definition across the runtimes, and the parity claims that make the cross-runtime behaviour a conformance statement instead of a hope. + +=== 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 |Quantities, units, dimensions, typed errors +|1010 |Expression language |The closed expression grammar and the typed AST +|1011 |Evaluation processing |Unit-aware evaluation, propagation, series, second-order modes +|1012 |Constraint evaluation |Decision rules, residuals, verdicts +|1013 |Embedded-consumer contract |This document: the serialized surface and the parity claims +|=== + +=== Maintainers + +This document is maintained by the Plurimath project at https://github.com/plurimath/plurimath. diff --git a/sources/pm-1013/sections/00-introduction.adoc b/sources/pm-1013/sections/00-introduction.adoc new file mode 100644 index 0000000..e8ac656 --- /dev/null +++ b/sources/pm-1013/sections/00-introduction.adoc @@ -0,0 +1,12 @@ +== Introduction + +An embedded consumer does not import a gem; it drives a surface. The contract is the surface: a serialized request (the expressions, the bindings, the unit registers, the uncertainty components, the limits), a serialized response (the results, the diagnostics, the verdicts, the version stamps), and the parity claims that hold the runtimes to the same answers. + +The design centre is the pure function. No filesystem, no environment reads, no hidden state: identical requests yield byte-identical responses across the ruby, typescript and wasm bindings, with the engine and grammar versions stamped in every response. + +=== The design forces + +* *Pure.* The surface is a function; the corpus replays it. +* *Stamped.* Every response carries the versions that produced it. +* *One artifact.* The grammar and the model definitions are shared artifacts, checksummed; no runtime hand-writes what the artifact states. +* *Parity as conformance.* The cross-runtime difference is the drift; the corpus is the arbiter. diff --git a/sources/pm-1013/sections/01-scope.adoc b/sources/pm-1013/sections/01-scope.adoc new file mode 100644 index 0000000..83eb149 --- /dev/null +++ b/sources/pm-1013/sections/01-scope.adoc @@ -0,0 +1,14 @@ +== Scope + +This document specifies: + +* the boundary: what the host owns (the model, the bindings, the scope) and what plurimath owns (the expression parsing, the type-check, the evaluation, the diagnostics); +* the artifact sharing: the grammar and the LML definitions as checksummed artifacts across the runtimes; +* the serialized request and response: the JSON surface, its fields, and the version stamps; +* the parity claims: the cross-runtime byte-identity over the corpus generations, and the drift statement. + +This document does not specify: + +* the host languages' internal representations — the surface is the contract; +* the MCM (JCGM 101) — the boundary is stated in PM 1011; +* the transport — the surface is transport-independent. diff --git a/sources/pm-1013/sections/02-normrefs.adoc b/sources/pm-1013/sections/02-normrefs.adoc new file mode 100644 index 0000000..0f00bb6 --- /dev/null +++ b/sources/pm-1013/sections/02-normrefs.adoc @@ -0,0 +1,9 @@ +[bibliography] +== Normative references + +* [[[pm1009,nofetch(PM 1009 (quantity type system))]]] of this series — the quantity types the surface serializes. +* [[[pm1010,nofetch(PM 1010 (expression language))]]] of this series — the grammar artifacts the surface pins. +* [[[pm1011,nofetch(PM 1011 (evaluation processing))]]] of this series — the evaluation the surface drives. +* [[[pm1012,nofetch(PM 1012 (constraint evaluation))]]] of this series — the verdicts the surface returns. +* [[[parsanol,nofetch(Parsanol)]]] — the PARG toolchain; the binding declarations of parsanol#432. +* [[[lutamlmodel1033,nofetch(lutaml-model #1033)]]] — the LML cross-language schema realizations. diff --git a/sources/pm-1013/sections/03-terms.adoc b/sources/pm-1013/sections/03-terms.adoc new file mode 100644 index 0000000..4fbe3b0 --- /dev/null +++ b/sources/pm-1013/sections/03-terms.adoc @@ -0,0 +1,18 @@ +== Terms and definitions + +For the purposes of this document, the following terms and definitions apply. + +=== embedded consumer +a host that drives the evaluation through the serialized surface — the Primmel kernel, a document pipeline, a TS application + +=== serialized request +the JSON document stating the expressions, the bindings, the unit registers, the uncertainty components and the limits + +=== serialized response +the JSON document stating the results, the diagnostics, the verdicts and the version stamps + +=== parity +the property that identical requests yield byte-identical responses across the runtimes + +=== drift +a cross-runtime difference on an identical request — nonconformance, arbitrated by the corpus diff --git a/sources/pm-1013/sections/04-conventions.adoc b/sources/pm-1013/sections/04-conventions.adoc new file mode 100644 index 0000000..1df5c40 --- /dev/null +++ b/sources/pm-1013/sections/04-conventions.adoc @@ -0,0 +1,9 @@ +== Conventions + +=== General + +Requests and responses are shown as JSON shapes with their required fields; the field names are normative, the example values are illustrative. + +=== Examples + +Examples carry an *Expected outcome* paragraph stating the response field or the parity claim exercised. diff --git a/sources/pm-1013/sections/05-boundary.adoc b/sources/pm-1013/sections/05-boundary.adoc new file mode 100644 index 0000000..2793bbf --- /dev/null +++ b/sources/pm-1013/sections/05-boundary.adoc @@ -0,0 +1,13 @@ +== The boundary + +=== The host owns + +The host parses the model, resolves the bindings and builds the scope: the quantities, their provenance, the requirements the constraints state. + +=== plurimath owns + +The expression parsing (through the grammar artifact of PM 1010), the static type-check, the evaluation and propagation (PM 1011), the constraint evaluation (PM 1012), the diagnostics as data, and the rendering of the results and the traces. + +=== The seam + +The seam is the serialized request: everything on the host side arrives as data; everything on the plurimath side returns as data. The host never reaches into the tree; plurimath never reads the host's environment. diff --git a/sources/pm-1013/sections/06-artifact-sharing.adoc b/sources/pm-1013/sections/06-artifact-sharing.adoc new file mode 100644 index 0000000..a049551 --- /dev/null +++ b/sources/pm-1013/sections/06-artifact-sharing.adoc @@ -0,0 +1,13 @@ +== The artifact sharing + +=== The grammar + +The expression grammar of PM 1010 compiles per runtime through the PARG toolchain; the declared binding layer of parsanol#432 emits the per-target bindings. The artifacts are checksummed; the consumer pins the checksums and the runtime verifies them at load. + +=== The model definitions + +The LML definitions of PM 1009 materialize per runtime through the cross-language realizations of lutaml-model#1033. The definitions are the single source: a model type added in one runtime and not another is a drift the corpus catches. + +=== The discipline + +No runtime hand-writes what an artifact states. A change to the grammar or the model is a new artifact with new checksums — and a corpus generation named for it. diff --git a/sources/pm-1013/sections/07-request-contract.adoc b/sources/pm-1013/sections/07-request-contract.adoc new file mode 100644 index 0000000..0a3c3e0 --- /dev/null +++ b/sources/pm-1013/sections/07-request-contract.adoc @@ -0,0 +1,25 @@ +== The serialized surface + +=== The request + +[source,json] +---- +{ + "expressions": [ "..." ], + "bindings": { "V": { "value": "1.2", "unit": "V", "uncertainty": { "category": "standard", "magnitude": "0.06" } } }, + "unit_register": [ "unitsml(V)", "unitsml(kg)" ], + "uncertainty_components": [ "..." ], + "limits": [ "..." ], + "rule": { "kind": "guarded", "k": 2 } +} +---- + +The fields are normative; the shapes of the quantities and the uncertainties follow PM 1009 and PM 1002's encodings as serialized data. + +=== The response + +The response states the results (the quantities, the propagated uncertainties, the version stamps), the diagnostics (the typed errors with their carried data), the verdicts (per PM 1012, with the rules and the residuals), and the render traces where requested. + +=== The stamps + +Every response carries the engine version, the grammar-artifact checksum and the corpus generation the claims name. A response without stamps is not conforming. diff --git a/sources/pm-1013/sections/08-parity.adoc b/sources/pm-1013/sections/08-parity.adoc new file mode 100644 index 0000000..3c25ea1 --- /dev/null +++ b/sources/pm-1013/sections/08-parity.adoc @@ -0,0 +1,13 @@ +== The parity claims + +=== The claims + +Identical requests yield byte-identical responses across the ruby, typescript and wasm bindings — for the results, the diagnostics, the verdicts and the stamps (the stamps identical per the pinned versions). + +=== The arbitration + +A cross-runtime difference is drift: nonconformance, arbitrated by the corpus generation the request names. The corpus gains a vector per observed drift, per the append-only discipline. + +=== The scope + +The parity claims hold over the corpus generations and the stated precision of the accuracy classes; a runtime's platform-limited results at a stated guard precision are equal when their statements are equal — the statement is the contract, per PM 1004's accuracy classes. diff --git a/sources/pm-1013/sections/09-conformance.adoc b/sources/pm-1013/sections/09-conformance.adoc new file mode 100644 index 0000000..5aaa43a --- /dev/null +++ b/sources/pm-1013/sections/09-conformance.adoc @@ -0,0 +1,11 @@ +== Conformance + +=== The conformance class + +A binding conforms to this document when it drives the serialized surface per clause 7, verifies the artifact checksums at load, states the stamps in every response, and replays the corpus generation with byte-identical responses across every runtime it claims. + +=== The acceptance vectors + +* the parity vectors of PM 1011's serialized class, replayed across the runtimes; +* the checksum-verification refusal on a pinned-mismatched artifact; +* the stamp presence and correctness on every response. diff --git a/sources/pm-1013/sections/98-bibliography.adoc b/sources/pm-1013/sections/98-bibliography.adoc new file mode 100644 index 0000000..fe10cae --- /dev/null +++ b/sources/pm-1013/sections/98-bibliography.adoc @@ -0,0 +1,6 @@ +[bibliography] +== Bibliography + +* [[[ref-pm-1001-1012-of-this-series-the-specifi,nofetch(*PM 1001–1012 of this series*)]]] — *PM 1001–1012 of this series* — the specifications the surface drives +* [[[ref-parsanol-432-the-declared-per-target-bin,nofetch(parsanol#432)]]] — parsanol#432 — the declared per-target binding layer +* [[[ref-lutaml-model-1033-the-lml-cross-language,nofetch(lutaml-model#1033)]]] — lutaml-model#1033 — the LML cross-language schema realizations