giving hints to defun
Parent topic: MISCELLANEOUS Home
Common Lisp's defun
function does not easily allow one to pass extra
arguments such as ``hints''. ACL2 therefore supports a peculiar new
declaration (see declare) designed explicitly for passing
additional arguments to defun
via a keyword-like syntax.
The following declaration is nonsensical but does illustrate all of
the xargs
keywords:
(declare (xargs :guard (symbolp x) :measure (- i j) :well-founded-relation my-wfr :hints (("Goal" :in-theory (theory batch1))) :guard-hints (("Goal" :in-theory (theory batch1))) :mode :logic :verify-guards t :otf-flg t))where the keywords and their respective values are as shown below. Note that once ``inside'' the xargs form, the ``extra arguments'' toGeneral Form: (xargs :key1 val1 ... :keyn valn)
defun
are passed exactly as though they were keyword arguments.
:
GUARD
Value
is a term involving only the formals of the function being
defined. The actual guard used for the definition is the
conjunction of all the guards and types (see declare) declared.
:GUARD-HINTS
Value
: hints (see hints), to be used during the guard
verification proofs as opposed to the termination proofs of the
defun
.
:MEASURE
Value
is a term involving only the formals of the function being
defined. This term is indicates what is getting smaller in the
recursion. The well-founded relation with which successive measures
are compared is e0-ord-<
.
:
WELL-FOUNDED-RELATION
Value
is a function symbol that is known to be a well-founded
relation in the sense that a rule of class :
well-founded-relation
has been proved about it. See well-founded-relation.
:
HINTS
Value: hints (see hints), to be used during the termination
proofs as opposed to the guard verification proofs of the defun
.
:MODE
Value
is :
program
or :
logic
, indicating the defun
mode of the
function introduced. See defun-mode. If unspecified, the
defun
mode defaults to the default defun
mode of the current world.
To convert a function from :
program
mode to :
logic
mode,
see verify-termination.
:
VERIFY-GUARDS
Value
is t
or nil
, indicating whether or not guards are to be
verified upon completion of the termination proof. This flag should
only be t
if the :mode
is unspecified but the default defun
mode is
:
logic
, or else the :mode
is :
logic
.
:
OTF-FLG
Value is a flag indicating ``onward through the fog''
(see otf-flg).