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