• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • ACL2
    • Macro-libraries
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
          • Atj
            • Atj-implementation
              • Atj-types
              • Atj-java-primitive-array-model
              • Atj-java-abstract-syntax
              • Atj-input-processing
              • Atj-java-pretty-printer
              • Atj-code-generation
                • Atj-gen-test-method
                • Atj-shallow-code-generation
                  • Atj-gen-shallow-term-fns
                  • String-jmethodlist-alistp
                  • Atj-gen-shallow-fndef-method
                  • String-jfieldlist-alistp
                  • Atj-gen-shallow-test-code
                  • Atj-adapt-expr-to-type
                  • Atj-gen-shallow-fn-call
                  • Atj-check-marked-annotated-mv-let-call
                  • Atj-gen-shallow-main-class
                  • Atj-gen-shallow-fnnative-method
                  • Atj-gen-shallow-synonym-method
                  • Atj-gen-shallow-if-call
                  • Atj-gen-shallow-and-call
                  • Atj-gen-shallow-pkg-methods
                  • Atj-convert-expr-to-jprim
                  • Atj-gen-shallow-or-call
                  • Atj-convert-expr-from-jprimarr-method
                  • Atj-adapt-expr-to-types
                  • Atj-gen-shallow-all-pkg-methods
                  • Atj-convert-expr-to-jprimarr-method
                  • Atj-gen-shallow-fndef-all-methods
                  • Atj-convert-expr-from-jprim
                  • Atj-gen-shallow-mv-class
                  • Atj-gen-shallow-main-cunit
                    • Atj-gen-shallow-fndef-methods
                    • Atj-gen-shallow-mv-class-name
                    • Atj-shallow-fns-that-may-throw
                    • Atj-gen-shallow-term
                    • Atj-gen-shallow-let-bindings
                    • Atj-gen-shallow-fn-methods
                    • Atj-gen-shallow-jprimarr-new-init-call
                    • Atj-gen-shallow-fnname
                    • Atj-gen-shallow-all-fn-methods
                    • Atj-gen-shallow-not-call
                    • Atj-fnnative-method-name
                    • Atj-gen-shallow-mv-let
                    • Atj-gen-shallow-jprim-constr-call
                    • Atj-gen-shallow-jprimarr-write-call
                    • Atj-gen-shallow-fnnative-all-methods
                    • Atj-gen-shallow-pkg-class
                    • Atj-gen-shallow-jprimarr-length-call
                    • Atj-gen-shallow-pkg-fields
                    • Atj-all-mv-output-types
                    • Atj-gen-shallow-mv-call
                    • Atj-gen-shallow-jprim-binop-call
                    • Atj-gen-shallow-jprim-conv-call
                    • Atj-gen-shallow-primarray-write-method
                    • Atj-gen-shallow-mv-fields
                    • Atj-gen-shallow-jprimarr-read-call
                    • Atj-gen-shallow-jprimarr-new-len-call
                    • Atj-gen-shallow-jprimarr-conv-tolist-call
                    • Atj-gen-shallow-jprimarr-conv-fromlist-call
                    • Atj-gen-shallow-synonym-all-methods
                    • Atj-gen-shallow-jprim-deconstr-call
                    • Atj-gen-shallow-all-pkg-fields
                    • Atj-gen-shallow-test-code-asgs
                    • Atj-gen-shallow-lambda
                    • Atj-gen-shallow-jprim-unop-call
                    • Atj-jprim-binop-fn-to-jbinop
                    • Atj-gen-shallow-mv-asgs
                    • Atj-gen-shallow-env-class
                    • Atj-gen-shallow-mv-params
                    • Atj-gen-shallow-fnnative-methods
                    • Atj-gen-shallow-pkg-classes
                    • Atj-gen-shallow-env-cunit
                    • Atj-gen-shallow-all-synonym-methods
                    • Atj-convert-expr-to-jprimarr
                    • Atj-convert-expr-from-jprimarr
                    • Atj-jprim-constr-fn-of-qconst-to-expr
                    • Atj-gen-shallow-test-code-mv-asgs
                    • Atj-gen-shallow-synonym-methods
                    • Atj-gen-shallow-synonym-method-params
                    • Atj-convert-expr-to-jprimarr-method-name
                    • Atj-convert-expr-from-jprimarr-method-name
                    • Atj-jexpr-list-to-3-jexprs
                    • Atj-jblock-list-to-3-jblocks
                    • Atj-gen-shallow-test-code-comps
                    • Atj-jprim-conv-fn-to-jtype
                    • Atj-gen-shallow-terms
                    • Atj-gen-shallow-mv-field-name
                    • Atj-adapt-exprs-to-types
                    • Atj-jblock-list-to-2-jblocks
                    • Atj-gen-shallow-primarray-write-methods
                    • Atj-gen-shallow-mv-classes
                    • Atj-gen-shallow-jtype
                    • Atj-gen-shallow-build-method
                    • Atj-jexpr-list-to-2-jexprs
                    • Atj-jprimarr-write-to-method-name
                    • Atj-gen-shallow-all-jprimarr-conv-methods
                    • Atj-jprimarr-new-len-fn-to-comp-jtype
                    • Atj-jprimarr-new-init-fn-to-comp-jtype
                    • Atj-jprim-unop-fn-to-junop
                    • *atj-gen-cond-exprs*
                    • Atj-primarray-write-method-name
                    • Atj-gen-shallow-jprimarr-fromlist-methods
                    • Atj-gen-shallow-jprimarr-tolist-methods
                    • Atj-gen-shallow-mv-classes-guard
                    • *atj-mv-singleton-field-name*
                    • *atj-mv-factory-method-name*
                  • Atj-common-code-generation
                  • Atj-shallow-quoted-constant-generation
                  • Atj-pre-translation
                  • Atj-gen-everything
                  • Atj-name-translation
                  • Atj-gen-test-cunit
                  • Atj-gen-test-class
                  • Atj-gen-main-file
                  • Atj-post-translation
                  • Atj-deep-code-generation
                  • Atj-gen-test-methods
                  • Atj-gen-test-file
                  • Atj-gen-env-file
                  • Atj-gen-output-subdir
                • Atj-java-primitives
                • Atj-java-primitive-arrays
                • Atj-type-macros
                • Atj-java-syntax-operations
                • Atj-fn
                • Atj-library-extensions
                • Atj-java-input-types
                • Atj-test-structures
                • Aij-notions
                • Atj-macro-definition
              • Atj-tutorial
            • Aij
            • Language
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Atj-shallow-code-generation

    Atj-gen-shallow-main-cunit

    Generate the main Java compilation unit, in the shallow embedding approach.

    Signature
    (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)
    Arguments
    guards$ — Guard (booleanp guards$).
    no-aij-types$ — Guard (booleanp no-aij-types$).
    java-package$ — Guard (stringp java-package$).
    java-class$ — Guard (stringp java-class$).
    pkgs — Guard (string-listp pkgs).
    fns-to-translate — Guard (symbol-listp fns-to-translate).
    call-graph — Guard (symbol-symbollist-alistp call-graph).
    verbose$ — Guard (booleanp verbose$).
    wrld — Guard (plist-worldp wrld).
    Returns
    cunit — Type (jcunitp cunit).
    pkg-class-names — Type (string-string-alistp pkg-class-names), given (string-listp pkgs).
    fn-method-names — Type (symbol-string-alistp fn-method-names), given (symbol-listp fns-to-translate).

    The compilation unit imports all the AIJ public classes, since it needs to reference (at least some of) them. It also imports BigInteger, used to build certain quoted constants. However, if the :no-aij-types input is t, there are no 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.

    Definitions and Theorems

    Function: atj-gen-shallow-main-cunit

    (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: jcunitp-of-atj-gen-shallow-main-cunit.cunit

    (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: string-string-alistp-of-atj-gen-shallow-main-cunit.pkg-class-names

    (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: symbol-string-alistp-of-atj-gen-shallow-main-cunit.fn-method-names

    (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)