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