(chase-stack-fix x) is a usual fty list fixing function.
(chase-stack-fix x) → fty::newx
In the logic, we apply chase-position-fix to each member of the x. In the execution, none of that is actually necessary and this is just an inlined identity function.
Function:
(defun chase-stack-fix$inline (x) (declare (xargs :guard (chase-stack-p x))) (let ((__function__ 'chase-stack-fix)) (declare (ignorable __function__)) (mbe :logic (if (atom x) nil (cons (chase-position-fix (car x)) (chase-stack-fix (cdr x)))) :exec x)))
Theorem:
(defthm chase-stack-p-of-chase-stack-fix (b* ((fty::newx (chase-stack-fix$inline x))) (chase-stack-p fty::newx)) :rule-classes :rewrite)
Theorem:
(defthm chase-stack-fix-when-chase-stack-p (implies (chase-stack-p x) (equal (chase-stack-fix x) x)))
Function:
(defun chase-stack-equiv$inline (x y) (declare (xargs :guard (and (chase-stack-p x) (chase-stack-p y)))) (equal (chase-stack-fix x) (chase-stack-fix y)))
Theorem:
(defthm chase-stack-equiv-is-an-equivalence (and (booleanp (chase-stack-equiv x y)) (chase-stack-equiv x x) (implies (chase-stack-equiv x y) (chase-stack-equiv y x)) (implies (and (chase-stack-equiv x y) (chase-stack-equiv y z)) (chase-stack-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm chase-stack-equiv-implies-equal-chase-stack-fix-1 (implies (chase-stack-equiv x x-equiv) (equal (chase-stack-fix x) (chase-stack-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm chase-stack-fix-under-chase-stack-equiv (chase-stack-equiv (chase-stack-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-chase-stack-fix-1-forward-to-chase-stack-equiv (implies (equal (chase-stack-fix x) y) (chase-stack-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-chase-stack-fix-2-forward-to-chase-stack-equiv (implies (equal x (chase-stack-fix y)) (chase-stack-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm chase-stack-equiv-of-chase-stack-fix-1-forward (implies (chase-stack-equiv (chase-stack-fix x) y) (chase-stack-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm chase-stack-equiv-of-chase-stack-fix-2-forward (implies (chase-stack-equiv x (chase-stack-fix y)) (chase-stack-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm car-of-chase-stack-fix-x-under-chase-position-equiv (chase-position-equiv (car (chase-stack-fix x)) (car x)))
Theorem:
(defthm car-chase-stack-equiv-congruence-on-x-under-chase-position-equiv (implies (chase-stack-equiv x x-equiv) (chase-position-equiv (car x) (car x-equiv))) :rule-classes :congruence)
Theorem:
(defthm cdr-of-chase-stack-fix-x-under-chase-stack-equiv (chase-stack-equiv (cdr (chase-stack-fix x)) (cdr x)))
Theorem:
(defthm cdr-chase-stack-equiv-congruence-on-x-under-chase-stack-equiv (implies (chase-stack-equiv x x-equiv) (chase-stack-equiv (cdr x) (cdr x-equiv))) :rule-classes :congruence)
Theorem:
(defthm cons-of-chase-position-fix-x-under-chase-stack-equiv (chase-stack-equiv (cons (chase-position-fix x) y) (cons x y)))
Theorem:
(defthm cons-chase-position-equiv-congruence-on-x-under-chase-stack-equiv (implies (chase-position-equiv x x-equiv) (chase-stack-equiv (cons x y) (cons x-equiv y))) :rule-classes :congruence)
Theorem:
(defthm cons-of-chase-stack-fix-y-under-chase-stack-equiv (chase-stack-equiv (cons x (chase-stack-fix y)) (cons x y)))
Theorem:
(defthm cons-chase-stack-equiv-congruence-on-y-under-chase-stack-equiv (implies (chase-stack-equiv y y-equiv) (chase-stack-equiv (cons x y) (cons x y-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-chase-stack-fix (equal (consp (chase-stack-fix x)) (consp x)))
Theorem:
(defthm chase-stack-fix-under-iff (iff (chase-stack-fix x) (consp x)))
Theorem:
(defthm chase-stack-fix-of-cons (equal (chase-stack-fix (cons a x)) (cons (chase-position-fix a) (chase-stack-fix x))))
Theorem:
(defthm len-of-chase-stack-fix (equal (len (chase-stack-fix x)) (len x)))
Theorem:
(defthm chase-stack-fix-of-append (equal (chase-stack-fix (append std::a std::b)) (append (chase-stack-fix std::a) (chase-stack-fix std::b))))
Theorem:
(defthm chase-stack-fix-of-repeat (equal (chase-stack-fix (repeat acl2::n x)) (repeat acl2::n (chase-position-fix x))))
Theorem:
(defthm list-equiv-refines-chase-stack-equiv (implies (list-equiv x y) (chase-stack-equiv x y)) :rule-classes :refinement)
Theorem:
(defthm nth-of-chase-stack-fix (equal (nth acl2::n (chase-stack-fix x)) (if (< (nfix acl2::n) (len x)) (chase-position-fix (nth acl2::n x)) nil)))
Theorem:
(defthm chase-stack-equiv-implies-chase-stack-equiv-append-1 (implies (chase-stack-equiv x fty::x-equiv) (chase-stack-equiv (append x y) (append fty::x-equiv y))) :rule-classes (:congruence))
Theorem:
(defthm chase-stack-equiv-implies-chase-stack-equiv-append-2 (implies (chase-stack-equiv y fty::y-equiv) (chase-stack-equiv (append x y) (append x fty::y-equiv))) :rule-classes (:congruence))
Theorem:
(defthm chase-stack-equiv-implies-chase-stack-equiv-nthcdr-2 (implies (chase-stack-equiv acl2::l l-equiv) (chase-stack-equiv (nthcdr acl2::n acl2::l) (nthcdr acl2::n l-equiv))) :rule-classes (:congruence))
Theorem:
(defthm chase-stack-equiv-implies-chase-stack-equiv-take-2 (implies (chase-stack-equiv acl2::l l-equiv) (chase-stack-equiv (take acl2::n acl2::l) (take acl2::n l-equiv))) :rule-classes (:congruence))