Fixing function for context structures.
Function:
(defun context-fix$inline (x) (declare (xargs :guard (contextp x))) (let ((__function__ 'context-fix)) (declare (ignorable __function__)) (mbe :logic (b* ((tops (toplevel-list-fix (cdr (std::da-nth 0 x)))) (types (identifier-list-fix (cdr (std::da-nth 1 x)))) (functions (function-header-list-fix (cdr (std::da-nth 2 x)))) (variables (variable-context-fix (cdr (std::da-nth 3 x)))) (obligation-vars (typed-variable-list-fix (cdr (std::da-nth 4 x)))) (obligation-hyps (obligation-hyp-list-fix (cdr (std::da-nth 5 x))))) (list (cons 'tops tops) (cons 'types types) (cons 'functions functions) (cons 'variables variables) (cons 'obligation-vars obligation-vars) (cons 'obligation-hyps obligation-hyps))) :exec x)))
Theorem:
(defthm contextp-of-context-fix (b* ((new-x (context-fix$inline x))) (contextp new-x)) :rule-classes :rewrite)
Theorem:
(defthm context-fix-when-contextp (implies (contextp x) (equal (context-fix x) x)))
Function:
(defun context-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (contextp acl2::x) (contextp acl2::y)))) (equal (context-fix acl2::x) (context-fix acl2::y)))
Theorem:
(defthm context-equiv-is-an-equivalence (and (booleanp (context-equiv x y)) (context-equiv x x) (implies (context-equiv x y) (context-equiv y x)) (implies (and (context-equiv x y) (context-equiv y z)) (context-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm context-equiv-implies-equal-context-fix-1 (implies (context-equiv acl2::x x-equiv) (equal (context-fix acl2::x) (context-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm context-fix-under-context-equiv (context-equiv (context-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-context-fix-1-forward-to-context-equiv (implies (equal (context-fix acl2::x) acl2::y) (context-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-context-fix-2-forward-to-context-equiv (implies (equal acl2::x (context-fix acl2::y)) (context-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm context-equiv-of-context-fix-1-forward (implies (context-equiv (context-fix acl2::x) acl2::y) (context-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm context-equiv-of-context-fix-2-forward (implies (context-equiv acl2::x (context-fix acl2::y)) (context-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)