Abstract fixtype for the double value set [JLS14:4.2.3].
We introduce a constrained predicate for the underlying values
of Java
The predicate is constrained to be non-empty: this is expressed via a constrained nullary function that returns the positive 0 of the double value set. These constraints enable the definition of a fixer and fixtype.
Definition:
(encapsulate (((double-value-abs-p *) acl2::=> *) ((double-value-abs-pos-zero) acl2::=> *)) (local (value-triple :elided)) (local (value-triple :elided)) (defthm booleanp-of-double-value-abs-p (booleanp (double-value-abs-p x)) :rule-classes (:rewrite :type-prescription)) (defthm double-value-abs-p-of-double-value-abs-pos-zero (double-value-abs-p (double-value-abs-pos-zero))))
Definition:
(encapsulate (((double-value-abs-p *) acl2::=> *) ((double-value-abs-pos-zero) acl2::=> *)) (local (value-triple :elided)) (local (value-triple :elided)) (defthm booleanp-of-double-value-abs-p (booleanp (double-value-abs-p x)) :rule-classes (:rewrite :type-prescription)) (defthm double-value-abs-p-of-double-value-abs-pos-zero (double-value-abs-p (double-value-abs-pos-zero))))
Theorem:
(defthm booleanp-of-double-value-abs-p (booleanp (double-value-abs-p x)) :rule-classes (:rewrite :type-prescription))
Theorem:
(defthm double-value-abs-p-of-double-value-abs-pos-zero (double-value-abs-p (double-value-abs-pos-zero)))
Function:
(defun double-value-abs-fix (x) (declare (xargs :guard (double-value-abs-p x))) (mbe :logic (if (double-value-abs-p x) x (double-value-abs-pos-zero)) :exec x))
Theorem:
(defthm double-value-abs-p-of-double-value-abs-fix (b* ((fixed-x (double-value-abs-fix x))) (double-value-abs-p fixed-x)) :rule-classes :rewrite)
Theorem:
(defthm double-value-abs-fix-when-double-value-abs-p (implies (double-value-abs-p x) (equal (double-value-abs-fix x) x)))
Function:
(defun double-value-abs-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (double-value-abs-p acl2::x) (double-value-abs-p acl2::y)))) (equal (double-value-abs-fix acl2::x) (double-value-abs-fix acl2::y)))
Theorem:
(defthm double-value-abs-equiv-is-an-equivalence (and (booleanp (double-value-abs-equiv x y)) (double-value-abs-equiv x x) (implies (double-value-abs-equiv x y) (double-value-abs-equiv y x)) (implies (and (double-value-abs-equiv x y) (double-value-abs-equiv y z)) (double-value-abs-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm double-value-abs-equiv-implies-equal-double-value-abs-fix-1 (implies (double-value-abs-equiv acl2::x x-equiv) (equal (double-value-abs-fix acl2::x) (double-value-abs-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm double-value-abs-fix-under-double-value-abs-equiv (double-value-abs-equiv (double-value-abs-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-double-value-abs-fix-1-forward-to-double-value-abs-equiv (implies (equal (double-value-abs-fix acl2::x) acl2::y) (double-value-abs-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-double-value-abs-fix-2-forward-to-double-value-abs-equiv (implies (equal acl2::x (double-value-abs-fix acl2::y)) (double-value-abs-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm double-value-abs-equiv-of-double-value-abs-fix-1-forward (implies (double-value-abs-equiv (double-value-abs-fix acl2::x) acl2::y) (double-value-abs-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm double-value-abs-equiv-of-double-value-abs-fix-2-forward (implies (double-value-abs-equiv acl2::x (double-value-abs-fix acl2::y)) (double-value-abs-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)