Documentation

LeanUnits.Framework.Units.Basic

@[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
    structure Units.Unit :

    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₂)
    Instances For
      def Units.instDecidableEqUnit.decEq (x✝ x✝¹ : Unit) :
      Decidable (x✝ = x✝¹)
      Equations
      Instances For
        Equations
        Instances For
          Equations
          Equations
          Equations
          Equations
          Equations
          Equations
          Instances For
            Equations
            Instances For

              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

              Define a base unit with a given name and dimension.

              Example:

              Equations
              Instances For
                def Units.Unit.defineDerivedUnit (s : String) (u : Unit) (conv : Conversion := 0) :

                Define a derived unit with a given name, unit and optional conversion. Example:

                Equations
                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.