• Top
    • Documentation
    • Books
    • 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-sexpr-purebool-p
          • 4v-sexpr-<=
          • Sfaig
          • Sexpr-equivs
          • 3v-syntax-sexprp
          • Sexpr-rewriting
            • 4v-shannon-expansion
            • Onehot-rewriting
              • 4v-onehot-sexpr-list-prime
              • 4v-onehot-sexpr-prime
              • 4v-onehot-rw-sexpr-alist-aux
              • 4v-onehot-rw-sexpr-alist
              • 4v-onehot-rw-sexpr
              • 4vs-onehot
              • 4vs-ite*-list-dumb
              • 4v-onehot-filter
                • 4v-onehot-list-p
              • 4v-sexpr-restrict-with-rw
              • 4v-sexpr-compose-with-rw
              • Sexpr-rewrite
              • Sexpr-rewrite-default
              • Sexpr-rewriting-internals
              • *sexpr-rewrites*
            • 4v-sexpr-ind
            • 4v-alist-extract
          • 4v-monotonicity
          • 4v-operations
          • Why-4v-logic
          • 4v-<=
          • 4vp
          • 4vcases
          • 4v-fix
          • 4v-lookup
      • Projects
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Onehot-rewriting

    4v-onehot-filter

    Filter a sexpr-alist to avoid unnecessary onehot-rewriting.

    Definitions and Theorems

    Function: 4v-sexpr-mentions

    (defun 4v-sexpr-mentions (x vars-fal)
      (declare (xargs :guard t))
      (if (atom x)
          (hons-get x vars-fal)
        (4v-sexpr-list-mentions (cdr x)
                                vars-fal)))

    Function: 4v-sexpr-list-mentions

    (defun 4v-sexpr-list-mentions (x vars-fal)
      (declare (xargs :guard t))
      (if (atom x)
          nil
        (or (4v-sexpr-mentions (car x) vars-fal)
            (4v-sexpr-list-mentions (cdr x)
                                    vars-fal))))

    Function: 4v-sexpr-mentions-memoize-condition

    (defun 4v-sexpr-mentions-memoize-condition (x vars-fal)
      (declare (ignorable x vars-fal)
               (xargs :guard 't))
      (consp x))

    Function: 4v-onehot-filter

    (defun 4v-onehot-filter (x vars-fal keep skip)
      (declare (xargs :guard t))
      (cond ((atom x) (mv keep skip))
            ((atom (car x))
             (4v-onehot-filter (cdr x)
                               vars-fal keep skip))
            ((4v-sexpr-mentions (cdar x) vars-fal)
             (4v-onehot-filter (cdr x)
                               vars-fal (cons (car x) keep)
                               skip))
            (t (4v-onehot-filter (cdr x)
                                 vars-fal keep (cons (car x) skip)))))

    Theorem: 4v-onehot-filter-correct

    (defthm 4v-onehot-filter-correct
      (b* (((mv keep skip)
            (4v-onehot-filter x vars-fal nil nil)))
        (implies (no-duplicatesp-equal (alist-keys x))
                 (equal (hons-assoc-equal key x)
                        (or (hons-assoc-equal key keep)
                            (hons-assoc-equal key skip)))))
      :rule-classes nil)