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