• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
        • Bagp
        • Bag
        • Tail
        • Head
        • Emptyp
        • Subbag
        • Intersect
        • Union
        • Insert
        • Difference
        • Delete
        • Cardinality
        • Bfix
        • In
          • Occs
        • Std/util
        • Std/strings
        • Std/osets
        • Std/io
        • Std/basic
        • 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
    • Obags

    In

    Check if a values occurs in an obag.

    Signature
    (in x bag) → yes/no
    Arguments
    bag — Guard (bagp bag).
    Returns
    yes/no — Type (booleanp yes/no).

    This is similar to set::in on osets.

    Definitions and Theorems

    Function: in

    (defun in (x bag)
      (declare (xargs :guard (bagp bag)))
      (let ((__function__ 'in))
        (declare (ignorable __function__))
        (and (not (emptyp bag))
             (or (equal x (head bag))
                 (in x (tail bag))))))

    Theorem: booleanp-of-in

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