• 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-pre-translation
                  • Atj-pre-translation-array-analysis
                  • Atj-pre-translation-type-annotation
                  • Atj-pre-translation-var-reuse
                  • Atj-pre-translate
                  • Atj-pre-translation-multiple-values
                  • Atj-pre-translation-no-aij-types-analysis
                  • Atj-pre-translation-var-renaming
                  • Atj-pre-translation-remove-return-last
                  • Atj-pre-translation-disjunctions
                    • Atj-restore-or-calls-in-term
                      • Atj-restore-or-calls-in-terms
                  • Atj-pre-translation-trivial-vars
                  • Atj-pre-translation-conjunctions
                  • Atj-pre-translation-unused-vars
                  • Atj-pre-translation-remove-dead-if-branches
                • 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-pre-translation-disjunctions

Atj-restore-or-calls-in-term

Restore or calls in a translated term.

Signature
(atj-restore-or-calls-in-term term) → new-term
Arguments
term — Guard (pseudo-termp term).
Returns
new-term — Type (pseudo-termp new-term).

Recall that, at this point, terms have already been type-annotated. Thus, we must take the type annotations into account here, as we recognize and transform the terms.

In general, the test of an if may be type-annotated differently from its branches, even when the unannotated test is the same as a branch. The reason is that the type annotation step ensures that the branches have the same type (by inserting suitable type conversions). Thus, even though an untranslated (or a b) is translated to an unannotated (if a a b), then its annotated version may be (C1 (if (C2 a) (C3 a) (C4 b))) where C2 and C3 are different conversions. Thus, we need to unwrap the annotated test and `then' branch before comparing them for equality.

When the unwrapped test is equal to the unwrapped `then' branch, we generate the annotated (C1 (or (C3 a) (C4 b))). It is important that we take the annotated `then' branch, not the annotated test, because it is the type of the annotated `then' branch that matters with regard to the result of the disjunction.

Theorem: return-type-of-atj-restore-or-calls-in-term.new-term

(defthm return-type-of-atj-restore-or-calls-in-term.new-term
  (b* ((?new-term (atj-restore-or-calls-in-term term)))
    (pseudo-termp new-term))
  :rule-classes :rewrite)

Theorem: return-type-of-atj-restore-or-calls-in-terms.new-terms

(defthm return-type-of-atj-restore-or-calls-in-terms.new-terms
  (b* ((?new-terms (atj-restore-or-calls-in-terms terms)))
    (pseudo-term-listp new-terms))
  :rule-classes :rewrite)

Theorem: len-of-atj-restore-or-calls-in-terms

(defthm len-of-atj-restore-or-calls-in-terms
  (b* ((?new-terms (atj-restore-or-calls-in-terms terms)))
    (equal (len new-terms) (len terms))))

Subtopics

Atj-restore-or-calls-in-terms