Function:
(defun s4vec-fix (x) (declare (xargs :guard (s4vec-p x))) (let ((__function__ 's4vec-fix)) (declare (ignorable __function__)) (mbe :logic (if (atom x) (if (integerp x) x '(-1 . 0)) (b* ((car (sparseint-fix (car x))) ((unless (cdr x)) (if (integerp car) car (list car))) (cdr (sparseint-fix (cdr x))) ((when (equal car cdr)) (if (integerp car) car (list car)))) (cons car cdr))) :exec x)))
Theorem:
(defthm s4vec-p-of-s4vec-fix (b* ((new-x (s4vec-fix x))) (s4vec-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm s4vec-fix-when-s4vec-p (b* ((?new-x (s4vec-fix x))) (implies (s4vec-p x) (equal new-x x))))
Function:
(defun s4vec-equiv$inline (x y) (declare (xargs :guard (and (s4vec-p x) (s4vec-p y)))) (equal (s4vec-fix x) (s4vec-fix y)))
Theorem:
(defthm s4vec-equiv-is-an-equivalence (and (booleanp (s4vec-equiv x y)) (s4vec-equiv x x) (implies (s4vec-equiv x y) (s4vec-equiv y x)) (implies (and (s4vec-equiv x y) (s4vec-equiv y z)) (s4vec-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm s4vec-equiv-implies-equal-s4vec-fix-1 (implies (s4vec-equiv x x-equiv) (equal (s4vec-fix x) (s4vec-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm s4vec-fix-under-s4vec-equiv (s4vec-equiv (s4vec-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-s4vec-fix-1-forward-to-s4vec-equiv (implies (equal (s4vec-fix x) y) (s4vec-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-s4vec-fix-2-forward-to-s4vec-equiv (implies (equal x (s4vec-fix y)) (s4vec-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm s4vec-equiv-of-s4vec-fix-1-forward (implies (s4vec-equiv (s4vec-fix x) y) (s4vec-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm s4vec-equiv-of-s4vec-fix-2-forward (implies (s4vec-equiv x (s4vec-fix y)) (s4vec-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm s4vec-fix-of-s4vec-fix-x (equal (s4vec-fix (s4vec-fix x)) (s4vec-fix x)))
Theorem:
(defthm s4vec-fix-s4vec-equiv-congruence-on-x (implies (s4vec-equiv x x-equiv) (equal (s4vec-fix x) (s4vec-fix x-equiv))) :rule-classes :congruence)