• Top
    • Documentation
    • Books
    • Boolean-reasoning
      • Ipasir
      • Aignet
      • Aig
      • Satlink
      • Truth
      • Ubdds
      • Bdd
      • Faig
      • Bed
      • 4v
        • 4v-sexprs
          • 4v-sexpr-vars
            • 4v-sexpr-vars-1pass
            • 4v-nsexpr-vars
              • 4v-nsexpr-vars-sparse
              • 4v-nsexpr-vars-nonsparse
            • 4v-sexpr-vars-1pass-list-list
            • 4v-sexpr-vars-list-list
            • 4v-sexpr-vars-alists
            • 4v-sexpr-vars-alist
            • 4v-sexpr-vars-1pass-list
            • 4v-sexpr-vars-list
          • 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-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
    • Community
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • 4v-sexpr-vars

4v-nsexpr-vars

Optimized version of 4v-sexpr-vars for sexprs whose variables are natural numbers.

(4v-nsexpr-vars x) is logically just 4v-sexpr-vars. However, its guard requires that all variables in the sexpr are natural numbers; see 4v-nsexpr-p.

In the execution, we use a strategy that is quite similar to the ordinary 4v-sexpr-vars function: we memoize the entire computation and build variable sets for every sexpr subexpression. But, instead of using ordered lists of variables, we use either bitsets or sparse bitsets as our set representation. This turns out to make a very significant performance difference.

By default we use sparse bitsets since in our experiments they appear to significantly outperform ordinary bitsets when dealing with large modules. However, you can instead choose to use ordinary bitsets by running:

(4v-nsexpr-vars x :sparsep nil)

The real computation is done by 4v-nsexpr-vars-sparse or by 4v-nsexpr-vars-nonsparse. You will probably want to clear the memo tables for these functions occasionally. You may also need to clear the table for 4v-nsexpr-vars unless your guards are strong enough to ensure it will not be called.

Definitions and Theorems

Function: 4v-nsexpr-vars-fn

(defun 4v-nsexpr-vars-fn (x sparsep)
  (declare (xargs :guard (4v-nsexpr-p x)))
  (mbe :logic (4v-sexpr-vars x)
       :exec
       (if sparsep (sbitset-members (4v-nsexpr-vars-sparse x))
         (bitset-members (4v-nsexpr-vars-nonsparse x)))))

Subtopics

4v-nsexpr-vars-sparse
Sparse version.
4v-nsexpr-vars-nonsparse
Non-sparse version.