Make sure that the modnamespace is computed, or generate it if it isn't available already.
(vl-namefactory-maybe-initialize factory) → new-factory
We could do this as part of vl-starting-namefactory instead,
but this allows us to make
Function:
(defun vl-namefactory-maybe-initialize (factory) (declare (xargs :guard (vl-namefactory-p factory))) (let ((__function__ 'vl-namefactory-maybe-initialize)) (declare (ignorable __function__)) (if (vl-namedb->names (vl-namefactory->namedb factory)) (vl-namefactory-fix factory) (let* ((mod (vl-namefactory->mod factory)) (modns (and mod (vl-module->modnamespace mod)))) (change-vl-namefactory factory :namedb (vl-starting-namedb modns))))))
Theorem:
(defthm vl-namefactory-p-of-vl-namefactory-maybe-initialize (b* ((new-factory (vl-namefactory-maybe-initialize factory))) (vl-namefactory-p new-factory)) :rule-classes :rewrite)
Theorem:
(defthm vl-namefactory->mod-of-vl-namefactory-maybe-initialize (equal (vl-namefactory->mod (vl-namefactory-maybe-initialize factory)) (vl-namefactory->mod factory)))
Theorem:
(defthm subsetp-equal-of-modnamespace-and-vl-namefactory-maybe-initialize (implies (vl-namefactory->mod factory) (subsetp-equal (vl-module->modnamespace (vl-namefactory->mod factory)) (vl-namedb-allnames (vl-namefactory->namedb (vl-namefactory-maybe-initialize factory))))) :rule-classes ((:rewrite) (:forward-chaining :trigger-terms ((vl-namefactory-maybe-initialize factory)))))
Theorem:
(defthm vl-namefactory-maybe-initialize-when-already-has-names (implies (vl-namedb->names (vl-namefactory->namedb factory)) (equal (vl-namefactory-maybe-initialize factory) (vl-namefactory-fix factory))))
Theorem:
(defthm vl-namefactory-maybe-initialize-of-vl-namefactory-fix-factory (equal (vl-namefactory-maybe-initialize (vl-namefactory-fix factory)) (vl-namefactory-maybe-initialize factory)))
Theorem:
(defthm vl-namefactory-maybe-initialize-vl-namefactory-equiv-congruence-on-factory (implies (vl-namefactory-equiv factory factory-equiv) (equal (vl-namefactory-maybe-initialize factory) (vl-namefactory-maybe-initialize factory-equiv))) :rule-classes :congruence)