Fixing function for schar-array structures.
(schar-array-fix x) → new-x
Function:
(defun schar-array-fix$inline (x) (declare (xargs :guard (schar-arrayp x))) (let ((__function__ 'schar-array-fix)) (declare (ignorable __function__)) (mbe :logic (b* ((elemtype (type-fix (std::da-nth 0 (cdr x)))) (elements (schar-list-fix (std::da-nth 1 (cdr x))))) (let ((elemtype (if (type-case elemtype :schar) elemtype (type-schar))) (elements (if (consp elements) elements (list (schar-from-integer 0))))) (cons :array (list elemtype elements)))) :exec x)))
Theorem:
(defthm schar-arrayp-of-schar-array-fix (b* ((new-x (schar-array-fix$inline x))) (schar-arrayp new-x)) :rule-classes :rewrite)
Theorem:
(defthm schar-array-fix-when-schar-arrayp (implies (schar-arrayp x) (equal (schar-array-fix x) x)))
Function:
(defun schar-array-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (schar-arrayp acl2::x) (schar-arrayp acl2::y)))) (equal (schar-array-fix acl2::x) (schar-array-fix acl2::y)))
Theorem:
(defthm schar-array-equiv-is-an-equivalence (and (booleanp (schar-array-equiv x y)) (schar-array-equiv x x) (implies (schar-array-equiv x y) (schar-array-equiv y x)) (implies (and (schar-array-equiv x y) (schar-array-equiv y z)) (schar-array-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm schar-array-equiv-implies-equal-schar-array-fix-1 (implies (schar-array-equiv acl2::x x-equiv) (equal (schar-array-fix acl2::x) (schar-array-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm schar-array-fix-under-schar-array-equiv (schar-array-equiv (schar-array-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-schar-array-fix-1-forward-to-schar-array-equiv (implies (equal (schar-array-fix acl2::x) acl2::y) (schar-array-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-schar-array-fix-2-forward-to-schar-array-equiv (implies (equal acl2::x (schar-array-fix acl2::y)) (schar-array-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm schar-array-equiv-of-schar-array-fix-1-forward (implies (schar-array-equiv (schar-array-fix acl2::x) acl2::y) (schar-array-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm schar-array-equiv-of-schar-array-fix-2-forward (implies (schar-array-equiv acl2::x (schar-array-fix acl2::y)) (schar-array-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)