Look up a variable in a variable table.
(var-table-lookup var vartab) → info
If the variable is found, we return its information;
otherwise, we return
Function:
(defun var-table-lookup (var vartab) (declare (xargs :guard (and (identp var) (var-tablep vartab)))) (let ((__function__ 'var-table-lookup)) (declare (ignorable __function__)) (b* (((unless (mbt (consp vartab))) nil) (varscope (var-table-scope-fix (car vartab))) (pair (omap::assoc (ident-fix var) varscope)) ((when (consp pair)) (cdr pair)) (vartab (cdr vartab)) ((when (endp vartab)) nil)) (var-table-lookup var vartab))))
Theorem:
(defthm var-sinfo-optionp-of-var-table-lookup (b* ((info (var-table-lookup var vartab))) (var-sinfo-optionp info)) :rule-classes :rewrite)
Theorem:
(defthm var-table-lookup-of-ident-fix-var (equal (var-table-lookup (ident-fix var) vartab) (var-table-lookup var vartab)))
Theorem:
(defthm var-table-lookup-ident-equiv-congruence-on-var (implies (ident-equiv var var-equiv) (equal (var-table-lookup var vartab) (var-table-lookup var-equiv vartab))) :rule-classes :congruence)
Theorem:
(defthm var-table-lookup-of-var-table-fix-vartab (equal (var-table-lookup var (var-table-fix vartab)) (var-table-lookup var vartab)))
Theorem:
(defthm var-table-lookup-var-table-equiv-congruence-on-vartab (implies (var-table-equiv vartab vartab-equiv) (equal (var-table-lookup var vartab) (var-table-lookup var vartab-equiv))) :rule-classes :congruence)