• 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
  • Numbers
  • ACL2-built-ins

Logbitp

The ith bit of an integer

For a nonnegative integer i and an integer j, (logbitp i j) is a Boolean, which is t if and only if the value of the ith bit is 1 in the two's complement representation of j.

(Logbitp i j) has a guard that i is a nonnegative integer and j is an integer.

Logbitp is a Common Lisp function. See any Common Lisp documentation for more information.

Function: logbitp

(defun logbitp (i j)
  (declare (xargs :guard (and (integerp j)
                              (integerp i)
                              (>= i 0))))
  (oddp (floor (ifix j) (expt 2 (nfix i)))))

Subtopics

Open-logbitp-of-const-meta
Rewrite terms like (logbitp foo 7) to (or (not (natp foo)) (member-equal foo '(0 1 2))).
Ihs/logbitp-lemmas
Lemmas about logbitp and logbit from the logops-lemmas book.
Equal-by-logbitp
Show a = b by showing their bits are equal.
Logbit
(logbit pos i) returns the bit of i at bit-position pos as a bitp, 0 or 1.
Logbitp-mismatch
(logbitp-mismatch a b) finds the minimal bit-position for which a and b differ, or returns NIL if no such bit exists.
Logbitp-bounds
Lemmas about inferring logbitp information from bounds expressed using expt and vice versa
Logbitp-defaults
Behavior of logbitp on bad inputs.
Logbitp*
Recursive definition of logbitp.