• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
      • Ipasir
      • Aignet
      • Aig
      • Satlink
      • Truth
      • Ubdds
      • Bdd
      • Faig
      • Bed
      • 4v
        • 4v-sexprs
          • 4v-sexpr-vars
          • 4v-sexpr-eval
          • 4v-sexpr-to-faig
          • 4v-sexpr-restrict-with-rw
          • 4vs-constructors
          • 4v-sexpr-compose-with-rw
          • 4v-sexpr-restrict
          • 4v-sexpr-alist-extract
          • 4v-sexpr-compose
          • 4v-nsexpr-p
            • 4v-nsexpr-alist-p
            • 4v-nsexpr-p-4v-sexpr-compose
            • 4v-nsexpr-p-4v-sexpr-restrict
          • 4v-sexpr-purebool-p
          • 4v-sexpr-<=
          • Sfaig
          • Sexpr-equivs
          • 3v-syntax-sexprp
          • Sexpr-rewriting
          • 4v-sexpr-ind
          • 4v-alist-extract
        • 4v-monotonicity
        • 4v-operations
        • Why-4v-logic
        • 4v-<=
        • 4vp
        • 4vcases
        • 4v-fix
        • 4v-lookup
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Testing-utilities
    • Math
  • 4v-sexprs

4v-nsexpr-p

(4v-nsexpr-p x) recognizes s-expressions where every variable is a natural number.

We can develop a faster version of 4v-sexpr-vars by requiring all of the variables in an s-expression to be natural numbers; see 4v-nsexpr-vars.

Memoized. You should probably clear its table when you clear the tables for 4v-nsexpr-vars-nonsparse or 4v-nsexpr-vars-sparse.

We typically leave these disabled and reason about, e.g.,

(nat-listp (4v-sexpr-vars x))

Definitions and Theorems

Function: 4v-nsexpr-p

(defun 4v-nsexpr-p (x)
  (declare (xargs :guard t))
  (if (atom x)
      (or (not x) (natp x))
    (4v-nsexpr-list-p (cdr x))))

Function: 4v-nsexpr-list-p

(defun 4v-nsexpr-list-p (x)
  (declare (xargs :guard t))
  (if (atom x)
      t
    (and (4v-nsexpr-p (car x))
         (4v-nsexpr-list-p (cdr x)))))

Function: 4v-nsexpr-p-memoize-condition

(defun 4v-nsexpr-p-memoize-condition (x)
  (declare (ignorable x)
           (xargs :guard 't))
  (and (consp x) (consp (cdr x))))

Theorem: 4v-nsexpr-p-when-nat-listp-4v-sexpr-vars

(defthm 4v-nsexpr-p-when-nat-listp-4v-sexpr-vars
  (equal (4v-nsexpr-p x)
         (nat-listp (4v-sexpr-vars x))))

Theorem: 4v-nsexpr-list-p-when-nat-listp-4v-sexpr-vars-list

(defthm 4v-nsexpr-list-p-when-nat-listp-4v-sexpr-vars-list
  (equal (4v-nsexpr-list-p x)
         (nat-listp (4v-sexpr-vars-list x))))

Subtopics

4v-nsexpr-alist-p
(4v-nsexpr-p x) recognizes an alist where every value is an 4v-nsexpr-p.
4v-nsexpr-p-4v-sexpr-compose
4v-nsexpr-p-4v-sexpr-restrict