Abstract recognizer and fixer for the float-extended-exponent value set [JLS14:4.2.3].
We introduce a constrained predicate for the underlying values
of Java
The predicate is constrained to be empty
if and only if floatx-param is
Definition:
(encapsulate (((floatx-value-abs-p *) => *) ((floatx-value-abs-pos-zero) => *)) (local (value-triple :elided)) (local (value-triple :elided)) (local (value-triple :elided)) (defthm booleanp-of-floatx-value-abs-p (booleanp (floatx-value-abs-p x)) :rule-classes (:rewrite :type-prescription)) (defrule not-floatx-value-abs-p-when-not-floatx-param (implies (not (floatx-param)) (not (floatx-value-abs-p x)))) (defrule floatx-value-abs-p-of-floatx-value-abs-pos-zero-when-floatx-param (implies (floatx-param) (floatx-value-abs-p (floatx-value-abs-pos-zero)))))
Definition:
(encapsulate (((floatx-value-abs-p *) => *) ((floatx-value-abs-pos-zero) => *)) (local (value-triple :elided)) (local (value-triple :elided)) (local (value-triple :elided)) (defthm booleanp-of-floatx-value-abs-p (booleanp (floatx-value-abs-p x)) :rule-classes (:rewrite :type-prescription)) (defrule not-floatx-value-abs-p-when-not-floatx-param (implies (not (floatx-param)) (not (floatx-value-abs-p x)))) (defrule floatx-value-abs-p-of-floatx-value-abs-pos-zero-when-floatx-param (implies (floatx-param) (floatx-value-abs-p (floatx-value-abs-pos-zero)))))
Theorem:
(defthm booleanp-of-floatx-value-abs-p (booleanp (floatx-value-abs-p x)) :rule-classes (:rewrite :type-prescription))
Theorem:
(defthm not-floatx-value-abs-p-when-not-floatx-param (implies (not (floatx-param)) (not (floatx-value-abs-p x))))
Theorem:
(defthm floatx-value-abs-p-of-floatx-value-abs-pos-zero-when-floatx-param (implies (floatx-param) (floatx-value-abs-p (floatx-value-abs-pos-zero))))
Function:
(defun floatx-value-abs-fix (x) (declare (xargs :guard (floatx-value-abs-p x))) (let ((__function__ 'floatx-value-abs-fix)) (declare (ignorable __function__)) (mbe :logic (if (floatx-value-abs-p x) x (floatx-value-abs-pos-zero)) :exec x)))
Theorem:
(defthm floatx-value-abs-p-of-floatx-value-abs-fix (implies (floatx-param) (b* ((fixed-x (floatx-value-abs-fix x))) (floatx-value-abs-p fixed-x))) :rule-classes :rewrite)
Theorem:
(defthm floatx-value-abs-fix-when-floatx-value-abs-p (implies (floatx-value-abs-p x) (equal (floatx-value-abs-fix x) x)))