Transform a function definition.
(specialize-fundef fundef target-fn target-param const) → (mv found new-fundef)
Function:
(defun specialize-fundef (fundef target-fn target-param const) (declare (xargs :guard (and (fundefp fundef) (identp target-fn) (identp target-param) (exprp const)))) (let ((__function__ 'specialize-fundef)) (declare (ignorable __function__)) (b* (((fundef fundef) fundef) ((declor fundef.declor) fundef.declor)) (stmt-case fundef.body :compound (dirdeclor-case fundef.declor.direct :function-params (b* (((unless (equal target-fn (dirdeclor-get-ident fundef.declor.direct.decl))) (mv nil (fundef-fix fundef))) ((mv success new-params removed-param) (paramdecl-list-remove-param-by-ident fundef.declor.direct.params target-param)) ((unless success) (prog2$ (raise "Function ~x0 did not have a parameter ~x1" target-fn target-param) (mv nil (fundef-fix fundef)))) (dirdeclor-params (make-dirdeclor-function-params :decl fundef.declor.direct.decl :params new-params :ellipsis fundef.declor.direct.ellipsis)) ((mv - decl) (paramdecl-to-decl removed-param (initer-single const)))) (mv t (make-fundef :extension fundef.extension :spec fundef.spec :declor (make-declor :pointers fundef.declor.pointers :direct dirdeclor-params) :decls fundef.decls :body (stmt-compound (cons (block-item-decl decl) fundef.body.items))))) :otherwise (mv nil (fundef-fix fundef))) :otherwise (prog2$ (raise "Function definition body is not a compound statement.") (mv nil (fundef-fix fundef)))))))
Theorem:
(defthm booleanp-of-specialize-fundef.found (b* (((mv ?found ?new-fundef) (specialize-fundef fundef target-fn target-param const))) (booleanp found)) :rule-classes :rewrite)
Theorem:
(defthm fundefp-of-specialize-fundef.new-fundef (b* (((mv ?found ?new-fundef) (specialize-fundef fundef target-fn target-param const))) (fundefp new-fundef)) :rule-classes :rewrite)