• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
        • Syntax-for-tools
        • Atc
        • Transformation-tools
          • Simpadd0
          • Proof-generation
          • Split-gso
          • Wrap-fn
          • Constant-propagation
          • Specialize
          • Split-fn
          • Split-fn-when
          • Split-all-gso
          • Copy-fn
            • Copy-fn-ext-declon
            • Copy-fn-fundef
            • Copy-fn-filepath-transunit-map
            • Copy-fn-ext-declon-list
            • Copy-fn-transunit-ensemble
            • Copy-fn-code-ensemble
            • Copy-fn-transunit
          • Variables-in-computation-states
          • Rename
          • Utilities
          • Proof-generation-theorems
          • Input-processing
        • Language
        • Representation
        • Insertion-sort
        • Pack
      • Proof-checker-array
      • Soft
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Ethereum
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Zcash
      • Des
      • X86isa
      • Sha-2
      • Yul
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Axe
      • Poseidon
      • Where-do-i-place-my-book
      • Aleo
      • Bigmems
      • Builtins
      • Execloader
      • Solidity
      • Paco
      • Concurrent-programs
      • Bls12-377-curves
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Transformation-tools

Copy-fn

A C-to-C transformation to copy a function.

This transformation introduces a new function which is the duplicate of another.

For instance, consider the following C code:

int fibonacci(int x) {
  if (x <= 1) {
    return x;
  }
  return fibonacci(x - 1) + fibonacci(x - 2);
}

Copying fibonacci and creating a new function fib yields the following:

int fibonacci(int x) {
  if (x <= 1) {
    return x;
  }
  return fibonacci(x - 1) + fibonacci(x - 2);
}
int fib(int x) {
  if (x <= 1) {
    return x;
  }
  return fib(x - 1) + fib(x - 2);
}

This transformation is not likely to be useful in isolation. Most often it is an initial step before applying different transformations to the two duplicates.

Subtopics

Copy-fn-ext-declon
Transform an external declaration.
Copy-fn-fundef
Transform a function definition.
Copy-fn-filepath-transunit-map
Transform a filepath.
Copy-fn-ext-declon-list
Transform a list of external declarations.
Copy-fn-transunit-ensemble
Transform a translation unit ensemble.
Copy-fn-code-ensemble
Transform a code ensemble.
Copy-fn-transunit
Transform a translation unit.