The defuns created by the
Consider the event shown in stobj-example-1:
(defstobj counters (NodeCnt :type integer :initially 0) (TipCnt :type integer :initially 0) (IntTipsSeen :type t :initially nil))
Here is a complete list of the defuns added by the event.
The careful reader will note that the
(defun NodeCntp (x) ;;; Recognizer for 1st field (declare (xargs :guard t :verify-guards t)) (integerp x)) (defun TipCntp (x) ;;; Recognizer for 2nd field (declare (xargs :guard t :verify-guards t)) (integerp x)) (defun IntTipsSeenp (x) ;;; Recognizer for 3rd field (declare (xargs :guard t :verify-guards t) (ignore x)) t) (defun countersp (counters) ;;; Recognizer for object (declare (xargs :guard t :verify-guards t)) (and (true-listp counters) (= (length counters) 3) (NodeCntp (nth 0 counters)) (TipCntp (nth 1 counters)) (IntTipsSeenp (nth 2 counters)) t)) (defun create-counters () ;;; Creator for object (declare (xargs :guard t :verify-guards t)) (list '0 '0 'nil)) (defun NodeCnt (counters) ;;; Accessor for 1st field (declare (xargs :guard (countersp counters) :verify-guards t)) (nth 0 counters)) (defun update-NodeCnt (v counters) ;;; Updater for 1st field (declare (xargs :guard (and (integerp v) (countersp counters)) :verify-guards t)) (update-nth 0 v counters)) (defun TipCnt (counters) ;;; Accessor for 2nd field (declare (xargs :guard (countersp counters) :verify-guards t)) (nth 1 counters)) (defun update-TipCnt (v counters) ;;; Updater for 2nd field (declare (xargs :guard (and (integerp v) (countersp counters)) :verify-guards t)) (update-nth 1 v counters)) (defun IntTipsSeen (counters) ;;; Accessor for 3rd field (declare (xargs :guard (countersp counters) :verify-guards t)) (nth 2 counters)) (defun update-IntTipsSeen (v counters) ;;; Updater for 3rd field (declare (xargs :guard (countersp counters) :verify-guards t)) (update-nth 2 v counters))
Observe that there is a recognizer for each of the three fields and then a
recognizer for the
Observe also that the functions are guarded so that they expect a
You can see all of the
ACL2 !>:pcb! counters
will print the defuns above.
We now clear up the ``mystery'' mentioned above. Note, for example in
The explanation of this mystery is as follows. At the time
You may return to stobj-example-1 here.