Documentation

LeanUnits.Framework.Quantities.Basic

structure Units.Quantity {δ : Type} (dim : δ) (α : Type) [AddCommGroup δ] :
  • val : α
Instances For
    def Units.instInhabitedQuantity.default {a✝ : Type} {a✝¹ : a✝} {a✝² : Type} [Inhabited a✝²] {a✝³ : AddCommGroup a✝} :
    Quantity a✝¹ a✝²
    Equations
    Instances For
      instance Units.instInhabitedQuantity {a✝ : Type} {a✝¹ : a✝} {a✝² : Type} [Inhabited a✝²] {a✝³ : AddCommGroup a✝} :
      Inhabited (Quantity a✝¹ a✝²)
      Equations
      instance Units.instBEqQuantity {δ✝ : Type} {dim✝ : δ✝} {α✝ : Type} {inst✝ : AddCommGroup δ✝} [BEq δ✝] [BEq α✝] :
      BEq (Quantity dim✝ α✝)
      Equations
      def Units.instBEqQuantity.beq {δ✝ : Type} {dim✝ : δ✝} {α✝ : Type} {inst✝ : AddCommGroup δ✝} [BEq δ✝] [BEq α✝] :
      Quantity dim✝ α✝Quantity dim✝ α✝Bool
      Equations
      Instances For
        def Units.instDecidableEqQuantity.decEq {δ✝ : Type} {dim✝ : δ✝} {α✝ : Type} {inst✝ : AddCommGroup δ✝} [DecidableEq δ✝] [DecidableEq α✝] (x✝ x✝¹ : Quantity dim✝ α✝) :
        Decidable (x✝ = x✝¹)
        Equations
        Instances For
          instance Units.instDecidableEqQuantity {δ✝ : Type} {dim✝ : δ✝} {α✝ : Type} {inst✝ : AddCommGroup δ✝} [DecidableEq δ✝] [DecidableEq α✝] :
          DecidableEq (Quantity dim✝ α✝)
          Equations
          instance Units.Quantity.instRepr {α δ : Type} [AddCommGroup δ] [Repr δ] {d : δ} [Repr α] :
          Repr (Quantity d α)
          Equations
          instance Units.Quantity.instToStringOfRepr {α δ : Type} [AddCommGroup δ] [Repr δ] {d : δ} [Repr α] :
          Equations
          instance Units.Quantity.instZero {α δ : Type} [AddCommGroup δ] {d : δ} [Zero α] :
          Zero (Quantity d α)
          Equations
          instance Units.Quantity.instOne {α δ : Type} [AddCommGroup δ] {d : δ} [One α] :
          One (Quantity d α)
          Equations
          def Units.Quantity.add {α δ : Type} [AddCommGroup δ] {d : δ} [Add α] (q1 q2 : Quantity d α) :
          Equations
          Instances For
            instance Units.Quantity.instAdd {α δ : Type} [AddCommGroup δ] {d : δ} [Add α] :
            Add (Quantity d α)
            Equations
            def Units.Quantity.sub {α δ : Type} [AddCommGroup δ] {d : δ} [Sub α] (q1 q2 : Quantity d α) :
            Equations
            Instances For
              instance Units.Quantity.instSub {α δ : Type} [AddCommGroup δ] {d : δ} [Sub α] :
              Sub (Quantity d α)
              Equations
              def Units.Quantity.neg {α δ : Type} [AddCommGroup δ] {d : δ} [Neg α] (q : Quantity d α) :
              Equations
              Instances For
                instance Units.Quantity.instNeg {α δ : Type} [AddCommGroup δ] {d : δ} [Neg α] :
                Neg (Quantity d α)
                Equations
                def Units.Quantity.hMul {α δ : Type} [AddCommGroup δ] {d₁ d₂ : δ} [Mul α] (q1 : Quantity d₁ α) (q2 : Quantity d₂ α) :
                Quantity (d₁ + d₂) α
                Equations
                Instances For
                  instance Units.Quantity.instHMulHAddOfMul {α δ : Type} [AddCommGroup δ] {d₁ d₂ : δ} [Mul α] :
                  HMul (Quantity d₁ α) (Quantity d₂ α) (Quantity (d₁ + d₂) α)
                  Equations
                  def Units.Quantity.hDiv {α δ : Type} [AddCommGroup δ] {d₁ d₂ : δ} [Div α] (q1 : Quantity d₁ α) (q2 : Quantity d₂ α) :
                  Quantity (d₁ - d₂) α
                  Equations
                  Instances For
                    instance Units.Quantity.instHDivHSubOfDiv {α δ : Type} [AddCommGroup δ] {d₁ d₂ : δ} [Div α] :
                    HDiv (Quantity d₁ α) (Quantity d₂ α) (Quantity (d₁ - d₂) α)
                    Equations
                    def Units.Quantity.smul {α δ : Type} [AddCommGroup δ] {d : δ} [SMul α α] (s : α) (q : Quantity d α) :
                    Equations
                    Instances For
                      def Units.Quantity.nsmul {α δ : Type} [AddCommGroup δ] {d : δ} [SMul α] (n : ) (q : Quantity d α) :
                      Equations
                      Instances For
                        def Units.Quantity.zsmul {α δ : Type} [AddCommGroup δ] {d : δ} [SMul α] (n : ) (q : Quantity d α) :
                        Equations
                        Instances For
                          def Units.Quantity.qsmul {α δ : Type} [AddCommGroup δ] {d : δ} [SMul α] (n : ) (q : Quantity d α) :
                          Equations
                          Instances For
                            instance Units.Quantity.instSMul {α δ : Type} [AddCommGroup δ] {d : δ} [SMul α α] :
                            SMul α (Quantity d α)
                            Equations
                            def Units.Quantity.npow {α δ : Type} [AddCommGroup δ] {d : δ} [Pow α ] (q : Quantity d α) (n : ) :
                            Quantity (n d) α
                            Equations
                            Instances For
                              def Units.Quantity.zpow {α δ : Type} [AddCommGroup δ] {d : δ} [Pow α ] (q : Quantity d α) (n : ) :
                              Quantity (n d) α
                              Equations
                              Instances For
                                def Units.Quantity.qpow {α δ : Type} [AddCommGroup δ] {d : δ} [Pow α ] [SMul δ] (q : Quantity d α) (n : ) :
                                Quantity (n d) α
                                Equations
                                Instances For
                                  def Units.Quantity.inv {α δ : Type} [AddCommGroup δ] {d : δ} [Inv α] (q : Quantity d α) :
                                  Quantity (-d) α
                                  Equations
                                  Instances For
                                    def Units.Quantity.fun_to_val {α δ : Type} [AddCommGroup δ] {d₁ d₂ : δ} (f : Quantity d₁ αQuantity d₂ α) :
                                    αα
                                    Equations
                                    Instances For
                                      noncomputable def Units.Quantity.deriv {α δ : Type} [AddCommGroup δ] {d₁ d₂ : δ} [NontriviallyNormedField α] (f : Quantity d₁ αQuantity d₂ α) (x : Quantity d₁ α) :
                                      Quantity (d₂ - d₁) α
                                      Equations
                                      Instances For
                                        noncomputable def Units.Quantity.integral {α δ : Type} [AddCommGroup δ] {d₁ d₂ : δ} [NormedAddCommGroup α] [NormedSpace α] [MeasurableSpace α] (f : Quantity d₁ αQuantity d₂ α) (μ : MeasureTheory.Measure α) :
                                        Quantity (d₁ + d₂) α
                                        Equations
                                        Instances For
                                          def Units.Quantity.lt {α δ : Type} [AddCommGroup δ] {d : δ} [LT α] (q1 q2 : Quantity d α) :
                                          Equations
                                          Instances For
                                            instance Units.Quantity.instLT {α δ : Type} [AddCommGroup δ] {d : δ} [LT α] :
                                            LT (Quantity d α)
                                            Equations
                                            def Units.Quantity.le {α δ : Type} [AddCommGroup δ] {d : δ} [LE α] (q1 q2 : Quantity d α) :
                                            Equations
                                            Instances For
                                              instance Units.Quantity.instLE {α δ : Type} [AddCommGroup δ] {d : δ} [LE α] :
                                              LE (Quantity d α)
                                              Equations
                                              def Units.Quantity.dimension {α δ : Type} [AddCommGroup δ] {d : δ} [HasDimension δ] :
                                              Equations
                                              Instances For
                                                def Units.Quantity.conversion {α δ : Type} [AddCommGroup δ] {d : δ} [HasConversion δ] :
                                                Equations
                                                Instances For
                                                  def Units.Quantity.units {α δ : Type} [AddCommGroup δ] {d : δ} :
                                                  Quantity d αδ
                                                  Equations
                                                  Instances For
                                                    def Units.Quantity.cast {α δ : Type} [AddCommGroup δ] {d₁ d₂ : δ} [HasEquiv δ] (q : Quantity d₁ α) :
                                                    autoParam (d₁ d₂) _auto✝Quantity d₂ α

                                                    Preferred notation for casting: write ↑x instead of cast x.

                                                    • Purpose: ↑x is equivalent to cast x and is the idiomatic, preferred syntax throughout this library. Please use this notation in new code and docs.
                                                    • Precedence: the operator has high priority and binds tightly; use parentheses when needed, e.g. ↑(f x) or (↑x).field.
                                                    • Typing the symbol: in Lean/VSCode, type \uparrow then space to get .

                                                    Examples:

                                                    • let q' : Quantity β := ↑q -- preferred
                                                    • -- instead of: cast q
                                                    Equations
                                                    Instances For
                                                      def Units.Quantity.convert {α δ : Type} [AddCommGroup δ] {d₁ d₂ : δ} [RatCast α] [Mul α] [Add α] [HasDimension δ] [HasConversion δ] (q : Quantity d₁ α) :
                                                      autoParam (𝒟 d₁ = 𝒟 d₂) _auto✝Quantity d₂ α

                                                      convert from one quantity to another of the same dimension

                                                      Preferred notation for convert: write q → instead of convert q.

                                                      • Purpose: q → is equivalent to convert q and is the idiomatic, preferred syntax throughout this library. Please use this notation in new code and docs.

                                                      Examples:

                                                      Equations
                                                      Instances For
                                                        def Units.Quantity.into {α δ : Type} [AddCommGroup δ] {d : δ} [RatCast α] [Mul α] [Add α] [HasDimension δ] [HasConversion δ] (q : Quantity d α) (target : δ) :
                                                        autoParam (𝒟 d = 𝒟 target) _auto✝Quantity target α

                                                        convert and cast in one step from one quantity to another of the same dimension the target is a unit

                                                        Examples: convert constant c from natural unit to meter per second: c.into (Unit.meter-Unit.second)

                                                        Equations
                                                        Instances For
                                                          def Units.Quantity.as {α δ : Type} [AddCommGroup δ] {d₁ d₂ : δ} [RatCast α] [Mul α] [Add α] [HasDimension δ] [HasConversion δ] (q : Quantity d₁ α) :
                                                          Quantity d₂ αautoParam (𝒟 d₁ = 𝒟 d₂) _auto✝Quantity d₂ α

                                                          convert and cast in one step from one quantity to another of the same dimension the target is another quantity

                                                          Examples:

                                                          Equations
                                                          Instances For

                                                            Preferred notation for casting: write ↑x instead of cast x.

                                                            • Purpose: ↑x is equivalent to cast x and is the idiomatic, preferred syntax throughout this library. Please use this notation in new code and docs.
                                                            • Precedence: the operator has high priority and binds tightly; use parentheses when needed, e.g. ↑(f x) or (↑x).field.
                                                            • Typing the symbol: in Lean/VSCode, type \uparrow then space to get .

                                                            Examples:

                                                            • let q' : Quantity β := ↑q -- preferred
                                                            • -- instead of: cast q
                                                            Equations
                                                            Instances For

                                                              convert from one quantity to another of the same dimension

                                                              Preferred notation for convert: write q → instead of convert q.

                                                              • Purpose: q → is equivalent to convert q and is the idiomatic, preferred syntax throughout this library. Please use this notation in new code and docs.

                                                              Examples:

                                                              Equations
                                                              Instances For