• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/io
      • Std/osets
      • Std/system
      • Std/basic
      • Std/typed-lists
      • Std/bitsets
        • Bitsets
          • Bitset-members
          • Bitset-insert
          • Bitset-delete
          • Bitset-intersectp
          • Bitset-intersect
          • Bitset-difference
          • Bitset-subsetp
          • Bitset-memberp
          • Bitset-union
          • Bitset-singleton
            • Bitset-list
            • Bitset-cardinality
            • Bitset-list*
            • Utilities
          • Sbitsets
          • Reasoning
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
        • Std-extensions
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Bitsets

    Bitset-singleton

    (bitset-singleton a) constructs the singleton set {a}.

    Signature
    (bitset-singleton a) → bitset
    Arguments
    a — Guard (natp a).
    Returns
    bitset — Type (natp bitset).

    This is perhaps slightly more efficient than the equivalent, (bitset-insert A 0).

    Definitions and Theorems

    Function: bitset-singleton$inline

    (defun acl2::bitset-singleton$inline (a)
           (declare (type unsigned-byte a))
           (declare (xargs :guard (natp a)))
           (declare (xargs :split-types t))
           (let ((__function__ 'bitset-singleton))
                (declare (ignorable __function__))
                (the unsigned-byte
                     (ash 1 (the unsigned-byte (lnfix a))))))

    Theorem: natp-of-bitset-singleton

    (defthm acl2::natp-of-bitset-singleton
            (b* ((bitset (acl2::bitset-singleton$inline a)))
                (natp bitset))
            :rule-classes :type-prescription)

    Theorem: bitset-singleton-when-not-natp

    (defthm bitset-singleton-when-not-natp
            (implies (not (natp a))
                     (equal (bitset-singleton a)
                            (bitset-singleton 0))))

    Theorem: bitset-singleton-of-nfix

    (defthm bitset-singleton-of-nfix
            (equal (bitset-singleton (nfix a))
                   (bitset-singleton a)))

    Theorem: bitset-members-of-bitset-singleton

    (defthm bitset-members-of-bitset-singleton
            (equal (bitset-members (bitset-singleton a))
                   (insert (nfix a) nil)))