• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/io
      • Std/osets
      • Std/system
      • Std/basic
        • Maybe-stringp
        • Maybe-natp
        • Two-nats-measure
        • Impossible
        • Nat-list-measure
        • Bytep
        • Maybe-posp
        • Nibblep
          • Nibble
          • Nibblep-additional-theorems
        • Mbt$
        • Organize-symbols-by-pkg
        • Organize-symbols-by-name
        • Good-valuep
        • Lnfix
        • Streqv
        • Chareqv
        • Symbol-package-name-non-cl
        • Std/basic-extensions
        • Arith-equivs
        • Induction-schemes
        • Maybe-integerp
        • Char-fix
        • Symbol-package-name-lst
        • Pos-fix
        • Maybe-bitp
        • Good-pseudo-termp
        • Str-fix
        • Maybe-string-fix
        • Lifix
        • Bfix
        • Std/basic/if*
        • Impliez
        • Tuplep
        • Std/basic/symbol-name-lst
        • Std/basic/intern-in-package-of-symbol
        • Lbfix
        • True
        • Std/basic/member-symbol-name
        • False
      • Std/typed-lists
      • Std/bitsets
      • Std/testing
      • Std/typed-alists
      • Std/stobjs
      • Std-extensions
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Testing-utilities
    • Math
  • Std/basic
  • Unsigned-byte-p
  • Signed-byte-p

Nibblep

Recognize unsigned 4-bit bytes.

Signature
(nibblep x) → yes/no
Returns
yes/no — Type (booleanp yes/no).

ACL2 has a flexible notion of `byte', which may be signed or unsigned, and consist of (almost) any number of bits: see unsigned-byte-p and signed-byte-p. But very often the unqualified term `byte' refers to a sequence of exactly 8 bits, represented by natural numbers below 256, and the term `nibble' refers to half of such a byte, i.e. a sequence of 4 bits, represented by natural numbers below 16; this predicate caters to this common terminology.

Definitions and Theorems

Function: nibblep

(defun nibblep (x)
       (declare (xargs :guard t))
       (mbe :logic (unsigned-byte-p 4 x)
            :exec (and (integerp x) (<= 0 x) (< x 16))))

Theorem: booleanp-of-nibblep

(defthm booleanp-of-nibblep
        (b* ((yes/no (nibblep x)))
            (booleanp yes/no))
        :rule-classes :rewrite)

Theorem: nibblep-compound-recognizer

(defthm nibblep-compound-recognizer
        (implies (nibblep x)
                 (and (integerp x) (<= 0 x)))
        :rule-classes :compound-recognizer)

Subtopics

Nibble
A fixtype of (unsigned 4-bit) nibbles.
Nibblep-additional-theorems
Additional theorems about nibble.