Post-translate a Java method body generated from an ACL2 function.
We always fold
If the method is tail-recursive,
which is signaled by the
The other post-translation steps are always performed. These are the post-translation steps that operate at the level of individual method bodies.
Function:
(defun atj-post-translate-body (name params body tailrecp) (declare (xargs :guard (and (stringp name) (jparam-listp params) (jblockp body) (booleanp tailrecp)))) (let ((__function__ 'atj-post-translate-body)) (declare (ignorable __function__)) (b* ((body (atj-fold-returns body)) (body (if tailrecp (atj-elim-tailrec name params body) body)) (body (atj-lift-loop-test body)) (body (atj-remove-continue-in-jblock body)) (body (atj-remove-array-write-calls body)) (body (atj-simplify-conds-in-jblock body))) body)))
Theorem:
(defthm jblockp-of-atj-post-translate-body (implies (and (stringp name) (jparam-listp params) (jblockp body) (booleanp tailrecp)) (b* ((new-body (atj-post-translate-body name params body tailrecp))) (jblockp new-body))) :rule-classes :rewrite)