• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
      • B*
      • Defunc
      • Fty
        • Deftagsum
        • Defprod
        • Defflexsum
        • Defbitstruct
        • Deflist
        • Defalist
        • Defbyte
        • Deffixequiv
        • Defresult
        • Deffixtype
        • Defoption
        • Fty-discipline
        • Fold
        • Fty-extensions
          • Defbyte
          • Defresult
          • Fold
          • Defsubtype
          • Defset
          • Specific-types
          • Defflatsum
          • Deflist-of-len
          • Pos-list
          • Defbytelist
          • Defomap
          • Defbyte-standard-instances
          • Deffixtype-alias
          • Defbytelist-standard-instances
          • Defunit
          • Byte-list
          • Byte
          • Database
          • Pos-option
          • Nibble
          • Nat-option
          • String-option
          • Byte-list20
          • Byte-list32
          • Byte-list64
          • Pseudo-event-form
          • Natoption/natoptionlist
          • Nati
          • Character-list
          • Nat/natlist
          • Maybe-string
          • Nibble-list
          • Natoption/natoptionlist-result
          • Nat/natlist-result
          • Nat-option-list-result
          • Set
          • String-result
          • String-list-result
          • Nat-result
          • Nat-option-result
          • Nat-list-result
          • Maybe-string-result
          • Integer-result
          • Character-result
          • Character-list-result
          • Boolean-result
          • Map
          • Bag
          • Pos-set
          • Hex-digit-char-list
          • Dec-digit-char-list
          • Pseudo-event-form-list
          • Nat-option-list
          • Symbol-set
          • String-set
          • Nat-set
            • Nat-sfix
            • Nat-setp
              • Nat-sequiv
            • Oct-digit-char-list
            • Bin-digit-char-list
            • Bit-list
          • Defsubtype
          • Defset
          • Deftypes
          • Specific-types
          • Defflatsum
          • Deflist-of-len
          • Defbytelist
          • Fty::basetypes
          • Defomap
          • Defvisitors
          • Deffixtype-alias
          • Deffixequiv-sk
          • Defunit
          • Multicase
          • Deffixequiv-mutual
          • Fty::baselists
          • Def-enumcase
          • Defmap
        • Apt
        • Std/util
        • Defdata
        • Defrstobj
        • Seq
        • Match-tree
        • Defrstobj
        • With-supporters
        • Def-partial-measure
        • Template-subst
        • Soft
        • Defthm-domain
        • Event-macros
        • Def-universal-equiv
        • Def-saved-obligs
        • With-supporters-after
        • Definec
        • Sig
        • Outer-local
        • Data-structures
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Nat-set

    Nat-setp

    Recognizer for nat-set.

    Signature
    (nat-setp x) → *

    Definitions and Theorems

    Function: nat-setp

    (defun nat-setp (x)
      (declare (xargs :guard t))
      (if (atom x)
          (null x)
        (and (natp (car x))
             (or (null (cdr x))
                 (and (consp (cdr x))
                      (fast-<< (car x) (cadr x))
                      (nat-setp (cdr x)))))))

    Theorem: booleanp-ofnat-setp

    (defthm booleanp-ofnat-setp
      (booleanp (nat-setp x)))

    Theorem: setp-when-nat-setp

    (defthm setp-when-nat-setp
      (implies (nat-setp x) (set::setp x))
      :rule-classes (:rewrite))

    Theorem: natp-of-head-when-nat-setp

    (defthm natp-of-head-when-nat-setp
      (implies (nat-setp x)
               (equal (natp (set::head x))
                      (not (set::emptyp x)))))

    Theorem: nat-setp-of-tail-when-nat-setp

    (defthm nat-setp-of-tail-when-nat-setp
      (implies (nat-setp x)
               (nat-setp (set::tail x))))

    Theorem: nat-setp-of-insert

    (defthm nat-setp-of-insert
      (equal (nat-setp (set::insert a x))
             (and (natp a)
                  (nat-setp (set::sfix x)))))

    Theorem: natp-when-in-nat-setp-binds-free-x

    (defthm natp-when-in-nat-setp-binds-free-x
      (implies (and (set::in a x) (nat-setp x))
               (natp a)))

    Theorem: not-in-nat-setp-when-not-natp

    (defthm not-in-nat-setp-when-not-natp
      (implies (and (nat-setp x) (not (natp a)))
               (not (set::in a x))))

    Theorem: nat-setp-of-union

    (defthm nat-setp-of-union
      (equal (nat-setp (set::union x y))
             (and (nat-setp (set::sfix x))
                  (nat-setp (set::sfix y)))))

    Theorem: nat-setp-of-intersect

    (defthm nat-setp-of-intersect
      (implies (and (nat-setp x) (nat-setp y))
               (nat-setp (set::intersect x y))))

    Theorem: nat-setp-of-difference

    (defthm nat-setp-of-difference
      (implies (nat-setp x)
               (nat-setp (set::difference x y))))

    Theorem: nat-setp-of-delete

    (defthm nat-setp-of-delete
      (implies (nat-setp x)
               (nat-setp (set::delete a x))))