• 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-common-code-generation
                • Atj-shallow-quoted-constant-generation
                • Atj-pre-translation
                • Atj-gen-everything
                • Atj-name-translation
                  • Atj-var-to-jvar
                  • Atj-char-to-jchars-id
                  • Atj-fn-to-method
                  • Atj-pkg-to-class
                  • Atj-fns-to-methods
                  • *atj-disallowed-class-names*
                  • Atj-pkgs-to-classes
                  • *atj-predefined-method-names*
                  • Atj-chars-to-jchars-id
                  • *atj-disallowed-jvar-names*
                  • Atj-get-pkg-class-name
                  • Atj-get-fn-method-name
                  • Atj-var-add-index
                    • *atj-disallowed-method-names*
                  • 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-name-translation

    Atj-var-add-index

    Append a numeric index to a variable.

    Signature
    (atj-var-add-index var index) → new-var
    Arguments
    var — Guard (symbolp var).
    index — Guard (natp index).
    Returns
    new-var — Type (symbolp new-var).

    This is used to make Java variables unique. The index is appended to the result of atj-var-to-jvar, as explained there.

    Definitions and Theorems

    Function: atj-var-add-index

    (defun atj-var-add-index (var index)
      (declare (xargs :guard (and (symbolp var) (natp index))))
      (let ((__function__ 'atj-var-add-index))
        (declare (ignorable __function__))
        (b* ((index-chars (if (= index 0)
                              nil
                            (append (list #\$)
                                    (str::nat-to-dec-chars index))))
             (index-string (implode index-chars)))
          (add-suffix var index-string))))

    Theorem: symbolp-of-atj-var-add-index

    (defthm symbolp-of-atj-var-add-index
      (b* ((new-var (atj-var-add-index var index)))
        (symbolp new-var))
      :rule-classes :rewrite)