Generate the main Java compilation unit, in the shallow embedding approach.
(atj-gen-shallow-main-cunit guards$ no-aij-types$ java-package$ java-class$ pkgs fns-to-translate call-graph verbose$ wrld) → (mv cunit pkg-class-names fn-method-names)
The compilation unit imports all the AIJ public classes,
since it needs to reference (at least some of) them.
It also imports
We also return the alist from ACL2 package names to Java class names and the alist from ACL2 function symbols to Java method names, which must be eventually passed to the functions that generate the Java test class.
Function:
(defun atj-gen-shallow-main-cunit (guards$ no-aij-types$ java-package$ java-class$ pkgs fns-to-translate call-graph verbose$ wrld) (declare (xargs :guard (and (booleanp guards$) (booleanp no-aij-types$) (stringp java-package$) (stringp java-class$) (string-listp pkgs) (symbol-listp fns-to-translate) (symbol-symbollist-alistp call-graph) (booleanp verbose$) (plist-worldp wrld)))) (declare (xargs :guard (no-duplicatesp-equal pkgs))) (let ((__function__ 'atj-gen-shallow-main-cunit)) (declare (ignorable __function__)) (b* (((mv class pkg-class-names fn-method-names) (atj-gen-shallow-main-class pkgs fns-to-translate call-graph guards$ no-aij-types$ java-class$ verbose$ wrld)) (imports (if no-aij-types$ nil (list (make-jimport :static? nil :target (str::cat *aij-package* ".*")) (make-jimport :static? nil :target "java.math.BigInteger")))) ((run-when verbose$) (cw "~%Generate the main Java compilation unit.~%")) (cunit (make-jcunit :package? java-package$ :imports imports :types (list class)))) (mv cunit pkg-class-names fn-method-names))))
Theorem:
(defthm jcunitp-of-atj-gen-shallow-main-cunit.cunit (b* (((mv ?cunit ?pkg-class-names ?fn-method-names) (atj-gen-shallow-main-cunit guards$ no-aij-types$ java-package$ java-class$ pkgs fns-to-translate call-graph verbose$ wrld))) (jcunitp cunit)) :rule-classes :rewrite)
Theorem:
(defthm string-string-alistp-of-atj-gen-shallow-main-cunit.pkg-class-names (implies (string-listp pkgs) (b* (((mv ?cunit ?pkg-class-names ?fn-method-names) (atj-gen-shallow-main-cunit guards$ no-aij-types$ java-package$ java-class$ pkgs fns-to-translate call-graph verbose$ wrld))) (string-string-alistp pkg-class-names))) :rule-classes :rewrite)
Theorem:
(defthm symbol-string-alistp-of-atj-gen-shallow-main-cunit.fn-method-names (implies (symbol-listp fns-to-translate) (b* (((mv ?cunit ?pkg-class-names ?fn-method-names) (atj-gen-shallow-main-cunit guards$ no-aij-types$ java-package$ java-class$ pkgs fns-to-translate call-graph verbose$ wrld))) (symbol-string-alistp fn-method-names))) :rule-classes :rewrite)