• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • 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
          • 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-jlocvar-indexed

    Generate a Java declaration for an indexed local variable.

    Signature
    (atj-gen-jlocvar-indexed var-type var-base var-index var-init?) 
      → 
    (mv locvar-block var-name new-var-index)
    Arguments
    var-type — Type of the local variable.
        Guard (jtypep var-type).
    var-base — Base name of the local variable.
        Guard (stringp var-base).
    var-index — Index of the local variable.
        Guard (natp var-index).
    var-init? — Initializer of the local variable.
        Guard (maybe-jexprp var-init?).
    Returns
    locvar-block — Type (jblockp locvar-block).
    var-name — The name of the local variable.
        Type (stringp var-name).
    new-var-index — The updated variable index.
        Type (natp new-var-index), given (natp var-index).

    The name of the local variable to use is obtained by adding the next variable index after the base name. The index is incremented and returned because it has been used, and the next variable with the same name must use the next index.

    For convenience of the callers of this function, the local variable declaration is returned in a singleton block.

    Definitions and Theorems

    Function: atj-gen-jlocvar-indexed

    (defun atj-gen-jlocvar-indexed
           (var-type var-base var-index var-init?)
     (declare (xargs :guard (and (jtypep var-type)
                                 (stringp var-base)
                                 (natp var-index)
                                 (maybe-jexprp var-init?))))
     (let ((__function__ 'atj-gen-jlocvar-indexed))
       (declare (ignorable __function__))
       (b* ((var-name (str::cat var-base (nat-to-dec-string var-index)))
            (var-index (1+ var-index))
            (locvar-block (jblock-locvar var-type var-name var-init?)))
         (mv locvar-block var-name var-index))))

    Theorem: jblockp-of-atj-gen-jlocvar-indexed.locvar-block

    (defthm jblockp-of-atj-gen-jlocvar-indexed.locvar-block
      (b* (((mv ?locvar-block ?var-name ?new-var-index)
            (atj-gen-jlocvar-indexed
                 var-type var-base var-index var-init?)))
        (jblockp locvar-block))
      :rule-classes :rewrite)

    Theorem: stringp-of-atj-gen-jlocvar-indexed.var-name

    (defthm stringp-of-atj-gen-jlocvar-indexed.var-name
      (b* (((mv ?locvar-block ?var-name ?new-var-index)
            (atj-gen-jlocvar-indexed
                 var-type var-base var-index var-init?)))
        (stringp var-name))
      :rule-classes :rewrite)

    Theorem: natp-of-atj-gen-jlocvar-indexed.new-var-index

    (defthm natp-of-atj-gen-jlocvar-indexed.new-var-index
      (implies (natp var-index)
               (b* (((mv ?locvar-block ?var-name ?new-var-index)
                     (atj-gen-jlocvar-indexed
                          var-type var-base var-index var-init?)))
                 (natp new-var-index)))
      :rule-classes :rewrite)

    Theorem: posp-of-atj-gen-jlocvar-indexed-new-var-index

    (defthm posp-of-atj-gen-jlocvar-indexed-new-var-index
     (implies
      (posp var-index)
      (posp
       (mv-nth 2
               (atj-gen-jlocvar-indexed var-type
                                        var-base var-index var-init)))))