Extend the lexscopes with a local declaration.
(vl-lexscopes-declare-name name decl scopes warnings &key genblockp) → (mv scopes warnings)
Function:
(defun vl-lexscopes-declare-name-fn (name decl scopes warnings genblockp) (declare (xargs :guard (and (stringp name) (any-p decl) (vl-lexscopes-p scopes) (vl-warninglist-p warnings) (booleanp genblockp)))) (let ((__function__ 'vl-lexscopes-declare-name)) (declare (ignorable __function__)) (b* ((name (string-fix name)) (scopes (vl-lexscopes-fix scopes)) (warnings (vl-warninglist-fix warnings)) ((when (atom scopes)) (raise "Expected at least one scope.") (mv scopes warnings)) (scope1 (car scopes)) (decls (vl-lexscope->decls scope1)) (entry (vl-lexscope-find name scope1)) ((unless entry) (mv (cons (change-vl-lexscope scope1 :decls (hons-acons name (make-vl-lexscope-entry :decl decl :direct-pkg nil :wildpkgs nil :genblockp genblockp) decls)) (cdr scopes)) warnings)) ((vl-lexscope-entry entry)) (warnings (if entry.direct-pkg (fatal :type :vl-name-clash :msg "~a0: can't declare ~s1 after importing it from ~s2." :args (list decl name entry.direct-pkg)) (ok))) (new-entry (change-vl-lexscope-entry entry :decl (or entry.decl decl))) (new-scope1 (change-vl-lexscope scope1 :decls (hons-acons name new-entry decls))) (new-scopes (cons new-scope1 (cdr scopes)))) (mv new-scopes warnings))))
Theorem:
(defthm vl-lexscopes-p-of-vl-lexscopes-declare-name.scopes (b* (((mv ?scopes ?warnings) (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp))) (vl-lexscopes-p scopes)) :rule-classes :rewrite)
Theorem:
(defthm vl-warninglist-p-of-vl-lexscopes-declare-name.warnings (b* (((mv ?scopes ?warnings) (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-lexscopes-declare-name-fn-of-str-fix-name (equal (vl-lexscopes-declare-name-fn (str-fix name) decl scopes warnings genblockp) (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp)))
Theorem:
(defthm vl-lexscopes-declare-name-fn-streqv-congruence-on-name (implies (streqv name name-equiv) (equal (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp) (vl-lexscopes-declare-name-fn name-equiv decl scopes warnings genblockp))) :rule-classes :congruence)
Theorem:
(defthm vl-lexscopes-declare-name-fn-of-identity-decl (equal (vl-lexscopes-declare-name-fn name (identity decl) scopes warnings genblockp) (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp)))
Theorem:
(defthm vl-lexscopes-declare-name-fn-equal-congruence-on-decl (implies (equal decl decl-equiv) (equal (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp) (vl-lexscopes-declare-name-fn name decl-equiv scopes warnings genblockp))) :rule-classes :congruence)
Theorem:
(defthm vl-lexscopes-declare-name-fn-of-vl-lexscopes-fix-scopes (equal (vl-lexscopes-declare-name-fn name decl (vl-lexscopes-fix scopes) warnings genblockp) (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp)))
Theorem:
(defthm vl-lexscopes-declare-name-fn-vl-lexscopes-equiv-congruence-on-scopes (implies (vl-lexscopes-equiv scopes scopes-equiv) (equal (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp) (vl-lexscopes-declare-name-fn name decl scopes-equiv warnings genblockp))) :rule-classes :congruence)
Theorem:
(defthm vl-lexscopes-declare-name-fn-of-vl-warninglist-fix-warnings (equal (vl-lexscopes-declare-name-fn name decl scopes (vl-warninglist-fix warnings) genblockp) (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp)))
Theorem:
(defthm vl-lexscopes-declare-name-fn-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp) (vl-lexscopes-declare-name-fn name decl scopes warnings-equiv genblockp))) :rule-classes :congruence)
Theorem:
(defthm vl-lexscopes-declare-name-fn-of-bool-fix-genblockp (equal (vl-lexscopes-declare-name-fn name decl scopes warnings (acl2::bool-fix genblockp)) (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp)))
Theorem:
(defthm vl-lexscopes-declare-name-fn-iff-congruence-on-genblockp (implies (iff genblockp genblockp-equiv) (equal (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp) (vl-lexscopes-declare-name-fn name decl scopes warnings genblockp-equiv))) :rule-classes :congruence)