/-
Copyright (c) 2026 Nicolas Rouquette. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Nicolas Rouquette
-/modulepublicimportPhyslib.Units.Basic
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: UnitChoices has five named unit fields and
UnitChoices.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
MonoidHomd ↦ ∏ b, (u₁ b / u₂ b) ^ d.exponent b, generic in B.
The current five-field UnitChoices.dimScale is the LTMCTDimensionBase instance of this
fold, written out by hand; UnitChoices.toScale exhibits the correspondence.
@[expose]publicsection
A choice of unit for each base dimension of B: a positive-real magnitude per
base. This is the basis-generic form of UnitChoices.
The positive-real magnitude of the chosen unit at each base dimension.
The current five-field UnitChoices is the LTMCTDimensionBase instance
UnitChoices.toScale reads the five typed units as a UnitScale LTMCTDimensionBase,
exhibiting the existing bespoke dimScale as the LTMCTDimensionBase case of the generic
fold.