• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Testing-utilities
    • Math
      • 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
          • Install-bit
          • Trailing-0-count
          • Bitops/defaults
          • Logbitp-mismatch
          • Trailing-1-count
          • Bitops/rotate
            • Rotate-right
            • Rotate-left
            • Rotate-right-1
            • Rotate-left-1
            • Rotate-right**
              • Rotate-left**
            • 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
    • Bitops/rotate
    • Rotate-right

    Rotate-right**

    Alternate, recursive definitions of rotate-right.

    Here are both tail-recursive and non tail-recursive versions of rotate-right. These rules are disabled by default and must be explicitly enabled when you want to use them.

    Definitions and Theorems

    Theorem: rotate-right**

    (defthm
         rotate-right**
         (equal (rotate-right x width places)
                (if (zp places)
                    (loghead width x)
                    (rotate-right-1 (rotate-right x width (- places 1))
                                    width)))
         :rule-classes
         ((:definition :clique (rotate-right)
                       :controller-alist ((rotate-right nil nil t)))))

    Theorem: rotate-right**-tr

    (defthm
         rotate-right**-tr
         (equal (rotate-right x width places)
                (if (zp places)
                    (loghead width x)
                    (rotate-right (rotate-right-1 x width)
                                  width (- places 1))))
         :rule-classes
         ((:definition :clique (rotate-right)
                       :controller-alist ((rotate-right nil nil t)))))