• 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

    Empty

    (empty x) recognizes empty sets.

    This function is like endp for lists, but it respects the non-set convention and always returns true for ill-formed sets.

    Definitions and Theorems

    Function: empty

    (defun empty (x)
           (declare (xargs :guard (setp x)))
           (mbe :logic (or (null x) (not (setp x)))
                :exec (null x)))

    Theorem: empty-type

    (defthm empty-type
            (or (equal (empty x) t)
                (equal (empty x) nil))
            :rule-classes :type-prescription)

    Theorem: nonempty-means-set

    (defthm nonempty-means-set
            (implies (not (empty x)) (setp x)))

    Theorem: empty-sfix-cancel

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