Safely try to give these vardecls new names of the form
(vl-namemangle-vardecls prefix vardecls nf) → (mv new-vars new-nf)
You'll generally want to do something like:
(pairlis$ (vl-vardecllist->names old-vardecls) (vl-vardecllist->names renamed-vardecls))
And then use this as a substitution.
Function:
(defun vl-namemangle-vardecls (prefix vardecls nf) (declare (xargs :guard (and (stringp prefix) (vl-vardecllist-p vardecls) (vl-namefactory-p nf)))) (let ((__function__ 'vl-namemangle-vardecls)) (declare (ignorable __function__)) (b* (((when (atom vardecls)) (mv nil (vl-namefactory-fix nf))) (name1 (vl-vardecl->name (car vardecls))) (want1 (cat prefix "_" name1)) ((mv fresh1 nf) (vl-namefactory-plain-name want1 nf)) (inst1 (change-vl-vardecl (car vardecls) :name fresh1)) ((mv insts2 nf) (vl-namemangle-vardecls prefix (cdr vardecls) nf))) (mv (cons inst1 insts2) nf))))
Theorem:
(defthm vl-vardecllist-p-of-vl-namemangle-vardecls.new-vars (b* (((mv ?new-vars ?new-nf) (vl-namemangle-vardecls prefix vardecls nf))) (vl-vardecllist-p new-vars)) :rule-classes :rewrite)
Theorem:
(defthm vl-namefactory-p-of-vl-namemangle-vardecls.new-nf (b* (((mv ?new-vars ?new-nf) (vl-namemangle-vardecls prefix vardecls nf))) (vl-namefactory-p new-nf)) :rule-classes :rewrite)
Theorem:
(defthm vl-namemangle-vardecls-mvtypes-0 (true-listp (mv-nth 0 (vl-namemangle-vardecls prefix vardecls nf))) :rule-classes :type-prescription)
Theorem:
(defthm len-of-vl-namemangle-vardecls (b* (((mv new-vardecls ?new-nf) (vl-namemangle-vardecls loc vardecls nf))) (equal (len new-vardecls) (len vardecls))))
Theorem:
(defthm vl-namemangle-vardecls-of-str-fix-prefix (equal (vl-namemangle-vardecls (str-fix prefix) vardecls nf) (vl-namemangle-vardecls prefix vardecls nf)))
Theorem:
(defthm vl-namemangle-vardecls-streqv-congruence-on-prefix (implies (streqv prefix prefix-equiv) (equal (vl-namemangle-vardecls prefix vardecls nf) (vl-namemangle-vardecls prefix-equiv vardecls nf))) :rule-classes :congruence)
Theorem:
(defthm vl-namemangle-vardecls-of-vl-vardecllist-fix-vardecls (equal (vl-namemangle-vardecls prefix (vl-vardecllist-fix vardecls) nf) (vl-namemangle-vardecls prefix vardecls nf)))
Theorem:
(defthm vl-namemangle-vardecls-vl-vardecllist-equiv-congruence-on-vardecls (implies (vl-vardecllist-equiv vardecls vardecls-equiv) (equal (vl-namemangle-vardecls prefix vardecls nf) (vl-namemangle-vardecls prefix vardecls-equiv nf))) :rule-classes :congruence)
Theorem:
(defthm vl-namemangle-vardecls-of-vl-namefactory-fix-nf (equal (vl-namemangle-vardecls prefix vardecls (vl-namefactory-fix nf)) (vl-namemangle-vardecls prefix vardecls nf)))
Theorem:
(defthm vl-namemangle-vardecls-vl-namefactory-equiv-congruence-on-nf (implies (vl-namefactory-equiv nf nf-equiv) (equal (vl-namemangle-vardecls prefix vardecls nf) (vl-namemangle-vardecls prefix vardecls nf-equiv))) :rule-classes :congruence)