Theorems about variables in computation states w.r.t. execution.
These theorems are about c::compustate-has-var-with-type-p, and how the execution of constructs preserve and/or modify it.
Theorem:
(defthm expr-ident-compustate-vars (b* ((expr (c::expr-ident var)) (result (c::exec-expr-pure expr compst)) (value (c::expr-value->value result))) (implies (c::compustate-has-var-with-type-p var type compst) (equal (c::type-of-value value) (c::type-fix type)))))
Theorem:
(defthm expr-compustate-vars (b* (((mv result compst1) (c::exec-expr expr compst fenv limit))) (implies (and (not (c::errorp result)) (c::compustate-has-var-with-type-p var type compst)) (c::compustate-has-var-with-type-p var type compst1))))
Theorem:
(defthm expr-compustate-vars-multi (b* (((mv eval compst1) (c::exec-expr expr compst fenv limit))) (implies (and (> (c::compustate-frames-number compst) 0) (not (c::errorp eval)) (c::compustate-has-vars-with-types-p vartys compst)) (c::compustate-has-vars-with-types-p vartys compst1))))
Theorem:
(defthm stmt-compustate-vars (b* (((mv sval compst1) (c::exec-stmt stmt compst fenv limit))) (implies (and (> (c::compustate-frames-number compst) 0) (not (c::errorp sval)) (c::compustate-has-var-with-type-p var type compst)) (c::compustate-has-var-with-type-p var type compst1))))
Theorem:
(defthm stmt-compustate-vars-multi (b* (((mv sval compst1) (c::exec-stmt stmt compst fenv limit))) (implies (and (> (c::compustate-frames-number compst) 0) (not (c::errorp sval)) (c::compustate-has-vars-with-types-p vartys compst)) (c::compustate-has-vars-with-types-p vartys compst1))))
Theorem:
(defthm initer-compustate-vars (b* (((mv result compst1) (c::exec-initer initer compst fenv limit))) (implies (and (> (c::compustate-frames-number compst) 0) (not (c::errorp result)) (c::compustate-has-var-with-type-p var type compst)) (c::compustate-has-var-with-type-p var type compst1))))
Theorem:
(defthm decl-decl-compustate-vars-old (b* ((declor (c::obj-declon->declor declon)) (var (c::obj-declor-ident->get declor)) (initer (c::obj-declon->init? declon)) ((mv & compst0) (c::exec-initer initer compst fenv (1- limit))) (compst1 (c::exec-obj-declon declon compst fenv limit))) (implies (and (equal (c::obj-declon->scspec declon) (c::scspecseq-none)) (equal (c::obj-declor-kind declor) :ident) (not (c::errorp compst1)) (c::identp var1) (not (equal var var1)) (c::compustate-has-var-with-type-p var1 type compst0)) (c::compustate-has-var-with-type-p var1 type compst1))))
Theorem:
(defthm decl-decl-compustate-vars-new (b* ((declor (c::obj-declon->declor declon)) (tyspecs (c::obj-declon->tyspec declon)) (compst1 (c::exec-obj-declon declon compst fenv limit))) (implies (and (equal (c::obj-declon->scspec declon) (c::scspecseq-none)) (equal (c::obj-declor-kind declor) :ident) (equal type (c::tyspecseq-to-type tyspecs)) (equal var (c::obj-declor-ident->get declor)) (not (c::errorp compst1))) (c::compustate-has-var-with-type-p var type compst1))))
Theorem:
(defthm block-item-stmt-compustate-vars (b* ((stmt (c::block-item-stmt->get item)) ((mv & compst0) (c::exec-stmt stmt compst fenv (1- limit))) ((mv result compst1) (c::exec-block-item item compst fenv limit))) (implies (and (equal (c::block-item-kind item) :stmt) (not (c::errorp result)) (c::compustate-has-var-with-type-p var type compst0)) (c::compustate-has-var-with-type-p var type compst1))))
Theorem:
(defthm block-item-decl-compustate-vars (b* ((declon (c::block-item-declon->get item)) (compst0 (c::exec-obj-declon declon compst fenv (1- limit))) ((mv result compst1) (c::exec-block-item item compst fenv limit))) (implies (and (equal (c::block-item-kind item) :declon) (not (c::errorp result)) (c::compustate-has-var-with-type-p var type compst0)) (c::compustate-has-var-with-type-p var type compst1))))
Theorem:
(defthm block-item-list-empty-compustate-vars (b* (((mv result compst1) (c::exec-block-item-list items compst fenv limit))) (implies (and (equal items nil) (not (c::errorp result)) (c::compustate-has-var-with-type-p var type compst)) (c::compustate-has-var-with-type-p var type compst1))))
Theorem:
(defthm block-item-list-cons-compustate-vars (b* ((item (car item+items)) (items (cdr item+items)) ((mv result0 compst0) (c::exec-block-item item compst fenv (1- limit))) ((mv & compst1) (c::exec-block-item-list items compst0 fenv (1- limit))) ((mv result2 compst2) (c::exec-block-item-list item+items compst fenv limit))) (implies (and (consp item+items) (not (c::errorp result2)) (or (and (equal (c::stmt-value-kind result0) :return) (c::compustate-has-var-with-type-p var type compst0)) (and (equal (c::stmt-value-kind result0) :none) (c::compustate-has-var-with-type-p var type compst1)))) (c::compustate-has-var-with-type-p var type compst2))))