Fixing function for svar structures.
Function:
(defun svar-fix$inline (x) (declare (xargs :guard (svar-p x))) (let ((__function__ 'svar-fix)) (declare (ignorable __function__)) (mbe :logic (b* ((name (if (atom x) x (cadr x))) (delay (nfix (if (atom x) 0 (b* ((rest (cddr x)) ((when (integerp rest)) (loghead 4 rest)) ((when (integerp (first rest))) (first rest))) (cdr (first rest)))))) (bits (ifix (if (atom x) 0 (b* ((rest (cddr x)) ((when (integerp rest)) (logtail 4 rest)) ((when (integerp (first rest))) (cdr rest))) (cdr (second rest)))))) (props (svar-proplist-fix (if (atom x) nil (b* ((rest (cddr x)) ((when (integerp rest)) nil) ((when (integerp (first rest))) nil)) (cddr rest)))))) (cond (props (hons :var (hons name (hons (hons :delay delay) (hons (hons :bits bits) props))))) ((>= delay 16) (hons :var (hons name (hons delay bits)))) ((and (or (stringp name) (and (symbolp name) (not (booleanp name)))) (eql delay 0) (eql bits 0)) name) (t (hons :var (hons name (logapp 4 delay bits)))))) :exec x)))
Theorem:
(defthm svar-p-of-svar-fix (b* ((new-x (svar-fix$inline x))) (svar-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm svar-fix-when-svar-p (implies (svar-p x) (equal (svar-fix x) x)))
Function:
(defun svar-equiv$inline (x y) (declare (xargs :guard (and (svar-p x) (svar-p y)))) (equal (svar-fix x) (svar-fix y)))
Theorem:
(defthm svar-equiv-is-an-equivalence (and (booleanp (svar-equiv x y)) (svar-equiv x x) (implies (svar-equiv x y) (svar-equiv y x)) (implies (and (svar-equiv x y) (svar-equiv y z)) (svar-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm svar-equiv-implies-equal-svar-fix-1 (implies (svar-equiv x x-equiv) (equal (svar-fix x) (svar-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm svar-fix-under-svar-equiv (svar-equiv (svar-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-svar-fix-1-forward-to-svar-equiv (implies (equal (svar-fix x) y) (svar-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-svar-fix-2-forward-to-svar-equiv (implies (equal x (svar-fix y)) (svar-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm svar-equiv-of-svar-fix-1-forward (implies (svar-equiv (svar-fix x) y) (svar-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm svar-equiv-of-svar-fix-2-forward (implies (svar-equiv x (svar-fix y)) (svar-equiv x y)) :rule-classes :forward-chaining)