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