• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
      • Ipasir
      • Aignet
        • Base-api
        • Aignet-construction
          • Gatesimp
          • Aignet-hash-mux
            • Aignet-hash-or
            • Aignet-hash-and
            • Aignet-hash-xor
            • Aignet-hash-iff
            • Aignet-build
            • Patbind-aignet-build
          • Representation
          • Aignet-copy-init
          • Aignet-simplify-marked-with-tracking
          • Aignet-cnf
          • Aignet-simplify-with-tracking
          • Aignet-complete-copy
          • Aignet-eval
          • Semantics
          • Aignet-transforms
          • Aignet-simplify-marked
          • Aignet-read-aiger
          • Aignet-write-aiger
          • Aignet-abc-interface
          • Utilities
        • Aig
        • Satlink
        • Truth
        • Ubdds
        • Bdd
        • Faig
        • Bed
        • 4v
      • Debugging
      • Projects
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Aignet-construction

    Aignet-hash-mux

    Implement an if-then-else of the given literals in an AIGNET, or find a node already representing the required logical expression.

    Signature
    (aignet-hash-mux c tb fb gatesimp strash aignet) 
      → 
    (mv result new-strash new-aignet)
    Arguments
    c — Literal to AND with lit2.
        Guard (litp c).
    tb — Guard (litp tb).
    fb — Guard (litp fb).
    gatesimp — Configuration for how much simplification to try and whether to use hashing.
        Guard (gatesimp-p gatesimp).
    strash — Stobj containing the aignet's structural hash table.
    Returns
    result — Type (litp result).

    See aignet-construction.

    Definitions and Theorems

    Function: aignet-hash-mux

    (defun
         aignet-hash-mux
         (c tb fb gatesimp strash aignet)
         (declare (xargs :stobjs (strash aignet)))
         (declare (type (unsigned-byte 30) c)
                  (type (unsigned-byte 30) tb)
                  (type (unsigned-byte 30) fb)
                  (type (unsigned-byte 6) gatesimp))
         (declare (xargs :guard (and (litp c)
                                     (litp tb)
                                     (litp fb)
                                     (gatesimp-p gatesimp))))
         (declare (xargs :guard (and (fanin-litp c aignet)
                                     (fanin-litp tb aignet)
                                     (fanin-litp fb aignet))
                         :split-types t))
         (let ((__function__ 'aignet-hash-mux))
              (declare (ignorable __function__))
              (b* ((aignet (mbe :logic (non-exec (node-list-fix aignet))
                                :exec aignet))
                   (c (mbe :logic (non-exec (aignet-lit-fix c aignet))
                           :exec c))
                   (tb (mbe :logic (non-exec (aignet-lit-fix tb aignet))
                            :exec tb))
                   (fb (mbe :logic (non-exec (aignet-lit-fix fb aignet))
                            :exec fb))
                   ((when (eql tb fb))
                    (mv tb strash aignet))
                   ((when (eql tb (lit-negate fb)))
                    (aignet-hash-xor c fb gatesimp strash aignet)))
                  (aignet-build (or (and c tb) (and (not c) fb))
                                gatesimp strash aignet))))

    Theorem: litp-of-aignet-hash-mux.result

    (defthm acl2::litp-of-aignet-hash-mux.result
            (b* (((mv ?result ?new-strash ?new-aignet)
                  (aignet-hash-mux c tb fb gatesimp strash aignet)))
                (litp result))
            :rule-classes (:rewrite :type-prescription))

    Theorem: aignet-extension-p-of-aignet-hash-mux

    (defthm
         acl2::aignet-extension-p-of-aignet-hash-mux
         (aignet-extension-p
              (mv-nth 2
                      (aignet-hash-mux c tb fb gatesimp strash aignet))
              aignet)
         :rule-classes :rewrite)

    Theorem: aignet-litp-of-aignet-hash-mux

    (defthm aignet-litp-of-aignet-hash-mux
            (b* (((mv ?result ?new-strash ?new-aignet)
                  (aignet-hash-mux c tb fb gatesimp strash aignet)))
                (aignet-litp result new-aignet)))

    Theorem: deps-of-aignet-hash-mux

    (defthm
         deps-of-aignet-hash-mux
         (b* (((mv ?result ?new-strash ?new-aignet)
               (aignet-hash-mux c tb fb gatesimp strash aignet)))
             (implies (and (not (depends-on (lit->var c) ci-id aignet))
                           (not (depends-on (lit->var tb) ci-id aignet))
                           (not (depends-on (lit->var fb)
                                            ci-id aignet)))
                      (not (depends-on (lit->var result)
                                       ci-id new-aignet)))))

    Theorem: lit-eval-of-aignet-hash-mux

    (defthm lit-eval-of-aignet-hash-mux
            (b* (((mv ?result ?new-strash ?new-aignet)
                  (aignet-hash-mux c tb fb gatesimp strash aignet)))
                (equal (lit-eval result invals regvals new-aignet)
                       (b-ite (lit-eval c invals regvals aignet)
                              (lit-eval tb invals regvals aignet)
                              (lit-eval fb invals regvals aignet)))))

    Theorem: stype-counts-preserved-of-aignet-hash-mux

    (defthm
         stype-counts-preserved-of-aignet-hash-mux
         (b* (((mv ?result ?new-strash ?new-aignet)
               (aignet-hash-mux c tb fb gatesimp strash aignet)))
             (implies (and (not (equal (stype-fix stype) (and-stype)))
                           (not (equal (stype-fix stype) (xor-stype))))
                      (equal (stype-count stype new-aignet)
                             (stype-count stype aignet)))))

    Theorem: unsigned-byte-p-of-aignet-hash-mux

    (defthm unsigned-byte-p-of-aignet-hash-mux
            (b* (((mv ?result ?new-strash ?new-aignet)
                  (aignet-hash-mux c tb fb gatesimp strash aignet)))
                (implies (and (< (fanin-count aignet) 536870909)
                              (natp n)
                              (<= 30 n))
                         (unsigned-byte-p n result))))

    Theorem: aignet-hash-mux-of-lit-fix-c

    (defthm acl2::aignet-hash-mux-of-lit-fix-c
            (equal (aignet-hash-mux (lit-fix c)
                                    tb fb gatesimp strash aignet)
                   (aignet-hash-mux c tb fb gatesimp strash aignet)))

    Theorem: aignet-hash-mux-lit-equiv-congruence-on-c

    (defthm
        acl2::aignet-hash-mux-lit-equiv-congruence-on-c
        (implies (lit-equiv c acl2::c-equiv)
                 (equal (aignet-hash-mux c tb fb gatesimp strash aignet)
                        (aignet-hash-mux acl2::c-equiv
                                         tb fb gatesimp strash aignet)))
        :rule-classes :congruence)

    Theorem: aignet-hash-mux-of-lit-fix-tb

    (defthm acl2::aignet-hash-mux-of-lit-fix-tb
            (equal (aignet-hash-mux c (lit-fix tb)
                                    fb gatesimp strash aignet)
                   (aignet-hash-mux c tb fb gatesimp strash aignet)))

    Theorem: aignet-hash-mux-lit-equiv-congruence-on-tb

    (defthm
        acl2::aignet-hash-mux-lit-equiv-congruence-on-tb
        (implies (lit-equiv tb acl2::tb-equiv)
                 (equal (aignet-hash-mux c tb fb gatesimp strash aignet)
                        (aignet-hash-mux c acl2::tb-equiv
                                         fb gatesimp strash aignet)))
        :rule-classes :congruence)

    Theorem: aignet-hash-mux-of-lit-fix-fb

    (defthm acl2::aignet-hash-mux-of-lit-fix-fb
            (equal (aignet-hash-mux c tb (lit-fix fb)
                                    gatesimp strash aignet)
                   (aignet-hash-mux c tb fb gatesimp strash aignet)))

    Theorem: aignet-hash-mux-lit-equiv-congruence-on-fb

    (defthm
     acl2::aignet-hash-mux-lit-equiv-congruence-on-fb
     (implies
        (lit-equiv fb acl2::fb-equiv)
        (equal (aignet-hash-mux c tb fb gatesimp strash aignet)
               (aignet-hash-mux c tb
                                acl2::fb-equiv gatesimp strash aignet)))
     :rule-classes :congruence)

    Theorem: aignet-hash-mux-of-gatesimp-fix-gatesimp

    (defthm acl2::aignet-hash-mux-of-gatesimp-fix-gatesimp
            (equal (aignet-hash-mux c tb fb (gatesimp-fix gatesimp)
                                    strash aignet)
                   (aignet-hash-mux c tb fb gatesimp strash aignet)))

    Theorem: aignet-hash-mux-gatesimp-equiv-congruence-on-gatesimp

    (defthm
     acl2::aignet-hash-mux-gatesimp-equiv-congruence-on-gatesimp
     (implies
        (gatesimp-equiv gatesimp acl2::gatesimp-equiv)
        (equal (aignet-hash-mux c tb fb gatesimp strash aignet)
               (aignet-hash-mux c tb
                                fb acl2::gatesimp-equiv strash aignet)))
     :rule-classes :congruence)

    Theorem: aignet-hash-mux-of-node-list-fix-aignet

    (defthm
         acl2::aignet-hash-mux-of-node-list-fix-aignet
         (equal (aignet-hash-mux c tb fb
                                 gatesimp strash (node-list-fix aignet))
                (aignet-hash-mux c tb fb gatesimp strash aignet)))

    Theorem: aignet-hash-mux-node-list-equiv-congruence-on-aignet

    (defthm
     acl2::aignet-hash-mux-node-list-equiv-congruence-on-aignet
     (implies
        (node-list-equiv aignet acl2::aignet-equiv)
        (equal (aignet-hash-mux c tb fb gatesimp strash aignet)
               (aignet-hash-mux c tb
                                fb gatesimp strash acl2::aignet-equiv)))
     :rule-classes :congruence)