Fixing function for 2bits bit structures.
Function:
(defun 2bits-fix (x) (declare (xargs :guard (2bits-p x))) (let ((__function__ '2bits-fix)) (declare (ignorable __function__)) (mbe :logic (loghead 2 x) :exec x)))
Theorem:
(defthm 2bits-p-of-2bits-fix (b* ((fty::fixed (2bits-fix x))) (2bits-p fty::fixed)) :rule-classes :rewrite)
Theorem:
(defthm 2bits-fix-when-2bits-p (implies (2bits-p x) (equal (2bits-fix x) x)))
Function:
(defun 2bits-equiv$inline (x y) (declare (xargs :guard (and (2bits-p x) (2bits-p y)))) (equal (2bits-fix x) (2bits-fix y)))
Theorem:
(defthm 2bits-equiv-is-an-equivalence (and (booleanp (2bits-equiv x y)) (2bits-equiv x x) (implies (2bits-equiv x y) (2bits-equiv y x)) (implies (and (2bits-equiv x y) (2bits-equiv y z)) (2bits-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm 2bits-equiv-implies-equal-2bits-fix-1 (implies (2bits-equiv x x-equiv) (equal (2bits-fix x) (2bits-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm 2bits-fix-under-2bits-equiv (2bits-equiv (2bits-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))