Function:
(defun swap-vars-aux (n m truth numvars) (declare (xargs :guard (and (natp n) (natp m) (integerp truth) (natp numvars)))) (declare (xargs :guard (and (< n numvars) (< m n)))) (let ((__function__ 'swap-vars-aux)) (declare (ignorable __function__)) (b* ((truth (loghead (ash 1 (lnfix numvars)) truth)) (varn (var n numvars)) (varm (var m numvars)) (same (logeqv varn varm)) (n&~m (logand varn (lognot varm))) (m&~n (logand varm (lognot varn))) (shift (- (ash 1 (lnfix n)) (ash 1 (lnfix m))))) (logior (logand same truth) (ash (logand n&~m truth) (- shift)) (ash (logand m&~n truth) shift)))))
Theorem:
(defthm integerp-of-swap-vars-aux (b* ((swapped-truth (swap-vars-aux n m truth numvars))) (integerp swapped-truth)) :rule-classes :type-prescription)
Theorem:
(defthm eval-of-swap-vars-aux (b* ((?swapped-truth (swap-vars-aux n m truth numvars))) (implies (and (< (nfix n) (nfix numvars)) (< (nfix m) (nfix n))) (equal (truth-eval swapped-truth env numvars) (truth-eval truth (env-swap-vars n m env) numvars)))))
Theorem:
(defthm size-of-swap-vars-aux (b* ((?swapped-truth (swap-vars-aux n m truth numvars))) (implies (and (< (nfix n) (nfix numvars)) (< (nfix m) (nfix n)) (natp size) (<= (ash 1 (nfix numvars)) size)) (unsigned-byte-p size swapped-truth))))
Theorem:
(defthm truth-norm-of-swap-vars-aux (b* ((?swapped-truth (swap-vars-aux n m truth numvars))) (implies (and (< (nfix n) (nfix numvars)) (< (nfix m) (nfix n))) (equal (truth-norm swapped-truth numvars) swapped-truth))))
Theorem:
(defthm swap-vars-aux-of-truth-norm (equal (swap-vars-aux n m (truth-norm truth numvars) numvars) (swap-vars-aux n m truth numvars)))
Theorem:
(defthm swap-vars-aux-of-nfix-n (equal (swap-vars-aux (nfix n) m truth numvars) (swap-vars-aux n m truth numvars)))
Theorem:
(defthm swap-vars-aux-nat-equiv-congruence-on-n (implies (nat-equiv n n-equiv) (equal (swap-vars-aux n m truth numvars) (swap-vars-aux n-equiv m truth numvars))) :rule-classes :congruence)
Theorem:
(defthm swap-vars-aux-of-nfix-m (equal (swap-vars-aux n (nfix m) truth numvars) (swap-vars-aux n m truth numvars)))
Theorem:
(defthm swap-vars-aux-nat-equiv-congruence-on-m (implies (nat-equiv m m-equiv) (equal (swap-vars-aux n m truth numvars) (swap-vars-aux n m-equiv truth numvars))) :rule-classes :congruence)
Theorem:
(defthm swap-vars-aux-of-ifix-truth (equal (swap-vars-aux n m (ifix truth) numvars) (swap-vars-aux n m truth numvars)))
Theorem:
(defthm swap-vars-aux-int-equiv-congruence-on-truth (implies (int-equiv truth truth-equiv) (equal (swap-vars-aux n m truth numvars) (swap-vars-aux n m truth-equiv numvars))) :rule-classes :congruence)
Theorem:
(defthm swap-vars-aux-of-nfix-numvars (equal (swap-vars-aux n m truth (nfix numvars)) (swap-vars-aux n m truth numvars)))
Theorem:
(defthm swap-vars-aux-nat-equiv-congruence-on-numvars (implies (nat-equiv numvars numvars-equiv) (equal (swap-vars-aux n m truth numvars) (swap-vars-aux n m truth numvars-equiv))) :rule-classes :congruence)