Physlib.Units.ParametricUnits
The unit side, parametrised in the same basis
The dimension basis is parametric (`Dimension B`), but the *unit* side of the bridge is hardwired in parallel: `LTMCTUnitChoices` has five named unit fields and `LTMCTUnitChoices.dimScale` folds over exactly those five. This module provides the generic twin, parametrised in the same basis `B`.
Every PhysLib base unit (`LengthUnit`, `TimeUnit`, …) is, structurally, a positive real (`{ val : ℝ // 0 < val }`); the typed names carry no extra algebraic content. So a unit choice over a basis `B` is a positive real per base dimension, and the scaling homomorphism folds the per-base unit ratio over `B`:
* `UnitScale B` — a positive-real magnitude for each `b : B`. * `UnitScale.dimScale : UnitScale B → UnitScale B → Dimension B →* ℝ≥0` — the `MonoidHom` `d ↦ ∏ b, (u₁ b / u₂ b) ^ d.exponent b`, generic in `B`.
The current five-field `LTMCTUnitChoices.dimScale` is the `LTMCTDimensionBase` instance of this fold, written out by hand; `LTMCTUnitChoices.toScale` exhibits the correspondence.
The current five-field `LTMCTUnitChoices` is the `LTMCTDimensionBase` instance
`LTMCTUnitChoices.toScale` reads the five typed units as a `UnitScale LTMCTDimensionBase`, exhibiting the existing bespoke `dimScale` as the `LTMCTDimensionBase` case of the generic fold.
6 declarations
The ratio of unit scales is non-zero
Let be a basis. For any two unit scales mapping elements of to positive real numbers, and for any , the ratio of the magnitudes is non-zero.
Dimension-scaling homomorphism
Let be a finite set representing a basis of physical dimensions. Given two unit scales and (which assign a positive real magnitude to each base dimension ), the dimension-scaling homomorphism is a monoid homomorphism from the group of dimensions to the non-negative real numbers . For any dimension , the scaling factor is defined by the product: where denotes the exponent of the base dimension in the dimension . This map determines how a physical quantity of dimension rescales when the unit choice is changed from to .
Let be a finite basis of physical dimensions. For any unit scale (which assigns a positive real magnitude to each base dimension ) and any physical dimension , the dimension-scaling factor from to itself is equal to 1, i.e.,
The scaling factor for a dimensionless quantity is
Let be a finite set representing a basis of physical dimensions. For any two unit scales and over , the dimension-scaling homomorphism maps the dimensionless identity to the multiplicative identity in . That is, This reflects the fact that dimensionless quantities do not change their numerical value when the system of units is rescaled.
Transitivity of dimension-scaling factors:
Let be a finite set representing a basis of physical dimensions. For any three unit scales (which assign positive real magnitudes to each base dimension in ) and any physical dimension , the dimension-scaling factors satisfy the transitivity property: where denotes the scaling factor applied to a quantity of dimension when changing the system of units from to .
Conversion of `LTMCTUnitChoices` to `UnitScale`
The function maps a set of unit choices (of type `LTMCTUnitChoices`) to a `UnitScale` over the basis of base dimensions . For each base dimension , the resulting scale is defined as the positive real magnitude of the corresponding field in (length, time, mass, charge, or temperature).
