Add an XOR node to an AIGNET, or find a node already representing the required logical expression.
(aignet-hash-xor lit1 lit2 gatesimp strash aignet) → (mv xor-lit new-strash new-aignet)
See aignet-construction.
Function:
(defun aignet-hash-xor (lit1 lit2 gatesimp strash aignet) (declare (xargs :stobjs (strash aignet))) (declare (type (unsigned-byte 30) lit1) (type (unsigned-byte 30) lit2) (type (unsigned-byte 6) gatesimp)) (declare (xargs :guard (and (litp lit1) (litp lit2) (gatesimp-p gatesimp)))) (declare (xargs :guard (and (fanin-litp lit1 aignet) (fanin-litp lit2 aignet)) :split-types t)) (let ((__function__ 'aignet-hash-xor)) (declare (ignorable __function__)) (b* ((lit1 (mbe :logic (non-exec (aignet-lit-fix lit1 aignet)) :exec lit1)) (lit2 (mbe :logic (non-exec (aignet-lit-fix lit2 aignet)) :exec lit2)) ((when (eql 0 (gatesimp->xor-mode gatesimp))) (aignet-build (and (not (and lit1 lit2)) (not (and (not lit1) (not lit2)))) gatesimp strash aignet)) ((mv code key lit1 lit2) (aignet-xor-gate-simp/strash lit1 lit2 gatesimp strash aignet))) (aignet-install-gate code key lit1 lit2 gatesimp strash aignet))))
Theorem:
(defthm acl2::litp-of-aignet-hash-xor.xor-lit (b* (((mv ?xor-lit ?new-strash ?new-aignet) (aignet-hash-xor lit1 lit2 gatesimp strash aignet))) (litp xor-lit)) :rule-classes (:rewrite :type-prescription))
Theorem:
(defthm acl2::aignet-extension-p-of-aignet-hash-xor (aignet-extension-p (mv-nth 2 (aignet-hash-xor lit1 lit2 gatesimp strash aignet)) aignet) :rule-classes :rewrite)
Theorem:
(defthm aignet-litp-of-aignet-hash-xor (b* (((mv ?xor-lit ?new-strash ?new-aignet) (aignet-hash-xor lit1 lit2 gatesimp strash aignet))) (aignet-litp xor-lit new-aignet)))
Theorem:
(defthm deps-of-aignet-hash-xor (b* (((mv ?xor-lit ?new-strash ?new-aignet) (aignet-hash-xor lit1 lit2 gatesimp strash aignet))) (implies (and (not (depends-on (lit->var lit1) ci-id aignet)) (not (depends-on (lit->var lit2) ci-id aignet))) (not (depends-on (lit->var xor-lit) ci-id new-aignet)))))
Theorem:
(defthm lit-eval-of-aignet-hash-xor (b* (((mv ?xor-lit ?new-strash ?new-aignet) (aignet-hash-xor lit1 lit2 gatesimp strash aignet))) (equal (lit-eval xor-lit invals regvals new-aignet) (b-xor (lit-eval lit1 invals regvals aignet) (lit-eval lit2 invals regvals aignet)))))
Theorem:
(defthm stype-counts-preserved-of-aignet-hash-xor (b* (((mv ?xor-lit ?new-strash ?new-aignet) (aignet-hash-xor lit1 lit2 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:
(defthm unsigned-byte-p-of-aignet-hash-xor (b* (((mv ?xor-lit ?new-strash ?new-aignet) (aignet-hash-xor lit1 lit2 gatesimp strash aignet))) (implies (and (< (fanin-count aignet) 536870909) (natp n) (<= 30 n)) (unsigned-byte-p n xor-lit))))
Theorem:
(defthm acl2::aignet-hash-xor-of-lit-fix-lit1 (equal (aignet-hash-xor (lit-fix lit1) lit2 gatesimp strash aignet) (aignet-hash-xor lit1 lit2 gatesimp strash aignet)))
Theorem:
(defthm acl2::aignet-hash-xor-lit-equiv-congruence-on-lit1 (implies (lit-equiv lit1 acl2::lit1-equiv) (equal (aignet-hash-xor lit1 lit2 gatesimp strash aignet) (aignet-hash-xor acl2::lit1-equiv lit2 gatesimp strash aignet))) :rule-classes :congruence)
Theorem:
(defthm acl2::aignet-hash-xor-of-lit-fix-lit2 (equal (aignet-hash-xor lit1 (lit-fix lit2) gatesimp strash aignet) (aignet-hash-xor lit1 lit2 gatesimp strash aignet)))
Theorem:
(defthm acl2::aignet-hash-xor-lit-equiv-congruence-on-lit2 (implies (lit-equiv lit2 acl2::lit2-equiv) (equal (aignet-hash-xor lit1 lit2 gatesimp strash aignet) (aignet-hash-xor lit1 acl2::lit2-equiv gatesimp strash aignet))) :rule-classes :congruence)
Theorem:
(defthm acl2::aignet-hash-xor-of-gatesimp-fix-gatesimp (equal (aignet-hash-xor lit1 lit2 (gatesimp-fix gatesimp) strash aignet) (aignet-hash-xor lit1 lit2 gatesimp strash aignet)))
Theorem:
(defthm acl2::aignet-hash-xor-gatesimp-equiv-congruence-on-gatesimp (implies (gatesimp-equiv gatesimp acl2::gatesimp-equiv) (equal (aignet-hash-xor lit1 lit2 gatesimp strash aignet) (aignet-hash-xor lit1 lit2 acl2::gatesimp-equiv strash aignet))) :rule-classes :congruence)
Theorem:
(defthm acl2::aignet-hash-xor-of-node-list-fix-aignet (equal (aignet-hash-xor lit1 lit2 gatesimp strash (node-list-fix aignet)) (aignet-hash-xor lit1 lit2 gatesimp strash aignet)))
Theorem:
(defthm acl2::aignet-hash-xor-node-list-equiv-congruence-on-aignet (implies (node-list-equiv aignet acl2::aignet-equiv) (equal (aignet-hash-xor lit1 lit2 gatesimp strash aignet) (aignet-hash-xor lit1 lit2 gatesimp strash acl2::aignet-equiv))) :rule-classes :congruence)