Generate the new function definition.
(isodata-gen-new-fn old$ arg-isomaps res-isomaps predicate$ undefined$ new$ new-enable$ verify-guards$ untranslate$ compatibility appcond-thm-names wrld) → (mv new-fn-local-event new-fn-exported-event)
The macro used to introduce the new function is determined by
whether the new function must be
enabled or not, and non-executable or not.
We make it non-executable if and only if
The new function has the same formal arguments as the old function.
If the new function is recursive, its well-founded relation is the same as the old function's. The new function uses all ruler extenders, in case the old function's termination depends on any ruler extender.
Guard verification is deferred; see isodata-gen-new-fn-verify-guards.
If the old function returns a multi-value result, we adjust the body of the new function to do the same.
Function:
(defun isodata-gen-new-fn (old$ arg-isomaps res-isomaps predicate$ undefined$ new$ new-enable$ verify-guards$ untranslate$ compatibility appcond-thm-names wrld) (declare (xargs :guard (and (symbolp old$) (isodata-symbol-isomap-alistp arg-isomaps) (isodata-pos-isomap-alistp res-isomaps) (booleanp predicate$) (symbolp new$) (booleanp new-enable$) (booleanp verify-guards$) (untranslate-specifier-p untranslate$) (symbol-symbol-alistp appcond-thm-names) (plist-worldp wrld)))) (let ((__function__ 'isodata-gen-new-fn)) (declare (ignorable __function__)) (b* ((macro (function-intro-macro new-enable$ (non-executablep old$ wrld))) (formals (formals old$ wrld)) (body (isodata-gen-new-fn-body old$ arg-isomaps res-isomaps predicate$ undefined$ new$ compatibility wrld)) (body (if (> (number-of-results old$ wrld) 1) (mvify body) body)) (body (case untranslate$ (:nice (directed-untranslate (ibody old$ wrld) (ubody old$ wrld) body nil nil wrld)) (:nice-expanded (directed-untranslate-no-lets (ibody old$ wrld) (ubody old$ wrld) body nil nil wrld)) ((nil) body) (t (untranslate body nil wrld)))) (guard (isodata-gen-new-fn-guard old$ arg-isomaps predicate$ wrld)) (guard (conjoin (flatten-ands-in-lit guard))) (guard (untranslate guard nil wrld)) (recursive (recursivep old$ nil wrld)) (wfrel? (if recursive (well-founded-relation old$ wrld) nil)) (measure? (if recursive (isodata-gen-new-fn-measure old$ arg-isomaps wrld) nil)) (termination-hints? (if recursive (isodata-gen-new-fn-termination-hints appcond-thm-names old$ arg-isomaps wrld) nil)) (local-event (cons 'local (cons (cons macro (cons new$ (cons formals (cons (cons 'declare (cons (cons 'xargs (append (and recursive (list :well-founded-relation wfrel? :measure measure? :hints termination-hints? :ruler-extenders :all)) (cons ':guard (cons guard '(:verify-guards nil))))) 'nil)) (cons body 'nil))))) 'nil))) (exported-event (cons macro (cons new$ (cons formals (cons (cons 'declare (cons (cons 'xargs (append (and recursive (list :well-founded-relation wfrel? :measure measure? :ruler-extenders :all)) (cons ':guard (cons guard (cons ':verify-guards (cons verify-guards$ 'nil)))))) 'nil)) (cons body 'nil))))))) (mv local-event exported-event))))