• 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

    Sfix

    (sfix x) is a fixing function for sets.

    We return any proper setp unchanged, but coerce any non-setp into the empty set.

    This does for sets what functions like nfix or rfix do for numbers. It is often useful to use sfix in the base case of a set operation to ensure that an ordered set is always produced.

    Definitions and Theorems

    Function: sfix

    (defun sfix (x)
           (declare (xargs :guard (setp x)))
           (mbe :logic (if (empty x) nil x)
                :exec x))

    Theorem: sfix-produces-set

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

    Theorem: sfix-set-identity

    (defthm sfix-set-identity
            (implies (setp x) (equal (sfix x) x)))

    Theorem: sfix-when-empty

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