Resolve parameters in packages.
(vl-package-elaborate x elabindex warnings &key (config 'config)) → (mv ok warnings1 new-elabindex new-x)
Assumption: packages reference each other only in reverse parse order, i.e., later-defined packages can reference parameters inside earlier-defined packages. This gets around some horrible complications in implementation. We still have to do some convoluted stuff with scopestacks.
Function:
(defun vl-package-elaborate-fn (x elabindex warnings config) (declare (xargs :stobjs (elabindex))) (declare (xargs :guard (and (vl-package-p x) (vl-warninglist-p warnings) (vl-simpconfig-p config)))) (let ((__function__ 'vl-package-elaborate)) (declare (ignorable __function__)) (b* ((x (vl-package-fix x)) (warnings (vl-warninglist-fix warnings)) (elabindex (vl-elabindex-push x)) ((wmv ok warnings new-x elabindex) (vl-package-elaborate-aux x elabindex :reclimit (vl-simpconfig->elab-limit config))) (elabindex (vl-elabindex-undo))) (mv ok warnings elabindex new-x))))
Theorem:
(defthm vl-warninglist-p-of-vl-package-elaborate.warnings1 (b* (((mv ?ok ?warnings1 ?new-elabindex ?new-x) (vl-package-elaborate-fn x elabindex warnings config))) (vl-warninglist-p warnings1)) :rule-classes :rewrite)
Theorem:
(defthm vl-package-p-of-vl-package-elaborate.new-x (b* (((mv ?ok ?warnings1 ?new-elabindex ?new-x) (vl-package-elaborate-fn x elabindex warnings config))) (vl-package-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm vl-package-elaborate-fn-of-vl-package-fix-x (equal (vl-package-elaborate-fn (vl-package-fix x) elabindex warnings config) (vl-package-elaborate-fn x elabindex warnings config)))
Theorem:
(defthm vl-package-elaborate-fn-vl-package-equiv-congruence-on-x (implies (vl-package-equiv x x-equiv) (equal (vl-package-elaborate-fn x elabindex warnings config) (vl-package-elaborate-fn x-equiv elabindex warnings config))) :rule-classes :congruence)
Theorem:
(defthm vl-package-elaborate-fn-of-vl-warninglist-fix-warnings (equal (vl-package-elaborate-fn x elabindex (vl-warninglist-fix warnings) config) (vl-package-elaborate-fn x elabindex warnings config)))
Theorem:
(defthm vl-package-elaborate-fn-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-package-elaborate-fn x elabindex warnings config) (vl-package-elaborate-fn x elabindex warnings-equiv config))) :rule-classes :congruence)
Theorem:
(defthm vl-package-elaborate-fn-of-vl-simpconfig-fix-config (equal (vl-package-elaborate-fn x elabindex warnings (vl-simpconfig-fix config)) (vl-package-elaborate-fn x elabindex warnings config)))
Theorem:
(defthm vl-package-elaborate-fn-vl-simpconfig-equiv-congruence-on-config (implies (vl-simpconfig-equiv config config-equiv) (equal (vl-package-elaborate-fn x elabindex warnings config) (vl-package-elaborate-fn x elabindex warnings config-equiv))) :rule-classes :congruence)