• 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

    Tail

    Rest of a non-empty obag after removing an occurrence of its smallest element.

    Signature
    (tail bag) → bag1
    Arguments
    bag — Guard (bagp bag).
    Returns
    bag1 — Type (bagp bag1).

    This is similar to set::tail on osets.

    Definitions and Theorems

    Function: tail

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

    Theorem: bagp-of-tail

    (defthm bagp-of-tail
      (b* ((bag1 (tail bag))) (bagp bag1))
      :rule-classes :rewrite)

    Theorem: tail-when-emptyp

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

    Theorem: tail-count

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

    Theorem: tail-count-built-in

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