Generate a C block item that consists of a given statement.
(atc-gen-block-item-stmt stmt stmt-limit stmt-events stmt-thm uterm? type result new-compst gin state) → (mv item item-limit item-events item-thm thm-index names-to-avoid)
This is used to lift generated statements
to generated block items.
Besdies the block item,
we also generate a theorem saying that
exec-block-item applied to the quoted block item
yields an mv pair consisting of
a result term (or
If
The limit for the block item is
1 more than the limit for the statement,
because we need 1 to go from exec-block-item
to the
Function:
(defun atc-gen-block-item-stmt (stmt stmt-limit stmt-events stmt-thm uterm? type result new-compst gin state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (stmtp stmt) (pseudo-termp stmt-limit) (pseudo-event-form-listp stmt-events) (symbolp stmt-thm) (typep type) (stmt-ginp gin)))) (let ((__function__ 'atc-gen-block-item-stmt)) (declare (ignorable __function__)) (b* (((stmt-gin gin) gin) (wrld (w state)) (item (block-item-stmt stmt)) (item-limit (pseudo-term-fncall 'binary-+ (list (pseudo-term-quote 1) stmt-limit))) (name (pack gin.fn '-correct- gin.thm-index)) (thm-index (1+ gin.thm-index)) ((mv name names-to-avoid) (fresh-logical-name-with-$s-suffix name nil gin.names-to-avoid wrld)) (exec-formula (cons 'equal (cons (cons 'exec-block-item (cons (cons 'quote (cons item 'nil)) (cons gin.compst-var (cons gin.fenv-var (cons gin.limit-var 'nil))))) (cons (cons 'mv (cons result (cons new-compst 'nil))) 'nil)))) (exec-formula (atc-contextualize exec-formula gin.context gin.fn gin.fn-guard gin.compst-var gin.limit-var item-limit t wrld)) (formula (if uterm? (b* (((mv type-formula &) (atc-gen-term-type-formula uterm? type gin.affect gin.inscope gin.prec-tags)) (type-formula (atc-contextualize type-formula gin.context gin.fn gin.fn-guard nil nil nil nil wrld))) (cons 'and (cons exec-formula (cons type-formula 'nil)))) exec-formula)) (hints (cons (cons '"Goal" (cons ':in-theory (cons (cons 'quote (cons (cons 'exec-block-item-when-stmt (cons '(:e block-item-kind) (cons 'not-zp-of-limit-variable (cons '(:e block-item-stmt->get) (cons stmt-thm '(uchar-array-length-of-uchar-array-write schar-array-length-of-schar-array-write ushort-array-length-of-ushort-array-write sshort-array-length-of-sshort-array-write uint-array-length-of-uint-array-write sint-array-length-of-sint-array-write ulong-array-length-of-ulong-array-write slong-array-length-of-slong-array-write ullong-array-length-of-ullong-array-write sllong-array-length-of-sllong-array-write)))))) 'nil)) 'nil))) 'nil)) ((mv event &) (evmac-generate-defthm name :formula formula :hints hints :enable nil))) (mv item item-limit (append stmt-events (list event)) name thm-index names-to-avoid))))
Theorem:
(defthm block-itemp-of-atc-gen-block-item-stmt.item (b* (((mv ?item ?item-limit ?item-events ?item-thm ?thm-index ?names-to-avoid) (atc-gen-block-item-stmt stmt stmt-limit stmt-events stmt-thm uterm? type result new-compst gin state))) (block-itemp item)) :rule-classes :rewrite)
Theorem:
(defthm pseudo-termp-of-atc-gen-block-item-stmt.item-limit (b* (((mv ?item ?item-limit ?item-events ?item-thm ?thm-index ?names-to-avoid) (atc-gen-block-item-stmt stmt stmt-limit stmt-events stmt-thm uterm? type result new-compst gin state))) (pseudo-termp item-limit)) :rule-classes :rewrite)
Theorem:
(defthm pseudo-event-form-listp-of-atc-gen-block-item-stmt.item-events (implies (pseudo-event-form-listp stmt-events) (b* (((mv ?item ?item-limit ?item-events ?item-thm ?thm-index ?names-to-avoid) (atc-gen-block-item-stmt stmt stmt-limit stmt-events stmt-thm uterm? type result new-compst gin state))) (pseudo-event-form-listp item-events))) :rule-classes :rewrite)
Theorem:
(defthm symbolp-of-atc-gen-block-item-stmt.item-thm (b* (((mv ?item ?item-limit ?item-events ?item-thm ?thm-index ?names-to-avoid) (atc-gen-block-item-stmt stmt stmt-limit stmt-events stmt-thm uterm? type result new-compst gin state))) (symbolp item-thm)) :rule-classes :rewrite)
Theorem:
(defthm posp-of-atc-gen-block-item-stmt.thm-index (b* (((mv ?item ?item-limit ?item-events ?item-thm ?thm-index ?names-to-avoid) (atc-gen-block-item-stmt stmt stmt-limit stmt-events stmt-thm uterm? type result new-compst gin state))) (posp thm-index)) :rule-classes (:rewrite :type-prescription))
Theorem:
(defthm symbol-listp-of-atc-gen-block-item-stmt.names-to-avoid (b* (((mv ?item ?item-limit ?item-events ?item-thm ?thm-index ?names-to-avoid) (atc-gen-block-item-stmt stmt stmt-limit stmt-events stmt-thm uterm? type result new-compst gin state))) (symbol-listp names-to-avoid)) :rule-classes :rewrite)