• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
          • Defbyte
          • Defresult
          • Fold
          • Specific-types
            • Pos-list
            • Defbyte-standard-instances
            • Defbytelist-standard-instances
            • Byte-list
            • Byte
            • String-option
            • Pos-option
            • Nibble
            • Nat-option
            • Ubyte32-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
            • Character-any-map
            • Any-nat-map
            • Symbol-set
            • String-set
            • Nat-set
              • Nat-sfix
              • Nat-setp
                • Nat-sequiv
              • Character-set
              • Oct-digit-char-list
              • Bin-digit-char-list
              • Bit-list
            • Defsubtype
            • Defset
            • Defflatsum
            • Deflist-of-len
            • Pos-list
            • Defomap
            • Defbytelist
            • Defbyte-standard-instances
            • Deffixtype-alias
            • Defbytelist-standard-instances
            • Defunit
            • Byte-list
            • Database
            • Byte
            • String-option
            • Pos-option
            • Nibble
            • Nat-option
            • Ubyte32-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
            • Dependencies
            • Bag
            • Pos-set
            • Hex-digit-char-list
            • Dec-digit-char-list
            • Pseudo-event-form-list
            • Nat-option-list
            • Character-any-map
            • Any-nat-map
            • Symbol-set
            • String-set
            • Nat-set
              • Nat-sfix
              • Nat-setp
                • Nat-sequiv
              • Character-set
              • Oct-digit-char-list
              • Bin-digit-char-list
              • Bit-list
            • Isar
            • Kestrel-utilities
            • Set
            • C
            • Soft
            • Bv
            • Imp-language
            • Ethereum
            • Event-macros
            • Java
            • Riscv
            • Bitcoin
            • Zcash
            • Yul
            • ACL2-programming-language
            • Prime-fields
            • Json
            • Syntheto
            • File-io-light
            • Cryptography
            • Number-theory
            • Axe
            • Lists-light
            • Builtins
            • Solidity
            • Helpers
            • Htclient
            • Typed-lists-light
            • Arithmetic-light
          • X86isa
          • Axe
          • Execloader
        • 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 (or (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))))