Recognizer, fixer, constructor, and destructor of
Java
We define the recognizer analogously to the one of
the fixtypes of other Java primitive values,
by tagging the underlying values introduced in floatx-value-abs.
The recognizer is non-empty if and only if
floatx-param is non-
Function:
(defun floatx-valuep (x) (declare (xargs :guard t)) (let ((__function__ 'floatx-valuep)) (declare (ignorable __function__)) (and (tuplep 2 x) (eq (first x) :floatx) (floatx-value-abs-p (second x)))))
Theorem:
(defthm booleanp-of-floatx-valuep (b* ((yes/no (floatx-valuep x))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm no-floatx-value-when-unsupported (implies (not (floatx-param)) (not (floatx-valuep x))))
Function:
(defun floatx-value-fix (x) (declare (xargs :guard (floatx-valuep x))) (let ((__function__ 'floatx-value-fix)) (declare (ignorable __function__)) (mbe :logic (if (floatx-valuep x) x (list :floatx (floatx-value-abs-pos-zero))) :exec x)))
Theorem:
(defthm floatx-valuep-of-floatx-value-fix (implies (floatx-param) (b* ((fixed-x (floatx-value-fix x))) (floatx-valuep fixed-x))) :rule-classes :rewrite)
Theorem:
(defthm floatx-value-fix-when-floatx-valuep (implies (floatx-valuep x) (equal (floatx-value-fix x) x)))
Function:
(defun floatx-value (x) (declare (xargs :guard (floatx-value-abs-p x))) (let ((__function__ 'floatx-value)) (declare (ignorable __function__)) (list :floatx (floatx-value-abs-fix x))))
Theorem:
(defthm floatx-valuep-of-floatx-value (implies (floatx-param) (b* ((value (floatx-value x))) (floatx-valuep value))) :rule-classes :rewrite)
Function:
(defun floatx-value->floatx (value) (declare (xargs :guard (floatx-valuep value))) (let ((__function__ 'floatx-value->floatx)) (declare (ignorable __function__)) (second (floatx-value-fix value))))
Theorem:
(defthm floatx-value-abs-p-of-floatx-value->floatx (implies (floatx-param) (b* ((x (floatx-value->floatx value))) (floatx-value-abs-p x))) :rule-classes :rewrite)
Theorem:
(defthm floatx-value->floatx-of-floatx-value (implies (floatx-param) (equal (floatx-value->floatx (floatx-value x)) (floatx-value-abs-fix x))))