(stack-fix x) is a usual ACL2::fty list fixing function.
In the logic, we apply frame-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 stack-fix$inline (x) (declare (xargs :guard (stackp x))) (let ((__function__ 'stack-fix)) (declare (ignorable __function__)) (mbe :logic (if (atom x) nil (cons (frame-fix (car x)) (stack-fix (cdr x)))) :exec x)))
Theorem:
(defthm stackp-of-stack-fix (b* ((fty::newx (stack-fix$inline x))) (stackp fty::newx)) :rule-classes :rewrite)
Theorem:
(defthm stack-fix-when-stackp (implies (stackp x) (equal (stack-fix x) x)))
Function:
(defun stack-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (stackp acl2::x) (stackp acl2::y)))) (equal (stack-fix acl2::x) (stack-fix acl2::y)))
Theorem:
(defthm stack-equiv-is-an-equivalence (and (booleanp (stack-equiv x y)) (stack-equiv x x) (implies (stack-equiv x y) (stack-equiv y x)) (implies (and (stack-equiv x y) (stack-equiv y z)) (stack-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm stack-equiv-implies-equal-stack-fix-1 (implies (stack-equiv acl2::x x-equiv) (equal (stack-fix acl2::x) (stack-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm stack-fix-under-stack-equiv (stack-equiv (stack-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-stack-fix-1-forward-to-stack-equiv (implies (equal (stack-fix acl2::x) acl2::y) (stack-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-stack-fix-2-forward-to-stack-equiv (implies (equal acl2::x (stack-fix acl2::y)) (stack-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm stack-equiv-of-stack-fix-1-forward (implies (stack-equiv (stack-fix acl2::x) acl2::y) (stack-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm stack-equiv-of-stack-fix-2-forward (implies (stack-equiv acl2::x (stack-fix acl2::y)) (stack-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm car-of-stack-fix-x-under-frame-equiv (frame-equiv (car (stack-fix acl2::x)) (car acl2::x)))
Theorem:
(defthm car-stack-equiv-congruence-on-x-under-frame-equiv (implies (stack-equiv acl2::x x-equiv) (frame-equiv (car acl2::x) (car x-equiv))) :rule-classes :congruence)
Theorem:
(defthm cdr-of-stack-fix-x-under-stack-equiv (stack-equiv (cdr (stack-fix acl2::x)) (cdr acl2::x)))
Theorem:
(defthm cdr-stack-equiv-congruence-on-x-under-stack-equiv (implies (stack-equiv acl2::x x-equiv) (stack-equiv (cdr acl2::x) (cdr x-equiv))) :rule-classes :congruence)
Theorem:
(defthm cons-of-frame-fix-x-under-stack-equiv (stack-equiv (cons (frame-fix acl2::x) acl2::y) (cons acl2::x acl2::y)))
Theorem:
(defthm cons-frame-equiv-congruence-on-x-under-stack-equiv (implies (frame-equiv acl2::x x-equiv) (stack-equiv (cons acl2::x acl2::y) (cons x-equiv acl2::y))) :rule-classes :congruence)
Theorem:
(defthm cons-of-stack-fix-y-under-stack-equiv (stack-equiv (cons acl2::x (stack-fix acl2::y)) (cons acl2::x acl2::y)))
Theorem:
(defthm cons-stack-equiv-congruence-on-y-under-stack-equiv (implies (stack-equiv acl2::y y-equiv) (stack-equiv (cons acl2::x acl2::y) (cons acl2::x y-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-stack-fix (equal (consp (stack-fix acl2::x)) (consp acl2::x)))
Theorem:
(defthm stack-fix-under-iff (iff (stack-fix acl2::x) (consp acl2::x)))
Theorem:
(defthm stack-fix-of-cons (equal (stack-fix (cons a x)) (cons (frame-fix a) (stack-fix x))))
Theorem:
(defthm len-of-stack-fix (equal (len (stack-fix acl2::x)) (len acl2::x)))
Theorem:
(defthm stack-fix-of-append (equal (stack-fix (append std::a std::b)) (append (stack-fix std::a) (stack-fix std::b))))
Theorem:
(defthm stack-fix-of-repeat (equal (stack-fix (repeat acl2::n acl2::x)) (repeat acl2::n (frame-fix acl2::x))))
Theorem:
(defthm list-equiv-refines-stack-equiv (implies (list-equiv acl2::x acl2::y) (stack-equiv acl2::x acl2::y)) :rule-classes :refinement)
Theorem:
(defthm nth-of-stack-fix (equal (nth acl2::n (stack-fix acl2::x)) (if (< (nfix acl2::n) (len acl2::x)) (frame-fix (nth acl2::n acl2::x)) nil)))
Theorem:
(defthm stack-equiv-implies-stack-equiv-append-1 (implies (stack-equiv acl2::x fty::x-equiv) (stack-equiv (append acl2::x acl2::y) (append fty::x-equiv acl2::y))) :rule-classes (:congruence))
Theorem:
(defthm stack-equiv-implies-stack-equiv-append-2 (implies (stack-equiv acl2::y fty::y-equiv) (stack-equiv (append acl2::x acl2::y) (append acl2::x fty::y-equiv))) :rule-classes (:congruence))
Theorem:
(defthm stack-equiv-implies-stack-equiv-nthcdr-2 (implies (stack-equiv acl2::l l-equiv) (stack-equiv (nthcdr acl2::n acl2::l) (nthcdr acl2::n l-equiv))) :rule-classes (:congruence))
Theorem:
(defthm stack-equiv-implies-stack-equiv-take-2 (implies (stack-equiv acl2::l l-equiv) (stack-equiv (take acl2::n acl2::l) (take acl2::n l-equiv))) :rule-classes (:congruence))