Lift a variable through a (single) operator.
(up-past-op vlift op left right order) → (mv bed order)
Function:
(defun up-past-op (vlift op left right order) (declare (xargs :guard (and (atom vlift) (bed-op-p op)))) (let ((__function__ 'up-past-op)) (declare (ignorable __function__)) (b* ((op (bed-op-fix$ op)) ((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))) (b* (((mv new-left order) (mk-op1 op ltrue rtrue order)) ((mv new-right order) (mk-op1 op lfalse rfalse order)) (ans (mk-var1 vlift new-left new-right))) (mv ans order))) ((when (and lok (equal lvar vlift))) (b* (((mv new-left order) (mk-op1 op ltrue right order)) ((mv new-right order) (mk-op1 op lfalse right order)) (ans (mk-var1 vlift new-left new-right))) (mv ans order))) ((when (and rok (equal rvar vlift))) (b* (((mv new-left order) (mk-op1 op left rtrue order)) ((mv new-right order) (mk-op1 op left rfalse order)) (ans (mk-var1 vlift new-left new-right))) (mv ans order))) ((mv ans order) (mk-op1 op left right order))) (mv ans order))))
Theorem:
(defthm up-past-op-correct (implies (force (atom vlift)) (b* (((mv bed ?order) (up-past-op vlift op left right order))) (equal (bed-eval bed env) (bed-op-eval op (bed-eval left env) (bed-eval right env))))))