• 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
          • Syntax-for-tools
          • Atc
          • Transformation-tools
            • Simpadd0
            • Proof-generation
            • Split-gso
            • Wrap-fn
              • Wrap-fn-implementation
                • Init-declor-list-wrap-fn-add-wrapper-def
                • Declor-wrap-fn-add-wrapper-def
                • Ext-declon-wrap-fn-add-wrapper-def
                • Fundef-wrap-fn-add-wrapper-def
                • Declon-wrap-fn-add-wrapper-def
                • Ext-declon-list-wrap-fn
                • Wrap-fn-process-param-declon-list-loop
                • Filepath-transunit-map-wrap-fn
                • Wrap-fn-process-param-declon-list
                • Transunit-wrap-fn
                  • Transunit-ensemble-wrap-fn
                  • Code-ensemble-wrap-fn
                  • Code-ensemble-wrap-fn-multiple
                  • Declor-wrap-fn-make-wrapper
                  • Dirdeclor-wrap-fn-make-wrapper
                  • Wrap-fn-input-processing
                  • Wrap-fn-event-generation
              • Constant-propagation
              • Specialize
              • Split-fn
              • Split-fn-when
              • Split-all-gso
              • Copy-fn
              • Variables-in-computation-states
              • Rename
              • Utilities
              • Proof-generation-theorems
              • Input-processing
            • Language
            • Representation
            • Insertion-sort
            • Pack
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • 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
    • Wrap-fn-implementation

    Transunit-wrap-fn

    Transform a translation unit.

    Signature
    (transunit-wrap-fn transunit target-name wrapper-name? blacklist) 
      → 
    (mv er? warnings? foundp transunit$)
    Arguments
    transunit — Guard (transunitp transunit).
    target-name — Guard (identp target-name).
    wrapper-name? — Guard (ident-optionp wrapper-name?).
    blacklist — Guard (ident-setp blacklist).
    Returns
    er? — Type (maybe-msgp er?).
    warnings? — Type (maybe-msgp warnings?).
    foundp — Type (booleanp foundp).
    transunit$ — Type (transunitp transunit$).

    Definitions and Theorems

    Function: transunit-wrap-fn

    (defun transunit-wrap-fn
           (transunit target-name wrapper-name? blacklist)
     (declare (xargs :guard (and (transunitp transunit)
                                 (identp target-name)
                                 (ident-optionp wrapper-name?)
                                 (ident-setp blacklist))))
     (declare (xargs :guard (transunit-annop transunit)))
     (b*
      (((reterr)
        nil nil (c$::transunit-fix transunit))
       ((transunit transunit) transunit)
       ((erp foundp found-satp extdecls)
        (ext-declon-list-wrap-fn transunit.declons
                                 target-name wrapper-name? blacklist))
       (warnings?
        (if
         (and foundp (not found-satp))
         (msg$
              "Declaration of ~x0 found, but couldn't create a wrapper."
              (ident->unwrap target-name))
         nil)))
      (retok warnings? foundp
             (c$::change-transunit transunit
                                   :declons extdecls
                                   :info nil))))

    Theorem: maybe-msgp-of-transunit-wrap-fn.er?

    (defthm maybe-msgp-of-transunit-wrap-fn.er?
      (b* (((mv ?er? ?warnings? ?foundp ?transunit$)
            (transunit-wrap-fn transunit
                               target-name wrapper-name? blacklist)))
        (maybe-msgp er?))
      :rule-classes :rewrite)

    Theorem: maybe-msgp-of-transunit-wrap-fn.warnings?

    (defthm maybe-msgp-of-transunit-wrap-fn.warnings?
      (b* (((mv ?er? ?warnings? ?foundp ?transunit$)
            (transunit-wrap-fn transunit
                               target-name wrapper-name? blacklist)))
        (maybe-msgp warnings?))
      :rule-classes :rewrite)

    Theorem: booleanp-of-transunit-wrap-fn.foundp

    (defthm booleanp-of-transunit-wrap-fn.foundp
      (b* (((mv ?er? ?warnings? ?foundp ?transunit$)
            (transunit-wrap-fn transunit
                               target-name wrapper-name? blacklist)))
        (booleanp foundp))
      :rule-classes :type-prescription)

    Theorem: transunitp-of-transunit-wrap-fn.transunit$

    (defthm transunitp-of-transunit-wrap-fn.transunit$
      (b* (((mv ?er? ?warnings? ?foundp ?transunit$)
            (transunit-wrap-fn transunit
                               target-name wrapper-name? blacklist)))
        (transunitp transunit$))
      :rule-classes :rewrite)

    Theorem: transunit-wrap-fn-of-transunit-fix-transunit

    (defthm transunit-wrap-fn-of-transunit-fix-transunit
      (equal (transunit-wrap-fn (c$::transunit-fix transunit)
                                target-name wrapper-name? blacklist)
             (transunit-wrap-fn transunit
                                target-name wrapper-name? blacklist)))

    Theorem: transunit-wrap-fn-transunit-equiv-congruence-on-transunit

    (defthm transunit-wrap-fn-transunit-equiv-congruence-on-transunit
     (implies
        (c$::transunit-equiv transunit transunit-equiv)
        (equal (transunit-wrap-fn transunit
                                  target-name wrapper-name? blacklist)
               (transunit-wrap-fn transunit-equiv
                                  target-name wrapper-name? blacklist)))
     :rule-classes :congruence)

    Theorem: transunit-wrap-fn-of-ident-fix-target-name

    (defthm transunit-wrap-fn-of-ident-fix-target-name
      (equal (transunit-wrap-fn transunit (ident-fix target-name)
                                wrapper-name? blacklist)
             (transunit-wrap-fn transunit
                                target-name wrapper-name? blacklist)))

    Theorem: transunit-wrap-fn-ident-equiv-congruence-on-target-name

    (defthm transunit-wrap-fn-ident-equiv-congruence-on-target-name
     (implies
          (c$::ident-equiv target-name target-name-equiv)
          (equal (transunit-wrap-fn transunit
                                    target-name wrapper-name? blacklist)
                 (transunit-wrap-fn transunit target-name-equiv
                                    wrapper-name? blacklist)))
     :rule-classes :congruence)

    Theorem: transunit-wrap-fn-of-ident-option-fix-wrapper-name?

    (defthm transunit-wrap-fn-of-ident-option-fix-wrapper-name?
      (equal (transunit-wrap-fn transunit target-name
                                (ident-option-fix wrapper-name?)
                                blacklist)
             (transunit-wrap-fn transunit
                                target-name wrapper-name? blacklist)))

    Theorem: transunit-wrap-fn-ident-option-equiv-congruence-on-wrapper-name?

    (defthm
       transunit-wrap-fn-ident-option-equiv-congruence-on-wrapper-name?
     (implies
          (c$::ident-option-equiv wrapper-name? wrapper-name?-equiv)
          (equal (transunit-wrap-fn transunit
                                    target-name wrapper-name? blacklist)
                 (transunit-wrap-fn transunit target-name
                                    wrapper-name?-equiv blacklist)))
     :rule-classes :congruence)

    Theorem: transunit-wrap-fn-of-ident-set-fix-blacklist

    (defthm transunit-wrap-fn-of-ident-set-fix-blacklist
      (equal (transunit-wrap-fn transunit target-name
                                wrapper-name? (ident-set-fix blacklist))
             (transunit-wrap-fn transunit
                                target-name wrapper-name? blacklist)))

    Theorem: transunit-wrap-fn-ident-set-equiv-congruence-on-blacklist

    (defthm transunit-wrap-fn-ident-set-equiv-congruence-on-blacklist
     (implies
          (c$::ident-set-equiv blacklist blacklist-equiv)
          (equal (transunit-wrap-fn transunit
                                    target-name wrapper-name? blacklist)
                 (transunit-wrap-fn transunit target-name
                                    wrapper-name? blacklist-equiv)))
     :rule-classes :congruence)