Follow a scope expression to find the associated declaration.
(vl-follow-scopeexpr x ss &key strictp) → (mv err trace context tail)
Function:
(defun vl-follow-scopeexpr-fn (x ss strictp) (declare (xargs :guard (and (vl-scopeexpr-p x) (vl-scopestack-p ss) (booleanp strictp)))) (let ((__function__ 'vl-follow-scopeexpr)) (declare (ignorable __function__)) (vl-scopeexpr-case x :end (vl-follow-hidexpr x.hid ss :strictp strictp :origx x :elabpath nil) :colon (b* ((x (vl-scopeexpr-fix x)) ((unless (stringp x.first)) (mv (vmsg "~a0: The scope modifier '~x1' is not yet supported." x (case x.first (:vl-local "local") (:vl-$unit "$unit") (otherwise "??UNKNOWN??"))) nil nil (vl-scopeexpr->hid x))) ((mv package pkg-ss elabkey classp) (b* (((mv class class-ss) (vl-scopestack-find-class/ss x.first ss)) ((when class) (mv class class-ss (vl-elabkey-class x.first) t)) ((mv package pkg-ss) (vl-scopestack-find-package/ss x.first ss))) (mv package pkg-ss (vl-elabkey-package x.first) nil))) ((unless package) (mv (vmsg "~a0: Package/class ~s1 not found.." x x.first) nil nil (vl-scopeexpr->hid x))) (pkg-ss (vl-scopestack-push package pkg-ss)) ((unless (vl-scopeexpr-case x.rest :end)) (mv (vmsg "~a0: Multiple levels of :: operators are ~ not yet supported." x) nil nil (vl-scopeexpr->hid x))) (elabpath (list (vl-elabinstruction-push-named elabkey) (vl-elabinstruction-root))) ((mv err trace context tail) (vl-follow-hidexpr (vl-scopeexpr-end->hid x.rest) pkg-ss :strictp strictp :origx x :elabpath elabpath)) ((when err) (mv err trace context tail)) ((unless (vl-scopecontext-case context :local)) (mv nil trace context tail))) (mv nil trace (if classp (make-vl-scopecontext-class :class package) (make-vl-scopecontext-package :pkg package)) tail)))))
Theorem:
(defthm return-type-of-vl-follow-scopeexpr.err (b* (((mv ?err common-lisp::?trace ?context set::?tail) (vl-follow-scopeexpr-fn x ss strictp))) (iff (vl-msg-p err) err)) :rule-classes :rewrite)
Theorem:
(defthm vl-hidtrace-p-of-vl-follow-scopeexpr.trace (b* (((mv ?err common-lisp::?trace ?context set::?tail) (vl-follow-scopeexpr-fn x ss strictp))) (vl-hidtrace-p trace)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-follow-scopeexpr.context (b* (((mv ?err common-lisp::?trace ?context set::?tail) (vl-follow-scopeexpr-fn x ss strictp))) (implies (not err) (vl-scopecontext-p context))) :rule-classes :rewrite)
Theorem:
(defthm vl-hidexpr-p-of-vl-follow-scopeexpr.tail (b* (((mv ?err common-lisp::?trace ?context set::?tail) (vl-follow-scopeexpr-fn x ss strictp))) (vl-hidexpr-p tail)) :rule-classes :rewrite)
Theorem:
(defthm consp-of-vl-follow-scopeexpr.trace (b* (((mv ?err common-lisp::?trace ?context set::?tail) (vl-follow-scopeexpr-fn x ss strictp))) (implies (not err) (consp trace))))
Theorem:
(defthm count-of-vl-follow-scopeexpr.tail (b* (((mv ?err common-lisp::?trace ?context set::?tail) (vl-follow-scopeexpr-fn x ss strictp))) (< (vl-hidexpr-count tail) (vl-scopeexpr-count x))) :rule-classes :linear)
Theorem:
(defthm vl-subhid-p-of-vl-follow-scopeexpr (b* (((mv ?err common-lisp::?trace ?context set::?tail) (vl-follow-scopeexpr-fn x ss strictp))) (implies (not err) (vl-subhid-p tail (vl-scopeexpr->hid x)))))
Theorem:
(defthm vl-follow-scopeexpr-fn-of-vl-scopeexpr-fix-x (equal (vl-follow-scopeexpr-fn (vl-scopeexpr-fix x) ss strictp) (vl-follow-scopeexpr-fn x ss strictp)))
Theorem:
(defthm vl-follow-scopeexpr-fn-vl-scopeexpr-equiv-congruence-on-x (implies (vl-scopeexpr-equiv x x-equiv) (equal (vl-follow-scopeexpr-fn x ss strictp) (vl-follow-scopeexpr-fn x-equiv ss strictp))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-scopeexpr-fn-of-vl-scopestack-fix-ss (equal (vl-follow-scopeexpr-fn x (vl-scopestack-fix ss) strictp) (vl-follow-scopeexpr-fn x ss strictp)))
Theorem:
(defthm vl-follow-scopeexpr-fn-vl-scopestack-equiv-congruence-on-ss (implies (vl-scopestack-equiv ss ss-equiv) (equal (vl-follow-scopeexpr-fn x ss strictp) (vl-follow-scopeexpr-fn x ss-equiv strictp))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-scopeexpr-fn-of-bool-fix-strictp (equal (vl-follow-scopeexpr-fn x ss (acl2::bool-fix strictp)) (vl-follow-scopeexpr-fn x ss strictp)))
Theorem:
(defthm vl-follow-scopeexpr-fn-iff-congruence-on-strictp (implies (iff strictp strictp-equiv) (equal (vl-follow-scopeexpr-fn x ss strictp) (vl-follow-scopeexpr-fn x ss strictp-equiv))) :rule-classes :congruence)