Function:
(defun env-mismatch-aux (n truth env1 env2 numvars) (declare (xargs :guard (and (natp n) (integerp truth) (natp env1) (natp env2) (natp numvars)))) (declare (xargs :guard (<= n numvars))) (let ((__function__ 'env-mismatch-aux)) (declare (ignorable __function__)) (b* (((when (mbe :logic (zp (- (nfix numvars) (nfix n))) :exec (eql n numvars))) 0) ((when (and (depends-on n truth numvars) (xor (env-lookup n env1) (env-lookup n env2)))) (lnfix n))) (env-mismatch-aux (+ 1 (lnfix n)) truth env1 env2 numvars))))
Theorem:
(defthm natp-of-env-mismatch-aux (b* ((var (env-mismatch-aux n truth env1 env2 numvars))) (natp var)) :rule-classes :type-prescription)
Theorem:
(defthm env-mismatch-aux-bound (b* ((?var (env-mismatch-aux n truth env1 env2 numvars))) (implies (posp numvars) (< var numvars))))
Theorem:
(defthm env-mismatch-aux-when-mismatch (b* ((?var (env-mismatch-aux n truth env1 env2 numvars))) (implies (and (depends-on m truth numvars) (xor (env-lookup m env1) (env-lookup m env2)) (< (nfix m) (nfix numvars)) (<= (nfix n) (nfix m))) (and (depends-on var truth numvars) (iff (env-lookup var env1) (not (env-lookup var env2))) (< var numvars)))))
Theorem:
(defthm env-mismatch-aux-when-eval-mismatch (b* ((?var (env-mismatch-aux n truth env1 env2 numvars))) (implies (and (not (equal (truth-eval truth env1 numvars) (truth-eval truth env2 numvars))) (equal (loghead n (nfix env1)) (loghead n (nfix env2)))) (and (depends-on var truth numvars) (iff (env-lookup var env1) (not (env-lookup var env2))) (< var (nfix numvars)) (implies (natp numvars) (< var numvars))))))
Theorem:
(defthm env-mismatch-aux-of-nfix-n (equal (env-mismatch-aux (nfix n) truth env1 env2 numvars) (env-mismatch-aux n truth env1 env2 numvars)))
Theorem:
(defthm env-mismatch-aux-nat-equiv-congruence-on-n (implies (nat-equiv n n-equiv) (equal (env-mismatch-aux n truth env1 env2 numvars) (env-mismatch-aux n-equiv truth env1 env2 numvars))) :rule-classes :congruence)
Theorem:
(defthm env-mismatch-aux-of-ifix-truth (equal (env-mismatch-aux n (ifix truth) env1 env2 numvars) (env-mismatch-aux n truth env1 env2 numvars)))
Theorem:
(defthm env-mismatch-aux-int-equiv-congruence-on-truth (implies (int-equiv truth truth-equiv) (equal (env-mismatch-aux n truth env1 env2 numvars) (env-mismatch-aux n truth-equiv env1 env2 numvars))) :rule-classes :congruence)
Theorem:
(defthm env-mismatch-aux-of-nfix-env1 (equal (env-mismatch-aux n truth (nfix env1) env2 numvars) (env-mismatch-aux n truth env1 env2 numvars)))
Theorem:
(defthm env-mismatch-aux-nat-equiv-congruence-on-env1 (implies (nat-equiv env1 env1-equiv) (equal (env-mismatch-aux n truth env1 env2 numvars) (env-mismatch-aux n truth env1-equiv env2 numvars))) :rule-classes :congruence)
Theorem:
(defthm env-mismatch-aux-of-nfix-env2 (equal (env-mismatch-aux n truth env1 (nfix env2) numvars) (env-mismatch-aux n truth env1 env2 numvars)))
Theorem:
(defthm env-mismatch-aux-nat-equiv-congruence-on-env2 (implies (nat-equiv env2 env2-equiv) (equal (env-mismatch-aux n truth env1 env2 numvars) (env-mismatch-aux n truth env1 env2-equiv numvars))) :rule-classes :congruence)
Theorem:
(defthm env-mismatch-aux-of-nfix-numvars (equal (env-mismatch-aux n truth env1 env2 (nfix numvars)) (env-mismatch-aux n truth env1 env2 numvars)))
Theorem:
(defthm env-mismatch-aux-nat-equiv-congruence-on-numvars (implies (nat-equiv numvars numvars-equiv) (equal (env-mismatch-aux n truth env1 env2 numvars) (env-mismatch-aux n truth env1 env2 numvars-equiv))) :rule-classes :congruence)