Recursively rewrite an svex expression.
(svex-rewrite x masks multirefs out-multirefs memo) → (mv xx out-multirefs memo)
Theorem:
(defthm return-type-of-svex-rewrite.xx (b* (((mv ?xx ?out-multirefs ?memo) (svex-rewrite x masks multirefs out-multirefs memo))) (svex-p xx)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-svex-rewrite.out-multirefs (b* (((mv ?xx ?out-multirefs ?memo) (svex-rewrite x masks multirefs out-multirefs memo))) (svex-key-alist-p out-multirefs)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-svex-rewrite.memo (b* (((mv ?xx ?out-multirefs ?memo) (svex-rewrite x masks multirefs out-multirefs memo))) (svex-svex-memo-p memo)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-svexlist-rewrite.xx (b* (((mv ?xx ?out-multirefs ?memo) (svexlist-rewrite x masks multirefs out-multirefs memo))) (svexlist-p xx)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-svexlist-rewrite.out-multirefs (b* (((mv ?xx ?out-multirefs ?memo) (svexlist-rewrite x masks multirefs out-multirefs memo))) (svex-key-alist-p out-multirefs)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-svexlist-rewrite.memo (b* (((mv ?xx ?out-multirefs ?memo) (svexlist-rewrite x masks multirefs out-multirefs memo))) (svex-svex-memo-p memo)) :rule-classes :rewrite)
Theorem:
(defthm svex-rewrite-of-svex-fix-x (equal (svex-rewrite (svex-fix x) masks multirefs out-multirefs memo) (svex-rewrite x masks multirefs out-multirefs memo)))
Theorem:
(defthm svex-rewrite-of-svex-mask-alist-fix-masks (equal (svex-rewrite x (svex-mask-alist-fix masks) multirefs out-multirefs memo) (svex-rewrite x masks multirefs out-multirefs memo)))
Theorem:
(defthm svex-rewrite-of-svex-key-alist-fix-multirefs (equal (svex-rewrite x masks (svex-key-alist-fix multirefs) out-multirefs memo) (svex-rewrite x masks multirefs out-multirefs memo)))
Theorem:
(defthm svex-rewrite-of-svex-key-alist-fix-out-multirefs (equal (svex-rewrite x masks multirefs (svex-key-alist-fix out-multirefs) memo) (svex-rewrite x masks multirefs out-multirefs memo)))
Theorem:
(defthm svex-rewrite-of-svex-svex-memo-fix-memo (equal (svex-rewrite x masks multirefs out-multirefs (svex-svex-memo-fix memo)) (svex-rewrite x masks multirefs out-multirefs memo)))
Theorem:
(defthm svexlist-rewrite-of-svexlist-fix-x (equal (svexlist-rewrite (svexlist-fix x) masks multirefs out-multirefs memo) (svexlist-rewrite x masks multirefs out-multirefs memo)))
Theorem:
(defthm svexlist-rewrite-of-svex-mask-alist-fix-masks (equal (svexlist-rewrite x (svex-mask-alist-fix masks) multirefs out-multirefs memo) (svexlist-rewrite x masks multirefs out-multirefs memo)))
Theorem:
(defthm svexlist-rewrite-of-svex-key-alist-fix-multirefs (equal (svexlist-rewrite x masks (svex-key-alist-fix multirefs) out-multirefs memo) (svexlist-rewrite x masks multirefs out-multirefs memo)))
Theorem:
(defthm svexlist-rewrite-of-svex-key-alist-fix-out-multirefs (equal (svexlist-rewrite x masks multirefs (svex-key-alist-fix out-multirefs) memo) (svexlist-rewrite x masks multirefs out-multirefs memo)))
Theorem:
(defthm svexlist-rewrite-of-svex-svex-memo-fix-memo (equal (svexlist-rewrite x masks multirefs out-multirefs (svex-svex-memo-fix memo)) (svexlist-rewrite x masks multirefs out-multirefs memo)))
Theorem:
(defthm svex-rewrite-svex-equiv-congruence-on-x (implies (svex-equiv x x-equiv) (equal (svex-rewrite x masks multirefs out-multirefs memo) (svex-rewrite x-equiv masks multirefs out-multirefs memo))) :rule-classes :congruence)
Theorem:
(defthm svex-rewrite-svex-mask-alist-equiv-congruence-on-masks (implies (svex-mask-alist-equiv masks masks-equiv) (equal (svex-rewrite x masks multirefs out-multirefs memo) (svex-rewrite x masks-equiv multirefs out-multirefs memo))) :rule-classes :congruence)
Theorem:
(defthm svex-rewrite-svex-key-alist-equiv-congruence-on-multirefs (implies (svex-key-alist-equiv multirefs multirefs-equiv) (equal (svex-rewrite x masks multirefs out-multirefs memo) (svex-rewrite x masks multirefs-equiv out-multirefs memo))) :rule-classes :congruence)
Theorem:
(defthm svex-rewrite-svex-key-alist-equiv-congruence-on-out-multirefs (implies (svex-key-alist-equiv out-multirefs out-multirefs-equiv) (equal (svex-rewrite x masks multirefs out-multirefs memo) (svex-rewrite x masks multirefs out-multirefs-equiv memo))) :rule-classes :congruence)
Theorem:
(defthm svex-rewrite-svex-svex-memo-equiv-congruence-on-memo (implies (svex-svex-memo-equiv memo memo-equiv) (equal (svex-rewrite x masks multirefs out-multirefs memo) (svex-rewrite x masks multirefs out-multirefs memo-equiv))) :rule-classes :congruence)
Theorem:
(defthm svexlist-rewrite-svexlist-equiv-congruence-on-x (implies (svexlist-equiv x x-equiv) (equal (svexlist-rewrite x masks multirefs out-multirefs memo) (svexlist-rewrite x-equiv masks multirefs out-multirefs memo))) :rule-classes :congruence)
Theorem:
(defthm svexlist-rewrite-svex-mask-alist-equiv-congruence-on-masks (implies (svex-mask-alist-equiv masks masks-equiv) (equal (svexlist-rewrite x masks multirefs out-multirefs memo) (svexlist-rewrite x masks-equiv multirefs out-multirefs memo))) :rule-classes :congruence)
Theorem:
(defthm svexlist-rewrite-svex-key-alist-equiv-congruence-on-multirefs (implies (svex-key-alist-equiv multirefs multirefs-equiv) (equal (svexlist-rewrite x masks multirefs out-multirefs memo) (svexlist-rewrite x masks multirefs-equiv out-multirefs memo))) :rule-classes :congruence)
Theorem:
(defthm svexlist-rewrite-svex-key-alist-equiv-congruence-on-out-multirefs (implies (svex-key-alist-equiv out-multirefs out-multirefs-equiv) (equal (svexlist-rewrite x masks multirefs out-multirefs memo) (svexlist-rewrite x masks multirefs out-multirefs-equiv memo))) :rule-classes :congruence)
Theorem:
(defthm svexlist-rewrite-svex-svex-memo-equiv-congruence-on-memo (implies (svex-svex-memo-equiv memo memo-equiv) (equal (svexlist-rewrite x masks multirefs out-multirefs memo) (svexlist-rewrite x masks multirefs out-multirefs memo-equiv))) :rule-classes :congruence)
Theorem:
(defthm len-of-svexlist-rewrite (equal (len (mv-nth 0 (svexlist-rewrite x masks multirefs out-multirefs memo))) (len x)))
Theorem:
(defthm svex-rewrite-correct (b* (((mv res out-multirefs1 memo1) (svex-rewrite x masks multirefs out-multirefs memo)) (mask (svex-mask-lookup x masks))) (implies (and (svex-rewrite-memo-correct memo masks env) (svex-mask-alist-complete masks)) (and (svex-rewrite-memo-correct memo1 masks env) (equal (4vec-mask mask (svex-eval res env)) (4vec-mask mask (svex-eval x env)))))))
Theorem:
(defthm svexlist-rewrite-correct (b* (((mv res out-multirefs1 memo1) (svexlist-rewrite x masks multirefs out-multirefs memo)) (argmasks (svex-argmasks-lookup x masks))) (implies (and (svex-rewrite-memo-correct memo masks env) (svex-mask-alist-complete masks)) (and (svex-rewrite-memo-correct memo1 masks env) (equal (4veclist-mask argmasks (svexlist-eval res env)) (4veclist-mask argmasks (svexlist-eval x env)))))))
Theorem:
(defthm svex-rewrite-vars (b* (((mv res out-multirefs1 memo1) (svex-rewrite x masks multirefs out-multirefs memo))) (implies (svex-rewrite-memo-vars-ok memo v) (and (svex-rewrite-memo-vars-ok memo1 v) (implies (not (member v (svex-vars x))) (not (member v (svex-vars res))))))))
Theorem:
(defthm svexlist-rewrite-vars (b* (((mv res out-multirefs1 memo1) (svexlist-rewrite x masks multirefs out-multirefs memo))) (implies (svex-rewrite-memo-vars-ok memo v) (and (svex-rewrite-memo-vars-ok memo1 v) (implies (not (member v (svexlist-vars x))) (not (member v (svexlist-vars res))))))))
Theorem:
(defthm true-listp-of-svexlist-rewrite (true-listp (mv-nth 0 (svexlist-rewrite x masks multirefs out-multirefs memo))))
Theorem:
(defthm svexlist-rewrite-breakdown (equal (list (mv-nth 0 (svexlist-rewrite x masks multirefs out-multirefs memo)) (mv-nth 1 (svexlist-rewrite x masks multirefs out-multirefs memo)) (mv-nth 2 (svexlist-rewrite x masks multirefs out-multirefs memo))) (svexlist-rewrite x masks multirefs out-multirefs memo)))