(svstmt-assign->subst lhs rhs offset blockingp st) → new-st
Function:
(defun svstmt-assign->subst (lhs rhs offset blockingp st) (declare (xargs :guard (and (lhs-p lhs) (svex-p rhs) (natp offset) (svstate-p st)))) (let ((__function__ 'svstmt-assign->subst)) (declare (ignorable __function__)) (b* ((offset (lnfix offset)) ((mv first rest) (lhs-decomp lhs)) ((unless first) (svstate-fix st)) ((lhrange first) first) (st (svstmt-assign->subst rest rhs (+ offset first.w) blockingp st)) ((svstate st))) (lhatom-case first.atom :z st :var (b* ((var first.atom.name) (binding (or (if blockingp (svstack-lookup var st.blkst) (svex-fastlookup var st.nonblkst)) (make-svex-var :name var))) (new-val (svex-replace-range binding :lsb first.atom.rsh :width first.w :val (svex-rsh offset rhs))) (new-alist (if blockingp (svstack-assign first.atom.name new-val st.blkst) (hons-acons first.atom.name new-val st.nonblkst))) (st (if blockingp (change-svstate st :blkst new-alist) (change-svstate st :nonblkst new-alist)))) st)))))
Theorem:
(defthm svstate-p-of-svstmt-assign->subst (b* ((new-st (svstmt-assign->subst lhs rhs offset blockingp st))) (svstate-p new-st)) :rule-classes :rewrite)
Theorem:
(defthm svex-p-nonnil-compound-recognizer (implies (svex-p x) x) :rule-classes :compound-recognizer)
Theorem:
(defthm svstmt-assign->subst-preserves-blkst-when-nonblocking (equal (svstate->blkst (svstmt-assign->subst lhs rhs offset nil st)) (svstate->blkst st)))
Theorem:
(defthm svstmt-assign->subst-preserves-nonblkst-when-blocking (equal (svstate->nonblkst (svstmt-assign->subst lhs rhs offset t st)) (svstate->nonblkst st)))
Theorem:
(defthm keys-of-svstmt-assign->subst-blkst (implies (and (not (svex-lookup v (svstack-to-svex-alist (svstate->blkst st)))) (not (member (svar-fix v) (lhs-vars lhs)))) (not (svex-lookup v (svstack-to-svex-alist (svstate->blkst (svstmt-assign->subst lhs rhs offset blockingp st)))))))
Theorem:
(defthm keys-of-svstmt-assign->subst-nonblkst (implies (and (not (svex-lookup v (svstate->nonblkst st))) (not (member (svar-fix v) (lhs-vars lhs)))) (not (svex-lookup v (svstate->nonblkst (svstmt-assign->subst lhs rhs offset blockingp st))))))
Theorem:
(defthm vars-of-svstmt-assign->subst-blkst (implies (and (not (member v (svex-alist-vars (svstack-to-svex-alist (svstate->blkst st))))) (not (member v (lhs-vars lhs))) (not (member v (svex-vars rhs)))) (not (member v (svex-alist-vars (svstack-to-svex-alist (svstate->blkst (svstmt-assign->subst lhs rhs offset blockingp st))))))))
Theorem:
(defthm vars-of-svstmt-assign->subst-nonblkst (implies (and (not (member v (svex-alist-vars (svstate->nonblkst st)))) (not (member v (lhs-vars lhs))) (not (member v (svex-vars rhs)))) (not (member v (svex-alist-vars (svstate->nonblkst (svstmt-assign->subst lhs rhs offset blockingp st)))))))
Theorem:
(defthm vars-of-svstmt-assign->subst (implies (and (not (member v (svstate-vars st))) (not (member v (lhs-vars lhs))) (not (member v (svex-vars rhs)))) (not (member v (svstate-vars (svstmt-assign->subst lhs rhs offset blockingp st))))))
Theorem:
(defthm consp-blkst-of-svstmt-assign->subst (b* ((?new-st (svstmt-assign->subst lhs rhs offset blockingp st))) (implies (consp (svstate->blkst st)) (consp (svstate->blkst new-st)))))
Theorem:
(defthm len-blkst-of-svstmt-assign->subst (b* ((?new-st (svstmt-assign->subst lhs rhs offset blockingp st))) (<= (len (svstate->blkst st)) (len (svstate->blkst new-st)))) :rule-classes :linear)
Theorem:
(defthm svstates-compatible-of-svstmt-assign->subst (b* ((?new-st (svstmt-assign->subst lhs rhs offset blockingp st))) (implies (consp (svstate->blkst st)) (svstates-compatible new-st st))))
Theorem:
(defthm svstmt-assign->subst-of-lhs-fix-lhs (equal (svstmt-assign->subst (lhs-fix lhs) rhs offset blockingp st) (svstmt-assign->subst lhs rhs offset blockingp st)))
Theorem:
(defthm svstmt-assign->subst-lhs-equiv-congruence-on-lhs (implies (lhs-equiv lhs lhs-equiv) (equal (svstmt-assign->subst lhs rhs offset blockingp st) (svstmt-assign->subst lhs-equiv rhs offset blockingp st))) :rule-classes :congruence)
Theorem:
(defthm svstmt-assign->subst-of-svex-fix-rhs (equal (svstmt-assign->subst lhs (svex-fix rhs) offset blockingp st) (svstmt-assign->subst lhs rhs offset blockingp st)))
Theorem:
(defthm svstmt-assign->subst-svex-equiv-congruence-on-rhs (implies (svex-equiv rhs rhs-equiv) (equal (svstmt-assign->subst lhs rhs offset blockingp st) (svstmt-assign->subst lhs rhs-equiv offset blockingp st))) :rule-classes :congruence)
Theorem:
(defthm svstmt-assign->subst-of-nfix-offset (equal (svstmt-assign->subst lhs rhs (nfix offset) blockingp st) (svstmt-assign->subst lhs rhs offset blockingp st)))
Theorem:
(defthm svstmt-assign->subst-nat-equiv-congruence-on-offset (implies (nat-equiv offset offset-equiv) (equal (svstmt-assign->subst lhs rhs offset blockingp st) (svstmt-assign->subst lhs rhs offset-equiv blockingp st))) :rule-classes :congruence)
Theorem:
(defthm svstmt-assign->subst-of-svstate-fix-st (equal (svstmt-assign->subst lhs rhs offset blockingp (svstate-fix st)) (svstmt-assign->subst lhs rhs offset blockingp st)))
Theorem:
(defthm svstmt-assign->subst-svstate-equiv-congruence-on-st (implies (svstate-equiv st st-equiv) (equal (svstmt-assign->subst lhs rhs offset blockingp st) (svstmt-assign->subst lhs rhs offset blockingp st-equiv))) :rule-classes :congruence)