• 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-common-code-generation
                • Atj-shallow-quoted-constant-generation
                  • Atj-qconstants-p
                  • Atj-gen-shallow-symbol
                  • Atj-gen-shallow-cons-field-name
                    • Atj-gen-shallow-symbol-field-name
                    • Atj-add-qconstant
                    • Atj-add-qconstants-in-term
                    • Atj-gen-shallow-symbol-field
                    • Atj-gen-shallow-rational-id-part
                    • Atj-gen-shallow-number-id-part
                    • Atj-gen-shallow-number-field
                    • Atj-gen-shallow-value
                    • Atj-gen-shallow-cons-fields
                    • Atj-gen-shallow-cons-field
                    • Atj-gen-shallow-string
                    • Atj-gen-shallow-integer-id-part
                    • Atj-gen-shallow-string-field
                    • Atj-gen-shallow-number-field-name
                    • Atj-gen-shallow-char-field
                    • Atj-gen-shallow-char
                    • Atj-gen-shallow-string-field-name
                    • Atj-gen-shallow-cons
                    • Atj-gen-shallow-char-field-name
                    • Atj-gen-shallow-symbol-fields
                    • Atj-gen-shallow-string-fields
                    • Atj-gen-shallow-number-fields
                    • Atj-gen-shallow-number
                    • Atj-gen-shallow-char-fields
                  • 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-quoted-constant-generation

    Atj-gen-shallow-cons-field-name

    Generate the name of the Java field for an ACL2 quoted cons pair.

    Signature
    (atj-gen-shallow-cons-field-name cons qpairs) → name
    Arguments
    cons — Guard (consp cons).
    qpairs — Guard (cons-pos-alistp qpairs).
    Returns
    name — Type (stringp name).

    When this function is called, the cons pair in question has already been collected in an atj-qconstants record, whose alist from cons pairs to indices is passed to this function. We prepend $P_ (for `pair') to the index associated to the cons pair in the alist.

    Since cons pairs may be potentially large (unlike atoms), there is no easy way to generate a good field name based on the value, unlike in atj-gen-shallow-number-field-name and others. Thus, as we collect cons pairs from terms, we assign unique indices to them, stored in the alist, and we use the index as the name for the field that contains the associated cons pair.

    Definitions and Theorems

    Function: atj-gen-shallow-cons-field-name

    (defun atj-gen-shallow-cons-field-name (cons qpairs)
      (declare (xargs :guard (and (consp cons)
                                  (cons-pos-alistp qpairs))))
      (let ((__function__ 'atj-gen-shallow-cons-field-name))
        (declare (ignorable __function__))
        (b* ((cons+index (assoc-equal cons qpairs))
             ((unless (consp cons+index))
              (raise "Internal error: no index for CONS pair ~x0."
                     cons)
              "")
             (index (cdr cons+index)))
          (str::cat "$P_" (nat-to-dec-string index)))))

    Theorem: stringp-of-atj-gen-shallow-cons-field-name

    (defthm stringp-of-atj-gen-shallow-cons-field-name
      (b* ((name (atj-gen-shallow-cons-field-name cons qpairs)))
        (stringp name))
      :rule-classes :rewrite)