Generate a shallowly embedded ACL2 or call.
(atj-gen-shallow-or-call left-block right-block left-expr right-expr types jvar-tmp-base jvar-tmp-index) → (mv block expr new-jvar-tmp-index)
This is called after translating the arguments to Java. The resulting blocks and expressions are passed as parameters here.
Recall that ATJ's pre-translation
(see atj-pre-translation-disjunctions)
turns (annotated) terms
The parameter
If both operands have type
<left-block> <type> <tmp> = <a-expr>; if (<tmp> == NIL) { <b-block> <tmp> = <b-expr>; }
and the Java expression
Function:
(defun atj-gen-shallow-or-call (left-block right-block left-expr right-expr types jvar-tmp-base jvar-tmp-index) (declare (xargs :guard (and (jblockp left-block) (jblockp right-block) (jexprp left-expr) (jexprp right-expr) (atj-type-listp types) (stringp jvar-tmp-base) (posp jvar-tmp-index)))) (declare (xargs :guard (consp types))) (let ((__function__ 'atj-gen-shallow-or-call)) (declare (ignorable __function__)) (if (and (equal types (list (atj-type-acl2 (atj-atype-boolean)))) (null right-block)) (mv (jblock-fix left-block) (jexpr-binary (jbinop-condor) left-expr right-expr) jvar-tmp-index) (b* (((mv tmp-locvar-block jvar-tmp jvar-tmp-index) (atj-gen-jlocvar-indexed (atj-gen-shallow-jtype types) jvar-tmp-base jvar-tmp-index left-expr)) (if-block (jblock-if (jexpr-binary (jbinop-eq) (jexpr-name jvar-tmp) (atj-gen-symbol nil t nil)) (append right-block (jblock-asg-name jvar-tmp right-expr))))) (mv (append (jblock-fix left-block) tmp-locvar-block if-block) (jexpr-name jvar-tmp) jvar-tmp-index)))))
Theorem:
(defthm jblockp-of-atj-gen-shallow-or-call.block (b* (((mv common-lisp::?block ?expr ?new-jvar-tmp-index) (atj-gen-shallow-or-call left-block right-block left-expr right-expr types jvar-tmp-base jvar-tmp-index))) (jblockp block)) :rule-classes :rewrite)
Theorem:
(defthm jexprp-of-atj-gen-shallow-or-call.expr (b* (((mv common-lisp::?block ?expr ?new-jvar-tmp-index) (atj-gen-shallow-or-call left-block right-block left-expr right-expr types jvar-tmp-base jvar-tmp-index))) (jexprp expr)) :rule-classes :rewrite)
Theorem:
(defthm posp-of-atj-gen-shallow-or-call.new-jvar-tmp-index (implies (posp jvar-tmp-index) (b* (((mv common-lisp::?block ?expr ?new-jvar-tmp-index) (atj-gen-shallow-or-call left-block right-block left-expr right-expr types jvar-tmp-base jvar-tmp-index))) (posp new-jvar-tmp-index))) :rule-classes :rewrite)