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

Bytep

Recognize unsigned 8-bit bytes.

Signature
(bytep 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: this predicate caters to this common terminology.

Definitions and Theorems

Function: bytep

(defun bytep (x)
  (declare (xargs :guard t))
  (mbe :logic (unsigned-byte-p 8 x)
       :exec (and (integerp x) (<= 0 x) (< x 256))))

Theorem: booleanp-of-bytep

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

Theorem: bytep-compound-recognizer

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

Subtopics

Byte
A fixtype of (unsigned 8-bit) bytes.
Bytes-as-digits-in-base-256
Specialized versions of the operations to convert between natural numbers and digits that use bytes as digits, in base 256.
Bytep-additional-theorems
Additional theorems about byte.