Fixing function for path structures.
Function:
(defun path-fix$inline (x) (declare (xargs :guard (path-p x))) (let ((__function__ 'path-fix)) (declare (ignorable __function__)) (mbe :logic (case (path-kind x) (:wire (b* ((name (name-fix x))) name)) (:scope (b* ((subpath (path-fix (cdr x))) (namespace (name-fix (car x)))) (cons namespace subpath)))) :exec x)))
Theorem:
(defthm path-p-of-path-fix (b* ((new-x (path-fix$inline x))) (path-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm path-fix-when-path-p (implies (path-p x) (equal (path-fix x) x)))
Function:
(defun path-equiv$inline (x y) (declare (xargs :guard (and (path-p x) (path-p y)))) (equal (path-fix x) (path-fix y)))
Theorem:
(defthm path-equiv-is-an-equivalence (and (booleanp (path-equiv x y)) (path-equiv x x) (implies (path-equiv x y) (path-equiv y x)) (implies (and (path-equiv x y) (path-equiv y z)) (path-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm path-equiv-implies-equal-path-fix-1 (implies (path-equiv x x-equiv) (equal (path-fix x) (path-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm path-fix-under-path-equiv (path-equiv (path-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-path-fix-1-forward-to-path-equiv (implies (equal (path-fix x) y) (path-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-path-fix-2-forward-to-path-equiv (implies (equal x (path-fix y)) (path-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm path-equiv-of-path-fix-1-forward (implies (path-equiv (path-fix x) y) (path-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm path-equiv-of-path-fix-2-forward (implies (path-equiv x (path-fix y)) (path-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm path-kind$inline-of-path-fix-x (equal (path-kind$inline (path-fix x)) (path-kind$inline x)))
Theorem:
(defthm path-kind$inline-path-equiv-congruence-on-x (implies (path-equiv x x-equiv) (equal (path-kind$inline x) (path-kind$inline x-equiv))) :rule-classes :congruence)