Extend the lexscopes with a direct import of a single name.
(vl-lexscopes-direct-import-name pkgname name scopes ctx warnings) → (mv scopes warnings)
Function:
(defun vl-lexscopes-direct-import-name (pkgname name scopes ctx warnings) (declare (xargs :guard (and (stringp pkgname) (stringp name) (vl-lexscopes-p scopes) (vl-import-p ctx) (vl-warninglist-p warnings)))) (let ((__function__ 'vl-lexscopes-direct-import-name)) (declare (ignorable __function__)) (b* ((pkgname (string-fix pkgname)) (name (string-fix name)) (scopes (vl-lexscopes-fix scopes)) (ctx (vl-import-fix ctx)) (warnings (vl-warninglist-fix warnings)) ((when (atom scopes)) (raise "Expected at least one scope.") (mv scopes warnings)) (scope1 (car scopes)) (entry (vl-lexscope-find name scope1)) ((unless entry) (mv (cons (hons-acons name (make-vl-lexscope-entry :direct-pkg pkgname :decl nil :wildpkgs nil) scope1) (cdr scopes)) warnings)) ((vl-lexscope-entry entry)) (warnings (if entry.decl (fatal :type :vl-name-clash :msg "~a0: can't import ~s1 after locally declaring it (~a2)." :args (list ctx name entry.decl)) warnings)) (warnings (if (and entry.direct-pkg (not (equal entry.direct-pkg pkgname))) (fatal :type :vl-name-clash :msg "~a0: can't import ~s1 from ~s2 after previously importing ~ it from ~s3." :args (list ctx name pkgname entry.direct-pkg)) warnings)) (new-entry (if (or entry.decl entry.direct-pkg) entry (change-vl-lexscope-entry entry :direct-pkg pkgname))) (new-scope1 (hons-acons name new-entry scope1)) (new-scopes (cons new-scope1 (cdr scopes)))) (mv new-scopes warnings))))
Theorem:
(defthm vl-lexscopes-p-of-vl-lexscopes-direct-import-name.scopes (b* (((mv ?scopes ?warnings) (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings))) (vl-lexscopes-p scopes)) :rule-classes :rewrite)
Theorem:
(defthm vl-warninglist-p-of-vl-lexscopes-direct-import-name.warnings (b* (((mv ?scopes ?warnings) (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-lexscopes-direct-import-name-of-str-fix-pkgname (equal (vl-lexscopes-direct-import-name (str-fix pkgname) name scopes ctx warnings) (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings)))
Theorem:
(defthm vl-lexscopes-direct-import-name-streqv-congruence-on-pkgname (implies (streqv pkgname pkgname-equiv) (equal (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings) (vl-lexscopes-direct-import-name pkgname-equiv name scopes ctx warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-lexscopes-direct-import-name-of-str-fix-name (equal (vl-lexscopes-direct-import-name pkgname (str-fix name) scopes ctx warnings) (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings)))
Theorem:
(defthm vl-lexscopes-direct-import-name-streqv-congruence-on-name (implies (streqv name name-equiv) (equal (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings) (vl-lexscopes-direct-import-name pkgname name-equiv scopes ctx warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-lexscopes-direct-import-name-of-vl-lexscopes-fix-scopes (equal (vl-lexscopes-direct-import-name pkgname name (vl-lexscopes-fix scopes) ctx warnings) (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings)))
Theorem:
(defthm vl-lexscopes-direct-import-name-vl-lexscopes-equiv-congruence-on-scopes (implies (vl-lexscopes-equiv scopes scopes-equiv) (equal (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings) (vl-lexscopes-direct-import-name pkgname name scopes-equiv ctx warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-lexscopes-direct-import-name-of-vl-import-fix-ctx (equal (vl-lexscopes-direct-import-name pkgname name scopes (vl-import-fix ctx) warnings) (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings)))
Theorem:
(defthm vl-lexscopes-direct-import-name-vl-import-equiv-congruence-on-ctx (implies (vl-import-equiv ctx ctx-equiv) (equal (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings) (vl-lexscopes-direct-import-name pkgname name scopes ctx-equiv warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-lexscopes-direct-import-name-of-vl-warninglist-fix-warnings (equal (vl-lexscopes-direct-import-name pkgname name scopes ctx (vl-warninglist-fix warnings)) (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings)))
Theorem:
(defthm vl-lexscopes-direct-import-name-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings) (vl-lexscopes-direct-import-name pkgname name scopes ctx warnings-equiv))) :rule-classes :congruence)