• 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

    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 (empty 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-empty

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

    Theorem: tail-count

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

    Theorem: tail-count-built-in

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