• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defmacro
        • Loop$-primer
        • Fast-alists
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
          • Df
          • Unsigned-byte-p
          • Posp
          • Natp
          • <
          • +
          • Bitp
          • Zero-test-idioms
          • Nat-listp
          • Integerp
          • *
          • -
          • Zp
          • Signed-byte-p
          • Logbitp
            • Open-logbitp-of-const-meta
            • Ihs/logbitp-lemmas
              • Equal-by-logbitp
              • Logbit
              • Logbitp-mismatch
              • Logbitp-bounds
              • Logbitp-defaults
              • Logbitp*
            • Sharp-f-reader
            • Expt
            • <=
            • Ash
            • Rationalp
            • =
            • Nfix
            • Logand
            • Floor
            • Random$
            • Integer-listp
            • Complex
            • Numbers-introduction
            • Truncate
            • Code-char
            • Char-code
            • Integer-length
            • Zip
            • Logior
            • Sharp-u-reader
            • Mod
            • Unary--
            • Boole$
            • /
            • Logxor
            • Ifix
            • Lognot
            • Integer-range-p
            • Allocate-fixnum-range
            • ACL2-numberp
            • Sharp-d-reader
            • Mod-expt
            • Ceiling
            • Round
            • Logeqv
            • Fix
            • Explode-nonnegative-integer
            • Max
            • Evenp
            • Zerop
            • Abs
            • Nonnegative-integer-quotient
            • Rfix
            • 1+
            • Pos-listp
            • Signum
            • Rem
            • Real/rationalp
            • Rational-listp
            • >=
            • >
            • Logcount
            • ACL2-number-listp
            • /=
            • Unary-/
            • Realfix
            • Complex/complex-rationalp
            • Logtest
            • Logandc1
            • Logorc1
            • Logandc2
            • Denominator
            • 1-
            • Numerator
            • Logorc2
            • The-number
            • Int=
            • Complex-rationalp
            • Min
            • Lognor
            • Zpf
            • Oddp
            • Minusp
            • Lognand
            • Imagpart
            • Conjugate
            • Realpart
            • Plusp
          • Efficiency
          • Irrelevant-formals
          • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
          • Redefining-programs
          • Lists
          • Invariant-risk
          • Errors
          • Defabbrev
          • Conses
          • Alists
          • Set-register-invariant-risk
          • Strings
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Logbitp
    • Logbit
    • Logops-lemmas

    Ihs/logbitp-lemmas

    Lemmas about logbitp and logbit from the logops-lemmas book.

    We prove a set of lemmas about logbitp, then prove the analogous lemmas about logbit, which is defined in terms of logbitp.

    Definitions and Theorems

    Theorem: logbitp-0-minus-1

    (defthm logbitp-0-minus-1
      (implies (and (integerp pos) (>= pos 0))
               (and (not (logbitp pos 0))
                    (logbitp pos -1))))

    Theorem: logbit-0-minus-1

    (defthm logbit-0-minus-1
      (implies (and (integerp pos)
                    (>= pos 0)
                    (integerp i))
               (and (equal (logbit pos 0) 0)
                    (equal (logbit pos -1) 1))))

    Theorem: logbitp-loghead

    (defthm logbitp-loghead
      (implies (and (loghead-guard size i)
                    (force (integerp pos))
                    (force (>= pos 0)))
               (equal (logbitp pos (loghead size i))
                      (if (< pos size) (logbitp pos i) nil))))

    Theorem: logbit-loghead

    (defthm logbit-loghead
      (implies (and (loghead-guard size i)
                    (force (integerp pos))
                    (force (>= pos 0))
                    (< pos size))
               (equal (logbit pos (loghead size i))
                      (if (< pos size) (logbit pos i) 0))))

    Theorem: logbitp-logtail

    (defthm logbitp-logtail
      (implies (and (logtail-guard pos i)
                    (force (integerp pos1))
                    (force (>= pos1 0)))
               (equal (logbitp pos1 (logtail pos i))
                      (logbitp (+ pos pos1) i))))

    Theorem: logbit-logtail

    (defthm logbit-logtail
      (implies (and (logtail-guard pos i)
                    (force (integerp pos1))
                    (force (>= pos1 0)))
               (equal (logbit pos1 (logtail pos i))
                      (logbit (+ pos pos1) i))))

    Theorem: logbitp-logapp

    (defthm logbitp-logapp
      (implies (and (logapp-guard size i j)
                    (force (integerp pos))
                    (force (>= pos 0)))
               (equal (logbitp pos (logapp size i j))
                      (if (< pos size)
                          (logbitp pos i)
                        (logbitp (- pos size) j)))))

    Theorem: logbit-logapp

    (defthm logbit-logapp
      (implies (and (logapp-guard size i j)
                    (force (integerp pos))
                    (force (>= pos 0)))
               (equal (logbit pos (logapp size i j))
                      (if (< pos size)
                          (logbit pos i)
                        (logbit (- pos size) j)))))

    Theorem: logbitp-logrpl

    (defthm logbitp-logrpl
      (implies (and (logrpl-guard size i j)
                    (force (integerp pos))
                    (force (>= pos 0)))
               (equal (logbitp pos (logrpl size i j))
                      (if (< pos size)
                          (logbitp pos i)
                        (logbitp pos j)))))

    Theorem: logbit-logrpl

    (defthm logbit-logrpl
      (implies (and (logrpl-guard size i j)
                    (force (integerp pos))
                    (force (>= pos 0)))
               (equal (logbit pos (logrpl size i j))
                      (if (< pos size)
                          (logbit pos i)
                        (logbit pos j)))))

    Theorem: logbitp-lognot

    (defthm logbitp-lognot
      (implies (and (integerp pos)
                    (>= pos 0)
                    (integerp i))
               (equal (logbitp pos (lognot i))
                      (not (logbitp pos i)))))

    Theorem: logbit-lognot

    (defthm logbit-lognot
      (implies (and (integerp pos)
                    (>= pos 0)
                    (integerp i))
               (equal (logbit pos (lognot i))
                      (b-not (logbit pos i)))))

    Theorem: logbitp-lognotu

    (defthm logbitp-lognotu
      (implies (and (integerp pos)
                    (>= pos 0)
                    (integerp i)
                    (force (integerp size))
                    (force (>= size 0)))
               (equal (logbitp pos (lognotu size i))
                      (if (< pos size)
                          (not (logbitp pos i))
                        nil))))

    Theorem: logbit-lognotu

    (defthm logbit-lognotu
      (implies (and (integerp pos)
                    (>= pos 0)
                    (integerp i)
                    (force (integerp size))
                    (force (>= size 0)))
               (equal (logbit pos (lognotu size i))
                      (if (< pos size)
                          (b-not (logbit pos i))
                        0))))