• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
        • Svex-stvs
        • Svex-decomposition-methodology
        • Sv-versus-esim
        • Svex-decomp
        • Svex-compose-dfs
        • Svex-compilation
        • Moddb
        • Svmods
        • Svstmt
        • Sv-tutorial
        • Expressions
          • Rewriting
          • Svex
          • Bit-blasting
          • Functions
          • 4vmask
          • Why-infinite-width
          • Svex-vars
          • Evaluation
            • Svex-xeval
            • Svex-mono-eval
            • Svex-eval
            • Svex-apply
            • Svex-env
              • Svex-env-p
              • Svex-env-reduce
              • Svex-envs-similar
              • Svex-envs-equivalent
              • Svex-env-fix
              • Svex-env-extract
              • Svex-env-lookup
                • Svex-env-acons
                • Svex-env-<<=
                • Svarlist-x-subst
                • Svex-env-equiv
                • Svex-env-boundp
                • Svarlist-x-env
                • Svex-env-fastlookup
              • Svex-alist-eval
              • Svar-boolmasks-lookup
              • Svex-s4eval
              • Svexlist-unquote
              • Svex-alist-eval-for-symbolic
              • Svexlist-eval
              • Svexlist-quotesp
              • Svar-boolmasks
              • Svexlist-s4eval
              • Svexlist-eval-for-symbolic
            • Values
          • Symbolic-test-vector
          • Vl-to-svex
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Svex-env

    Svex-env-lookup

    (Slow) Look up a variable's value in an svex-env.

    Signature
    (svex-env-lookup var env) → val
    Arguments
    var — Guard (svar-p var).
    env — Guard (svex-env-p env).
    Returns
    val — Type (4vec-p val).

    We treat any unbound variables as being bound to infinite Xes.

    Definitions and Theorems

    Function: svex-env-lookup

    (defun svex-env-lookup (var env)
      (declare (xargs :guard (and (svar-p var) (svex-env-p env))))
      (let ((__function__ 'svex-env-lookup))
        (declare (ignorable __function__))
        (mbe :logic
             (4vec-fix (cdr (hons-get (svar-fix var) env)))
             :exec
             (let ((look (hons-get var env)))
               (if look (cdr look) (4vec-x))))))

    Theorem: 4vec-p-of-svex-env-lookup

    (defthm 4vec-p-of-svex-env-lookup
      (b* ((val (svex-env-lookup var env)))
        (4vec-p val))
      :rule-classes :rewrite)

    Theorem: svex-env-lookup-of-svar-fix-var

    (defthm svex-env-lookup-of-svar-fix-var
      (equal (svex-env-lookup (svar-fix var) env)
             (svex-env-lookup var env)))

    Theorem: svex-env-lookup-svar-equiv-congruence-on-var

    (defthm svex-env-lookup-svar-equiv-congruence-on-var
      (implies (svar-equiv var var-equiv)
               (equal (svex-env-lookup var env)
                      (svex-env-lookup var-equiv env)))
      :rule-classes :congruence)

    Theorem: svex-env-lookup-of-svex-env-fix-env

    (defthm svex-env-lookup-of-svex-env-fix-env
      (equal (svex-env-lookup var (svex-env-fix env))
             (svex-env-lookup var env)))

    Theorem: svex-env-lookup-svex-env-equiv-congruence-on-env

    (defthm svex-env-lookup-svex-env-equiv-congruence-on-env
      (implies (svex-env-equiv env env-equiv)
               (equal (svex-env-lookup var env)
                      (svex-env-lookup var env-equiv)))
      :rule-classes :congruence)

    Theorem: svex-env-lookup-in-empty

    (defthm svex-env-lookup-in-empty
      (equal (svex-env-lookup var nil)
             (4vec-x)))

    Theorem: svex-env-lookup-in-svex-env-acons

    (defthm svex-env-lookup-in-svex-env-acons
      (equal (svex-env-lookup var1 (svex-env-acons var2 val env))
             (if (svar-equiv var1 var2)
                 (4vec-fix val)
               (svex-env-lookup var1 env))))