Extend the lexscopes with a package import.
(vl-lexscopes-do-import x scopes warnings design) → (mv scopes warnings)
Function:
(defun vl-lexscopes-do-import (x scopes warnings design) (declare (xargs :guard (and (vl-import-p x) (vl-lexscopes-p scopes) (vl-warninglist-p warnings) (vl-design-p design)))) (let ((__function__ 'vl-lexscopes-do-import)) (declare (ignorable __function__)) (b* (((vl-import x) (vl-import-fix x)) (scopes (vl-lexscopes-fix scopes)) (warnings (vl-warninglist-fix warnings)) ((when (atom scopes)) (raise "Expected at least one scope.") (mv scopes warnings)) (pkg (vl-find-package x.pkg (vl-design->packages design))) (warnings (if pkg warnings (fatal :type :vl-bad-import :msg "~a0: trying to import from undefined package ~s1." :args (list x x.pkg)))) (pkg-item-alist (and pkg (vl-package-scope-item-alist-top pkg))) ((unless (eq x.part :vl-import*)) (b* ((item (hons-get x.part pkg-item-alist)) (warnings (if item warnings (fatal :type :vl-bad-import :msg "~a0: no declaration of ~s1 in package ~s2." :args (list x x.part x.pkg))))) (vl-lexscopes-direct-import-name x.pkg x.part scopes x warnings))) ((vl-lexscope scope1) (car scopes)) ((when (hons-assoc-equal x.pkg scope1.wildpkgs)) (mv scopes warnings))) (mv (cons (change-vl-lexscope scope1 :wildpkgs (cons (cons x.pkg pkg-item-alist) scope1.wildpkgs)) (cdr scopes)) warnings))))
Theorem:
(defthm vl-lexscopes-p-of-vl-lexscopes-do-import.scopes (b* (((mv ?scopes ?warnings) (vl-lexscopes-do-import x scopes warnings design))) (vl-lexscopes-p scopes)) :rule-classes :rewrite)
Theorem:
(defthm vl-warninglist-p-of-vl-lexscopes-do-import.warnings (b* (((mv ?scopes ?warnings) (vl-lexscopes-do-import x scopes warnings design))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-lexscopes-do-import-of-vl-import-fix-x (equal (vl-lexscopes-do-import (vl-import-fix x) scopes warnings design) (vl-lexscopes-do-import x scopes warnings design)))
Theorem:
(defthm vl-lexscopes-do-import-vl-import-equiv-congruence-on-x (implies (vl-import-equiv x x-equiv) (equal (vl-lexscopes-do-import x scopes warnings design) (vl-lexscopes-do-import x-equiv scopes warnings design))) :rule-classes :congruence)
Theorem:
(defthm vl-lexscopes-do-import-of-vl-lexscopes-fix-scopes (equal (vl-lexscopes-do-import x (vl-lexscopes-fix scopes) warnings design) (vl-lexscopes-do-import x scopes warnings design)))
Theorem:
(defthm vl-lexscopes-do-import-vl-lexscopes-equiv-congruence-on-scopes (implies (vl-lexscopes-equiv scopes scopes-equiv) (equal (vl-lexscopes-do-import x scopes warnings design) (vl-lexscopes-do-import x scopes-equiv warnings design))) :rule-classes :congruence)
Theorem:
(defthm vl-lexscopes-do-import-of-vl-warninglist-fix-warnings (equal (vl-lexscopes-do-import x scopes (vl-warninglist-fix warnings) design) (vl-lexscopes-do-import x scopes warnings design)))
Theorem:
(defthm vl-lexscopes-do-import-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-lexscopes-do-import x scopes warnings design) (vl-lexscopes-do-import x scopes warnings-equiv design))) :rule-classes :congruence)
Theorem:
(defthm vl-lexscopes-do-import-of-vl-design-fix-design (equal (vl-lexscopes-do-import x scopes warnings (vl-design-fix design)) (vl-lexscopes-do-import x scopes warnings design)))
Theorem:
(defthm vl-lexscopes-do-import-vl-design-equiv-congruence-on-design (implies (vl-design-equiv design design-equiv) (equal (vl-lexscopes-do-import x scopes warnings design) (vl-lexscopes-do-import x scopes warnings design-equiv))) :rule-classes :congruence)