Lift a variable through another (single) variable.
(up-past-var vlift vpast left right order) → (mv bed order)
Function:
(defun up-past-var (vlift vpast left right order) (declare (xargs :guard t)) (let ((__function__ 'up-past-var)) (declare (ignorable __function__)) (b* (((mv lok lvar ltrue lfalse) (bed-match-var left)) ((mv rok rvar rtrue rfalse) (bed-match-var right)) ((when (and lok rok (equal lvar vlift) (equal rvar vlift))) (mv (mk-var1 vlift (mk-var1 vpast ltrue rtrue) (mk-var1 vpast lfalse rfalse)) order)) ((when (and lok (equal lvar vlift))) (mv (mk-var1 vlift (mk-var1 vpast ltrue right) (mk-var1 vpast lfalse right)) order)) ((when (and rok (equal rvar vlift))) (mv (mk-var1 vlift (mk-var1 vpast left rtrue) (mk-var1 vpast left rfalse)) order))) (mv (mk-var1 vpast left right) order))))
Theorem:
(defthm up-past-var-correct (b* (((mv bed ?order) (up-past-var vlift vpast left right order))) (equal (bed-eval bed env) (if (bed-env-lookup vpast env) (bed-eval left env) (bed-eval right env)))))