Generate the theorem that relates the old and new functions.
(restrict-gen-old-to-new old restriction new new-body old-to-new old-to-new-enable appcond-thm-names stub? old-unnorm new-unnorm wrld) → (mv local-event exported-event)
The macro used to introduce the theorem is determined by whether the theorem must be enabled or not.
The formula of the theorem equates old and new functions under the restricting predicate, as described in the documentation.
If the old and new functions are not recursive, then, following the design notes, the theorem is proved in the theory consisting of the non-normalized definitions of the functions.
If the old and new functions are recursive,
then, following the design notes, the theorem is proved
by induction on the old function,
utilizing the non-normalized definitions of the functions
and the applicability condition.
We have seen at least one case in which a definition was not expanded,
presumably due to some ACL2 heuristics.
Using
Function:
(defun restrict-gen-old-to-new (old restriction new new-body old-to-new old-to-new-enable appcond-thm-names stub? old-unnorm new-unnorm wrld) (declare (xargs :guard (and (symbolp old) (pseudo-termp restriction) (symbolp new) (pseudo-termp new-body) (symbolp old-to-new) (booleanp old-to-new-enable) (symbol-symbol-alistp appcond-thm-names) (symbolp stub?) (symbolp old-unnorm) (symbolp new-unnorm) (plist-worldp wrld)))) (let ((__function__ 'restrict-gen-old-to-new)) (declare (ignorable __function__)) (b* ((formals (formals old wrld)) (formula (implicate restriction (cons 'equal (cons (cons old formals) (cons (cons new formals) 'nil))))) (formula (untranslate formula t wrld)) (recursive (recursivep old nil wrld))) (if recursive (b* ((lemma-name (cdr (assoc-eq :restriction-of-rec-calls appcond-thm-names))) (lemma-instance (if stub? (cons ':functional-instance (cons lemma-name (cons (cons stub? (cons new 'nil)) 'nil))) lemma-name)) (instructions (cons (cons 'in-theory (cons (cons 'enable (cons (cons ':induction (cons old 'nil)) 'nil)) 'nil)) (cons (cons 'then (cons (cons 'induct (cons (cons old formals) 'nil)) (cons (cons 'do-all (cons (cons 'claim (cons (cons 'equal (cons (cons old formals) (cons (ubody old wrld) 'nil))) (cons ':hints (cons (cons (cons '"Goal" (cons ':in-theory (cons (cons 'quote (cons (cons old-unnorm 'nil) 'nil)) (cons ':expand (cons (cons (cons old formals) 'nil) 'nil))))) 'nil) 'nil)))) (cons (cons 'claim (cons (cons 'equal (cons (cons new formals) (cons new-body 'nil))) (cons ':hints (cons (cons (cons '"Goal" (cons ':in-theory (cons (cons 'quote (cons (cons new-unnorm 'nil) 'nil)) (cons ':expand (cons (cons (cons new formals) 'nil) 'nil))))) 'nil) 'nil)))) (cons (cons 'prove (cons ':hints (cons (cons (cons '"Goal" (cons ':in-theory (cons (cons 'quote (cons (cons old-unnorm (cons new-unnorm 'nil)) 'nil)) (cons ':use (cons lemma-instance 'nil))))) 'nil) 'nil))) 'nil)))) 'nil))) 'nil)))) (evmac-generate-defthm old-to-new :formula formula :instructions instructions :enable old-to-new-enable)) (b* ((hints (cons (cons '"Goal" (cons ':in-theory (cons (cons 'quote (cons (cons old-unnorm (cons new-unnorm 'nil)) 'nil)) 'nil))) 'nil))) (evmac-generate-defthm old-to-new :formula formula :hints hints :enable old-to-new-enable))))))