Function:
(defun permute-shrink (n count mask truth numvars) (declare (xargs :guard (and (natp n) (natp mask) (integerp truth) (natp numvars)))) (declare (xargs :guard (and (<= n numvars) (eql count (logcount (loghead n mask)))))) (let ((__function__ 'permute-shrink)) (declare (ignorable __function__)) (b* (((when (mbe :logic (zp (- (nfix numvars) (nfix n))) :exec (eql n numvars))) (truth-norm truth numvars)) (n (lnfix n)) (count (mbe :logic (logcount (loghead n (lnfix mask))) :exec count)) (bit (logbit n (lnfix mask))) (truth (if (eql bit 1) (permute-var-down count n truth numvars) truth))) (permute-shrink (1+ n) (+ bit count) mask truth numvars))))
Theorem:
(defthm natp-of-permute-shrink (b* ((perm-truth (permute-shrink n count mask truth numvars))) (natp perm-truth)) :rule-classes :type-prescription)
Theorem:
(defthm normalize-count-of-permute-shrink (b* nil (implies (syntaxp (not (equal count ''nil))) (equal (permute-shrink n count mask truth numvars) (let ((count nil)) (permute-shrink n count mask truth numvars))))))
Theorem:
(defthm eval-of-permute-shrink-with-env-permute-shrink (b* ((?perm-truth (permute-shrink n count mask truth numvars))) (implies (<= (nfix n) (nfix numvars)) (equal (truth-eval perm-truth (env-permute-shrink n count mask env numvars) numvars) (truth-eval truth env numvars)))))
Theorem:
(defthm eval-of-permute-shrink (b* ((?perm-truth (permute-shrink n count mask truth numvars))) (implies (<= (nfix n) (nfix numvars)) (equal (truth-eval perm-truth env numvars) (truth-eval truth (env-permute-stretch n count mask env numvars) numvars)))))
Theorem:
(defthm size-of-permute-shrink (b* ((?perm-truth (permute-shrink n count mask truth numvars))) (implies (and (natp size) (<= (ash 1 (nfix numvars)) size)) (unsigned-byte-p size perm-truth))))
Theorem:
(defthm depends-on-of-permute-shrink (implies (and (natp numvars) (< (nfix n) numvars) (not (depends-on (index-permute-stretch 0 nil mask n numvars) truth numvars))) (not (depends-on n (permute-shrink 0 count mask truth numvars) numvars))))
Theorem:
(defthm permute-shrink-of-truth-norm (equal (permute-shrink n count mask (truth-norm truth numvars) numvars) (permute-shrink n count mask truth numvars)))
Theorem:
(defthm permute-shrink-of-nfix-n (equal (permute-shrink (nfix n) count mask truth numvars) (permute-shrink n count mask truth numvars)))
Theorem:
(defthm permute-shrink-nat-equiv-congruence-on-n (implies (nat-equiv n n-equiv) (equal (permute-shrink n count mask truth numvars) (permute-shrink n-equiv count mask truth numvars))) :rule-classes :congruence)
Theorem:
(defthm permute-shrink-of-nfix-mask (equal (permute-shrink n count (nfix mask) truth numvars) (permute-shrink n count mask truth numvars)))
Theorem:
(defthm permute-shrink-nat-equiv-congruence-on-mask (implies (nat-equiv mask mask-equiv) (equal (permute-shrink n count mask truth numvars) (permute-shrink n count mask-equiv truth numvars))) :rule-classes :congruence)
Theorem:
(defthm permute-shrink-of-ifix-truth (equal (permute-shrink n count mask (ifix truth) numvars) (permute-shrink n count mask truth numvars)))
Theorem:
(defthm permute-shrink-int-equiv-congruence-on-truth (implies (int-equiv truth truth-equiv) (equal (permute-shrink n count mask truth numvars) (permute-shrink n count mask truth-equiv numvars))) :rule-classes :congruence)
Theorem:
(defthm permute-shrink-of-nfix-numvars (equal (permute-shrink n count mask truth (nfix numvars)) (permute-shrink n count mask truth numvars)))
Theorem:
(defthm permute-shrink-nat-equiv-congruence-on-numvars (implies (nat-equiv numvars numvars-equiv) (equal (permute-shrink n count mask truth numvars) (permute-shrink n count mask truth numvars-equiv))) :rule-classes :congruence)