Generate a theorem for the transformation of a pure expression.
(gen-expr-pure-thm old new vartys const-new thm-index hints) → (mv thm-event thm-name updated-thm-index)
We are in the process of transitioning theorem generation for expressions from this function to gen-expr-thm, while at the same time we are extending and generalizing our dynamic semantics of C. When that transition is completed, we will eliminate this function.
Function:
(defun gen-expr-pure-thm (old new vartys const-new thm-index hints) (declare (xargs :guard (and (exprp old) (exprp new) (c::ident-type-mapp vartys) (symbolp const-new) (posp thm-index) (true-listp hints)))) (declare (xargs :guard (and (expr-unambp old) (expr-annop old) (expr-unambp new) (expr-annop new)))) (let ((__function__ 'gen-expr-pure-thm)) (declare (ignorable __function__)) (b* ((old (expr-fix old)) (new (expr-fix new)) ((unless (expr-pure-formalp old)) (raise "Internal error: ~x0 is not in the formalized subset." old) (mv '(_) nil 1)) ((unless (expr-pure-formalp new)) (raise "Internal error: ~x0 is not in the formalized subset." new) (mv '(_) nil 1)) (type (expr-type old)) ((unless (equal (expr-type new) type)) (raise "Internal error: ~ the type ~x0 of the new expression ~x1 differs from ~ the type ~x2 of the old expression ~x3." (expr-type new) new type old) (mv '(_) nil 1)) ((unless (type-formalp type)) (raise "Internal error: expression ~x0 has type ~x1." old type) (mv '(_) nil 1)) ((mv & old-expr) (ldm-expr old)) ((mv & new-expr) (ldm-expr new)) ((mv & ctype) (ldm-type type)) (vars-pre (gen-var-assertions vartys 'compst)) (formula (cons 'b* (cons (cons (cons 'old-expr (cons (cons 'quote (cons old-expr 'nil)) 'nil)) (cons (cons 'new-expr (cons (cons 'quote (cons new-expr 'nil)) 'nil)) '((old-result (c::exec-expr-pure old-expr compst)) (new-result (c::exec-expr-pure new-expr compst)) (old-value (c::expr-value->value old-result)) (new-value (c::expr-value->value new-result))))) (cons (cons 'implies (cons (cons 'and (append vars-pre '((not (c::errorp old-result))))) (cons (cons 'and (cons '(not (c::errorp new-result)) (cons '(equal old-value new-value) (cons (cons 'equal (cons '(c::type-of-value old-value) (cons (cons 'quote (cons ctype 'nil)) 'nil))) 'nil)))) 'nil))) 'nil)))) ((mv thm-name thm-index) (gen-thm-name const-new thm-index)) (thm-event (cons 'defrule (cons thm-name (cons formula (cons ':rule-classes (cons 'nil (cons ':hints (cons hints 'nil))))))))) (mv thm-event thm-name thm-index))))
Theorem:
(defthm pseudo-event-formp-of-gen-expr-pure-thm.thm-event (b* (((mv ?thm-event ?thm-name ?updated-thm-index) (gen-expr-pure-thm old new vartys const-new thm-index hints))) (pseudo-event-formp thm-event)) :rule-classes :rewrite)
Theorem:
(defthm symbolp-of-gen-expr-pure-thm.thm-name (b* (((mv ?thm-event ?thm-name ?updated-thm-index) (gen-expr-pure-thm old new vartys const-new thm-index hints))) (symbolp thm-name)) :rule-classes :rewrite)
Theorem:
(defthm posp-of-gen-expr-pure-thm.updated-thm-index (b* (((mv ?thm-event ?thm-name ?updated-thm-index) (gen-expr-pure-thm old new vartys const-new thm-index hints))) (posp updated-thm-index)) :rule-classes :rewrite)
Theorem:
(defthm gen-expr-pure-thm-of-expr-fix-old (equal (gen-expr-pure-thm (expr-fix old) new vartys const-new thm-index hints) (gen-expr-pure-thm old new vartys const-new thm-index hints)))
Theorem:
(defthm gen-expr-pure-thm-expr-equiv-congruence-on-old (implies (c$::expr-equiv old old-equiv) (equal (gen-expr-pure-thm old new vartys const-new thm-index hints) (gen-expr-pure-thm old-equiv new vartys const-new thm-index hints))) :rule-classes :congruence)
Theorem:
(defthm gen-expr-pure-thm-of-expr-fix-new (equal (gen-expr-pure-thm old (expr-fix new) vartys const-new thm-index hints) (gen-expr-pure-thm old new vartys const-new thm-index hints)))
Theorem:
(defthm gen-expr-pure-thm-expr-equiv-congruence-on-new (implies (c$::expr-equiv new new-equiv) (equal (gen-expr-pure-thm old new vartys const-new thm-index hints) (gen-expr-pure-thm old new-equiv vartys const-new thm-index hints))) :rule-classes :congruence)