• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • C
        • Soft
        • Bv
        • Imp-language
        • Ethereum
        • 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
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Atj-shallow-code-generation

    Atj-gen-shallow-mv-class-name

    Generate the name of the mv class for the given types.

    Signature
    (atj-gen-shallow-mv-class-name types) → class-name
    Arguments
    types — Guard (atj-type-listp types).
    Returns
    class-name — Type (stringp class-name).

    Since Java does not allow methods to return multiple values directly, we need to create, for ACL2 functions that return mv results, Java classes that group these multiple values into single objects. There is a different class for each tuple of types of the multiple values. Here we generate the names of these classes, based on the ATJ types of the multiple values.

    These classes have names of the form MV_A_B_C_..., where A, B, C, etc. correspond to the ATJ types, or more precisely to their Java types counterparts. For AIJ classes, we use the class names themselves. For Java primitive types, we use the primitive types themselves. For Java primitive array types, we use the element types followed by array. For instance, for the ATJ types (:asymbol :jint :jbyte[]), the class name is MV_Acl2Symbol_int_bytearray.

    The list of ATJ types must have at least two elements. It does not make sense to have a multiple value consisting of zero or one values.

    Definitions and Theorems

    Function: atj-gen-shallow-mv-class-name-aux

    (defun atj-gen-shallow-mv-class-name-aux (types)
      (declare (xargs :guard (atj-type-listp types)))
      (let ((__function__ 'atj-gen-shallow-mv-class-name-aux))
        (declare (ignorable __function__))
        (b* (((when (endp types)) "")
             (type (car types))
             (jtype (atj-type-to-jitype type))
             (first (cond ((equal jtype (jtype-boolean))
                           "_boolean")
                          ((equal jtype (jtype-char)) "_char")
                          ((equal jtype (jtype-byte)) "_byte")
                          ((equal jtype (jtype-short)) "_short")
                          ((equal jtype (jtype-int)) "_int")
                          ((equal jtype (jtype-long)) "_long")
                          ((equal jtype (jtype-float)) "_float")
                          ((equal jtype (jtype-double)) "_double")
                          ((equal jtype (jtype-array (jtype-boolean)))
                           "_booleanarray")
                          ((equal jtype (jtype-array (jtype-char)))
                           "_chararray")
                          ((equal jtype (jtype-array (jtype-byte)))
                           "_bytearray")
                          ((equal jtype (jtype-array (jtype-short)))
                           "_shortarray")
                          ((equal jtype (jtype-array (jtype-int)))
                           "_intarray")
                          ((equal jtype (jtype-array (jtype-long)))
                           "_longarray")
                          ((equal jtype (jtype-array (jtype-float)))
                           "_floatarray")
                          ((equal jtype (jtype-array (jtype-double)))
                           "_doublearray")
                          (t (str::cat "_" (jtype-class->name jtype)))))
             (rest (atj-gen-shallow-mv-class-name-aux (cdr types))))
          (str::cat first rest))))

    Theorem: stringp-of-atj-gen-shallow-mv-class-name-aux

    (defthm stringp-of-atj-gen-shallow-mv-class-name-aux
     (b* ((class-name-suffix (atj-gen-shallow-mv-class-name-aux types)))
       (stringp class-name-suffix))
     :rule-classes :rewrite)

    Function: atj-gen-shallow-mv-class-name

    (defun atj-gen-shallow-mv-class-name (types)
      (declare (xargs :guard (atj-type-listp types)))
      (declare (xargs :guard (>= (len types) 2)))
      (let ((__function__ 'atj-gen-shallow-mv-class-name))
        (declare (ignorable __function__))
        (str::cat "MV"
                  (atj-gen-shallow-mv-class-name-aux types))))

    Theorem: stringp-of-atj-gen-shallow-mv-class-name

    (defthm stringp-of-atj-gen-shallow-mv-class-name
      (b* ((class-name (atj-gen-shallow-mv-class-name types)))
        (stringp class-name))
      :rule-classes :rewrite)