• Top
    • Documentation
    • Books
    • Boolean-reasoning
      • Ipasir
      • Aignet
        • Base-api
        • Aignet-construction
        • Representation
        • Aignet-copy-init
        • Aignet-simplify-with-tracking
        • Aignet-simplify-marked-with-tracking
        • Aignet-cnf
        • Aignet-simplify-marked
        • Aignet-complete-copy
        • Aignet-transforms
          • Aignet-output-ranges
          • Aignet-comb-transforms
            • Fraig
            • Parametrize
              • Aignet-parametrize-output-ranges
              • Aignet-parametrize-copy-set-regs
              • Aignet-parametrize-copy-set-ins
              • Aignet-parametrize-collect-bdd-order-aux
              • Aignet-parametrize-collect-bdd-order
              • Aignet-output-range-conjoin-ubdds
              • Aignet-output-range-collect-in/reg-ubdd-order
              • Aignet-finish-reg-ubdd-order
              • Aignet-finish-in-ubdd-order
              • Aignet-copy-dfs-output-range
              • Aignet-parametrize-m-n
              • Aignet-node-to-ubdd
              • Aignet-output-range-to-ubdds
              • Ubdd-to-aignet
                • Aignet-parametrize-copy-init
                • Parametrize-config
                • Parametrize-output-type
                • Ubdd-arr-to-param-space
                • Copy-lits-compose
                • Bitarr-range-1bit-indices
                • Bitarr-range-count
                • Aignet-count-ubdd-branches-wrap
                • Ubdd-to-aignet-memo-ok
                • Aignet-node-to-ubdd-build-cond
                • Copy-lits-compose-in-place
                • Bitarr-range-set
                • Ubdd/level
                • Ubdd-arr
                • Ubdd-arr-max-depth
                • Aignet-count-ubdd-branches
                • Ubdd-negate-cond
                • Ubdd-apply-gate
                • Aignet-node-to-ubdd-short-circuit-cond
                • Bits->bools
                • Eval-ubddarr
                • Ubdd-to-aignet-memo
                • Parametrize-output-type-map
                • Lubdd-fix
              • Observability-fix
              • Constprop
              • Apply-m-assumption-n-output-output-transform-default
              • Balance
              • Apply-n-output-comb-transform-default
              • Apply-comb-transform-default
              • Obs-constprop
              • Rewrite
              • Comb-transform
              • Abc-comb-simplify
              • Prune
              • Rewrite!
              • M-assumption-n-output-comb-transform->name
              • N-output-comb-transform->name
              • Comb-transform->name
              • N-output-comb-transformlist
              • M-assumption-n-output-comb-transformlist
              • Comb-transformlist
              • Apply-comb-transform
            • Aignet-m-assumption-n-output-transforms
            • Aignet-n-output-comb-transforms
          • Aignet-eval
          • Semantics
          • Aignet-read-aiger
          • Aignet-write-aiger
          • Aignet-abc-interface
          • Utilities
        • Aig
        • Satlink
        • Truth
        • Ubdds
        • Bdd
        • Faig
        • Bed
        • 4v
      • Projects
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Parametrize

    Ubdd-to-aignet

    Signature
    (ubdd-to-aignet x level memo litarr gatesimp strash aignet) 
      → 
    (mv val new-memo new-strash new-aignet)
    Arguments
    x — Guard (acl2::ubddp x).
    level — Guard (natp level).
    memo — Guard (ubdd-to-aignet-memo-p memo).
    gatesimp — Guard (gatesimp-p gatesimp).
    Returns
    val — Type (litp val).
    new-memo — Type (ubdd-to-aignet-memo-p new-memo).

    Definitions and Theorems

    Function: ubdd-to-aignet

    (defun ubdd-to-aignet (x level
                             memo litarr gatesimp strash aignet)
     (declare (xargs :stobjs (litarr strash aignet)))
     (declare (xargs :guard (and (acl2::ubddp x)
                                 (natp level)
                                 (ubdd-to-aignet-memo-p memo)
                                 (gatesimp-p gatesimp))))
     (declare (xargs :guard (and (aignet-lit-listp (alist-vals memo)
                                                   aignet)
                                 (aignet-copies-in-bounds litarr aignet)
                                 (<= (+ level (acl2::max-depth x))
                                     (lits-length litarr)))))
     (let ((__function__ 'ubdd-to-aignet))
       (declare (ignorable __function__))
       (b* ((memo (ubdd-to-aignet-memo-fix memo))
            (aignet (mbe :logic (non-exec (node-list-fix aignet))
                         :exec aignet))
            (x (lubdd-fix x))
            ((when (atom x))
             (mv (bool->bit x) memo strash aignet))
            (key (make-ubdd/level :ubdd x :level level))
            (look (hons-get key memo))
            ((when look)
             (mv (cdr look) memo strash aignet))
            ((mv then memo strash aignet)
             (ubdd-to-aignet (car x)
                             (1+ (lnfix level))
                             memo litarr gatesimp strash aignet))
            ((mv else memo strash aignet)
             (ubdd-to-aignet (cdr x)
                             (1+ (lnfix level))
                             memo litarr gatesimp strash aignet))
            (test (get-lit level litarr))
            ((mv ite strash aignet)
             (aignet-hash-mux test then else gatesimp strash aignet))
            (memo (hons-acons key ite memo)))
         (mv ite memo strash aignet))))

    Theorem: litp-of-ubdd-to-aignet.val

    (defthm litp-of-ubdd-to-aignet.val
      (b* (((mv ?val ?new-memo ?new-strash ?new-aignet)
            (ubdd-to-aignet x level
                            memo litarr gatesimp strash aignet)))
        (litp val))
      :rule-classes :rewrite)

    Theorem: ubdd-to-aignet-memo-p-of-ubdd-to-aignet.new-memo

    (defthm ubdd-to-aignet-memo-p-of-ubdd-to-aignet.new-memo
      (b* (((mv ?val ?new-memo ?new-strash ?new-aignet)
            (ubdd-to-aignet x level
                            memo litarr gatesimp strash aignet)))
        (ubdd-to-aignet-memo-p new-memo))
      :rule-classes :rewrite)

    Theorem: aignet-extension-p-of-ubdd-to-aignet

    (defthm aignet-extension-p-of-ubdd-to-aignet
      (b* (((mv ?val ?new-memo ?new-strash ?new-aignet)
            (ubdd-to-aignet x level
                            memo litarr gatesimp strash aignet)))
        (aignet-extension-p new-aignet aignet)))

    Theorem: num-ins-of-ubdd-to-aignet

    (defthm num-ins-of-ubdd-to-aignet
      (b* (((mv ?val ?new-memo ?new-strash ?new-aignet)
            (ubdd-to-aignet x level
                            memo litarr gatesimp strash aignet)))
        (equal (stype-count :pi new-aignet)
               (stype-count :pi aignet))))

    Theorem: num-regs-of-ubdd-to-aignet

    (defthm num-regs-of-ubdd-to-aignet
      (b* (((mv ?val ?new-memo ?new-strash ?new-aignet)
            (ubdd-to-aignet x level
                            memo litarr gatesimp strash aignet)))
        (equal (stype-count :reg new-aignet)
               (stype-count :reg aignet))))

    Theorem: num-outs-of-ubdd-to-aignet

    (defthm num-outs-of-ubdd-to-aignet
      (b* (((mv ?val ?new-memo ?new-strash ?new-aignet)
            (ubdd-to-aignet x level
                            memo litarr gatesimp strash aignet)))
        (equal (stype-count :po new-aignet)
               (stype-count :po aignet))))

    Theorem: result-lits-of-ubdd-to-aignet

    (defthm result-lits-of-ubdd-to-aignet
     (b* (((mv ?val ?new-memo ?new-strash ?new-aignet)
           (ubdd-to-aignet x level
                           memo litarr gatesimp strash aignet)))
      (implies
       (and
           (aignet-lit-listp (alist-vals (ubdd-to-aignet-memo-fix memo))
                             aignet)
           (aignet-copies-in-bounds litarr aignet))
       (and (aignet-litp val new-aignet)
            (aignet-lit-listp (alist-vals new-memo)
                              new-aignet)))))

    Theorem: ubdd-to-aignet-preserves-ubdd-to-aignet-memo-ok

    (defthm ubdd-to-aignet-preserves-ubdd-to-aignet-memo-ok
     (b* (((mv ?val ?new-memo ?new-strash ?new-aignet)
           (ubdd-to-aignet x level
                           memo litarr gatesimp strash aignet)))
      (b*
       ((values
            (bits->bools (lit-eval-list litarr invals regvals aignet))))
       (implies
        (and
           (ubdd-to-aignet-memo-ok memo litarr aignet invals regvals)
           (aignet-copies-in-bounds litarr aignet)
           (aignet-lit-listp (alist-vals (ubdd-to-aignet-memo-fix memo))
                             aignet))
        (and
         (ubdd-to-aignet-memo-ok new-memo
                                 litarr new-aignet invals regvals)
         (equal
              (lit-eval val invals regvals new-aignet)
              (bool->bit (acl2::eval-bdd x (nthcdr level values)))))))))

    Theorem: ubdd-to-aignet-of-ubdd-fix-x

    (defthm ubdd-to-aignet-of-ubdd-fix-x
      (equal (ubdd-to-aignet (acl2::ubdd-fix x)
                             level
                             memo litarr gatesimp strash aignet)
             (ubdd-to-aignet x level
                             memo litarr gatesimp strash aignet)))

    Theorem: ubdd-to-aignet-ubdd-equiv-congruence-on-x

    (defthm ubdd-to-aignet-ubdd-equiv-congruence-on-x
      (implies
           (acl2::ubdd-equiv x x-equiv)
           (equal (ubdd-to-aignet x level
                                  memo litarr gatesimp strash aignet)
                  (ubdd-to-aignet x-equiv level
                                  memo litarr gatesimp strash aignet)))
      :rule-classes :congruence)

    Theorem: ubdd-to-aignet-of-nfix-level

    (defthm ubdd-to-aignet-of-nfix-level
      (equal (ubdd-to-aignet x (nfix level)
                             memo litarr gatesimp strash aignet)
             (ubdd-to-aignet x level
                             memo litarr gatesimp strash aignet)))

    Theorem: ubdd-to-aignet-nat-equiv-congruence-on-level

    (defthm ubdd-to-aignet-nat-equiv-congruence-on-level
      (implies
           (nat-equiv level level-equiv)
           (equal (ubdd-to-aignet x level
                                  memo litarr gatesimp strash aignet)
                  (ubdd-to-aignet x level-equiv
                                  memo litarr gatesimp strash aignet)))
      :rule-classes :congruence)

    Theorem: ubdd-to-aignet-of-ubdd-to-aignet-memo-fix-memo

    (defthm ubdd-to-aignet-of-ubdd-to-aignet-memo-fix-memo
      (equal (ubdd-to-aignet x level (ubdd-to-aignet-memo-fix memo)
                             litarr gatesimp strash aignet)
             (ubdd-to-aignet x level
                             memo litarr gatesimp strash aignet)))

    Theorem: ubdd-to-aignet-ubdd-to-aignet-memo-equiv-congruence-on-memo

    (defthm ubdd-to-aignet-ubdd-to-aignet-memo-equiv-congruence-on-memo
     (implies (ubdd-to-aignet-memo-equiv memo memo-equiv)
              (equal (ubdd-to-aignet x level
                                     memo litarr gatesimp strash aignet)
                     (ubdd-to-aignet x level memo-equiv
                                     litarr gatesimp strash aignet)))
     :rule-classes :congruence)

    Theorem: ubdd-to-aignet-of-gatesimp-fix-gatesimp

    (defthm ubdd-to-aignet-of-gatesimp-fix-gatesimp
      (equal (ubdd-to-aignet x level
                             memo litarr (gatesimp-fix gatesimp)
                             strash aignet)
             (ubdd-to-aignet x level
                             memo litarr gatesimp strash aignet)))

    Theorem: ubdd-to-aignet-gatesimp-equiv-congruence-on-gatesimp

    (defthm ubdd-to-aignet-gatesimp-equiv-congruence-on-gatesimp
      (implies
           (gatesimp-equiv gatesimp gatesimp-equiv)
           (equal (ubdd-to-aignet x level
                                  memo litarr gatesimp strash aignet)
                  (ubdd-to-aignet x level memo
                                  litarr gatesimp-equiv strash aignet)))
      :rule-classes :congruence)

    Theorem: ubdd-to-aignet-of-node-list-fix-aignet

    (defthm ubdd-to-aignet-of-node-list-fix-aignet
      (equal (ubdd-to-aignet x level memo litarr
                             gatesimp strash (node-list-fix aignet))
             (ubdd-to-aignet x level
                             memo litarr gatesimp strash aignet)))

    Theorem: ubdd-to-aignet-node-list-equiv-congruence-on-aignet

    (defthm ubdd-to-aignet-node-list-equiv-congruence-on-aignet
      (implies
           (node-list-equiv aignet aignet-equiv)
           (equal (ubdd-to-aignet x level
                                  memo litarr gatesimp strash aignet)
                  (ubdd-to-aignet x level memo
                                  litarr gatesimp strash aignet-equiv)))
      :rule-classes :congruence)