@[reducible, inline]
Choosing a metric involves choosing
- a power factor (it's one for base and derived units)
- an affine conversion (to convert between units of the same dimension)
- a dimension (to ensure dimensional correctness)
Note that all these 3 choices form a AddCommGroup, so we can combine them easily.
Equations
Instances For
A unit is a product of base units raised to rational powers.
For example, the unit of force in the SI system is kg•m/s²
can be represented as :
force₁ = {"kg" ↦ (1,0,Mass), "m" ↦ (1,0,Length), "s" ↦ (-2,0,Time⁻²)}
or when using derived units:
force₂={"N" ↦ (1,0,Mass•Length•Time⁻²)}
Converting between these two representations is possible because their dimensions are the same under product:
Π 𝒟(force₁) = Mass•Length•Time⁻² = Π 𝒟(force₂)
- _impl : Π₀ (x : String), UnitChoice
Instances For
Equations
- Units.instBEqUnit.beq { _impl := a } { _impl := b } = (a == b)
- Units.instBEqUnit.beq x✝¹ x✝ = false
Instances For
Equations
- Units.instBEqUnit = { beq := Units.instBEqUnit.beq }
Equations
- Units.Unit.instMul = { mul := fun (u1 u2 : Units.Unit) => u1 + u2 }
Equations
- Units.Unit.instInv = { inv := fun (u : Units.Unit) => -u }
Equations
- Units.Unit.instDiv = { div := fun (u1 u2 : Units.Unit) => u1 - u2 }
Equations
- Units.Unit.instPowNat = { pow := fun (u : Units.Unit) (q : ℕ) => q • u }
Equations
- Units.Unit.instPowInt = { pow := fun (u : Units.Unit) (n : ℤ) => n • u }
Instances For
Equations
- u.conversion = u._impl.sum fun (x : String) (qd : Units.UnitChoice) => qd.2.1
Instances For
Equations
- Units.Unit.instHasDimension = { dimension := Units.Unit.dimension }
Equations
- Units.Unit.instHasConversion = { conversion := Units.Unit.conversion }
Two units are considered equal if they have the same dimension and conversion, regardless of their representation.
For example, N and kg•m/s² are considered equivalent
Equations
- Units.Unit.instSetoidUnit = { r := fun (u₁ u₂ : Units.Unit) => u₁.dimension = u₂.dimension ∧ u₁.conversion = u₂.conversion, iseqv := Units.Unit.instSetoidUnit._proof_1 }
Equations
Define a derived unit with a given name, unit and optional conversion. Example:
newton = defineDerivedUnit "N" (kilogram * meter / second^2)celsius = defineDerivedUnit "°C" kelvin (Conversion.translate (27315/100))
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.