Fixing function for toplevel structures.
Function:
(defun toplevel-fix$inline (x) (declare (xargs :guard (toplevelp x))) (let ((__function__ 'toplevel-fix)) (declare (ignorable __function__)) (mbe :logic (case (toplevel-kind x) (:type (b* ((get (type-definition-fix (std::da-nth 0 (cdr x))))) (cons :type (list get)))) (:types (b* ((get (type-recursion-fix (std::da-nth 0 (cdr x))))) (cons :types (list get)))) (:function (b* ((get (function-definition-fix (std::da-nth 0 (cdr x))))) (cons :function (list get)))) (:functions (b* ((get (function-recursion-fix (std::da-nth 0 (cdr x))))) (cons :functions (list get)))) (:specification (b* ((get (function-specification-fix (std::da-nth 0 (cdr x))))) (cons :specification (list get)))) (:theorem (b* ((get (theorem-fix (std::da-nth 0 (cdr x))))) (cons :theorem (list get)))) (:transform (b* ((get (transform-fix (std::da-nth 0 (cdr x))))) (cons :transform (list get))))) :exec x)))
Theorem:
(defthm toplevelp-of-toplevel-fix (b* ((new-x (toplevel-fix$inline x))) (toplevelp new-x)) :rule-classes :rewrite)
Theorem:
(defthm toplevel-fix-when-toplevelp (implies (toplevelp x) (equal (toplevel-fix x) x)))
Function:
(defun toplevel-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (toplevelp acl2::x) (toplevelp acl2::y)))) (equal (toplevel-fix acl2::x) (toplevel-fix acl2::y)))
Theorem:
(defthm toplevel-equiv-is-an-equivalence (and (booleanp (toplevel-equiv x y)) (toplevel-equiv x x) (implies (toplevel-equiv x y) (toplevel-equiv y x)) (implies (and (toplevel-equiv x y) (toplevel-equiv y z)) (toplevel-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm toplevel-equiv-implies-equal-toplevel-fix-1 (implies (toplevel-equiv acl2::x x-equiv) (equal (toplevel-fix acl2::x) (toplevel-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm toplevel-fix-under-toplevel-equiv (toplevel-equiv (toplevel-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-toplevel-fix-1-forward-to-toplevel-equiv (implies (equal (toplevel-fix acl2::x) acl2::y) (toplevel-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-toplevel-fix-2-forward-to-toplevel-equiv (implies (equal acl2::x (toplevel-fix acl2::y)) (toplevel-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm toplevel-equiv-of-toplevel-fix-1-forward (implies (toplevel-equiv (toplevel-fix acl2::x) acl2::y) (toplevel-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm toplevel-equiv-of-toplevel-fix-2-forward (implies (toplevel-equiv acl2::x (toplevel-fix acl2::y)) (toplevel-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm toplevel-kind$inline-of-toplevel-fix-x (equal (toplevel-kind$inline (toplevel-fix x)) (toplevel-kind$inline x)))
Theorem:
(defthm toplevel-kind$inline-toplevel-equiv-congruence-on-x (implies (toplevel-equiv x x-equiv) (equal (toplevel-kind$inline x) (toplevel-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-toplevel-fix (consp (toplevel-fix x)) :rule-classes :type-prescription)