• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
      • 100-theorems
      • Arithmetic
      • Bit-vectors
        • Sparseint
        • Bitops
        • Bv
        • Ihs
          • Logops-definitions
            • Logops-byte-functions
            • Defword
            • Defbytetype
            • Logext
            • Logrev
            • Loghead
            • Logops-bit-functions
            • Logtail
            • Logapp
            • Logsat
            • Binary--
            • Logcdr
            • Logcar
            • Logbit
            • Logextu
            • Logcons
            • Lshu
            • Logrpl
            • Ashu
            • Logmaskp
            • Lognotu
            • Logmask
              • Imod
              • Ifloor
              • Bfix
              • Bitmaskp
              • Logite
              • Expt2
              • Zbp
              • *logops-functions*
              • Word/bit-macros
              • Logops-definitions-theory
              • Logops-functions
              • Lbfix
              • Logextu-guard
              • Lshu-guard
              • Logtail-guard
              • Logrpl-guard
              • Logrev-guard
              • Lognotu-guard
              • Logmask-guard
              • Loghead-guard
              • Logext-guard
              • Logbit-guard
              • Logapp-guard
              • Ashu-guard
            • Math-lemmas
            • Ihs-theories
            • Ihs-init
            • Logops
          • Rtl
        • Algebra
      • Testing-utilities
    • Logops-definitions

    Logmask

    (logmask size) creates a low-order, size-bit mask.

    Signature
    (logmask size) → nat
    Arguments
    size — Guard (natp size).
    Returns
    nat — Type (natp nat).

    In languages like C, this might be written as (1 << size) - 1.

    Definitions and Theorems

    Function: logmask$inline

    (defun logmask$inline (size)
      (declare (xargs :guard (natp size)))
      (let ((__function__ 'logmask))
        (declare (ignorable __function__))
        (mbe :logic (- (expt2 size) 1)
             :exec (the unsigned-byte
                        (1- (the unsigned-byte (ash 1 size)))))))

    Theorem: logmask-type

    (defthm logmask-type
      (b* ((nat (logmask$inline size)))
        (natp nat))
      :rule-classes :type-prescription)