Fixing function for npn4 bit structures.
Function:
(defun npn4-fix (x) (declare (xargs :guard (npn4-p x))) (let ((__function__ 'npn4-fix)) (declare (ignorable __function__)) (mbe :logic (loghead 27 (logapp 16 (part-select x :width 16 :low 0) (logapp 1 (part-select x :width 1 :low 16) (logapp 4 (part-select x :width 4 :low 17) (perm4-fix (part-select x :width 6 :low 21)))))) :exec x)))
Theorem:
(defthm npn4-p-of-npn4-fix (b* ((fty::fixed (npn4-fix x))) (npn4-p fty::fixed)) :rule-classes :rewrite)
Theorem:
(defthm npn4-fix-when-npn4-p (implies (npn4-p x) (equal (npn4-fix x) x)))
Function:
(defun npn4-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (npn4-p acl2::x) (npn4-p acl2::y)))) (equal (npn4-fix acl2::x) (npn4-fix acl2::y)))
Theorem:
(defthm npn4-equiv-is-an-equivalence (and (booleanp (npn4-equiv x y)) (npn4-equiv x x) (implies (npn4-equiv x y) (npn4-equiv y x)) (implies (and (npn4-equiv x y) (npn4-equiv y z)) (npn4-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm npn4-equiv-implies-equal-npn4-fix-1 (implies (npn4-equiv acl2::x x-equiv) (equal (npn4-fix acl2::x) (npn4-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm npn4-fix-under-npn4-equiv (npn4-equiv (npn4-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm npn4-fix-of-npn4-fix-x (equal (npn4-fix (npn4-fix x)) (npn4-fix x)))
Theorem:
(defthm npn4-fix-npn4-equiv-congruence-on-x (implies (npn4-equiv x x-equiv) (equal (npn4-fix x) (npn4-fix x-equiv))) :rule-classes :congruence)