Transform a function definition.
The variable-type map resulting from
the transformation of the function declarator
includes the applicable parameters of the function,
if the function declarator has the
The variable-type map resulting from transforming the body is discarded. We call a separate function, xeq-fundef, to complete the transformation and possibly generate a theorem. That function returns, among other things, a variable-type map that is like the one at the beginning of the function definition (before its declaration specifiers, declarator, etc.), with the addition of the function itself (no addition currently, as explained above, but the code is more general for future extensions).
Function:
(defun simpadd0-fundef (fundef gin) (declare (xargs :guard (and (fundefp fundef) (ginp gin)))) (declare (xargs :guard (and (fundef-unambp fundef) (fundef-annop fundef)))) (let ((__function__ 'simpadd0-fundef)) (declare (ignorable __function__)) (b* (((fundef fundef) fundef) ((mv new-spec (gout gout-spec)) (simpadd0-decl-spec-list fundef.spec gin)) (gin (gin-update gin gout-spec)) ((mv new-declor & (gout gout-declor)) (simpadd0-declor fundef.declor t gin)) (gin (gin-update gin gout-declor)) (type (fundef-info->type fundef.info)) (ident (declor->ident fundef.declor)) (vartys-with-fun (if (and (ident-formalp ident) (type-formalp type) (not (type-case type :void)) (not (type-case type :char))) (b* (((mv & cvar) (ldm-ident ident)) ((mv & ctype) (ldm-type type))) (omap::update cvar ctype gout-declor.vartys)) gout-declor.vartys)) ((mv new-decls (gout gout-decls)) (simpadd0-decl-list fundef.decls (change-gin gin :vartys vartys-with-fun))) (gin (gin-update gin gout-decls)) (vartys-for-body gout-decls.vartys) ((mv new-body (gout gout-body)) (simpadd0-comp-stmt fundef.body (change-gin gin :vartys vartys-for-body))) ((gin gin) (gin-update gin gout-body))) (xeq-fundef fundef.extension fundef.spec new-spec fundef.declor new-declor fundef.asm? fundef.attribs fundef.decls new-decls fundef.body new-body gout-body.thm-name fundef.info gin))))
Theorem:
(defthm fundefp-of-simpadd0-fundef.new-fundef (b* (((mv ?new-fundef ?gout) (simpadd0-fundef fundef gin))) (fundefp new-fundef)) :rule-classes :rewrite)
Theorem:
(defthm goutp-of-simpadd0-fundef.gout (b* (((mv ?new-fundef ?gout) (simpadd0-fundef fundef gin))) (goutp gout)) :rule-classes :rewrite)
Theorem:
(defthm fundef-unambp-of-simpadd0-fundef (b* (((mv ?new-fundef ?gout) (simpadd0-fundef fundef gin))) (fundef-unambp new-fundef)))
Theorem:
(defthm fundef-annop-of-simpadd0-fundef (implies (and (fundef-unambp fundef) (fundef-annop fundef)) (b* (((mv ?new-fundef ?gout) (simpadd0-fundef fundef gin))) (fundef-annop new-fundef))))
Theorem:
(defthm fundef-aidentp-of-simpadd0-fundef (implies (and (fundef-unambp fundef) (fundef-aidentp fundef gcc)) (b* (((mv ?new-fundef ?gout) (simpadd0-fundef fundef gin))) (fundef-aidentp new-fundef gcc))))
Theorem:
(defthm simpadd0-fundef-of-fundef-fix-fundef (equal (simpadd0-fundef (fundef-fix fundef) gin) (simpadd0-fundef fundef gin)))
Theorem:
(defthm simpadd0-fundef-fundef-equiv-congruence-on-fundef (implies (c$::fundef-equiv fundef fundef-equiv) (equal (simpadd0-fundef fundef gin) (simpadd0-fundef fundef-equiv gin))) :rule-classes :congruence)
Theorem:
(defthm simpadd0-fundef-of-gin-fix-gin (equal (simpadd0-fundef fundef (gin-fix gin)) (simpadd0-fundef fundef gin)))
Theorem:
(defthm simpadd0-fundef-gin-equiv-congruence-on-gin (implies (gin-equiv gin gin-equiv) (equal (simpadd0-fundef fundef gin) (simpadd0-fundef fundef gin-equiv))) :rule-classes :congruence)