Function:
(defun depends-on-witness (n truth numvars) (declare (xargs :guard (and (natp n) (integerp truth) (natp numvars)))) (declare (xargs :guard (< n numvars))) (let ((__function__ 'depends-on-witness)) (declare (ignorable __function__)) (b* ((var (var n numvars)) (truth (truth-norm truth numvars)) (diff (logxor (logand (lognot var) truth) (ash (logand var truth) (- (ash 1 (lnfix n))))))) (bitops::trailing-0-count diff))))
Theorem:
(defthm natp-of-depends-on-witness (b* ((diff-env (depends-on-witness n truth numvars))) (natp diff-env)) :rule-classes :type-prescription)
Theorem:
(defthm depends-on-witness-correct (b* ((?diff-env (depends-on-witness n truth numvars))) (implies (and (natp numvars) (< (nfix n) numvars) (depends-on n truth numvars)) (not (equal (truth-eval truth (env-update n t diff-env) numvars) (truth-eval truth diff-env numvars))))))
Theorem:
(defthm depends-on-witness-of-nfix-n (equal (depends-on-witness (nfix n) truth numvars) (depends-on-witness n truth numvars)))
Theorem:
(defthm depends-on-witness-nat-equiv-congruence-on-n (implies (nat-equiv n n-equiv) (equal (depends-on-witness n truth numvars) (depends-on-witness n-equiv truth numvars))) :rule-classes :congruence)
Theorem:
(defthm depends-on-witness-of-ifix-truth (equal (depends-on-witness n (ifix truth) numvars) (depends-on-witness n truth numvars)))
Theorem:
(defthm depends-on-witness-int-equiv-congruence-on-truth (implies (int-equiv truth truth-equiv) (equal (depends-on-witness n truth numvars) (depends-on-witness n truth-equiv numvars))) :rule-classes :congruence)
Theorem:
(defthm depends-on-witness-of-nfix-numvars (equal (depends-on-witness n truth (nfix numvars)) (depends-on-witness n truth numvars)))
Theorem:
(defthm depends-on-witness-nat-equiv-congruence-on-numvars (implies (nat-equiv numvars numvars-equiv) (equal (depends-on-witness n truth numvars) (depends-on-witness n truth numvars-equiv))) :rule-classes :congruence)