• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
      • 100-theorems
      • Arithmetic
      • Bit-vectors
        • Sparseint
        • Bitops
          • Bitops/merge
          • Bitops-compatibility
          • Bitops-books
          • Logbitp-reasoning
          • Bitops/signed-byte-p
          • Fast-part-select
          • Bitops/integer-length
          • Bitops/extra-defs
            • Abs-diff
            • Nth-slice512
            • Nth-slice128
              • Nth-slice8
              • Nth-slice64
              • Nth-slice4
              • Nth-slice32
              • Nth-slice256
              • Nth-slice2
              • Nth-slice16
              • Negate-slice8
              • Copybit
              • Negate-slice32
              • Negate-slice16
              • Negate-slice64
              • Bitscan-rev
              • Bitscan-fwd
              • Setbit
              • Notbit
              • Clearbit
            • Install-bit
            • Trailing-0-count
            • Bitops/defaults
            • Logbitp-mismatch
            • Trailing-1-count
            • Bitops/rotate
            • Bitops/equal-by-logbitp
            • Bitops/ash-bounds
            • Bitops/fast-logrev
            • Limited-shifts
            • Bitops/part-select
            • Bitops/parity
            • Bitops/saturate
            • Bitops/part-install
            • Bitops/logbitp-bounds
            • Bitops/ihsext-basics
            • Bitops/fast-rotate
            • Bitops/fast-logext
            • Bitops/ihs-extensions
          • Bv
          • Ihs
          • Rtl
        • Algebra
      • Testing-utilities
    • Bitops/extra-defs

    Nth-slice128

    Extract the nth 128-bit slice of the integer x.

    Signature
    (nth-slice128 n x) → slice
    Arguments
    n — Guard (natp n).
    x — Guard (integerp x).
    Returns
    slice — Type (natp slice).

    We leave this enabled; we would usually not expect to try to reason about it.

    Definitions and Theorems

    Function: nth-slice128$inline

    (defun acl2::nth-slice128$inline (n x)
     (declare (xargs :guard (and (natp n) (integerp x))))
     (let ((__function__ 'nth-slice128))
      (declare (ignorable __function__))
      (mbe
         :logic (logand (ash (ifix x) (* (nfix n) -128))
                        (1- (expt 2 128)))
         :exec (the (unsigned-byte 128)
                    (logand (ash x (the (integer * 0) (* n -128)))
                            340282366920938463463374607431768211455)))))

    Theorem: natp-of-nth-slice128

    (defthm acl2::natp-of-nth-slice128
      (b* ((slice (acl2::nth-slice128$inline n x)))
        (natp slice))
      :rule-classes :type-prescription)

    Theorem: nat-equiv-implies-equal-nth-slice128-1

    (defthm nat-equiv-implies-equal-nth-slice128-1
      (implies (nat-equiv n n-equiv)
               (equal (nth-slice128 n x)
                      (nth-slice128 n-equiv x)))
      :rule-classes (:congruence))

    Theorem: int-equiv-implies-equal-nth-slice128-2

    (defthm int-equiv-implies-equal-nth-slice128-2
      (implies (int-equiv x x-equiv)
               (equal (nth-slice128 n x)
                      (nth-slice128 n x-equiv)))
      :rule-classes (:congruence))

    Theorem: unsigned-byte-p-128-of-nth-slice128

    (defthm unsigned-byte-p-128-of-nth-slice128
      (unsigned-byte-p 128 (nth-slice128 n x)))

    Theorem: nth-slice128-is-nth-slice

    (defthm nth-slice128-is-nth-slice
      (equal (nth-slice128 n x)
             (nth-slice 128 n x)))