Documentation

Init.Data.UInt.BasicAux

This module exists to provide the very basic UInt8 etc. definitions required for Init.Data.Char.Basic and Init.Data.Array.Basic. These are very important as they are used in meta code that is then (transitively) used in Init.Data.UInt.Basic and Init.Data.BitVec.Basic. This file thus breaks the import cycle that would be created by this dependency.

Equations
  • x.val = x.toBitVec.toFin
Instances For
    @[extern lean_uint8_of_nat]
    def UInt8.ofNat (n : Nat) :
    Instances For
      @[reducible, inline]
      abbrev Nat.toUInt8 (n : Nat) :
      Equations
      Instances For
        @[extern lean_uint8_to_nat]
        def UInt8.toNat (n : UInt8) :
        Equations
        • n.toNat = n.toBitVec.toNat
        Instances For
          Equations
          • x.val = x.toBitVec.toFin
          Instances For
            @[extern lean_uint16_of_nat]
            Instances For
              @[reducible, inline]
              abbrev Nat.toUInt16 (n : Nat) :
              Instances For
                @[extern lean_uint16_to_nat]
                Equations
                • n.toNat = n.toBitVec.toNat
                Instances For
                  @[extern lean_uint16_to_uint8]
                  Equations
                  • a.toUInt8 = a.toNat.toUInt8
                  Instances For
                    @[extern lean_uint8_to_uint16]
                    Equations
                    • a.toUInt16 = { toBitVec := { toFin := a.toNat, } }
                    Instances For
                      Equations
                      • x.val = x.toBitVec.toFin
                      Instances For
                        @[extern lean_uint32_of_nat]
                        Equations
                        Instances For
                          @[extern lean_uint32_of_nat]
                          def UInt32.ofNat' (n : Nat) (h : n < UInt32.size) :
                          Equations
                          Instances For

                            Converts the given natural number to UInt32, but returns 2^32 - 1 for natural numbers >= 2^32.

                            Equations
                            Instances For
                              @[reducible, inline]
                              abbrev Nat.toUInt32 (n : Nat) :
                              Equations
                              Instances For
                                @[extern lean_uint32_to_uint8]
                                Instances For
                                  @[extern lean_uint32_to_uint16]
                                  Equations
                                  • a.toUInt16 = a.toNat.toUInt16
                                  Instances For
                                    @[extern lean_uint8_to_uint32]
                                    Instances For
                                      @[extern lean_uint16_to_uint32]
                                      Equations
                                      • a.toUInt32 = { toBitVec := { toFin := a.toNat, } }
                                      Instances For
                                        instance UInt32.instOfNat {n : Nat} :
                                        Equations
                                        theorem UInt32.ofNat'_lt_of_lt {n m : Nat} (h1 : n < UInt32.size) (h2 : m < UInt32.size) :
                                        n < mUInt32.ofNat' n h1 < UInt32.ofNat m
                                        theorem UInt32.lt_ofNat'_of_lt {n m : Nat} (h1 : n < UInt32.size) (h2 : m < UInt32.size) :
                                        m < nUInt32.ofNat m < UInt32.ofNat' n h1
                                        Equations
                                        • x.val = x.toBitVec.toFin
                                        Instances For
                                          @[extern lean_uint64_of_nat]
                                          Equations
                                          Instances For
                                            @[reducible, inline]
                                            abbrev Nat.toUInt64 (n : Nat) :
                                            Equations
                                            Instances For
                                              @[extern lean_uint64_to_nat]
                                              Equations
                                              • n.toNat = n.toBitVec.toNat
                                              Instances For
                                                @[extern lean_uint64_to_uint8]
                                                Equations
                                                • a.toUInt8 = a.toNat.toUInt8
                                                Instances For
                                                  @[extern lean_uint64_to_uint16]
                                                  Instances For
                                                    @[extern lean_uint64_to_uint32]
                                                    Instances For
                                                      @[extern lean_uint8_to_uint64]
                                                      Equations
                                                      • a.toUInt64 = { toBitVec := { toFin := a.toNat, } }
                                                      Instances For
                                                        @[extern lean_uint16_to_uint64]
                                                        Equations
                                                        • a.toUInt64 = { toBitVec := { toFin := a.toNat, } }
                                                        Instances For
                                                          @[extern lean_uint32_to_uint64]
                                                          Equations
                                                          • a.toUInt64 = { toBitVec := { toFin := a.toNat, } }
                                                          Instances For
                                                            instance UInt64.instOfNat {n : Nat} :
                                                            Equations
                                                            @[deprecated usize_size_pos]
                                                            Equations
                                                            • x.val = x.toBitVec.toFin
                                                            Instances For
                                                              @[extern lean_usize_of_nat]
                                                              def USize.ofNat (n : Nat) :
                                                              Equations
                                                              Instances For
                                                                @[reducible, inline]
                                                                abbrev Nat.toUSize (n : Nat) :
                                                                Instances For
                                                                  @[extern lean_usize_to_nat]
                                                                  def USize.toNat (n : USize) :
                                                                  Equations
                                                                  • n.toNat = n.toBitVec.toNat
                                                                  Instances For
                                                                    @[extern lean_usize_add]
                                                                    def USize.add (a b : USize) :
                                                                    Equations
                                                                    • a.add b = { toBitVec := a.toBitVec + b.toBitVec }
                                                                    Instances For
                                                                      @[extern lean_usize_sub]
                                                                      def USize.sub (a b : USize) :
                                                                      Instances For
                                                                        def USize.lt (a b : USize) :
                                                                        Equations
                                                                        • a.lt b = (a.toBitVec < b.toBitVec)
                                                                        Instances For
                                                                          def USize.le (a b : USize) :
                                                                          Instances For
                                                                            instance USize.instOfNat {n : Nat} :
                                                                            Equations
                                                                            Equations
                                                                            instance instLTUSize :
                                                                            Equations
                                                                            instance instLEUSize :
                                                                            Equations
                                                                            @[extern lean_usize_dec_lt]
                                                                            def USize.decLt (a b : USize) :
                                                                            Decidable (a < b)
                                                                            Instances For
                                                                              @[extern lean_usize_dec_le]
                                                                              def USize.decLe (a b : USize) :
                                                                              Instances For
                                                                                instance instDecidableLtUSize (a b : USize) :
                                                                                Decidable (a < b)
                                                                                Equations