• 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-type-annotate-term
                    • Atj-check-annotated-mv-let-call
                    • Atj-type-conv-allowed-p
                    • Atj-type-annotate-formals+body
                    • Atj-type-rewrap-term
                    • Atj-type-conv
                    • Atj-type-unwrap-term
                      • Atj-type-id
                      • Atj-type-wrap-term
                      • Atj-types-id
                      • Atj-types-of-conv
                      • Atj-types-conv-allowed-p
                      • Atj-type-annotate-var
                      • Atj-type-unannotate-var
                      • Atj-type-of-id
                      • Atj-types-of-id
                      • Atj-type-annotate-mv-nth-terms
                      • Atj-type-annotate-vars
                      • Atj-select-mv-term-types
                      • Atj-type-unannotate-vars
                      • Atj-type-rewrap-terms
                      • Atj-type-wrapped-variable-p
                    • 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-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-type-annotation

    Atj-type-unwrap-term

    Unwrap an ACL2 term wrapped by atj-type-wrap-term.

    Signature
    (atj-type-unwrap-term term) 
      → 
    (mv unwrapped-term src-types dst-types)
    Arguments
    term — Guard (pseudo-termp term).
    Returns
    unwrapped-term — Type (pseudo-termp unwrapped-term).
    src-types — Type (atj-type-listp src-types).
    dst-types — Type (atj-type-listp dst-types).

    This is essentially the inverse function, except that it always returns a list of destination types, never nil.

    Definitions and Theorems

    Function: atj-type-unwrap-term

    (defun atj-type-unwrap-term (term)
     (declare (xargs :guard (pseudo-termp term)))
     (let ((__function__ 'atj-type-unwrap-term))
       (declare (ignorable __function__))
       (b* ((term (if (mbt (pseudo-termp term)) term nil))
            ((when (or (variablep term)
                       (fquotep term)
                       (flambda-applicationp term)))
             (raise "Internal error: the term ~x0 has the wrong format."
                    term)
             (mv nil (list (atj-type-irrelevant))
                 (list (atj-type-irrelevant))))
            (fn (ffn-symb term))
            ((when (flambdap fn))
             (raise "Internal error: the term ~x0 has the wrong format."
                    term)
             (mv nil (list (atj-type-irrelevant))
                 (list (atj-type-irrelevant))))
            ((mv src-types dst-types)
             (atj-types-of-conv fn)))
         (mv (fargn term 1)
             src-types dst-types))))

    Theorem: pseudo-termp-of-atj-type-unwrap-term.unwrapped-term

    (defthm pseudo-termp-of-atj-type-unwrap-term.unwrapped-term
      (b* (((mv ?unwrapped-term ?src-types ?dst-types)
            (atj-type-unwrap-term term)))
        (pseudo-termp unwrapped-term))
      :rule-classes :rewrite)

    Theorem: atj-type-listp-of-atj-type-unwrap-term.src-types

    (defthm atj-type-listp-of-atj-type-unwrap-term.src-types
      (b* (((mv ?unwrapped-term ?src-types ?dst-types)
            (atj-type-unwrap-term term)))
        (atj-type-listp src-types))
      :rule-classes :rewrite)

    Theorem: atj-type-listp-of-atj-type-unwrap-term.dst-types

    (defthm atj-type-listp-of-atj-type-unwrap-term.dst-types
      (b* (((mv ?unwrapped-term ?src-types ?dst-types)
            (atj-type-unwrap-term term)))
        (atj-type-listp dst-types))
      :rule-classes :rewrite)

    Theorem: consp-of-atj-type-unwrap-term.src-types

    (defthm consp-of-atj-type-unwrap-term.src-types
      (b* (((mv ?unwrapped-term ?src-types ?dst-types)
            (atj-type-unwrap-term term)))
        (consp src-types))
      :rule-classes :type-prescription)

    Theorem: consp-of-atj-type-unwrap-term.dst-types

    (defthm consp-of-atj-type-unwrap-term.dst-types
      (b* (((mv ?unwrapped-term ?src-types ?dst-types)
            (atj-type-unwrap-term term)))
        (consp dst-types))
      :rule-classes :type-prescription)

    Theorem: acl2-count-of-atj-type-unwrap-term-linear

    (defthm acl2-count-of-atj-type-unwrap-term-linear
      (b* (((mv ?unwrapped-term ?src-types ?dst-types)
            (atj-type-unwrap-term term)))
        (implies unwrapped-term
                 (< (acl2-count unwrapped-term)
                    (acl2-count term))))
      :rule-classes :linear)

    Theorem: pseudo-term-count-of-atj-type-unwrap-term

    (defthm pseudo-term-count-of-atj-type-unwrap-term
      (b* (((mv ?unwrapped-term ?src-types ?dst-types)
            (atj-type-unwrap-term term)))
        (implies (not (pseudo-term-case unwrapped-term :null))
                 (< (pseudo-term-count unwrapped-term)
                    (pseudo-term-count term))))
      :rule-classes :linear)