Function:
(defun env-perm-rev (n perm x numvars) (declare (xargs :guard (and (natp n) (nat-listp perm) (natp x) (natp numvars)))) (declare (xargs :guard (and (<= n numvars) (eql (len perm) numvars)))) (let ((__function__ 'env-perm-rev)) (declare (ignorable __function__)) (b* (((when (mbe :logic (zp (- (nfix numvars) (nfix n))) :exec (eql n numvars))) (lnfix x)) (x (env-perm-rev (1+ (lnfix n)) perm x numvars))) (env-swap-vars n (nth n perm) x))))
Theorem:
(defthm natp-of-env-perm-rev (b* ((perm-env (env-perm-rev n perm x numvars))) (natp perm-env)) :rule-classes :type-prescription)
Theorem:
(defthm lookup-index-perm-rev-in-env-perm-rev (equal (env-lookup (index-perm-rev n perm k numvars) (env-perm-rev n perm env numvars)) (env-lookup k env)))
Theorem:
(defthm lookup-in-env-perm-rev (equal (env-lookup k (env-perm-rev n perm env numvars)) (env-lookup (index-perm n perm k numvars) env)))
Theorem:
(defthm env-perm-of-env-perm-rev (equal (env-perm n perm (env-perm-rev n perm x numvars) numvars) (nfix x)))
Theorem:
(defthm env-perm-rev-of-env-perm (equal (env-perm-rev n perm (env-perm n perm x numvars) numvars) (nfix x)))
Theorem:
(defthm env-perm-rev-of-nfix-n (equal (env-perm-rev (nfix n) perm x numvars) (env-perm-rev n perm x numvars)))
Theorem:
(defthm env-perm-rev-nat-equiv-congruence-on-n (implies (nat-equiv n n-equiv) (equal (env-perm-rev n perm x numvars) (env-perm-rev n-equiv perm x numvars))) :rule-classes :congruence)
Theorem:
(defthm env-perm-rev-of-nfix-x (equal (env-perm-rev n perm (nfix x) numvars) (env-perm-rev n perm x numvars)))
Theorem:
(defthm env-perm-rev-nat-equiv-congruence-on-x (implies (nat-equiv x x-equiv) (equal (env-perm-rev n perm x numvars) (env-perm-rev n perm x-equiv numvars))) :rule-classes :congruence)
Theorem:
(defthm env-perm-rev-of-nfix-numvars (equal (env-perm-rev n perm x (nfix numvars)) (env-perm-rev n perm x numvars)))
Theorem:
(defthm env-perm-rev-nat-equiv-congruence-on-numvars (implies (nat-equiv numvars numvars-equiv) (equal (env-perm-rev n perm x numvars) (env-perm-rev n perm x numvars-equiv))) :rule-classes :congruence)