• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • 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
        • Soft
        • C
          • Syntax-for-tools
          • Atc
          • Language
          • Representation
          • Transformation-tools
            • Simpadd0
            • Deftrans
            • Splitgso
            • Constant-propagation
            • Split-fn
            • Copy-fn
              • Copy-fn-extdecl
              • Copy-fn-filepath-transunit-map
              • Rename-fn-filepath-transunit-map
              • Copy-fn-fundef
                • Rename-fn-transunit-ensemble
                • Copy-fn-transunit-ensemble
                • Copy-fn-extdecl-list
                • Rename-fn-ident-list
                • Rename-fn-fundef
                • Rename-fn-extdecl-list
                • Rename-fn-extdecl
                • Copy-fn-transunit
                • Rename-fn-transunit
                • Rename-fn-ident
                • Rename-fn-const
                • Rename-fn-funcall-fun
              • Specialize
              • Split-all-gso
              • Rename
              • Utilities
            • Insertion-sort
            • Pack
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • 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
    • Copy-fn

    Copy-fn-fundef

    Transform a function definition.

    Signature
    (copy-fn-fundef fundef target-fn new-fn) → fundef?
    Arguments
    fundef — Guard (fundefp fundef).
    target-fn — Guard (identp target-fn).
    new-fn — Guard (identp new-fn).
    Returns
    fundef? — Type (fundef-optionp fundef?).

    Definitions and Theorems

    Function: copy-fn-fundef

    (defun copy-fn-fundef (fundef target-fn new-fn)
     (declare (xargs :guard (and (fundefp fundef)
                                 (identp target-fn)
                                 (identp new-fn))))
     (let ((__function__ 'copy-fn-fundef))
      (declare (ignorable __function__))
      (b* (((fundef fundef) fundef)
           ((declor fundef.declor) fundef.declor))
       (dirdeclor-case
        fundef.declor.direct :function-params
        (if
         (equal target-fn
                (c$::dirdeclor->ident fundef.declor.direct.declor))
         (make-fundef
             :extension fundef.extension
             :spec fundef.spec
             :declor
             (make-declor
                  :pointers fundef.declor.pointers
                  :direct (make-dirdeclor-function-params
                               :declor (dirdeclor-ident new-fn)
                               :params fundef.declor.direct.params
                               :ellipsis fundef.declor.direct.ellipsis))
             :decls fundef.decls
             :body (rename-fn-stmt fundef.body target-fn new-fn))
         nil)
        :otherwise nil))))

    Theorem: fundef-optionp-of-copy-fn-fundef

    (defthm fundef-optionp-of-copy-fn-fundef
      (b* ((fundef? (copy-fn-fundef fundef target-fn new-fn)))
        (fundef-optionp fundef?))
      :rule-classes :rewrite)