Documentation

Init.Data.SInt.Basic

This module contains the definition of signed fixed width integer types as well as basic arithmetic and bitwise operations on top of it.

structure Int8 :

Signed 8-bit integers.

This type has special support in the compiler so it can be represented by an unboxed 8-bit value.

  • ofUInt8 :: (
    • toUInt8 : UInt8

      Converts an 8-bit signed integer into the 8-bit unsigned integer that is its two's complement encoding.

  • )
Instances For
    structure Int16 :

    Signed 16-bit integers.

    This type has special support in the compiler so it can be represented by an unboxed 16-bit value.

    • ofUInt16 :: (
      • toUInt16 : UInt16

        Converts an 16-bit signed integer into the 16-bit unsigned integer that is its two's complement encoding.

    • )
    Instances For
      structure Int32 :

      Signed 32-bit integers.

      This type has special support in the compiler so it can be represented by an unboxed 32-bit value.

      • ofUInt32 :: (
        • toUInt32 : UInt32

          Converts an 32-bit signed integer into the 32-bit unsigned integer that is its two's complement encoding.

      • )
      Instances For
        structure Int64 :

        Signed 64-bit integers.

        This type has special support in the compiler so it can be represented by an unboxed 64-bit value.

        • ofUInt64 :: (
          • toUInt64 : UInt64

            Converts an 64-bit signed integer into the 64-bit unsigned integer that is its two's complement encoding.

        • )
        Instances For
          structure ISize :

          Signed integers that are the size of a word on the platform's architecture.

          On a 32-bit architecture, ISize is equivalent to Int32. On a 64-bit machine, it is equivalent to Int64. This type has special support in the compiler so it can be represented by an unboxed value.

          • ofUSize :: (
            • toUSize : USize

              Converts a word-sized signed integer into the word-sized unsigned integer that is its two's complement encoding.

          • )
          Instances For
            @[reducible, inline]
            abbrev Int8.size :

            The number of distinct values representable by Int8, that is, 2^8 = 256.

            Equations
            Instances For
              @[inline]

              Obtain the BitVec that contains the 2's complement representation of the Int8.

              Equations
              Instances For
                theorem Int8.toBitVec.inj {x y : Int8} :
                x.toBitVec = y.toBitVecx = y
                @[inline]

                Obtains the Int8 that is 2's complement equivalent to the UInt8.

                Equations
                Instances For
                  @[inline, deprecated UInt8.toInt8 (since := "2025-02-13")]
                  def Int8.mk (i : UInt8) :

                  Obtains the Int8 that is 2's complement equivalent to the UInt8.

                  Equations
                  Instances For
                    @[extern lean_int8_of_int]
                    def Int8.ofInt (i : Int) :

                    Converts an arbitrary-precision integer to an 8-bit integer, wrapping on overflow or underflow.

                    This function is overridden at runtime with an efficient implementation.

                    Examples:

                    Equations
                    Instances For
                      @[extern lean_int8_of_nat]
                      def Int8.ofNat (n : Nat) :

                      Converts a natural number to an 8-bit signed integer, wrapping around on overflow.

                      This function is overridden at runtime with an efficient implementation.

                      Examples:

                      Equations
                      Instances For
                        @[reducible, inline]
                        abbrev Int.toInt8 (i : Int) :

                        Converts an arbitrary-precision integer to an 8-bit integer, wrapping on overflow or underflow.

                        Examples:

                        Equations
                        Instances For
                          @[reducible, inline]
                          abbrev Nat.toInt8 (n : Nat) :

                          Converts a natural number to an 8-bit signed integer, wrapping around to negative numbers on overflow.

                          Examples:

                          Equations
                          Instances For
                            @[extern lean_int8_to_int]
                            def Int8.toInt (i : Int8) :

                            Converts an 8-bit signed integer to an arbitrary-precision integer that denotes the same number.

                            This function is overridden at runtime with an efficient implementation.

                            Equations
                            Instances For
                              @[inline]

                              Converts an 8-bit signed integer to a natural number, mapping all negative numbers to 0.

                              Use Int8.toBitVec to obtain the two's complement representation.

                              Equations
                              Instances For
                                @[inline, deprecated Int8.toNatClampNeg (since := "2025-02-13")]
                                def Int8.toNat (i : Int8) :

                                Converts an 8-bit signed integer to a natural number, mapping all negative numbers to 0.

                                Use Int8.toBitVec to obtain the two's complement representation.

                                Equations
                                Instances For
                                  @[inline]

                                  Obtains the Int8 whose 2's complement representation is the given BitVec 8.

                                  Equations
                                  Instances For
                                    @[extern lean_int8_neg]
                                    def Int8.neg (i : Int8) :

                                    Negates 8-bit signed integers. Usually accessed via the - prefix operator.

                                    This function is overridden at runtime with an efficient implementation.

                                    Equations
                                    Instances For
                                      Equations
                                      Equations
                                      Equations
                                      instance Int8.instOfNat {n : Nat} :
                                      Equations
                                      Equations
                                      @[reducible, inline]

                                      The largest number that Int8 can represent: 2^7 - 1 = 127.

                                      Equations
                                      Instances For
                                        @[reducible, inline]

                                        The smallest number that Int8 can represent: -2^7 = -128.

                                        Equations
                                        Instances For
                                          @[inline]
                                          def Int8.ofIntLE (i : Int) (_hl : minValue.toInt i) (_hr : i maxValue.toInt) :

                                          Constructs an Int8 from an Int that is known to be in bounds.

                                          Equations
                                          Instances For

                                            Constructs an Int8 from an Int, clamping if the value is too small or too large.

                                            Equations
                                            Instances For
                                              @[extern lean_int8_add]
                                              def Int8.add (a b : Int8) :

                                              Adds two 8-bit signed integers, wrapping around on over- or underflow. Usually accessed via the + operator.

                                              This function is overridden at runtime with an efficient implementation.

                                              Equations
                                              Instances For
                                                @[extern lean_int8_sub]
                                                def Int8.sub (a b : Int8) :

                                                Subtracts one 8-bit signed integer from another, wrapping around on over- or underflow. Usually accessed via the - operator.

                                                This function is overridden at runtime with an efficient implementation.

                                                Equations
                                                Instances For
                                                  @[extern lean_int8_mul]
                                                  def Int8.mul (a b : Int8) :

                                                  Multiplies two 8-bit signed integers, wrapping around on over- or underflow. Usually accessed via the * operator.

                                                  This function is overridden at runtime with an efficient implementation.

                                                  Equations
                                                  Instances For
                                                    @[extern lean_int8_div]
                                                    def Int8.div (a b : Int8) :

                                                    Truncating division for 8-bit signed integers, rounding towards zero. Usually accessed via the / operator.

                                                    Division by zero is defined to be zero.

                                                    This function is overridden at runtime with an efficient implementation.

                                                    Examples:

                                                    Equations
                                                    Instances For
                                                      @[extern lean_int8_mod]
                                                      def Int8.mod (a b : Int8) :

                                                      The modulo operator for 8-bit signed integers, which computes the remainder when dividing one integer by another with the T-rounding convention used by Int8.div. Usually accessed via the % operator.

                                                      When the divisor is 0, the result is the dividend rather than an error.

                                                      This function is overridden at runtime with an efficient implementation.

                                                      Examples:

                                                      Equations
                                                      Instances For
                                                        @[extern lean_int8_land]
                                                        def Int8.land (a b : Int8) :

                                                        Bitwise and for 8-bit signed integers. Usually accessed via the &&& operator.

                                                        Each bit of the resulting integer is set if the corresponding bits of both input integers are set, according to the two's complement representation.

                                                        This function is overridden at runtime with an efficient implementation.

                                                        Equations
                                                        Instances For
                                                          @[extern lean_int8_lor]
                                                          def Int8.lor (a b : Int8) :

                                                          Bitwise or for 8-bit signed integers. Usually accessed via the ||| operator.

                                                          Each bit of the resulting integer is set if at least one of the corresponding bits of the input integers is set, according to the two's complement representation.

                                                          This function is overridden at runtime with an efficient implementation.

                                                          Equations
                                                          Instances For
                                                            @[extern lean_int8_xor]
                                                            def Int8.xor (a b : Int8) :

                                                            Bitwise exclusive or for 8-bit signed integers. Usually accessed via the ^^^ operator.

                                                            Each bit of the resulting integer is set if exactly one of the corresponding bits of the input integers is set, according to the two's complement representation.

                                                            This function is overridden at runtime with an efficient implementation.

                                                            Equations
                                                            Instances For
                                                              @[extern lean_int8_shift_left]
                                                              def Int8.shiftLeft (a b : Int8) :

                                                              Bitwise left shift for 8-bit signed integers. Usually accessed via the <<< operator.

                                                              Signed integers are interpreted as bitvectors according to the two's complement representation.

                                                              This function is overridden at runtime with an efficient implementation.

                                                              Equations
                                                              Instances For
                                                                @[extern lean_int8_shift_right]

                                                                Arithmetic right shift for 8-bit signed integers. Usually accessed via the <<< operator.

                                                                The high bits are filled with the value of the most significant bit.

                                                                This function is overridden at runtime with an efficient implementation.

                                                                Equations
                                                                Instances For
                                                                  @[extern lean_int8_complement]

                                                                  Bitwise complement, also known as bitwise negation, for 8-bit signed integers. Usually accessed via the ~~~ prefix operator.

                                                                  Each bit of the resulting integer is the opposite of the corresponding bit of the input integer. Integers use the two's complement representation, so Int8.complement a = -(a + 1).

                                                                  This function is overridden at runtime with an efficient implementation.

                                                                  Equations
                                                                  Instances For
                                                                    @[extern lean_int8_abs]
                                                                    def Int8.abs (a : Int8) :

                                                                    Computes the absolute value of an 8-bit signed integer.

                                                                    This function is equivalent to if a < 0 then -a else a, so in particular Int8.minValue will be mapped to Int8.minValue.

                                                                    This function is overridden at runtime with an efficient implementation.

                                                                    Equations
                                                                    Instances For
                                                                      @[extern lean_int8_dec_eq]
                                                                      def Int8.decEq (a b : Int8) :
                                                                      Decidable (a = b)

                                                                      Decides whether two 8-bit signed integers are equal. Usually accessed via the DecidableEq Int8 instance.

                                                                      This function is overridden at runtime with an efficient implementation.

                                                                      Examples:

                                                                      • Int8.decEq 123 123 = .isTrue rfl
                                                                      • (if ((-7) : Int8) = 7 then "yes" else "no") = "no"
                                                                      • show (7 : Int8) = 7 by decide
                                                                      Equations
                                                                      Instances For
                                                                        def Int8.lt (a b : Int8) :

                                                                        Strict inequality of 8-bit signed integers, defined as inequality of the corresponding integers. Usually accessed via the < operator.

                                                                        Equations
                                                                        Instances For
                                                                          def Int8.le (a b : Int8) :

                                                                          Non-strict inequality of 8-bit signed integers, defined as inequality of the corresponding integers. Usually accessed via the operator.

                                                                          Equations
                                                                          Instances For
                                                                            Equations
                                                                            instance instAddInt8 :
                                                                            Equations
                                                                            instance instSubInt8 :
                                                                            Equations
                                                                            instance instMulInt8 :
                                                                            Equations
                                                                            instance instModInt8 :
                                                                            Equations
                                                                            instance instDivInt8 :
                                                                            Equations
                                                                            instance instLTInt8 :
                                                                            Equations
                                                                            instance instLEInt8 :
                                                                            Equations
                                                                            Equations
                                                                            Equations
                                                                            instance instXorInt8 :
                                                                            Equations
                                                                            @[extern lean_bool_to_int8]
                                                                            def Bool.toInt8 (b : Bool) :

                                                                            Converts true to 1 and false to 0.

                                                                            Equations
                                                                            Instances For
                                                                              @[extern lean_int8_dec_lt]
                                                                              def Int8.decLt (a b : Int8) :
                                                                              Decidable (a < b)

                                                                              Decides whether one 8-bit signed integer is strictly less than another. Usually accessed via the DecidableLT Int8 instance.

                                                                              This function is overridden at runtime with an efficient implementation.

                                                                              Examples:

                                                                              • (if ((-7) : Int8) < 7 then "yes" else "no") = "yes"
                                                                              • (if (5 : Int8) < 5 then "yes" else "no") = "no"
                                                                              • show ¬((7 : Int8) < 7) by decide
                                                                              Equations
                                                                              Instances For
                                                                                @[extern lean_int8_dec_le]
                                                                                def Int8.decLe (a b : Int8) :

                                                                                Decides whether one 8-bit signed integer is less than or equal to another. Usually accessed via the DecidableLE Int8 instance.

                                                                                This function is overridden at runtime with an efficient implementation.

                                                                                Examples:

                                                                                • (if ((-7) : Int8) ≤ 7 then "yes" else "no") = "yes"
                                                                                • (if (15 : Int8) ≤ 15 then "yes" else "no") = "yes"
                                                                                • (if (15 : Int8) ≤ 5 then "yes" else "no") = "no"
                                                                                • show (7 : Int8) ≤ 7 by decide
                                                                                Equations
                                                                                Instances For
                                                                                  instance instDecidableLtInt8 (a b : Int8) :
                                                                                  Decidable (a < b)
                                                                                  Equations
                                                                                  instance instDecidableLeInt8 (a b : Int8) :
                                                                                  Equations
                                                                                  @[reducible, inline]
                                                                                  abbrev Int16.size :

                                                                                  The number of distinct values representable by Int16, that is, 2^16 = 65536.

                                                                                  Equations
                                                                                  Instances For
                                                                                    @[inline]

                                                                                    Obtain the BitVec that contains the 2's complement representation of the Int16.

                                                                                    Equations
                                                                                    Instances For
                                                                                      theorem Int16.toBitVec.inj {x y : Int16} :
                                                                                      x.toBitVec = y.toBitVecx = y
                                                                                      @[inline]

                                                                                      Obtains the Int16 that is 2's complement equivalent to the UInt16.

                                                                                      Equations
                                                                                      Instances For
                                                                                        @[inline, deprecated UInt16.toInt16 (since := "2025-02-13")]
                                                                                        def Int16.mk (i : UInt16) :

                                                                                        Obtains the Int16 that is 2's complement equivalent to the UInt16.

                                                                                        Equations
                                                                                        Instances For
                                                                                          @[extern lean_int16_of_int]
                                                                                          def Int16.ofInt (i : Int) :

                                                                                          Converts an arbitrary-precision integer to a 16-bit signed integer, wrapping on overflow or underflow.

                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                          Examples:

                                                                                          Equations
                                                                                          Instances For
                                                                                            @[extern lean_int16_of_nat]
                                                                                            def Int16.ofNat (n : Nat) :

                                                                                            Converts a natural number to a 16-bit signed integer, wrapping around on overflow.

                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                            Examples:

                                                                                            Equations
                                                                                            Instances For
                                                                                              @[reducible, inline]
                                                                                              abbrev Int.toInt16 (i : Int) :

                                                                                              Converts an arbitrary-precision integer to a 16-bit integer, wrapping on overflow or underflow.

                                                                                              Examples:

                                                                                              Equations
                                                                                              Instances For
                                                                                                @[reducible, inline]
                                                                                                abbrev Nat.toInt16 (n : Nat) :

                                                                                                Converts a natural number to a 16-bit signed integer, wrapping around to negative numbers on overflow.

                                                                                                Examples:

                                                                                                Equations
                                                                                                Instances For
                                                                                                  @[extern lean_int16_to_int]
                                                                                                  def Int16.toInt (i : Int16) :

                                                                                                  Converts a 16-bit signed integer to an arbitrary-precision integer that denotes the same number.

                                                                                                  This function is overridden at runtime with an efficient implementation.

                                                                                                  Equations
                                                                                                  Instances For
                                                                                                    @[inline]

                                                                                                    Converts a 16-bit signed integer to a natural number, mapping all negative numbers to 0.

                                                                                                    Use Int16.toBitVec to obtain the two's complement representation.

                                                                                                    Equations
                                                                                                    Instances For
                                                                                                      @[inline, deprecated Int16.toNatClampNeg (since := "2025-02-13")]
                                                                                                      def Int16.toNat (i : Int16) :

                                                                                                      Converts a 16-bit signed integer to a natural number, mapping all negative numbers to 0.

                                                                                                      Use Int16.toBitVec to obtain the two's complement representation.

                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        @[inline]

                                                                                                        Obtains the Int16 whose 2's complement representation is the given BitVec 16.

                                                                                                        Equations
                                                                                                        Instances For
                                                                                                          @[extern lean_int16_to_int8]

                                                                                                          Converts 16-bit signed integers to 8-bit signed integers by truncating their bitvector representation.

                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                          Equations
                                                                                                          Instances For
                                                                                                            @[extern lean_int8_to_int16]

                                                                                                            Converts 8-bit signed integers to 16-bit signed integers that denote the same number.

                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                            Equations
                                                                                                            Instances For
                                                                                                              @[extern lean_int16_neg]
                                                                                                              def Int16.neg (i : Int16) :

                                                                                                              Negates 16-bit signed integers. Usually accessed via the - prefix operator.

                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                              Equations
                                                                                                              Instances For
                                                                                                                Equations
                                                                                                                Equations
                                                                                                                Equations
                                                                                                                instance Int16.instOfNat {n : Nat} :
                                                                                                                Equations
                                                                                                                Equations
                                                                                                                @[reducible, inline]

                                                                                                                The largest number that Int16 can represent: 2^15 - 1 = 32767.

                                                                                                                Equations
                                                                                                                Instances For
                                                                                                                  @[reducible, inline]

                                                                                                                  The smallest number that Int16 can represent: -2^15 = -32768.

                                                                                                                  Equations
                                                                                                                  Instances For
                                                                                                                    @[inline]
                                                                                                                    def Int16.ofIntLE (i : Int) (_hl : minValue.toInt i) (_hr : i maxValue.toInt) :

                                                                                                                    Constructs an Int16 from an Int that is known to be in bounds.

                                                                                                                    Equations
                                                                                                                    Instances For

                                                                                                                      Constructs an Int16 from an Int, clamping if the value is too small or too large.

                                                                                                                      Equations
                                                                                                                      Instances For
                                                                                                                        @[extern lean_int16_add]
                                                                                                                        def Int16.add (a b : Int16) :

                                                                                                                        Adds two 16-bit signed integers, wrapping around on over- or underflow. Usually accessed via the + operator.

                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                        Equations
                                                                                                                        Instances For
                                                                                                                          @[extern lean_int16_sub]
                                                                                                                          def Int16.sub (a b : Int16) :

                                                                                                                          Subtracts one 16-bit signed integer from another, wrapping around on over- or underflow. Usually accessed via the - operator.

                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                          Equations
                                                                                                                          Instances For
                                                                                                                            @[extern lean_int16_mul]
                                                                                                                            def Int16.mul (a b : Int16) :

                                                                                                                            Multiplies two 16-bit signed integers, wrapping around on over- or underflow. Usually accessed via the * operator.

                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                            Equations
                                                                                                                            Instances For
                                                                                                                              @[extern lean_int16_div]
                                                                                                                              def Int16.div (a b : Int16) :

                                                                                                                              Truncating division for 16-bit signed integers, rounding towards zero. Usually accessed via the / operator.

                                                                                                                              Division by zero is defined to be zero.

                                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                                              Examples:

                                                                                                                              Equations
                                                                                                                              Instances For
                                                                                                                                @[extern lean_int16_mod]
                                                                                                                                def Int16.mod (a b : Int16) :

                                                                                                                                The modulo operator for 16-bit signed integers, which computes the remainder when dividing one integer by another with the T-rounding convention used by Int16.div. Usually accessed via the % operator.

                                                                                                                                When the divisor is 0, the result is the dividend rather than an error.

                                                                                                                                This function is overridden at runtime with an efficient implementation.

                                                                                                                                Examples:

                                                                                                                                Equations
                                                                                                                                Instances For
                                                                                                                                  @[extern lean_int16_land]
                                                                                                                                  def Int16.land (a b : Int16) :

                                                                                                                                  Bitwise and for 16-bit signed integers. Usually accessed via the &&& operator.

                                                                                                                                  Each bit of the resulting integer is set if the corresponding bits of both input integers are set, according to the two's complement representation.

                                                                                                                                  This function is overridden at runtime with an efficient implementation.

                                                                                                                                  Equations
                                                                                                                                  Instances For
                                                                                                                                    @[extern lean_int16_lor]
                                                                                                                                    def Int16.lor (a b : Int16) :

                                                                                                                                    Bitwise or for 16-bit signed integers. Usually accessed via the ||| operator.

                                                                                                                                    Each bit of the resulting integer is set if at least one of the corresponding bits of the input integers is set, according to the two's complement representation.

                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                    Equations
                                                                                                                                    Instances For
                                                                                                                                      @[extern lean_int16_xor]
                                                                                                                                      def Int16.xor (a b : Int16) :

                                                                                                                                      Bitwise exclusive or for 16-bit signed integers. Usually accessed via the ^^^ operator.

                                                                                                                                      Each bit of the resulting integer is set if exactly one of the corresponding bits of the input integers is set, according to the two's complement representation.

                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                      Equations
                                                                                                                                      Instances For
                                                                                                                                        @[extern lean_int16_shift_left]

                                                                                                                                        Bitwise left shift for 16-bit signed integers. Usually accessed via the <<< operator.

                                                                                                                                        Signed integers are interpreted as bitvectors according to the two's complement representation.

                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                        Equations
                                                                                                                                        Instances For
                                                                                                                                          @[extern lean_int16_shift_right]

                                                                                                                                          Arithmetic right shift for 16-bit signed integers. Usually accessed via the <<< operator.

                                                                                                                                          The high bits are filled with the value of the most significant bit.

                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                          Equations
                                                                                                                                          Instances For
                                                                                                                                            @[extern lean_int16_complement]

                                                                                                                                            Bitwise complement, also known as bitwise negation, for 16-bit signed integers. Usually accessed via the ~~~ prefix operator.

                                                                                                                                            Each bit of the resulting integer is the opposite of the corresponding bit of the input integer. Integers use the two's complement representation, so Int16.complement a = -(a + 1).

                                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                                            Equations
                                                                                                                                            Instances For
                                                                                                                                              @[extern lean_int16_abs]
                                                                                                                                              def Int16.abs (a : Int16) :

                                                                                                                                              Computes the absolute value of a 16-bit signed integer.

                                                                                                                                              This function is equivalent to if a < 0 then -a else a, so in particular Int16.minValue will be mapped to Int16.minValue.

                                                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                                                              Equations
                                                                                                                                              Instances For
                                                                                                                                                @[extern lean_int16_dec_eq]
                                                                                                                                                def Int16.decEq (a b : Int16) :
                                                                                                                                                Decidable (a = b)

                                                                                                                                                Decides whether two 16-bit signed integers are equal. Usually accessed via the DecidableEq Int16 instance.

                                                                                                                                                This function is overridden at runtime with an efficient implementation.

                                                                                                                                                Examples:

                                                                                                                                                • Int16.decEq 123 123 = .isTrue rfl
                                                                                                                                                • (if ((-7) : Int16) = 7 then "yes" else "no") = "no"
                                                                                                                                                • show (7 : Int16) = 7 by decide
                                                                                                                                                Equations
                                                                                                                                                Instances For
                                                                                                                                                  def Int16.lt (a b : Int16) :

                                                                                                                                                  Strict inequality of 16-bit signed integers, defined as inequality of the corresponding integers. Usually accessed via the < operator.

                                                                                                                                                  Equations
                                                                                                                                                  Instances For
                                                                                                                                                    def Int16.le (a b : Int16) :

                                                                                                                                                    Non-strict inequality of 16-bit signed integers, defined as inequality of the corresponding integers. Usually accessed via the operator.

                                                                                                                                                    Equations
                                                                                                                                                    Instances For
                                                                                                                                                      Equations
                                                                                                                                                      Equations
                                                                                                                                                      Equations
                                                                                                                                                      Equations
                                                                                                                                                      Equations
                                                                                                                                                      Equations
                                                                                                                                                      instance instLTInt16 :
                                                                                                                                                      Equations
                                                                                                                                                      instance instLEInt16 :
                                                                                                                                                      Equations
                                                                                                                                                      Equations
                                                                                                                                                      @[extern lean_bool_to_int16]

                                                                                                                                                      Converts true to 1 and false to 0.

                                                                                                                                                      Equations
                                                                                                                                                      Instances For
                                                                                                                                                        @[extern lean_int16_dec_lt]
                                                                                                                                                        def Int16.decLt (a b : Int16) :
                                                                                                                                                        Decidable (a < b)

                                                                                                                                                        Decides whether one 16-bit signed integer is strictly less than another. Usually accessed via the DecidableLT Int16 instance.

                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                        Examples:

                                                                                                                                                        • (if ((-7) : Int16) < 7 then "yes" else "no") = "yes"
                                                                                                                                                        • (if (5 : Int16) < 5 then "yes" else "no") = "no"
                                                                                                                                                        • show ¬((7 : Int16) < 7) by decide
                                                                                                                                                        Equations
                                                                                                                                                        Instances For
                                                                                                                                                          @[extern lean_int16_dec_le]
                                                                                                                                                          def Int16.decLe (a b : Int16) :

                                                                                                                                                          Decides whether one 16-bit signed integer is less than or equal to another. Usually accessed via the DecidableLE Int16 instance.

                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                          Examples:

                                                                                                                                                          • (if ((-7) : Int16) ≤ 7 then "yes" else "no") = "yes"
                                                                                                                                                          • (if (15 : Int16) ≤ 15 then "yes" else "no") = "yes"
                                                                                                                                                          • (if (15 : Int16) ≤ 5 then "yes" else "no") = "no"
                                                                                                                                                          • show (7 : Int16) ≤ 7 by decide
                                                                                                                                                          Equations
                                                                                                                                                          Instances For
                                                                                                                                                            instance instDecidableLtInt16 (a b : Int16) :
                                                                                                                                                            Decidable (a < b)
                                                                                                                                                            Equations
                                                                                                                                                            instance instDecidableLeInt16 (a b : Int16) :
                                                                                                                                                            Equations
                                                                                                                                                            @[reducible, inline]
                                                                                                                                                            abbrev Int32.size :

                                                                                                                                                            The number of distinct values representable by Int32, that is, 2^32 = 4294967296.

                                                                                                                                                            Equations
                                                                                                                                                            Instances For
                                                                                                                                                              @[inline]

                                                                                                                                                              Obtain the BitVec that contains the 2's complement representation of the Int32.

                                                                                                                                                              Equations
                                                                                                                                                              Instances For
                                                                                                                                                                theorem Int32.toBitVec.inj {x y : Int32} :
                                                                                                                                                                x.toBitVec = y.toBitVecx = y
                                                                                                                                                                @[inline]

                                                                                                                                                                Obtains the Int32 that is 2's complement equivalent to the UInt32.

                                                                                                                                                                Equations
                                                                                                                                                                Instances For
                                                                                                                                                                  @[inline, deprecated UInt32.toInt32 (since := "2025-02-13")]
                                                                                                                                                                  def Int32.mk (i : UInt32) :

                                                                                                                                                                  Obtains the Int32 that is 2's complement equivalent to the UInt32.

                                                                                                                                                                  Equations
                                                                                                                                                                  Instances For
                                                                                                                                                                    @[extern lean_int32_of_int]
                                                                                                                                                                    def Int32.ofInt (i : Int) :

                                                                                                                                                                    Converts an arbitrary-precision integer to a 32-bit integer, wrapping on overflow or underflow.

                                                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                    Examples:

                                                                                                                                                                    Equations
                                                                                                                                                                    Instances For
                                                                                                                                                                      @[extern lean_int32_of_nat]
                                                                                                                                                                      def Int32.ofNat (n : Nat) :

                                                                                                                                                                      Converts a natural number to a 32-bit signed integer, wrapping around on overflow.

                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                      Examples:

                                                                                                                                                                      Equations
                                                                                                                                                                      Instances For
                                                                                                                                                                        @[reducible, inline]
                                                                                                                                                                        abbrev Int.toInt32 (i : Int) :

                                                                                                                                                                        Converts an arbitrary-precision integer to a 32-bit integer, wrapping on overflow or underflow.

                                                                                                                                                                        Examples:

                                                                                                                                                                        Equations
                                                                                                                                                                        Instances For
                                                                                                                                                                          @[reducible, inline]
                                                                                                                                                                          abbrev Nat.toInt32 (n : Nat) :

                                                                                                                                                                          Converts a natural number to a 32-bit signed integer, wrapping around to negative numbers on overflow.

                                                                                                                                                                          Examples:

                                                                                                                                                                          Equations
                                                                                                                                                                          Instances For
                                                                                                                                                                            @[extern lean_int32_to_int]
                                                                                                                                                                            def Int32.toInt (i : Int32) :

                                                                                                                                                                            Converts a 32-bit signed integer to an arbitrary-precision integer that denotes the same number.

                                                                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                            Equations
                                                                                                                                                                            Instances For
                                                                                                                                                                              @[inline]

                                                                                                                                                                              Converts a 32-bit signed integer to a natural number, mapping all negative numbers to 0.

                                                                                                                                                                              Use Int32.toBitVec to obtain the two's complement representation.

                                                                                                                                                                              Equations
                                                                                                                                                                              Instances For
                                                                                                                                                                                @[inline, deprecated Int32.toNatClampNeg (since := "2025-02-13")]
                                                                                                                                                                                def Int32.toNat (i : Int32) :

                                                                                                                                                                                Converts a 32-bit signed integer to a natural number, mapping all negative numbers to 0.

                                                                                                                                                                                Use Int32.toBitVec to obtain the two's complement representation.

                                                                                                                                                                                Equations
                                                                                                                                                                                Instances For
                                                                                                                                                                                  @[inline]

                                                                                                                                                                                  Obtains the Int32 whose 2's complement representation is the given BitVec 32.

                                                                                                                                                                                  Equations
                                                                                                                                                                                  Instances For
                                                                                                                                                                                    @[extern lean_int32_to_int8]

                                                                                                                                                                                    Converts a 32-bit signed integer to an 8-bit signed integer by truncating its bitvector representation.

                                                                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                    Equations
                                                                                                                                                                                    Instances For
                                                                                                                                                                                      @[extern lean_int32_to_int16]

                                                                                                                                                                                      Converts a 32-bit signed integer to an 16-bit signed integer by truncating its bitvector representation.

                                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                      Equations
                                                                                                                                                                                      Instances For
                                                                                                                                                                                        @[extern lean_int8_to_int32]

                                                                                                                                                                                        Converts 8-bit signed integers to 32-bit signed integers that denote the same number.

                                                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                        Equations
                                                                                                                                                                                        Instances For
                                                                                                                                                                                          @[extern lean_int16_to_int32]

                                                                                                                                                                                          Converts 8-bit signed integers to 32-bit signed integers that denote the same number.

                                                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                          Equations
                                                                                                                                                                                          Instances For
                                                                                                                                                                                            @[extern lean_int32_neg]
                                                                                                                                                                                            def Int32.neg (i : Int32) :

                                                                                                                                                                                            Negates 32-bit signed integers. Usually accessed via the - prefix operator.

                                                                                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                            Equations
                                                                                                                                                                                            Instances For
                                                                                                                                                                                              Equations
                                                                                                                                                                                              Equations
                                                                                                                                                                                              Equations
                                                                                                                                                                                              instance Int32.instOfNat {n : Nat} :
                                                                                                                                                                                              Equations
                                                                                                                                                                                              Equations
                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                              The largest number that Int32 can represent: 2^31 - 1 = 2147483647.

                                                                                                                                                                                              Equations
                                                                                                                                                                                              Instances For
                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                The smallest number that Int32 can represent: -2^31 = -2147483648.

                                                                                                                                                                                                Equations
                                                                                                                                                                                                Instances For
                                                                                                                                                                                                  @[inline]
                                                                                                                                                                                                  def Int32.ofIntLE (i : Int) (_hl : minValue.toInt i) (_hr : i maxValue.toInt) :

                                                                                                                                                                                                  Constructs an Int32 from an Int that is known to be in bounds.

                                                                                                                                                                                                  Equations
                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                    Constructs an Int32 from an Int, clamping if the value is too small or too large.

                                                                                                                                                                                                    Equations
                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                      @[extern lean_int32_add]
                                                                                                                                                                                                      def Int32.add (a b : Int32) :

                                                                                                                                                                                                      Adds two 32-bit signed integers, wrapping around on over- or underflow. Usually accessed via the + operator.

                                                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                      Equations
                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                        @[extern lean_int32_sub]
                                                                                                                                                                                                        def Int32.sub (a b : Int32) :

                                                                                                                                                                                                        Subtracts one 32-bit signed integer from another, wrapping around on over- or underflow. Usually accessed via the - operator.

                                                                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                        Equations
                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                          @[extern lean_int32_mul]
                                                                                                                                                                                                          def Int32.mul (a b : Int32) :

                                                                                                                                                                                                          Multiplies two 32-bit signed integers, wrapping around on over- or underflow. Usually accessed via the * operator.

                                                                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                          Equations
                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                            @[extern lean_int32_div]
                                                                                                                                                                                                            def Int32.div (a b : Int32) :

                                                                                                                                                                                                            Truncating division for 32-bit signed integers, rounding towards zero. Usually accessed via the / operator.

                                                                                                                                                                                                            Division by zero is defined to be zero.

                                                                                                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                            Examples:

                                                                                                                                                                                                            Equations
                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                              @[extern lean_int32_mod]
                                                                                                                                                                                                              def Int32.mod (a b : Int32) :

                                                                                                                                                                                                              The modulo operator for 32-bit signed integers, which computes the remainder when dividing one integer by another with the T-rounding convention used by Int32.div. Usually accessed via the % operator.

                                                                                                                                                                                                              When the divisor is 0, the result is the dividend rather than an error.

                                                                                                                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                              Examples:

                                                                                                                                                                                                              Equations
                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                @[extern lean_int32_land]
                                                                                                                                                                                                                def Int32.land (a b : Int32) :

                                                                                                                                                                                                                Bitwise and for 32-bit signed integers. Usually accessed via the &&& operator.

                                                                                                                                                                                                                Each bit of the resulting integer is set if the corresponding bits of both input integers are set, according to the two's complement representation.

                                                                                                                                                                                                                This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                  @[extern lean_int32_lor]
                                                                                                                                                                                                                  def Int32.lor (a b : Int32) :

                                                                                                                                                                                                                  Bitwise or for 32-bit signed integers. Usually accessed via the ||| operator.

                                                                                                                                                                                                                  Each bit of the resulting integer is set if at least one of the corresponding bits of the input integers is set, according to the two's complement representation.

                                                                                                                                                                                                                  This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                    @[extern lean_int32_xor]
                                                                                                                                                                                                                    def Int32.xor (a b : Int32) :

                                                                                                                                                                                                                    Bitwise exclusive or for 32-bit signed integers. Usually accessed via the ^^^ operator.

                                                                                                                                                                                                                    Each bit of the resulting integer is set if exactly one of the corresponding bits of the input integers is set, according to the two's complement representation.

                                                                                                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                      @[extern lean_int32_shift_left]

                                                                                                                                                                                                                      Bitwise left shift for 32-bit signed integers. Usually accessed via the <<< operator.

                                                                                                                                                                                                                      Signed integers are interpreted as bitvectors according to the two's complement representation.

                                                                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                        @[extern lean_int32_shift_right]

                                                                                                                                                                                                                        Arithmetic right shift for 32-bit signed integers. Usually accessed via the <<< operator.

                                                                                                                                                                                                                        The high bits are filled with the value of the most significant bit.

                                                                                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                          @[extern lean_int32_complement]

                                                                                                                                                                                                                          Bitwise complement, also known as bitwise negation, for 32-bit signed integers. Usually accessed via the ~~~ prefix operator.

                                                                                                                                                                                                                          Each bit of the resulting integer is the opposite of the corresponding bit of the input integer. Integers use the two's complement representation, so Int32.complement a = -(a + 1).

                                                                                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                            @[extern lean_int32_abs]
                                                                                                                                                                                                                            def Int32.abs (a : Int32) :

                                                                                                                                                                                                                            Computes the absolute value of a 32-bit signed integer.

                                                                                                                                                                                                                            This function is equivalent to if a < 0 then -a else a, so in particular Int32.minValue will be mapped to Int32.minValue.

                                                                                                                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                              @[extern lean_int32_dec_eq]
                                                                                                                                                                                                                              def Int32.decEq (a b : Int32) :
                                                                                                                                                                                                                              Decidable (a = b)

                                                                                                                                                                                                                              Decides whether two 32-bit signed integers are equal. Usually accessed via the DecidableEq Int32 instance.

                                                                                                                                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                              Examples:

                                                                                                                                                                                                                              • Int32.decEq 123 123 = .isTrue rfl
                                                                                                                                                                                                                              • (if ((-7) : Int32) = 7 then "yes" else "no") = "no"
                                                                                                                                                                                                                              • show (7 : Int32) = 7 by decide
                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                def Int32.lt (a b : Int32) :

                                                                                                                                                                                                                                Strict inequality of 32-bit signed integers, defined as inequality of the corresponding integers. Usually accessed via the < operator.

                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                  def Int32.le (a b : Int32) :

                                                                                                                                                                                                                                  Non-strict inequality of 32-bit signed integers, defined as inequality of the corresponding integers. Usually accessed via the operator.

                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    instance instLTInt32 :
                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    instance instLEInt32 :
                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    @[extern lean_bool_to_int32]

                                                                                                                                                                                                                                    Converts true to 1 and false to 0.

                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                      @[extern lean_int32_dec_lt]
                                                                                                                                                                                                                                      def Int32.decLt (a b : Int32) :
                                                                                                                                                                                                                                      Decidable (a < b)

                                                                                                                                                                                                                                      Decides whether one 32-bit signed integer is strictly less than another. Usually accessed via the DecidableLT Int32 instance.

                                                                                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                      Examples:

                                                                                                                                                                                                                                      • (if ((-7) : Int32) < 7 then "yes" else "no") = "yes"
                                                                                                                                                                                                                                      • (if (5 : Int32) < 5 then "yes" else "no") = "no"
                                                                                                                                                                                                                                      • show ¬((7 : Int32) < 7) by decide
                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                        @[extern lean_int32_dec_le]
                                                                                                                                                                                                                                        def Int32.decLe (a b : Int32) :

                                                                                                                                                                                                                                        Decides whether one 32-bit signed integer is less than or equal to another. Usually accessed via the DecidableLE Int32 instance.

                                                                                                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                        Examples:

                                                                                                                                                                                                                                        • (if ((-7) : Int32) ≤ 7 then "yes" else "no") = "yes"
                                                                                                                                                                                                                                        • (if (15 : Int32) ≤ 15 then "yes" else "no") = "yes"
                                                                                                                                                                                                                                        • (if (15 : Int32) ≤ 5 then "yes" else "no") = "no"
                                                                                                                                                                                                                                        • show (7 : Int32) ≤ 7 by decide
                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                          instance instDecidableLtInt32 (a b : Int32) :
                                                                                                                                                                                                                                          Decidable (a < b)
                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                          instance instDecidableLeInt32 (a b : Int32) :
                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                          @[reducible, inline]
                                                                                                                                                                                                                                          abbrev Int64.size :

                                                                                                                                                                                                                                          The number of distinct values representable by Int64, that is, 2^64 = 18446744073709551616.

                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                            @[inline]

                                                                                                                                                                                                                                            Obtain the BitVec that contains the 2's complement representation of the Int64.

                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                              theorem Int64.toBitVec.inj {x y : Int64} :
                                                                                                                                                                                                                                              x.toBitVec = y.toBitVecx = y
                                                                                                                                                                                                                                              @[inline]

                                                                                                                                                                                                                                              Obtains the Int64 that is 2's complement equivalent to the UInt64.

                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                @[inline, deprecated UInt64.toInt64 (since := "2025-02-13")]
                                                                                                                                                                                                                                                def Int64.mk (i : UInt64) :

                                                                                                                                                                                                                                                Obtains the Int64 that is 2's complement equivalent to the UInt64.

                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                  @[extern lean_int64_of_int]
                                                                                                                                                                                                                                                  def Int64.ofInt (i : Int) :

                                                                                                                                                                                                                                                  Converts an arbitrary-precision integer to a 64-bit integer, wrapping on overflow or underflow.

                                                                                                                                                                                                                                                  This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                  Examples:

                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                    @[extern lean_int64_of_nat]
                                                                                                                                                                                                                                                    def Int64.ofNat (n : Nat) :

                                                                                                                                                                                                                                                    Converts a natural number to a 64-bit signed integer, wrapping around to negative numbers on overflow.

                                                                                                                                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                    Examples:

                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                      @[reducible, inline]
                                                                                                                                                                                                                                                      abbrev Int.toInt64 (i : Int) :

                                                                                                                                                                                                                                                      Converts an arbitrary-precision integer to a 64-bit integer, wrapping on overflow or underflow.

                                                                                                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                      Examples:

                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                        @[reducible, inline]
                                                                                                                                                                                                                                                        abbrev Nat.toInt64 (n : Nat) :

                                                                                                                                                                                                                                                        Converts a natural number to a 64-bit signed integer, wrapping around to negative numbers on overflow.

                                                                                                                                                                                                                                                        Examples:

                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                          @[extern lean_int64_to_int_sint]
                                                                                                                                                                                                                                                          def Int64.toInt (i : Int64) :

                                                                                                                                                                                                                                                          Converts a 64-bit signed integer to an arbitrary-precision integer that denotes the same number.

                                                                                                                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                            @[inline]

                                                                                                                                                                                                                                                            Converts a 64-bit signed integer to a natural number, mapping all negative numbers to 0.

                                                                                                                                                                                                                                                            Use Int64.toBitVec to obtain the two's complement representation.

                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                              @[inline, deprecated Int64.toNatClampNeg (since := "2025-02-13")]
                                                                                                                                                                                                                                                              def Int64.toNat (i : Int64) :

                                                                                                                                                                                                                                                              Converts a 64-bit signed integer to a natural number, mapping all negative numbers to 0.

                                                                                                                                                                                                                                                              Use Int64.toBitVec to obtain the two's complement representation.

                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                @[inline]

                                                                                                                                                                                                                                                                Obtains the Int64 whose 2's complement representation is the given BitVec 64.

                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                  @[extern lean_int64_to_int8]

                                                                                                                                                                                                                                                                  Converts a 64-bit signed integer to an 8-bit signed integer by truncating its bitvector representation.

                                                                                                                                                                                                                                                                  This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                    @[extern lean_int64_to_int16]

                                                                                                                                                                                                                                                                    Converts a 64-bit signed integer to a 16-bit signed integer by truncating its bitvector representation.

                                                                                                                                                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                      @[extern lean_int64_to_int32]

                                                                                                                                                                                                                                                                      Converts a 64-bit signed integer to a 32-bit signed integer by truncating its bitvector representation.

                                                                                                                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                        @[extern lean_int8_to_int64]

                                                                                                                                                                                                                                                                        Converts 8-bit signed integers to 64-bit signed integers that denote the same number.

                                                                                                                                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                          @[extern lean_int16_to_int64]

                                                                                                                                                                                                                                                                          Converts 16-bit signed integers to 64-bit signed integers that denote the same number.

                                                                                                                                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                            @[extern lean_int32_to_int64]

                                                                                                                                                                                                                                                                            Converts 32-bit signed integers to 64-bit signed integers that denote the same number.

                                                                                                                                                                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                              @[extern lean_int64_neg]
                                                                                                                                                                                                                                                                              def Int64.neg (i : Int64) :

                                                                                                                                                                                                                                                                              Negates 64-bit signed integers. Usually accessed via the - prefix operator.

                                                                                                                                                                                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                instance Int64.instOfNat {n : Nat} :
                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                The largest number that Int64 can represent: 2^63 - 1 = 9223372036854775807.

                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                  The smallest number that Int64 can represent: -2^63 = -9223372036854775808.

                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                    @[inline]
                                                                                                                                                                                                                                                                                    def Int64.ofIntLE (i : Int) (_hl : minValue.toInt i) (_hr : i maxValue.toInt) :

                                                                                                                                                                                                                                                                                    Constructs an Int64 from an Int that is known to be in bounds.

                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                      Constructs an Int64 from an Int, clamping if the value is too small or too large.

                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                        @[extern lean_int64_add]
                                                                                                                                                                                                                                                                                        def Int64.add (a b : Int64) :

                                                                                                                                                                                                                                                                                        Adds two 64-bit signed integers, wrapping around on over- or underflow. Usually accessed via the + operator.

                                                                                                                                                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                          @[extern lean_int64_sub]
                                                                                                                                                                                                                                                                                          def Int64.sub (a b : Int64) :

                                                                                                                                                                                                                                                                                          Subtracts one 64-bit signed integer from another, wrapping around on over- or underflow. Usually accessed via the - operator.

                                                                                                                                                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                            @[extern lean_int64_mul]
                                                                                                                                                                                                                                                                                            def Int64.mul (a b : Int64) :

                                                                                                                                                                                                                                                                                            Multiplies two 64-bit signed integers, wrapping around on over- or underflow. Usually accessed via the * operator.

                                                                                                                                                                                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                              @[extern lean_int64_div]
                                                                                                                                                                                                                                                                                              def Int64.div (a b : Int64) :

                                                                                                                                                                                                                                                                                              Truncating division for 64-bit signed integers, rounding towards zero. Usually accessed via the / operator.

                                                                                                                                                                                                                                                                                              Division by zero is defined to be zero.

                                                                                                                                                                                                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                              Examples:

                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                @[extern lean_int64_mod]
                                                                                                                                                                                                                                                                                                def Int64.mod (a b : Int64) :

                                                                                                                                                                                                                                                                                                The modulo operator for 64-bit signed integers, which computes the remainder when dividing one integer by another with the T-rounding convention used by Int64.div. Usually accessed via the % operator.

                                                                                                                                                                                                                                                                                                When the divisor is 0, the result is the dividend rather than an error.

                                                                                                                                                                                                                                                                                                This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                Examples:

                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                  @[extern lean_int64_land]
                                                                                                                                                                                                                                                                                                  def Int64.land (a b : Int64) :

                                                                                                                                                                                                                                                                                                  Bitwise and for 64-bit signed integers. Usually accessed via the &&& operator.

                                                                                                                                                                                                                                                                                                  Each bit of the resulting integer is set if the corresponding bits of both input integers are set, according to the two's complement representation.

                                                                                                                                                                                                                                                                                                  This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                    @[extern lean_int64_lor]
                                                                                                                                                                                                                                                                                                    def Int64.lor (a b : Int64) :

                                                                                                                                                                                                                                                                                                    Bitwise or for 64-bit signed integers. Usually accessed via the ||| operator.

                                                                                                                                                                                                                                                                                                    Each bit of the resulting integer is set if at least one of the corresponding bits of the input integers is set, according to the two's complement representation.

                                                                                                                                                                                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                      @[extern lean_int64_xor]
                                                                                                                                                                                                                                                                                                      def Int64.xor (a b : Int64) :

                                                                                                                                                                                                                                                                                                      Bitwise exclusive or for 64-bit signed integers. Usually accessed via the ^^^ operator.

                                                                                                                                                                                                                                                                                                      Each bit of the resulting integer is set if exactly one of the corresponding bits of the input integers is set, according to the two's complement representation.

                                                                                                                                                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                        @[extern lean_int64_shift_left]

                                                                                                                                                                                                                                                                                                        Bitwise left shift for 64-bit signed integers. Usually accessed via the <<< operator.

                                                                                                                                                                                                                                                                                                        Signed integers are interpreted as bitvectors according to the two's complement representation.

                                                                                                                                                                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                          @[extern lean_int64_shift_right]

                                                                                                                                                                                                                                                                                                          Arithmetic right shift for 64-bit signed integers. Usually accessed via the <<< operator.

                                                                                                                                                                                                                                                                                                          The high bits are filled with the value of the most significant bit.

                                                                                                                                                                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                            @[extern lean_int64_complement]

                                                                                                                                                                                                                                                                                                            Bitwise complement, also known as bitwise negation, for 64-bit signed integers. Usually accessed via the ~~~ prefix operator.

                                                                                                                                                                                                                                                                                                            Each bit of the resulting integer is the opposite of the corresponding bit of the input integer. Integers use the two's complement representation, so Int64.complement a = -(a + 1).

                                                                                                                                                                                                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                              @[extern lean_int64_abs]
                                                                                                                                                                                                                                                                                                              def Int64.abs (a : Int64) :

                                                                                                                                                                                                                                                                                                              Computes the absolute value of a 64-bit signed integer.

                                                                                                                                                                                                                                                                                                              This function is equivalent to if a < 0 then -a else a, so in particular Int64.minValue will be mapped to Int64.minValue.

                                                                                                                                                                                                                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                @[extern lean_int64_dec_eq]
                                                                                                                                                                                                                                                                                                                def Int64.decEq (a b : Int64) :
                                                                                                                                                                                                                                                                                                                Decidable (a = b)

                                                                                                                                                                                                                                                                                                                Decides whether two 64-bit signed integers are equal. Usually accessed via the DecidableEq Int64 instance.

                                                                                                                                                                                                                                                                                                                This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                Examples:

                                                                                                                                                                                                                                                                                                                • Int64.decEq 123 123 = .isTrue rfl
                                                                                                                                                                                                                                                                                                                • (if ((-7) : Int64) = 7 then "yes" else "no") = "no"
                                                                                                                                                                                                                                                                                                                • show (7 : Int64) = 7 by decide
                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                  def Int64.lt (a b : Int64) :

                                                                                                                                                                                                                                                                                                                  Strict inequality of 64-bit signed integers, defined as inequality of the corresponding integers. Usually accessed via the < operator.

                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                    def Int64.le (a b : Int64) :

                                                                                                                                                                                                                                                                                                                    Non-strict inequality of 64-bit signed integers, defined as inequality of the corresponding integers. Usually accessed via the operator.

                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      instance instLTInt64 :
                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      instance instLEInt64 :
                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      @[extern lean_bool_to_int64]

                                                                                                                                                                                                                                                                                                                      Converts true to 1 and false to 0.

                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                        @[extern lean_int64_dec_lt]
                                                                                                                                                                                                                                                                                                                        def Int64.decLt (a b : Int64) :
                                                                                                                                                                                                                                                                                                                        Decidable (a < b)

                                                                                                                                                                                                                                                                                                                        Decides whether one 8-bit signed integer is strictly less than another. Usually accessed via the DecidableLT Int64 instance.

                                                                                                                                                                                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                        Examples:

                                                                                                                                                                                                                                                                                                                        • (if ((-7) : Int64) < 7 then "yes" else "no") = "yes"
                                                                                                                                                                                                                                                                                                                        • (if (5 : Int64) < 5 then "yes" else "no") = "no"
                                                                                                                                                                                                                                                                                                                        • show ¬((7 : Int64) < 7) by decide
                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                          @[extern lean_int64_dec_le]
                                                                                                                                                                                                                                                                                                                          def Int64.decLe (a b : Int64) :

                                                                                                                                                                                                                                                                                                                          Decides whether one 8-bit signed integer is less than or equal to another. Usually accessed via the DecidableLE Int64 instance.

                                                                                                                                                                                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                          Examples:

                                                                                                                                                                                                                                                                                                                          • (if ((-7) : Int64) ≤ 7 then "yes" else "no") = "yes"
                                                                                                                                                                                                                                                                                                                          • (if (15 : Int64) ≤ 15 then "yes" else "no") = "yes"
                                                                                                                                                                                                                                                                                                                          • (if (15 : Int64) ≤ 5 then "yes" else "no") = "no"
                                                                                                                                                                                                                                                                                                                          • show (7 : Int64) ≤ 7 by decide
                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                            instance instDecidableLtInt64 (a b : Int64) :
                                                                                                                                                                                                                                                                                                                            Decidable (a < b)
                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                            instance instDecidableLeInt64 (a b : Int64) :
                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                            @[reducible, inline]
                                                                                                                                                                                                                                                                                                                            abbrev ISize.size :

                                                                                                                                                                                                                                                                                                                            The number of distinct values representable by ISize, that is, 2^System.Platform.numBits.

                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                              @[inline]

                                                                                                                                                                                                                                                                                                                              Obtain the BitVec that contains the 2's complement representation of the ISize.

                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                theorem ISize.toBitVec.inj {x y : ISize} :
                                                                                                                                                                                                                                                                                                                                x.toBitVec = y.toBitVecx = y
                                                                                                                                                                                                                                                                                                                                @[inline]

                                                                                                                                                                                                                                                                                                                                Obtains the ISize that is 2's complement equivalent to the USize.

                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                  @[inline, deprecated USize.toISize (since := "2025-02-13")]
                                                                                                                                                                                                                                                                                                                                  def ISize.mk (i : USize) :

                                                                                                                                                                                                                                                                                                                                  Obtains the ISize that is 2's complement equivalent to the USize.

                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                    @[extern lean_isize_of_int]
                                                                                                                                                                                                                                                                                                                                    def ISize.ofInt (i : Int) :

                                                                                                                                                                                                                                                                                                                                    Converts an arbitrary-precision integer to a word-sized signed integer, wrapping around on over- or underflow.

                                                                                                                                                                                                                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                      @[extern lean_isize_of_nat]
                                                                                                                                                                                                                                                                                                                                      def ISize.ofNat (n : Nat) :

                                                                                                                                                                                                                                                                                                                                      Converts an arbitrary-precision natural number to a word-sized signed integer, wrapping around on overflow.

                                                                                                                                                                                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                        @[reducible, inline]
                                                                                                                                                                                                                                                                                                                                        abbrev Int.toISize (i : Int) :

                                                                                                                                                                                                                                                                                                                                        Converts an arbitrary-precision integer to a word-sized signed integer, wrapping around on over- or underflow.

                                                                                                                                                                                                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]
                                                                                                                                                                                                                                                                                                                                          abbrev Nat.toISize (n : Nat) :

                                                                                                                                                                                                                                                                                                                                          Converts an arbitrary-precision natural number to a word-sized signed integer, wrapping around on overflow.

                                                                                                                                                                                                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                            @[extern lean_isize_to_int]
                                                                                                                                                                                                                                                                                                                                            def ISize.toInt (i : ISize) :

                                                                                                                                                                                                                                                                                                                                            Converts a word-sized signed integer to an arbitrary-precision integer that denotes the same number.

                                                                                                                                                                                                                                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                              @[inline]

                                                                                                                                                                                                                                                                                                                                              Converts a word-sized signed integer to a natural number, mapping all negative numbers to 0.

                                                                                                                                                                                                                                                                                                                                              Use ISize.toBitVec to obtain the two's complement representation.

                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                @[inline, deprecated ISize.toNatClampNeg (since := "2025-02-13")]
                                                                                                                                                                                                                                                                                                                                                def ISize.toNat (i : ISize) :

                                                                                                                                                                                                                                                                                                                                                Converts a word-sized signed integer to a natural number, mapping all negative numbers to 0.

                                                                                                                                                                                                                                                                                                                                                Use ISize.toBitVec to obtain the two's complement representation.

                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                  @[inline]

                                                                                                                                                                                                                                                                                                                                                  Obtains the ISize whose 2's complement representation is the given BitVec.

                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                    @[extern lean_isize_to_int8]

                                                                                                                                                                                                                                                                                                                                                    Converts a word-sized signed integer to an 8-bit signed integer by truncating its bitvector representation.

                                                                                                                                                                                                                                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                      @[extern lean_isize_to_int16]

                                                                                                                                                                                                                                                                                                                                                      Converts a word-sized integer to a 16-bit integer by truncating its bitvector representation.

                                                                                                                                                                                                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                        @[extern lean_isize_to_int32]

                                                                                                                                                                                                                                                                                                                                                        Converts a word-sized signed integer to a 32-bit signed integer.

                                                                                                                                                                                                                                                                                                                                                        On 32-bit platforms, this conversion is lossless. On 64-bit platforms, the integer's bitvector representation is truncated to 32 bits. This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                          @[extern lean_isize_to_int64]

                                                                                                                                                                                                                                                                                                                                                          Converts word-sized signed integers to 64-bit signed integers that denote the same number. This conversion is lossless, because ISize is either Int32 or Int64.

                                                                                                                                                                                                                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                            @[extern lean_int8_to_isize]

                                                                                                                                                                                                                                                                                                                                                            Converts 8-bit signed integers to word-sized signed integers that denote the same number. This conversion is lossless, because ISize is either Int32 or Int64.

                                                                                                                                                                                                                                                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                              @[extern lean_int16_to_isize]

                                                                                                                                                                                                                                                                                                                                                              Converts 16-bit signed integers to word-sized signed integers that denote the same number. This conversion is lossless, because ISize is either Int32 or Int64.

                                                                                                                                                                                                                                                                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                @[extern lean_int32_to_isize]

                                                                                                                                                                                                                                                                                                                                                                Converts 32-bit signed integers to word-sized signed integers that denote the same number. This conversion is lossless, because ISize is either Int32 or Int64.

                                                                                                                                                                                                                                                                                                                                                                This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                  @[extern lean_int64_to_isize]

                                                                                                                                                                                                                                                                                                                                                                  Converts 64-bit signed integers to word-sized signed integers, truncating the bitvector representation on 32-bit platforms. This conversion is lossless on 64-bit platforms.

                                                                                                                                                                                                                                                                                                                                                                  This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                    @[extern lean_isize_neg]
                                                                                                                                                                                                                                                                                                                                                                    def ISize.neg (i : ISize) :

                                                                                                                                                                                                                                                                                                                                                                    Negates word-sized signed integers. Usually accessed via the - prefix operator.

                                                                                                                                                                                                                                                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                      instance ISize.instOfNat {n : Nat} :
                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                      The largest number that ISize can represent: 2^(System.Platform.numBits - 1) - 1.

                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                        The smallest number that ISize can represent: -2^(System.Platform.numBits - 1).

                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                          @[inline]
                                                                                                                                                                                                                                                                                                                                                                          def ISize.ofIntLE (i : Int) (_hl : minValue.toInt i) (_hr : i maxValue.toInt) :

                                                                                                                                                                                                                                                                                                                                                                          Constructs an ISize from an Int that is known to be in bounds.

                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                                            Constructs an ISize from an Int, clamping if the value is too small or too large.

                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                              @[extern lean_isize_add]
                                                                                                                                                                                                                                                                                                                                                                              def ISize.add (a b : ISize) :

                                                                                                                                                                                                                                                                                                                                                                              Adds two word-sized signed integers, wrapping around on over- or underflow. Usually accessed via the + operator.

                                                                                                                                                                                                                                                                                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                @[extern lean_isize_sub]
                                                                                                                                                                                                                                                                                                                                                                                def ISize.sub (a b : ISize) :

                                                                                                                                                                                                                                                                                                                                                                                Subtracts one word-sized signed integer from another, wrapping around on over- or underflow. Usually accessed via the - operator.

                                                                                                                                                                                                                                                                                                                                                                                This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                  @[extern lean_isize_mul]
                                                                                                                                                                                                                                                                                                                                                                                  def ISize.mul (a b : ISize) :

                                                                                                                                                                                                                                                                                                                                                                                  Multiplies two word-sized signed integers, wrapping around on over- or underflow. Usually accessed via the * operator.

                                                                                                                                                                                                                                                                                                                                                                                  This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                    @[extern lean_isize_div]
                                                                                                                                                                                                                                                                                                                                                                                    def ISize.div (a b : ISize) :

                                                                                                                                                                                                                                                                                                                                                                                    Truncating division for word-sized signed integers, rounding towards zero. Usually accessed via the / operator.

                                                                                                                                                                                                                                                                                                                                                                                    Division by zero is defined to be zero.

                                                                                                                                                                                                                                                                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                    Examples:

                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                      @[extern lean_isize_mod]
                                                                                                                                                                                                                                                                                                                                                                                      def ISize.mod (a b : ISize) :

                                                                                                                                                                                                                                                                                                                                                                                      The modulo operator for word-sized signed integers, which computes the remainder when dividing one integer by another with the T-rounding convention used by ISize.div. Usually accessed via the % operator.

                                                                                                                                                                                                                                                                                                                                                                                      When the divisor is 0, the result is the dividend rather than an error.

                                                                                                                                                                                                                                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                      Examples:

                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                        @[extern lean_isize_land]
                                                                                                                                                                                                                                                                                                                                                                                        def ISize.land (a b : ISize) :

                                                                                                                                                                                                                                                                                                                                                                                        Bitwise and for word-sized signed integers. Usually accessed via the &&& operator.

                                                                                                                                                                                                                                                                                                                                                                                        Each bit of the resulting integer is set if the corresponding bits of both input integers are set, according to the two's complement representation.

                                                                                                                                                                                                                                                                                                                                                                                        This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                          @[extern lean_isize_lor]
                                                                                                                                                                                                                                                                                                                                                                                          def ISize.lor (a b : ISize) :

                                                                                                                                                                                                                                                                                                                                                                                          Bitwise or for word-sized signed integers. Usually accessed via the ||| operator.

                                                                                                                                                                                                                                                                                                                                                                                          Each bit of the resulting integer is set if at least one of the corresponding bits of the input integers is set, according to the two's complement representation.

                                                                                                                                                                                                                                                                                                                                                                                          This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                            @[extern lean_isize_xor]
                                                                                                                                                                                                                                                                                                                                                                                            def ISize.xor (a b : ISize) :

                                                                                                                                                                                                                                                                                                                                                                                            Bitwise exclusive or for word-sized signed integers. Usually accessed via the ^^^ operator.

                                                                                                                                                                                                                                                                                                                                                                                            Each bit of the resulting integer is set if exactly one of the corresponding bits of the input integers is set, according to the two's complement representation.

                                                                                                                                                                                                                                                                                                                                                                                            This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                              @[extern lean_isize_shift_left]

                                                                                                                                                                                                                                                                                                                                                                                              Bitwise left shift for word-sized signed integers. Usually accessed via the <<< operator.

                                                                                                                                                                                                                                                                                                                                                                                              Signed integers are interpreted as bitvectors according to the two's complement representation.

                                                                                                                                                                                                                                                                                                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                @[extern lean_isize_shift_right]

                                                                                                                                                                                                                                                                                                                                                                                                Arithmetic right shift for word-sized signed integers. Usually accessed via the <<< operator.

                                                                                                                                                                                                                                                                                                                                                                                                The high bits are filled with the value of the most significant bit.

                                                                                                                                                                                                                                                                                                                                                                                                This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                  @[extern lean_isize_complement]

                                                                                                                                                                                                                                                                                                                                                                                                  Bitwise complement, also known as bitwise negation, for word-sized signed integers. Usually accessed via the ~~~ prefix operator.

                                                                                                                                                                                                                                                                                                                                                                                                  Each bit of the resulting integer is the opposite of the corresponding bit of the input integer. Integers use the two's complement representation, so ISize.complement a = -(a + 1).

                                                                                                                                                                                                                                                                                                                                                                                                  This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                    @[extern lean_isize_abs]
                                                                                                                                                                                                                                                                                                                                                                                                    def ISize.abs (a : ISize) :

                                                                                                                                                                                                                                                                                                                                                                                                    Computes the absolute value of a word-sized signed integer.

                                                                                                                                                                                                                                                                                                                                                                                                    This function is equivalent to if a < 0 then -a else a, so in particular ISize.minValue will be mapped to ISize.minValue.

                                                                                                                                                                                                                                                                                                                                                                                                    This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                      @[extern lean_isize_dec_eq]
                                                                                                                                                                                                                                                                                                                                                                                                      def ISize.decEq (a b : ISize) :
                                                                                                                                                                                                                                                                                                                                                                                                      Decidable (a = b)

                                                                                                                                                                                                                                                                                                                                                                                                      Decides whether two word-sized signed integers are equal. Usually accessed via the DecidableEq ISize instance.

                                                                                                                                                                                                                                                                                                                                                                                                      This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                                      Examples:

                                                                                                                                                                                                                                                                                                                                                                                                      • ISize.decEq 123 123 = .isTrue rfl
                                                                                                                                                                                                                                                                                                                                                                                                      • (if ((-7) : ISize) = 7 then "yes" else "no") = "no"
                                                                                                                                                                                                                                                                                                                                                                                                      • show (7 : ISize) = 7 by decide
                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                        def ISize.lt (a b : ISize) :

                                                                                                                                                                                                                                                                                                                                                                                                        Strict inequality of word-sized signed integers, defined as inequality of the corresponding integers. Usually accessed via the < operator.

                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                          def ISize.le (a b : ISize) :

                                                                                                                                                                                                                                                                                                                                                                                                          Non-strict inequality of word-sized signed integers, defined as inequality of the corresponding integers. Usually accessed via the operator.

                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            instance instLTISize :
                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            instance instLEISize :
                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            @[extern lean_bool_to_isize]

                                                                                                                                                                                                                                                                                                                                                                                                            Converts true to 1 and false to 0.

                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                              @[extern lean_isize_dec_lt]
                                                                                                                                                                                                                                                                                                                                                                                                              def ISize.decLt (a b : ISize) :
                                                                                                                                                                                                                                                                                                                                                                                                              Decidable (a < b)

                                                                                                                                                                                                                                                                                                                                                                                                              Decides whether one word-sized signed integer is strictly less than another. Usually accessed via the DecidableLT ISize instance.

                                                                                                                                                                                                                                                                                                                                                                                                              This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                                              Examples:

                                                                                                                                                                                                                                                                                                                                                                                                              • (if ((-7) : ISize) < 7 then "yes" else "no") = "yes"
                                                                                                                                                                                                                                                                                                                                                                                                              • (if (5 : ISize) < 5 then "yes" else "no") = "no"
                                                                                                                                                                                                                                                                                                                                                                                                              • show ¬((7 : ISize) < 7) by decide
                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                @[extern lean_isize_dec_le]
                                                                                                                                                                                                                                                                                                                                                                                                                def ISize.decLe (a b : ISize) :

                                                                                                                                                                                                                                                                                                                                                                                                                Decides whether one word-sized signed integer is less than or equal to another. Usually accessed via the DecidableLE ISize instance.

                                                                                                                                                                                                                                                                                                                                                                                                                This function is overridden at runtime with an efficient implementation.

                                                                                                                                                                                                                                                                                                                                                                                                                Examples:

                                                                                                                                                                                                                                                                                                                                                                                                                • (if ((-7) : ISize) ≤ 7 then "yes" else "no") = "yes"
                                                                                                                                                                                                                                                                                                                                                                                                                • (if (15 : ISize) ≤ 15 then "yes" else "no") = "yes"
                                                                                                                                                                                                                                                                                                                                                                                                                • (if (15 : ISize) ≤ 5 then "yes" else "no") = "no"
                                                                                                                                                                                                                                                                                                                                                                                                                • show (7 : ISize) ≤ 7 by decide
                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                  instance instDecidableLtISize (a b : ISize) :
                                                                                                                                                                                                                                                                                                                                                                                                                  Decidable (a < b)
                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                  instance instDecidableLeISize (a b : ISize) :
                                                                                                                                                                                                                                                                                                                                                                                                                  Equations