• 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

    Negate-slice8

    (negate-slice8 x) computes the 8-bit two's complement negation of x and returns it as an 8-bit natural.

    Signature
    (negate-slice8 x) → ~x
    Returns
    ~x — Type (natp ~x).

    For example, (negate-slice8 3) = 253.

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

    Definitions and Theorems

    Function: negate-slice8$inline

    (defun acl2::negate-slice8$inline (x)
     (declare (type (unsigned-byte 8) x))
     (let ((__function__ 'negate-slice8))
      (declare (ignorable __function__))
      (mbe
         :logic (logand (+ 1 (lognot (nfix x)))
                        (1- (expt 2 8)))
         :exec (the (unsigned-byte 8)
                    (logand (the (signed-byte 9)
                                 (+ 1 (the (signed-byte 9) (lognot x))))
                            255)))))

    Theorem: natp-of-negate-slice8

    (defthm acl2::natp-of-negate-slice8
      (b* ((~x (acl2::negate-slice8$inline x)))
        (natp ~x))
      :rule-classes :type-prescription)

    Theorem: nat-equiv-implies-equal-negate-slice8-1

    (defthm nat-equiv-implies-equal-negate-slice8-1
      (implies (nat-equiv x x-equiv)
               (equal (negate-slice8 x)
                      (negate-slice8 x-equiv)))
      :rule-classes (:congruence))

    Theorem: unsigned-byte-p-8-of-negate-slice8

    (defthm unsigned-byte-p-8-of-negate-slice8
      (unsigned-byte-p 8 (negate-slice8 x)))