PhysLean Documentation

PhysLean.Units.UnitDependent

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

class UnitDependent (M : Type) :

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.

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.

    Instances

      A type M with an instance of UnitDependent M such that scaleUnit u1 u2 is compatible with the Module ℝ M instance on 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.

        Instances

          ## Basic properties of scaleUnit

          @[simp]
          theorem UnitDependent.scaleUnit_symm_apply {M : Type} [UnitDependent M] (u1 u2 : UnitChoices) (m : M) :
          scaleUnit u2 u1 (scaleUnit u1 u2 m) = m
          @[simp]
          theorem UnitDependent.scaleUnit_injective {M : Type} [UnitDependent M] (u1 u2 : UnitChoices) (m1 m2 : M) :
          scaleUnit u1 u2 m1 = scaleUnit u1 u2 m2 m1 = m2

          ### Variations on the map scaleUnit

          For an M with an instance of UnitDependent M, scaleUnit u1 u2 as an equivalence.

          Equations
          Instances For

            For an M with an instance of LinearUnitDependent M, scaleUnit u1 u2 as a linear map.

            Equations
            Instances For

              For an M with an instance of ContinuousLinearUnitDependent M, scaleUnit u1 u2 as a continuous linear map.

              Equations
              Instances For

                For an M with an instance of ContinuousLinearUnitDependent M, scaleUnit u1 u2 as a continuous linear equivalence.

                Equations
                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.
                  @[simp]
                  noncomputable instance instMulUnitDependent {M1 : Type} [CarriesDimension M1] :
                  Equations
                  • One or more equations did not get rendered due to their size.

                  Functions #

                  noncomputable instance instUnitDependentForall {M1 M2 : Type} [UnitDependent M2] :
                  UnitDependent (M1M2)
                  Equations
                  • One or more equations did not get rendered due to their size.
                  @[simp]
                  theorem UnitDependent.scaleUnit_apply_fun_right {M1 M2 : Type} [UnitDependent M2] (u1 u2 : UnitChoices) (f : M1M2) (m1 : M1) :
                  scaleUnit u1 u2 f m1 = scaleUnit u1 u2 (f m1)
                  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.
                  noncomputable instance instUnitDependentForall_1 {M1 M2 : Type} [UnitDependent M1] :
                  UnitDependent (M1M2)
                  Equations
                  • One or more equations did not get rendered due to their size.
                  @[simp]
                  theorem UnitDependent.scaleUnit_apply_fun_left {M1 M2 : Type} [UnitDependent M1] (u1 u2 : UnitChoices) (f : M1M2) (m1 : M1) :
                  scaleUnit u1 u2 f m1 = f (scaleUnit u2 u1 m1)
                  noncomputable instance instUnitDependentTwoSided {M1 M2 : Type} [UnitDependent M1] [UnitDependent M2] :
                  UnitDependent (M1M2)
                  Equations
                  • One or more equations did not get rendered due to their size.
                  @[simp]
                  theorem UnitDependent.scaleUnit_apply_fun {M1 M2 : Type} [UnitDependent M1] [UnitDependent M2] (u1 u2 : UnitChoices) (f : M1M2) (m1 : M1) :
                  scaleUnit u1 u2 f m1 = scaleUnit u1 u2 (f (scaleUnit u2 u1 m1))
                  noncomputable instance instUnitDependentTwoSidedMul {M1 M2 : Type} [UnitDependent M1] [MulAction NNReal M2] [MulUnitDependent M2] :
                  MulUnitDependent (M1M2)
                  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
                  Instances For
                    @[simp]
                    theorem isDimensionallyCorrect_fun_iff {M1 M2 : Type} [UnitDependent M1] [UnitDependent M2] {f : M1M2} :
                    @[simp]
                    theorem isDimensionallyCorrect_fun_left {M1 M2 : Type} [UnitDependent M1] {f : M1M2} :
                    IsDimensionallyCorrect f ∀ (u1 u2 : UnitChoices) (m : M1), f (UnitDependent.scaleUnit u2 u1 m) = f m
                    @[simp]
                    theorem isDimensionallyCorrect_fun_right {M1 M2 : Type} [UnitDependent M2] {f : M1M2} :
                    IsDimensionallyCorrect f ∀ (u1 u2 : UnitChoices) (m : M1), UnitDependent.scaleUnit u1 u2 (f m) = f m

                    Some type classes to help track dimensions #

                    class DMul (M1 M2 M3 : Type) [CarriesDimension M1] [CarriesDimension M2] [CarriesDimension M3] extends HMul M1 M2 M3 :

                    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.

                    Instances
                      @[simp]
                      theorem DMul.hMul_scaleUnit {M1 M2 M3 : Type} [CarriesDimension M1] [CarriesDimension M2] [CarriesDimension M3] [DMul M1 M2 M3] (m1 : M1) (m2 : M2) (u1 u2 : UnitChoices) :

                      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
                        @[simp]
                        theorem scaleUnit_dimSet_val {M : Type} [MulAction NNReal M] [MulUnitDependent M] (d : Dimension) (m : (DimSet M d)) (u1 u2 : UnitChoices) :
                        theorem DimSet.mem_iff {M : Type} [MulAction NNReal M] [MulUnitDependent M] (d : Dimension) (m : M) :
                        m DimSet M d ∀ (u1 u2 : UnitChoices), UnitDependent.scaleUnit u1 u2 m = (u1.dimScale u2) d m