PhysLean Documentation

PhysLean.Units.WithDim.Basic

WithDim #

WithDim is the type M which carrying the dimension d.

structure WithDim (d : Dimension) (M : Type) [MulAction NNReal M] :

The type M carrying an instance of a dimension d.

  • val : M

    The underlying value of M.

Instances For
    theorem WithDim.ext {d : Dimension} {M : Type} [MulAction NNReal M] (x1 x2 : WithDim d M) (h : x1.val = x2.val) :
    x1 = x2
    theorem WithDim.ext_iff {d : Dimension} {M : Type} [MulAction NNReal M] {x1 x2 : WithDim d M} :
    x1 = x2 x1.val = x2.val
    Equations
    @[simp]
    theorem WithDim.smul_val {d : Dimension} {M : Type} [MulAction NNReal M] (a : NNReal) (m : WithDim d M) :
    (a m).val = a m.val
    Equations
    theorem WithDim.withDim_hMul_val {d1 d2 : Dimension} (m1 : WithDim d1 ) (m2 : WithDim d2 ) :
    (m1 * m2).val = m1.val * m2.val
    @[simp]
    theorem WithDim.val_mul_eq_mul {d1 d2 : Dimension} (m1 : WithDim d1 ) (m2 : WithDim d2 ) :
    m1.val * m2.val = (m1 * m2).val
    @[simp]
    theorem WithDim.val_pow_two_eq_mul {d1 : Dimension} (m1 : WithDim d1 ) :
    m1.val ^ 2 = (m1 * m1).val
    theorem WithDim.scaleUnit_val_eq_scaleUnit_val_of_dim_eq {d1 d2 : Dimension} {M : Type} [MulAction NNReal M] {u1 u2 : UnitChoices} {m1 : WithDim d1 M} {m2 : WithDim d2 M} (h : d1 = d2 := by ext <;> { simp; try ring }) :
    theorem WithDim.scaleUnit_val {d : Dimension} (M : Type) [MulAction NNReal M] (u1 u2 : UnitChoices) (m1 : WithDim d M) :
    (UnitDependent.scaleUnit u1 u2 m1).val = (u1.dimScale u2) d m1.val

    Division #

    noncomputable instance WithDim.instHDivRealHMulDimensionInv (d1 d2 : Dimension) :
    HDiv (WithDim d1 ) (WithDim d2 ) (WithDim (d1 * d2⁻¹) )
    Equations
    @[simp]
    theorem WithDim.val_div_val {d1 d2 : Dimension} (m1 : WithDim d1 ) (m2 : WithDim d2 ) :
    m1.val / m2.val = (m1 / m2).val
    @[simp]
    theorem WithDim.div_scaleUnit {d1 d2 : Dimension} (m1 : WithDim d1 ) (m2 : WithDim d2 ) (u1 u2 : UnitChoices) :
    @[simp]
    theorem WithDim.scaleUnit_dim_eq_zero {d : Dimension} (m : WithDim d ) (u1 u2 : UnitChoices) (h : d = 1 := by ext <;> { simp; try ring }) :

    Casting #

    def WithDim.cast {d d2 : Dimension} {M : Type} [MulAction NNReal M] (m : WithDim d M) (h : d = d2 := by ext <;> { simp; try ring }) :
    WithDim d2 M

    The casting from WithDim d M to WithDim d2 M when d = d2.

    Equations
    Instances For
      @[simp]
      theorem WithDim.cast_refl {d : Dimension} {M : Type} [MulAction NNReal M] (m : WithDim d M) :
      m.cast = m
      @[simp]
      theorem WithDim.cast_scaleUnit {d d2 : Dimension} {M : Type} [MulAction NNReal M] (m : WithDim d M) (h : d = d2) (u1 u2 : UnitChoices) :