• 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
        • 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-common-code-generation
                  • Atj-gen-value
                  • Atj-chars-to-jhexcodes
                  • Atj-gen-test-value
                    • Atj-gen-test-main-method
                    • Atj-gen-value-flat
                    • Atj-gen-test-values
                    • Atj-gen-jlocvar-indexed
                    • Atj-gen-pkg-method
                    • Atj-gen-symbol
                    • Atj-gen-jstring
                    • Atj-gen-init-method
                    • Atj-gen-char
                    • Atj-gen-string
                    • Atj-gen-pkg-name
                    • Atj-gen-integer
                    • Atj-gen-test-method-name
                    • Atj-gen-paramlist
                    • Atj-gen-pkg-method-name
                    • Atj-gen-run-tests
                    • Atj-gen-jshort-array
                    • Atj-gen-jboolean-array
                    • Atj-gen-test-failures-field
                    • Atj-gen-pkgs
                    • Atj-gen-jlong-array
                    • Atj-gen-jint-array
                    • Atj-gen-jchar-array
                    • Atj-gen-jchar
                    • Atj-gen-jbyte-array
                    • Atj-char-to-jhexcode
                    • Atj-gen-pkg-methods
                    • Atj-gen-number
                    • Atj-gen-symbols
                    • Atj-gen-static-initializer
                    • Atj-gen-rational
                    • Atj-gen-jlong
                    • Atj-gen-jboolean
                    • Atj-gen-jbigint
                    • Atj-gen-jshort
                    • Atj-gen-jint
                    • Atj-gen-jbyte
                    • *atj-gen-pkg-name-alist*
                  • 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
          • 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-common-code-generation

    Atj-gen-test-value

    Generate the Java code for a test value.

    Signature
    (atj-gen-test-value tvalue jvar-value-base 
                        jvar-value-index deep$ guards$) 
     
      → 
    (mv block expr type new-jvar-value-index)
    Arguments
    tvalue — Guard (atj-test-valuep tvalue).
    jvar-value-base — Guard (stringp jvar-value-base).
    jvar-value-index — Guard (posp jvar-value-index).
    deep$ — Guard (booleanp deep$).
    guards$ — Guard (booleanp guards$).
    Returns
    block — Type (jblockp block).
    expr — Type (jexprp expr).
    type — Type (atj-typep type).
    new-jvar-value-index — Type (posp new-jvar-value-index), given (posp jvar-value-index).

    We use atj-gen-value for a test values; this is why this function has the jvar-value-... arguments and returns the new-jvar-value-index result.

    For j test values, we use atj-gen-jboolean and similar functions.

    In both cases, we also return the ATJ type of the expression. In the shallow embedding, this will determine the Java type of the local variable that stores the value.

    Definitions and Theorems

    Function: atj-gen-test-value

    (defun atj-gen-test-value (tvalue jvar-value-base
                                      jvar-value-index deep$ guards$)
     (declare (xargs :guard (and (atj-test-valuep tvalue)
                                 (stringp jvar-value-base)
                                 (posp jvar-value-index)
                                 (booleanp deep$)
                                 (booleanp guards$))))
     (let ((__function__ 'atj-gen-test-value))
      (declare (ignorable __function__))
      (atj-test-value-case
       tvalue :acl2
       (b* (((mv block expr jvar-value-index)
             (atj-gen-value tvalue.get jvar-value-base
                            jvar-value-index deep$ guards$)))
         (mv block
             expr (atj-type-of-value tvalue.get)
             jvar-value-index))
       :jboolean (mv nil
                     (atj-gen-jboolean (boolean-value->bool tvalue.get))
                     (atj-type-jprim (primitive-type-boolean))
                     jvar-value-index)
       :jchar (mv nil
                  (atj-gen-jchar (char-value->nat tvalue.get))
                  (atj-type-jprim (primitive-type-char))
                  jvar-value-index)
       :jbyte (mv nil
                  (atj-gen-jbyte (byte-value->int tvalue.get))
                  (atj-type-jprim (primitive-type-byte))
                  jvar-value-index)
       :jshort (mv nil
                   (atj-gen-jshort (short-value->int tvalue.get))
                   (atj-type-jprim (primitive-type-short))
                   jvar-value-index)
       :jint (mv nil
                 (atj-gen-jint (int-value->int tvalue.get))
                 (atj-type-jprim (primitive-type-int))
                 jvar-value-index)
       :jlong (mv nil
                  (atj-gen-jlong (long-value->int tvalue.get))
                  (atj-type-jprim (primitive-type-long))
                  jvar-value-index)
       :jboolean[] (mv nil (atj-gen-jboolean-array tvalue.get)
                       (atj-type-jprimarr (primitive-type-boolean))
                       jvar-value-index)
       :jchar[] (mv nil (atj-gen-jchar-array tvalue.get)
                    (atj-type-jprimarr (primitive-type-char))
                    jvar-value-index)
       :jbyte[] (mv nil (atj-gen-jbyte-array tvalue.get)
                    (atj-type-jprimarr (primitive-type-byte))
                    jvar-value-index)
       :jshort[] (mv nil (atj-gen-jshort-array tvalue.get)
                     (atj-type-jprimarr (primitive-type-short))
                     jvar-value-index)
       :jint[] (mv nil (atj-gen-jint-array tvalue.get)
                   (atj-type-jprimarr (primitive-type-int))
                   jvar-value-index)
       :jlong[] (mv nil (atj-gen-jlong-array tvalue.get)
                    (atj-type-jprimarr (primitive-type-long))
                    jvar-value-index))))

    Theorem: jblockp-of-atj-gen-test-value.block

    (defthm jblockp-of-atj-gen-test-value.block
      (b* (((mv common-lisp::?block
                ?expr common-lisp::?type
                ?new-jvar-value-index)
            (atj-gen-test-value tvalue jvar-value-base
                                jvar-value-index deep$ guards$)))
        (jblockp block))
      :rule-classes :rewrite)

    Theorem: jexprp-of-atj-gen-test-value.expr

    (defthm jexprp-of-atj-gen-test-value.expr
      (b* (((mv common-lisp::?block
                ?expr common-lisp::?type
                ?new-jvar-value-index)
            (atj-gen-test-value tvalue jvar-value-base
                                jvar-value-index deep$ guards$)))
        (jexprp expr))
      :rule-classes :rewrite)

    Theorem: atj-typep-of-atj-gen-test-value.type

    (defthm atj-typep-of-atj-gen-test-value.type
      (b* (((mv common-lisp::?block
                ?expr common-lisp::?type
                ?new-jvar-value-index)
            (atj-gen-test-value tvalue jvar-value-base
                                jvar-value-index deep$ guards$)))
        (atj-typep type))
      :rule-classes :rewrite)

    Theorem: posp-of-atj-gen-test-value.new-jvar-value-index

    (defthm posp-of-atj-gen-test-value.new-jvar-value-index
      (implies
           (posp jvar-value-index)
           (b* (((mv common-lisp::?block
                     ?expr common-lisp::?type
                     ?new-jvar-value-index)
                 (atj-gen-test-value tvalue jvar-value-base
                                     jvar-value-index deep$ guards$)))
             (posp new-jvar-value-index)))
      :rule-classes :rewrite)