• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
        • Transforms
          • Expression-sizing
          • Occform
          • Oprewrite
          • Expand-functions
          • Delayredux
          • Unparameterization
          • Caseelim
          • Split
          • Selresolve
          • Weirdint-elim
          • Vl-delta
          • Replicate-insts
          • Rangeresolve
          • Propagate
          • Clean-selects
          • Clean-params
          • Blankargs
          • Inline-mods
          • Expr-simp
          • Trunc
          • Always-top
          • Gatesplit
          • Gate-elim
          • Expression-optimization
          • Elim-supplies
          • Wildelim
          • Drop-blankports
          • Clean-warnings
          • Addinstnames
          • Custom-transform-hooks
          • Annotate
            • Make-implicit-wires
              • Vl-modulelist-make-implicit-wires
              • Vl-make-implicit-wires-aux
              • Shadowcheck
                • Vl-shadowcheck-reference-name
                • Vl-shadowcheck-aux
                • Vl-shadowcheck-reference-names
                • Vl-shadowcheck-declare-names
                • Vl-shadowcheck-declare-name
                • Vl-shadowcheck-fundecl
                • Vl-shadowcheck-declare-typedefs
                • Vl-shadowcheck-blockitemlist
                • Vl-shadowcheck-taskdecl
                • Vl-shadowcheck-portdecllist
                • Vl-shadowcheck-paramdecls
                • Vl-shadowcheck-taskdecls
                • Vl-shadowcheck-paramdecl
                • Vl-shadowcheck-gateinst
                • Vl-shadowcheck-vardecls
                • Vl-shadowcheck-vardecl
                • Vl-shadowcheck-portdecl
                • Vl-shadowcheck-modinst
                • Vl-shadowcheck-imports
                • Vl-shadowcheck-import
                • Vl-shadowcheck-fundecls
                • Vl-shadowcheck-blockitem
                • Vl-shadowcheck-ports
                • Vl-shadowcheck-port
                • Vl-shadowcheck-initial
                • Vl-shadowcheck-assign
                • Vl-shadowcheck-always
                • Vl-shadowcheck-alias
                • Vl-shadowcheck-state
                • Vl-shadowcheck-module
                • Vl-shadowcheck-modules
                • Vl-shadowcheck-push-scope
                • Vl-lexscopes
                  • Vl-lexscopes-fix
                  • Vl-lexscopes-direct-import-name
                  • Vl-lexscopes-wild-import-name
                  • Vl-lexscopes-wild-import-names
                  • Vl-lexscopes-declare-name
                  • Vl-lexscopes-do-import
                  • Vl-lexscopes-find
                    • Vl-lexscopes-equiv
                    • Vl-lexscopes-p
                    • Vl-lexscopes-exit-scope
                    • Vl-lexscopes-enter-new-scope
                  • Vl-shadowcheck-design
                  • Vl-shadowcheck-pop-scope
                  • Vl-lexscope
                • Vl-stmt-check-undeclared
                • Vl-make-implicit-wires-main
                • Vl-fundecl-check-undeclared
                • Vl-warn-about-undeclared-wires
                • Vl-implicitst
                • Vl-blockitem-check-undeclared
                • Vl-taskdecl-check-undeclared
                • Vl-modinst-exprs-for-implicit-wires
                • Vl-blockitemlist-check-undeclared
                • Vl-import-check-undeclared
                • Vl-make-ordinary-implicit-wires
                • Vl-gateinst-exprs-for-implicit-wires
                • Vl-remove-declared-wires
                • Vl-make-port-implicit-wires
                • Vl-module-make-implicit-wires
                • Vl-vardecl-exprs-for-implicit-wires
                • Vl-design-make-implicit-wires
              • Resolve-indexing
              • Origexprs
              • Argresolve
              • Portdecl-sign
              • Designwires
              • Udp-elim
              • Vl-annotate-design
            • Latchcode
            • Elim-unused-vars
            • Problem-modules
          • Lint
          • Mlib
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Vl-lexscopes

    Vl-lexscopes-find

    Recursively look up a name, going from inner to outer lexical scopes.

    Signature
    (vl-lexscopes-find name scopes) → (mv entry tail)
    Arguments
    name — Guard (stringp name).
    scopes — Guard (vl-lexscopes-p scopes).
    Returns
    entry — Entry for this name, if it is declared.
        Type (iff (vl-lexscope-entry-p entry) entry).
    tail — The tail of scopes starting with the scope for this name.
        Type (vl-lexscopes-p tail).

    Definitions and Theorems

    Function: vl-lexscopes-find

    (defun vl-lexscopes-find (name scopes)
      (declare (xargs :guard (and (stringp name)
                                  (vl-lexscopes-p scopes))))
      (let ((__function__ 'vl-lexscopes-find))
        (declare (ignorable __function__))
        (b* ((name (string-fix name))
             (scopes (vl-lexscopes-fix scopes))
             ((when (atom scopes)) (mv nil nil))
             (entry (vl-lexscope-find name (car scopes)))
             ((when entry) (mv entry scopes)))
          (vl-lexscopes-find name (cdr scopes)))))

    Theorem: return-type-of-vl-lexscopes-find.entry

    (defthm return-type-of-vl-lexscopes-find.entry
      (b* (((mv ?entry set::?tail)
            (vl-lexscopes-find name scopes)))
        (iff (vl-lexscope-entry-p entry) entry))
      :rule-classes :rewrite)

    Theorem: vl-lexscopes-p-of-vl-lexscopes-find.tail

    (defthm vl-lexscopes-p-of-vl-lexscopes-find.tail
      (b* (((mv ?entry set::?tail)
            (vl-lexscopes-find name scopes)))
        (vl-lexscopes-p tail))
      :rule-classes :rewrite)

    Theorem: vl-lexscopes-find-of-str-fix-name

    (defthm vl-lexscopes-find-of-str-fix-name
      (equal (vl-lexscopes-find (str-fix name)
                                scopes)
             (vl-lexscopes-find name scopes)))

    Theorem: vl-lexscopes-find-streqv-congruence-on-name

    (defthm vl-lexscopes-find-streqv-congruence-on-name
      (implies (streqv name name-equiv)
               (equal (vl-lexscopes-find name scopes)
                      (vl-lexscopes-find name-equiv scopes)))
      :rule-classes :congruence)

    Theorem: vl-lexscopes-find-of-vl-lexscopes-fix-scopes

    (defthm vl-lexscopes-find-of-vl-lexscopes-fix-scopes
      (equal (vl-lexscopes-find name (vl-lexscopes-fix scopes))
             (vl-lexscopes-find name scopes)))

    Theorem: vl-lexscopes-find-vl-lexscopes-equiv-congruence-on-scopes

    (defthm vl-lexscopes-find-vl-lexscopes-equiv-congruence-on-scopes
      (implies (vl-lexscopes-equiv scopes scopes-equiv)
               (equal (vl-lexscopes-find name scopes)
                      (vl-lexscopes-find name scopes-equiv)))
      :rule-classes :congruence)