Functions and rules for prog2$ and other macros implemented with return-last.
Summary. The theory named
The ACL2 system makes use of many special macros that are implemented using
an operator, return-last, that provides special behavior in the
underlying Lisp implementation. These include prog2$, time$,
mbe, and several others. Evaluate the form
ACL2 !>(table return-last-table) ((TIME$1-RAW . TIME$1) ; time$ (WITH-PROVER-TIME-LIMIT1-RAW . WITH-PROVER-TIME-LIMIT1) ; with-prover-time-limit (WITH-FAST-ALIST-RAW . WITH-FAST-ALIST) ; with-fast-alist (WITH-STOLEN-ALIST-RAW . WITH-STOLEN-ALIST) ; with-stolen-alist (FAST-ALIST-FREE-ON-EXIT-RAW . FAST-ALIST-FREE-ON-EXIT) ; fast-alist-free-on-exit (PROGN . PROG2$) ; prog2$ (MBE1-RAW . MBE1) ; mbe (EC-CALL1-RAW . EC-CALL1) ; ec-call (WITH-GUARD-CHECKING1-RAW . WITH-GUARD-CHECKING1)) ; with-guard-checking ACL2 !>
For each such operator
The theory named
Return-last is in a class of operators, ACL2::guard-holders,
whose calls are typically expanded before a rule or a ``ACL2::normalized'' definition body is stored. This can be unfortunate for
simplification if one intends to preserve the special behavior afforded by the
operator, such as prog2$ or time$, that generated that use of
ACL2 !>(defun foo (n) (time$ (reverse (make-list n)))) [[.. output elided ..]] FOO ACL2 !>(simplify foo) ; Notice that the time$ call has been eliminated! (DEFUN FOO$1 (N) (DECLARE (XARGS :GUARD T :VERIFY-GUARDS NIL)) (REPEAT N NIL)) (DEFTHM FOO-BECOMES-FOO$1 (EQUAL (FOO N) (FOO$1 N))) ACL2 !>:u ; Undo and try again, this time to preserve the time$ call. L 3:x(DEFUN FOO (N) ...) ACL2 !>(simplify foo ; Disable time$-fn to preserve the time$ call. It might be good to disabled ; associated runes (:e time$-fn) and (:t time$-fn) as well, but in this case, ; at least, that wasn't necessary. :disable (time$-fn)) (DEFUN FOO$1 (N) (DECLARE (XARGS :GUARD T :VERIFY-GUARDS NIL)) (TIME$ (REPEAT N NIL))) (DEFTHM FOO-BECOMES-FOO$1 (EQUAL (FOO N) (FOO$1 N))) ACL2 !>