Compute the final parameter values for a static class scope invocation
(vl-unparam-class x elabindex ledger warnings &key (config 'config)) → (mv successp warnings new-classname instkey new-elabindex ledger)
Function:
(defun vl-unparam-class-fn (x elabindex ledger warnings config) (declare (xargs :stobjs (elabindex))) (declare (xargs :guard (and (classname/params-p x) (vl-unparam-ledger-p ledger) (vl-warninglist-p warnings) (vl-simpconfig-p config)))) (let ((__function__ 'vl-unparam-class)) (declare (ignorable __function__)) (b* ((ss (vl-elabindex->ss)) ((vl-simpconfig config)) ((classname/params x) (classname/params-fix x)) (ledger (vl-unparam-ledger-fix ledger)) (elabindex (vl-elabindex-sync-scopes)) (scopes (vl-elabindex->scopes)) ((mv class class-ss) (vl-scopestack-find-definition/ss x.name ss)) ((unless (and class (eq (tag class) :vl-class))) (vl-unparam-debug "Can't find class ~a0.~%" x.name) (mv nil (fatal :type :vl-programming-error :msg "Trying to unparameterize class ~a0 which isn't actually a class." :args (list x.name)) "" nil elabindex ledger)) (warnings (vl-warninglist-fix warnings)) ((wmv ok warnings x.params elabindex) (vl-maybe-paramargs-elaborate x.params elabindex :reclimit 100)) ((unless ok) (mv nil warnings "" nil elabindex ledger)) ((vl-class class)) (elabindex (vl-elabindex-traverse class-ss (list (vl-elabinstruction-root)))) (elabindex (if (or (not x.params) (vl-paramargs-empty-p x.params)) elabindex (b* ((scopes (vl-elabscopes-update-subscope (vl-elabkey-class x.name) (make-vl-elabscope) (vl-elabindex->scopes)))) (vl-elabindex-update-scopes scopes)))) (elabindex (vl-elabindex-push class)) ((mv ok scope-warnings elabindex final-paramdecls) (vl-scope-finalize-params class.paramdecls (or x.params (vl-paramargs-plain nil)) nil elabindex ss (rev (vl-elabscopes->elabtraversal scopes)))) (warnings (append-without-guard scope-warnings (vl-warninglist-fix warnings))) (inside-class-ss (vl-elabindex->ss)) (elabindex (vl-elabindex-undo)) ((unless ok) (vl-unparam-debug "~a0: failed to finalize params~%" x.name) (b* ((elabindex (vl-elabindex-undo))) (mv nil warnings "" nil elabindex ledger))) ((mv instkey ledger) (vl-unparam-add-to-ledger x.name final-paramdecls nil nil ledger ss inside-class-ss)) ((vl-unparam-signature sig) (cdr (hons-get instkey (vl-unparam-ledger->instkeymap ledger)))) (scopes (vl-elabindex->scopes)) (class-scope (vl-elabscopes-subscope (vl-elabkey-class x.name) (vl-elabindex->scopes))) (scopes (b* (((unless class-scope) scopes) (scopes (vl-elabscopes-update-subscope (vl-elabkey-class x.name) (make-vl-elabscope) scopes))) (vl-elabscopes-update-subscope (vl-elabkey-class sig.newname) class-scope scopes))) (elabindex (vl-elabindex-update-scopes scopes elabindex)) (elabindex (vl-elabindex-undo))) (mv t warnings sig.newname instkey elabindex ledger))))
Theorem:
(defthm booleanp-of-vl-unparam-class.successp (b* (((mv ?successp ?warnings ?new-classname ?instkey ?new-elabindex ?ledger) (vl-unparam-class-fn x elabindex ledger warnings config))) (booleanp successp)) :rule-classes :type-prescription)
Theorem:
(defthm vl-warninglist-p-of-vl-unparam-class.warnings (b* (((mv ?successp ?warnings ?new-classname ?instkey ?new-elabindex ?ledger) (vl-unparam-class-fn x elabindex ledger warnings config))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm stringp-of-vl-unparam-class.new-classname (b* (((mv ?successp ?warnings ?new-classname ?instkey ?new-elabindex ?ledger) (vl-unparam-class-fn x elabindex ledger warnings config))) (stringp new-classname)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-unparam-class.instkey (b* (((mv ?successp ?warnings ?new-classname ?instkey ?new-elabindex ?ledger) (vl-unparam-class-fn x elabindex ledger warnings config))) (implies successp (vl-unparam-instkey-p instkey))) :rule-classes :rewrite)
Theorem:
(defthm vl-unparam-ledger-p-of-vl-unparam-class.ledger (b* (((mv ?successp ?warnings ?new-classname ?instkey ?new-elabindex ?ledger) (vl-unparam-class-fn x elabindex ledger warnings config))) (vl-unparam-ledger-p ledger)) :rule-classes :rewrite)
Theorem:
(defthm vl-unparam-class-fn-of-classname/params-fix-x (equal (vl-unparam-class-fn (classname/params-fix x) elabindex ledger warnings config) (vl-unparam-class-fn x elabindex ledger warnings config)))
Theorem:
(defthm vl-unparam-class-fn-classname/params-equiv-congruence-on-x (implies (classname/params-equiv x x-equiv) (equal (vl-unparam-class-fn x elabindex ledger warnings config) (vl-unparam-class-fn x-equiv elabindex ledger warnings config))) :rule-classes :congruence)
Theorem:
(defthm vl-unparam-class-fn-of-vl-unparam-ledger-fix-ledger (equal (vl-unparam-class-fn x elabindex (vl-unparam-ledger-fix ledger) warnings config) (vl-unparam-class-fn x elabindex ledger warnings config)))
Theorem:
(defthm vl-unparam-class-fn-vl-unparam-ledger-equiv-congruence-on-ledger (implies (vl-unparam-ledger-equiv ledger ledger-equiv) (equal (vl-unparam-class-fn x elabindex ledger warnings config) (vl-unparam-class-fn x elabindex ledger-equiv warnings config))) :rule-classes :congruence)
Theorem:
(defthm vl-unparam-class-fn-of-vl-warninglist-fix-warnings (equal (vl-unparam-class-fn x elabindex ledger (vl-warninglist-fix warnings) config) (vl-unparam-class-fn x elabindex ledger warnings config)))
Theorem:
(defthm vl-unparam-class-fn-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-unparam-class-fn x elabindex ledger warnings config) (vl-unparam-class-fn x elabindex ledger warnings-equiv config))) :rule-classes :congruence)
Theorem:
(defthm vl-unparam-class-fn-of-vl-simpconfig-fix-config (equal (vl-unparam-class-fn x elabindex ledger warnings (vl-simpconfig-fix config)) (vl-unparam-class-fn x elabindex ledger warnings config)))
Theorem:
(defthm vl-unparam-class-fn-vl-simpconfig-equiv-congruence-on-config (implies (vl-simpconfig-equiv config config-equiv) (equal (vl-unparam-class-fn x elabindex ledger warnings config) (vl-unparam-class-fn x elabindex ledger warnings config-equiv))) :rule-classes :congruence)