Enforcement of logically unnecessary restrictions on
When a form is submitted to the ACL2's read-eval-print loop the
terms in it are translated (``macroexpanded'') into ACL2's internal form, in
which abbreviations like
But translation also enforces a logically unnecessary restriction in
argument positions of ilk
This is logically unnecessary because, like all ACL2 functions,
But ground
Why would you want to call
Warning: Using an ill-formed
There are two ways to bypass the check. Bypass 1 is to construct the
object in place rather than supply a quoted constant. This can be as simple
as consing a
; Here we show the error that occurs if you use an ill-formed ; LAMBDA object in a :FN slot. ACL2 !>(apply$ '(lambda (t) (cons t t)) '(a)) ACL2 Error in TOP-LEVEL: The second element of a well-formed LAMBDA object or lambda$ term must be a true list of distinct legal variable symbols and (T) is not. See :DOC gratuitous-lambda-object-restrictions for a workaround if you really mean to have an ill-formed LAMBDA-like constant in your code. Note: this error occurred in the context (APPLY$ '(LAMBDA (T) (CONS T T)) '(A)). ; Bypass 1: Cons the ill-formed object together in place. ACL2 !>(apply$ (cons 'lambda '((t) (cons t t))) '(a)) (A . A) ; Bypass 1 (more attractive but perhaps too subtle): Use ; backquote. This looks prettier, indeed, it is almost ; unnoticeable! But it does more eval-time consing. ACL2 !>(apply$ `(lambda (t) (cons t t)) '(a)) (A . A) ; Bypass 2: Use defconst first. No runtime consing. ACL2 !>(defconst *my-ill-formed-lambda* `(lambda (t) (cons t t))) ...output elided... ACL2 !>(apply$ *my-ill-formed-lambda* '(a)) (A . A) ; You can, of course, use these bypasses when defining new ; functions. ACL2 !>(defun foo (x) (apply$ *my-ill-formed-lambda* (list x))) ...successful defun output elided... ; You can then execute the new function, possibly slowly. ACL2 !>(foo 'b) (B . B) ; But you can't warrant the new function because defwarrant ; can't determine the ilks. ACL2 !>(defwarrant foo) ACL2 Error in DEFWARRANT: FOO will not be warranted because a :FN slot in its body is occupied by a quoted cons object, '(LAMBDA (T) (CONS T T)), that is not a well-formed, fully-translated, closed ACL2 lambda object. ... ; Thus, you can't apply$ 'foo either. ACL2 !>(apply$ 'foo '(c)) ACL2 Error in TOP-LEVEL: The value of APPLY$-USERFN is not specified on FOO because FOO has not been warranted.
By the way,