Fixing function for sd-key structures.
Function:
(defun sd-key-fix$inline (x) (declare (xargs :guard (sd-key-p x))) (let ((__function__ 'sd-key-fix)) (declare (ignorable __function__)) (mbe :logic (b* ((pat (str-fix (car (cdr x)))) (index (maybe-natp-fix (car (cdr (cdr x))))) (orig (str-fix (cdr (cdr (cdr x)))))) (cons :sd-key (cons pat (cons index orig)))) :exec x)))
Theorem:
(defthm sd-key-p-of-sd-key-fix (b* ((new-x (sd-key-fix$inline x))) (sd-key-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm sd-key-fix-when-sd-key-p (implies (sd-key-p x) (equal (sd-key-fix x) x)))
Function:
(defun sd-key-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (sd-key-p acl2::x) (sd-key-p acl2::y)))) (equal (sd-key-fix acl2::x) (sd-key-fix acl2::y)))
Theorem:
(defthm sd-key-equiv-is-an-equivalence (and (booleanp (sd-key-equiv x y)) (sd-key-equiv x x) (implies (sd-key-equiv x y) (sd-key-equiv y x)) (implies (and (sd-key-equiv x y) (sd-key-equiv y z)) (sd-key-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm sd-key-equiv-implies-equal-sd-key-fix-1 (implies (sd-key-equiv acl2::x x-equiv) (equal (sd-key-fix acl2::x) (sd-key-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm sd-key-fix-under-sd-key-equiv (sd-key-equiv (sd-key-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-sd-key-fix-1-forward-to-sd-key-equiv (implies (equal (sd-key-fix acl2::x) acl2::y) (sd-key-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-sd-key-fix-2-forward-to-sd-key-equiv (implies (equal acl2::x (sd-key-fix acl2::y)) (sd-key-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm sd-key-equiv-of-sd-key-fix-1-forward (implies (sd-key-equiv (sd-key-fix acl2::x) acl2::y) (sd-key-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm sd-key-equiv-of-sd-key-fix-2-forward (implies (sd-key-equiv acl2::x (sd-key-fix acl2::y)) (sd-key-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)