Recognizer for pointer.
Since our pointers are opaque, we introduce their recognizer as a constrained function.
We constrain the recognizer to return a boolean. We also indirectly constrain it to hold over an infinite number of values, by simultaneously introducing a constrained function that, given any list as input, returns a pointer that is not in the list. The list may include non-ponters, which are ignored.
This new-pointer function implies the infinity of pointers because
starting from the empty list
The
We use natural numbers as witnesses for pointers. The new-pointer function returns a natural number larger than all the ones that occur in the argument list.
Definition:
(encapsulate (((pointerp *) => *) ((new-pointer-raw *) => *)) (local (value-triple :elided)) (defrule booleanp-of-pointerp (booleanp (pointerp x)) :rule-classes (:rewrite :type-prescription)) (local (value-triple :elided)) (defrule pointerp-of-new-pointer-raw (pointerp (new-pointer-raw list))) (defrule new-pointer-raw-is-new (not (member-equal (new-pointer-raw list) list)) :use (:instance lemma (elem (new-pointer-raw list))) :prep-lemmas ((defruled lemma (implies (and (natp elem) (member-equal elem list)) (> (new-pointer-raw list) elem))))))
Theorem:
(defthm booleanp-of-pointerp (booleanp (pointerp x)) :rule-classes (:rewrite :type-prescription))
Theorem:
(defthm pointerp-of-new-pointer-raw (pointerp (new-pointer-raw list)))
Theorem:
(defthm new-pointer-raw-is-new (not (member-equal (new-pointer-raw list) list)))