• 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

    Head

    Smallest element of a non-empty obag.

    Signature
    (head bag) → *
    Arguments
    bag — Guard (bagp bag).

    This is similar to head for osets.

    Definitions and Theorems

    Function: head

    (defun head (bag)
      (declare (xargs :guard (bagp bag)))
      (declare (xargs :guard (not (emptyp bag))))
      (let ((__function__ 'head))
        (declare (ignorable __function__))
        (mbe :logic (car (bfix bag))
             :exec (car bag))))

    Theorem: head-when-emptyp

    (defthm head-when-emptyp
      (implies (emptyp bag)
               (equal (head bag) nil))
      :rule-classes (:rewrite :type-prescription))

    Theorem: head-count

    (defthm head-count
      (implies (not (emptyp bag))
               (< (acl2-count (head bag))
                  (acl2-count bag)))
      :rule-classes (:rewrite :linear))

    Theorem: head-count-built-in

    (defthm head-count-built-in
      (implies (not (emptyp bag))
               (o< (acl2-count (head bag))
                   (acl2-count bag)))
      :rule-classes :built-in-clause)