Fixtype of Java floating-point literals.
For now we model them via a predicate constrained to be non-empty so that a fixing function and a fixtype can be defined.
Definition:
(encapsulate (((floating-point-literalp *) acl2::=> *) ((floating-point-literal-witness) acl2::=> *)) (local (value-triple :elided)) (local (value-triple :elided)) (defthm booleanp-of-floating-point-literalp (booleanp (floating-point-literalp x)) :rule-classes (:rewrite :type-prescription)) (defthm floating-point-literalp-of-floating-point-literal-witness (floating-point-literalp (floating-point-literal-witness))))
Definition:
(encapsulate (((floating-point-literalp *) acl2::=> *) ((floating-point-literal-witness) acl2::=> *)) (local (value-triple :elided)) (local (value-triple :elided)) (defthm booleanp-of-floating-point-literalp (booleanp (floating-point-literalp x)) :rule-classes (:rewrite :type-prescription)) (defthm floating-point-literalp-of-floating-point-literal-witness (floating-point-literalp (floating-point-literal-witness))))
Theorem:
(defthm booleanp-of-floating-point-literalp (booleanp (floating-point-literalp x)) :rule-classes (:rewrite :type-prescription))
Theorem:
(defthm floating-point-literalp-of-floating-point-literal-witness (floating-point-literalp (floating-point-literal-witness)))
Function:
(defun floating-point-literal-fix (x) (declare (xargs :guard (floating-point-literalp x))) (mbe :logic (if (floating-point-literalp x) x (floating-point-literal-witness)) :exec x))
Theorem:
(defthm floating-point-literalp-of-floating-point-literal-fix (b* ((fixed-x (floating-point-literal-fix x))) (floating-point-literalp fixed-x)) :rule-classes :rewrite)
Theorem:
(defthm floating-point-literal-fix-when-floating-point-literalp (implies (floating-point-literalp x) (equal (floating-point-literal-fix x) x)))
Function:
(defun floating-point-literal-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (floating-point-literalp acl2::x) (floating-point-literalp acl2::y)))) (equal (floating-point-literal-fix acl2::x) (floating-point-literal-fix acl2::y)))
Theorem:
(defthm floating-point-literal-equiv-is-an-equivalence (and (booleanp (floating-point-literal-equiv x y)) (floating-point-literal-equiv x x) (implies (floating-point-literal-equiv x y) (floating-point-literal-equiv y x)) (implies (and (floating-point-literal-equiv x y) (floating-point-literal-equiv y z)) (floating-point-literal-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm floating-point-literal-equiv-implies-equal-floating-point-literal-fix-1 (implies (floating-point-literal-equiv acl2::x x-equiv) (equal (floating-point-literal-fix acl2::x) (floating-point-literal-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm floating-point-literal-fix-under-floating-point-literal-equiv (floating-point-literal-equiv (floating-point-literal-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-floating-point-literal-fix-1-forward-to-floating-point-literal-equiv (implies (equal (floating-point-literal-fix acl2::x) acl2::y) (floating-point-literal-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-floating-point-literal-fix-2-forward-to-floating-point-literal-equiv (implies (equal acl2::x (floating-point-literal-fix acl2::y)) (floating-point-literal-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm floating-point-literal-equiv-of-floating-point-literal-fix-1-forward (implies (floating-point-literal-equiv (floating-point-literal-fix acl2::x) acl2::y) (floating-point-literal-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm floating-point-literal-equiv-of-floating-point-literal-fix-2-forward (implies (floating-point-literal-equiv acl2::x (floating-point-literal-fix acl2::y)) (floating-point-literal-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)