Abstract recognizer and fixer for the double-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 doublex-param is
Definition:
(encapsulate (((doublex-value-abs-p *) => *) ((doublex-value-abs-pos-zero) => *)) (local (value-triple :elided)) (local (value-triple :elided)) (local (value-triple :elided)) (defthm booleanp-of-doublex-value-abs-p (booleanp (doublex-value-abs-p x)) :rule-classes (:rewrite :type-prescription)) (defrule not-doublex-value-abs-p-when-not-doublex-param (implies (not (doublex-param)) (not (doublex-value-abs-p x)))) (defrule doublex-value-abs-p-of-doublex-value-abs-pos-zero-when-doublex-param (implies (doublex-param) (doublex-value-abs-p (doublex-value-abs-pos-zero)))))
Definition:
(encapsulate (((doublex-value-abs-p *) => *) ((doublex-value-abs-pos-zero) => *)) (local (value-triple :elided)) (local (value-triple :elided)) (local (value-triple :elided)) (defthm booleanp-of-doublex-value-abs-p (booleanp (doublex-value-abs-p x)) :rule-classes (:rewrite :type-prescription)) (defrule not-doublex-value-abs-p-when-not-doublex-param (implies (not (doublex-param)) (not (doublex-value-abs-p x)))) (defrule doublex-value-abs-p-of-doublex-value-abs-pos-zero-when-doublex-param (implies (doublex-param) (doublex-value-abs-p (doublex-value-abs-pos-zero)))))
Theorem:
(defthm booleanp-of-doublex-value-abs-p (booleanp (doublex-value-abs-p x)) :rule-classes (:rewrite :type-prescription))
Theorem:
(defthm not-doublex-value-abs-p-when-not-doublex-param (implies (not (doublex-param)) (not (doublex-value-abs-p x))))
Theorem:
(defthm doublex-value-abs-p-of-doublex-value-abs-pos-zero-when-doublex-param (implies (doublex-param) (doublex-value-abs-p (doublex-value-abs-pos-zero))))
Function:
(defun doublex-value-abs-fix (x) (declare (xargs :guard (doublex-value-abs-p x))) (let ((__function__ 'doublex-value-abs-fix)) (declare (ignorable __function__)) (mbe :logic (if (doublex-value-abs-p x) x (doublex-value-abs-pos-zero)) :exec x)))
Theorem:
(defthm doublex-value-abs-p-of-doublex-value-abs-fix (implies (doublex-param) (b* ((fixed-x (doublex-value-abs-fix x))) (doublex-value-abs-p fixed-x))) :rule-classes :rewrite)
Theorem:
(defthm doublex-value-abs-fix-when-doublex-value-abs-p (implies (doublex-value-abs-p x) (equal (doublex-value-abs-fix x) x)))