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