• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/io
      • Std/osets
        • Omaps
        • All-by-membership
        • In
        • Defset
        • Primitives
          • Setp
          • Insert
          • Head
          • Tail
            • Sfix
            • Empty
          • Subset
          • Mergesort
          • Intersect
          • Union
          • Pick-a-point-subset-strategy
          • Delete
          • Difference
          • Cardinality
          • Set
          • Double-containment
          • Intersectp
        • 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
    • Primitives

    Tail

    (tail x) returns the remainder of a set after removing its head.

    This is like cdr, but respects the non-set convention and always returns nil for ill-formed sets.

    Definitions and Theorems

    Function: tail

    (defun tail (x)
           (declare (xargs :guard (and (setp x) (not (empty x)))))
           (mbe :logic (cdr (sfix x))
                :exec (cdr x)))

    Theorem: tail-count

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

    Theorem: tail-count-built-in

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

    Theorem: tail-produces-set

    (defthm tail-produces-set (setp (tail x)))

    Theorem: tail-when-empty

    (defthm tail-when-empty
            (implies (empty x)
                     (equal (tail x) nil)))

    Theorem: tail-sfix-cancel

    (defthm tail-sfix-cancel
            (equal (tail (sfix x)) (tail x)))