FO[Unit] ?¶
Note
This extension is work-in-progress.
Goal
This extension allows the use of synonyms for types INT and REAL, annotated with units of measurerement (e.g., kg
).
It also checks that equations are correct in their use of units of measure.
Lexicon
Token |
Pattern |
Example |
---|---|---|
UNIT |
|
|
Syntax
TypeInterpretation ← REAL '[' Units ']';
Units ← UNIT {UNIT} ['/' UNIT {UNIT} ];
Units ← '1' '/' UNIT {UNIT};
Identifier ← REALVAL '[' Units ']';
Well-formedness
UNIT
are one of the 7 base units and the 22 derived units in the International System of Units (SI), with multiplying prefixes (e.g.,M
) and power suffix. Another 14 commonly-used non-SI units are also accepted.Only numbers of the same type and comparable unit of measure can be added / substracted / compared. The multiplying prefixes are handled as usual.
The product (resp. division) of numbers of type
Real[A]
andReal[B]
has typeReal[A B]
(resp.Real[A/B]
).
Semantics
The interpretation of the type is the set of reals, annotated with the unit of measurement.
Example
vocabular {
type Acceleration := Real[m/s²]
a: () -> Acceleration
}
theory T {
a() = 1[cm] / 1[s] / 1[s].
}
In every model of T, a
has the value 0.01[m/s²]
.