Function:
(defun negative-cofactor (n truth numvars) (declare (xargs :guard (and (natp n) (integerp truth) (natp numvars)))) (declare (xargs :guard (< n numvars))) (let ((__function__ 'negative-cofactor)) (declare (ignorable __function__)) (b* ((mask (logand (lognot (var n numvars)) (loghead (ash 1 (lnfix numvars)) truth)))) (logior mask (ash mask (ash 1 (lnfix n)))))))
Theorem:
(defthm integerp-of-negative-cofactor (b* ((cofactor (negative-cofactor n truth numvars))) (integerp cofactor)) :rule-classes :type-prescription)
Theorem:
(defthm negative-cofactor-correct (b* ((?cofactor (negative-cofactor n truth numvars))) (implies (< (nfix n) (nfix numvars)) (equal (truth-eval cofactor env numvars) (truth-eval truth (env-update n nil env) numvars)))))
Theorem:
(defthm size-of-logand-by-size-of-loghead (implies (and (unsigned-byte-p m a) (unsigned-byte-p n (loghead m b))) (unsigned-byte-p n (logand a b))))
Theorem:
(defthm negative-cofactor-size-basic (b* ((?cofactor (negative-cofactor n truth numvars))) (implies (and (< (nfix n) numvars) (natp numvars)) (unsigned-byte-p (ash 1 numvars) cofactor))))
Theorem:
(defthm negative-cofactor-size (b* ((?cofactor (negative-cofactor n truth numvars))) (implies (and (natp m) (<= (ash 1 numvars) m) (< (nfix n) numvars) (natp numvars)) (unsigned-byte-p m cofactor))))
Theorem:
(defthm negative-cofactor-of-truth-norm (equal (negative-cofactor n (truth-norm truth numvars) numvars) (negative-cofactor n truth numvars)))
Theorem:
(defthm truth-norm-of-negative-cofactor (implies (< (nfix n) (nfix numvars)) (equal (truth-norm (negative-cofactor n truth numvars) numvars) (negative-cofactor n truth numvars))))
Theorem:
(defthm negative-cofactor-of-nfix-n (equal (negative-cofactor (nfix n) truth numvars) (negative-cofactor n truth numvars)))
Theorem:
(defthm negative-cofactor-nat-equiv-congruence-on-n (implies (nat-equiv n n-equiv) (equal (negative-cofactor n truth numvars) (negative-cofactor n-equiv truth numvars))) :rule-classes :congruence)
Theorem:
(defthm negative-cofactor-of-ifix-truth (equal (negative-cofactor n (ifix truth) numvars) (negative-cofactor n truth numvars)))
Theorem:
(defthm negative-cofactor-int-equiv-congruence-on-truth (implies (int-equiv truth truth-equiv) (equal (negative-cofactor n truth numvars) (negative-cofactor n truth-equiv numvars))) :rule-classes :congruence)
Theorem:
(defthm negative-cofactor-of-nfix-numvars (equal (negative-cofactor n truth (nfix numvars)) (negative-cofactor n truth numvars)))
Theorem:
(defthm negative-cofactor-nat-equiv-congruence-on-numvars (implies (nat-equiv numvars numvars-equiv) (equal (negative-cofactor n truth numvars) (negative-cofactor n truth numvars-equiv))) :rule-classes :congruence)