Automatically define necessary redundant definitions from after a specified event
When local include-book forms are used in support of
definitions and theorems, the resulting book or encapsulate event may
be ill-formed because of missing definitions. The macro,
See with-supporters for a related utility. (However,
General form:
(with-supporters-after name event-1 ... event-k)
where
(encapsulate () EXTRA event-1 ... event-k)
where
(in-package "ACL2") (include-book "tools/with-supporters" :dir :system) (deflabel my-label) (local (include-book "std/lists/duplicity" :dir :system)) (with-supporters-after my-label (defthm duplicity-append (equal (duplicity a (append x y)) (+ (duplicity a x) (duplicity a y)))))
The form above is equivalent to the following. Again, see with-supporters for relevant background.
(PROGN (SET-ENFORCE-REDUNDANCY T) (SET-BOGUS-DEFUN-HINTS-OK T) (SET-BOGUS-MUTUAL-RECURSION-OK T) (SET-IRRELEVANT-FORMALS-OK T) (SET-IGNORE-OK T) (PROGN (DEFUN DUPLICITY-EXEC (A X N) (DECLARE (XARGS :GUARD (NATP N))) (IF (ATOM X) N (DUPLICITY-EXEC A (CDR X) (IF (EQUAL (CAR X) A) (+ 1 N) N)))) (VERIFY-GUARDS DUPLICITY-EXEC)) (PROGN (DEFUN DUPLICITY (A X) (DECLARE (XARGS :GUARD T :VERIFY-GUARDS NIL)) (MBE :LOGIC (COND ((ATOM X) 0) ((EQUAL (CAR X) A) (+ 1 (DUPLICITY A (CDR X)))) (T (DUPLICITY A (CDR X)))) :EXEC (DUPLICITY-EXEC A X 0))) (VERIFY-GUARDS DUPLICITY)) (IN-THEORY (DISABLE (:DEFINITION DUPLICITY-EXEC) (:INDUCTION DUPLICITY-EXEC) (:DEFINITION DUPLICITY) (:INDUCTION DUPLICITY) (:DEFINITION DUPLICITY-EXEC) (:INDUCTION DUPLICITY-EXEC) (:DEFINITION DUPLICITY) (:INDUCTION DUPLICITY) (:DEFINITION DUPLICITY-EXEC) (:INDUCTION DUPLICITY-EXEC))) (SET-ENFORCE-REDUNDANCY NIL) (DEFTHM DUPLICITY-APPEND (EQUAL (DUPLICITY A (APPEND X Y)) (+ (DUPLICITY A X) (DUPLICITY A Y)))))