Function:
(defun env-perm (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)) (declare (ignorable __function__)) (b* (((when (mbe :logic (zp (- (nfix numvars) (nfix n))) :exec (eql n numvars))) (lnfix x)) (x (env-swap-vars n (nth n perm) x))) (env-perm (1+ (lnfix n)) perm x numvars))))
Theorem:
(defthm natp-of-env-perm (b* ((perm-env (env-perm n perm x numvars))) (natp perm-env)) :rule-classes :type-prescription)
Theorem:
(defthm lookup-index-perm-in-env-perm (equal (env-lookup (index-perm n perm k numvars) (env-perm n perm env numvars)) (env-lookup k env)))
Theorem:
(defthm lookup-in-env-perm (equal (env-lookup k (env-perm n perm env numvars)) (env-lookup (index-perm-rev n perm k numvars) env)))
Theorem:
(defthm env-perm-of-nfix-n (equal (env-perm (nfix n) perm x numvars) (env-perm n perm x numvars)))
Theorem:
(defthm env-perm-nat-equiv-congruence-on-n (implies (nat-equiv n n-equiv) (equal (env-perm n perm x numvars) (env-perm n-equiv perm x numvars))) :rule-classes :congruence)
Theorem:
(defthm env-perm-of-nfix-x (equal (env-perm n perm (nfix x) numvars) (env-perm n perm x numvars)))
Theorem:
(defthm env-perm-nat-equiv-congruence-on-x (implies (nat-equiv x x-equiv) (equal (env-perm n perm x numvars) (env-perm n perm x-equiv numvars))) :rule-classes :congruence)
Theorem:
(defthm env-perm-of-nfix-numvars (equal (env-perm n perm x (nfix numvars)) (env-perm n perm x numvars)))
Theorem:
(defthm env-perm-nat-equiv-congruence-on-numvars (implies (nat-equiv numvars numvars-equiv) (equal (env-perm n perm x numvars) (env-perm n perm x numvars-equiv))) :rule-classes :congruence)