Test an integer value logically.
In some contexts (e.g. conditional tests), an integer is treated as a logical boolean: false if 0, true if not 0. This is captured by this ACL2 function.
Function:
(defun test-integer-value (val) (declare (xargs :guard (valuep val))) (declare (xargs :guard (value-integerp val))) (let ((__function__ 'test-integer-value)) (declare (ignorable __function__)) (not (equal (value-integer->get val) 0))))
Theorem:
(defthm booleanp-of-test-integer-value (b* ((res (test-integer-value val))) (booleanp res)) :rule-classes :rewrite)
Theorem:
(defthm test-integer-value-of-value-fix-val (equal (test-integer-value (value-fix val)) (test-integer-value val)))
Theorem:
(defthm test-integer-value-value-equiv-congruence-on-val (implies (value-equiv val val-equiv) (equal (test-integer-value val) (test-integer-value val-equiv))) :rule-classes :congruence)