Function:
(defun env-move-var-up (m n env) (declare (xargs :guard (and (natp m) (natp n) (natp env)))) (declare (xargs :guard (<= m n))) (let ((__function__ 'env-move-var-up)) (declare (ignorable __function__)) (b* (((when (mbe :logic (zp (- (nfix n) (nfix m))) :exec (eql n m))) (lnfix env)) (next (1+ (lnfix m))) (env (env-update next (env-lookup m env) (env-update m (env-lookup next env) env)))) (env-move-var-up next n env))))
Theorem:
(defthm natp-of-env-move-var-up (b* ((perm-env (env-move-var-up m n env))) (natp perm-env)) :rule-classes :type-prescription)
Theorem:
(defthm lookup-in-env-move-var-up (b* ((?perm-env (env-move-var-up m n env))) (equal (env-lookup k perm-env) (env-lookup (index-move-down m n k) env))))
Theorem:
(defthm env-move-var-up-of-nfix-m (equal (env-move-var-up (nfix m) n env) (env-move-var-up m n env)))
Theorem:
(defthm env-move-var-up-nat-equiv-congruence-on-m (implies (nat-equiv m m-equiv) (equal (env-move-var-up m n env) (env-move-var-up m-equiv n env))) :rule-classes :congruence)
Theorem:
(defthm env-move-var-up-of-nfix-n (equal (env-move-var-up m (nfix n) env) (env-move-var-up m n env)))
Theorem:
(defthm env-move-var-up-nat-equiv-congruence-on-n (implies (nat-equiv n n-equiv) (equal (env-move-var-up m n env) (env-move-var-up m n-equiv env))) :rule-classes :congruence)
Theorem:
(defthm env-move-var-up-of-nfix-env (equal (env-move-var-up m n (nfix env)) (env-move-var-up m n env)))
Theorem:
(defthm env-move-var-up-nat-equiv-congruence-on-env (implies (nat-equiv env env-equiv) (equal (env-move-var-up m n env) (env-move-var-up m n env-equiv))) :rule-classes :congruence)