Types which depend on dimensions #
In addition to types which carry a dimension, we also have types whose elements
depend on a choice of a units. For example a function
f : M1 → M2
between two types M1
and M2
which carry dimensions does not itself
carry a dimensions, but is dependent on a choice of units.
We define three versions
UnitDependent M
having a functionscaleUnit : UnitChoices → UnitChoices → M → M
subject to two conditionsscaleUnit_trans
andscaleUnit_id
LinearUnitDependent M
extendsUnitDependent M
with additional linearity conditions onscaleUnit
.ContinuousLinearUnitDependent M
extendsLinearUnitDependent M
with an additional continuity condition onscaleUnit
.
A type carries the instance UnitDependent M
if it depends on a choice of units.
This dependence is manifested in scaleUnit u1 u2
which describes how elements of M
change
under a scaling of units which would take u1
to u2
.
This type is used for functions, and propositions etc.
- scaleUnit : UnitChoices → UnitChoices → M → M
- scaleUnit_trans (u1 u2 u3 : UnitChoices) (m : M) : scaleUnit u2 u3 (scaleUnit u1 u2 m) = scaleUnit u1 u3 m
- scaleUnit_trans' (u1 u2 u3 : UnitChoices) (m : M) : scaleUnit u1 u2 (scaleUnit u2 u3 m) = scaleUnit u1 u3 m
Instances
A type M
with an instance of UnitDependent M
such that scaleUnit u1 u2
is compatible
with the MulAction ℝ≥0 M
instance on M
.
- scaleUnit : UnitChoices → UnitChoices → M → M
- scaleUnit_trans (u1 u2 u3 : UnitChoices) (m : M) : scaleUnit u2 u3 (scaleUnit u1 u2 m) = scaleUnit u1 u3 m
- scaleUnit_trans' (u1 u2 u3 : UnitChoices) (m : M) : scaleUnit u1 u2 (scaleUnit u2 u3 m) = scaleUnit u1 u3 m
- scaleUnit_mul (u1 u2 : UnitChoices) (r : NNReal) (m : M) : UnitDependent.scaleUnit u1 u2 (r • m) = r • UnitDependent.scaleUnit u1 u2 m
Instances
A type M
with an instance of UnitDependent M
such that scaleUnit u1 u2
is compatible
with the Module ℝ M
instance on M
.
- scaleUnit : UnitChoices → UnitChoices → M → M
- scaleUnit_trans (u1 u2 u3 : UnitChoices) (m : M) : scaleUnit u2 u3 (scaleUnit u1 u2 m) = scaleUnit u1 u3 m
- scaleUnit_trans' (u1 u2 u3 : UnitChoices) (m : M) : scaleUnit u1 u2 (scaleUnit u2 u3 m) = scaleUnit u1 u3 m
- scaleUnit_add (u1 u2 : UnitChoices) (m1 m2 : M) : UnitDependent.scaleUnit u1 u2 (m1 + m2) = UnitDependent.scaleUnit u1 u2 m1 + UnitDependent.scaleUnit u1 u2 m2
- scaleUnit_smul (u1 u2 : UnitChoices) (r : ℝ) (m : M) : UnitDependent.scaleUnit u1 u2 (r • m) = r • UnitDependent.scaleUnit u1 u2 m
Instances
A type M
with an instance of UnitDependent M
such that scaleUnit u1 u2
is compatible
with the Module ℝ M
instance on M
, and is continuous.
- scaleUnit : UnitChoices → UnitChoices → M → M
- scaleUnit_trans (u1 u2 u3 : UnitChoices) (m : M) : scaleUnit u2 u3 (scaleUnit u1 u2 m) = scaleUnit u1 u3 m
- scaleUnit_trans' (u1 u2 u3 : UnitChoices) (m : M) : scaleUnit u1 u2 (scaleUnit u2 u3 m) = scaleUnit u1 u3 m
- scaleUnit_add (u1 u2 : UnitChoices) (m1 m2 : M) : UnitDependent.scaleUnit u1 u2 (m1 + m2) = UnitDependent.scaleUnit u1 u2 m1 + UnitDependent.scaleUnit u1 u2 m2
- scaleUnit_smul (u1 u2 : UnitChoices) (r : ℝ) (m : M) : UnitDependent.scaleUnit u1 u2 (r • m) = r • UnitDependent.scaleUnit u1 u2 m
- scaleUnit_cont (u1 u2 : UnitChoices) : Continuous (UnitDependent.scaleUnit u1 u2)
Instances
## Basic properties of scaleUnit
### Variations on the map scaleUnit
For an M
with an instance of UnitDependent M
, scaleUnit u1 u2
as an equivalence.
Equations
- UnitDependent.scaleUnitEquiv u1 u2 = { toFun := fun (m : M) => UnitDependent.scaleUnit u1 u2 m, invFun := fun (m : M) => UnitDependent.scaleUnit u2 u1 m, left_inv := ⋯, right_inv := ⋯ }
Instances For
For an M
with an instance of LinearUnitDependent M
, scaleUnit u1 u2
as a
linear map.
Equations
- LinearUnitDependent.scaleUnitLinear u1 u2 = { toFun := fun (m : M) => UnitDependent.scaleUnit u1 u2 m, map_add' := ⋯, map_smul' := ⋯ }
Instances For
For an M
with an instance of LinearUnitDependent M
, scaleUnit u1 u2
as a
linear equivalence.
Equations
Instances For
For an M
with an instance of ContinuousLinearUnitDependent M
, scaleUnit u1 u2
as a
continuous linear map.
Equations
- ContinuousLinearUnitDependent.scaleUnitContLinear u1 u2 = { toLinearMap := LinearUnitDependent.scaleUnitLinear u1 u2, cont := ⋯ }
Instances For
For an M
with an instance of ContinuousLinearUnitDependent M
, scaleUnit u1 u2
as a
continuous linear equivalence.
Equations
- ContinuousLinearUnitDependent.scaleUnitContLinearEquiv u1 u2 = { toLinearEquiv := LinearUnitDependent.scaleUnitLinearEquiv u1 u2, continuous_toFun := ⋯, continuous_invFun := ⋯ }
Instances For
Instances of the type classes #
We construct instance of the UnitDependent
, LinearUnitDependent
and
ContinuousLinearUnitDependent
type classes based on CarriesDimension
and functions.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- instLinearUnitDependentOfModuleCarriesDimension = { toUnitDependent := instMulUnitDependent.toUnitDependent, scaleUnit_add := ⋯, scaleUnit_smul := ⋯ }
Equations
- instContinuousLinearUnitDependentOfModuleCarriesDimensionOfContinuousConstSMulReal = { toLinearUnitDependent := instLinearUnitDependentOfModuleCarriesDimension, scaleUnit_cont := ⋯ }
Functions #
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
isDimensionallyCorrect #
A term of type M
carrying an instance of UnitDependent M
is said to be
dimensionally correct if under a change of units it remains the same.
More colloquially, something is dimensionally correct if it (e.g. it's value or its truth for a proposition) does not depend on the units it is written in.
For the case of m : M
with CarriesDimension M
then IsDimensionallyCorrect m
corresponds to the statement that m
does not depend on units, e.g. is zero
or the dimension of M
is zero.
Equations
- IsDimensionallyCorrect m = ∀ (u1 u2 : UnitChoices), UnitDependent.scaleUnit u1 u2 m = m
Instances For
Some type classes to help track dimensions #
The multiplication of an element of M1
with an element of M2
to get an element
of M3
in such a way that dimensions are preserved.
- hMul : M1 → M2 → M3
- mul_dim (m1 : Dimensionful M1) (m2 : Dimensionful M2) : HasDimension fun (u : UnitChoices) => ↑m1 u * ↑m2 u
Instances
Dim Subtype #
Given a type M
that depends on units, e.g. the function type M1 → M2
between two types
carrying a dimension, the subtype of M
which scales according to the dimension d
.
Equations
Instances For
Equations
- instCarriesDimensionElemDimSet M d = { toMulAction := instMulActionNNRealElemDimSet M d, d := d }