• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
        • Syntax-for-tools
        • Atc
        • Language
        • Representation
        • Transformation-tools
          • Simpadd0
          • Splitgso
          • Constant-propagation
          • Split-fn
            • Abstract-fn
            • Split-fn-block-item-list
            • Decl-to-ident-param-declon-map
            • Split-fn-fundef
              • Split-fn-extdecl
              • Split-fn-filepath-transunit-map
              • Split-fn-extdecl-list
              • Param-declon-to-ident-param-declon-map
              • Split-fn-transunit-ensemble
              • Split-fn-transunit
              • Param-declon-list-to-ident-param-declon-map
              • Ident-param-declon-map-filter
              • Decl-to-ident-param-declon-map0
              • Decl-list-to-ident-param-declon-map
              • Add-pointer-param-declon
              • Map-address-ident-list
              • Map-add-pointer-param-declon
              • Make-deref-subst
              • Ident-param-declon-map
            • Specialize
            • Split-all-gso
            • Copy-fn
            • Rename
            • Utilities
          • Insertion-sort
          • Pack
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Riscv
        • Taspi
        • Bitcoin
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Community
      • Proof-automation
      • ACL2
      • Macro-libraries
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Split-fn

    Split-fn-fundef

    Transform a function definition, splitting it if matches the target identifier, or else leaving it untouched.

    Signature
    (split-fn-fundef target-fn new-fn-name fundef split-point) 
      → 
    (mv er fundef1 fundef2)
    Arguments
    target-fn — Guard (identp target-fn).
    new-fn-name — Guard (identp new-fn-name).
    fundef — Guard (fundefp fundef).
    split-point — Guard (natp split-point).
    Returns
    fundef1 — Type (fundefp fundef1).
    fundef2 — Type (fundef-optionp fundef2).

    Definitions and Theorems

    Function: split-fn-fundef

    (defun split-fn-fundef (target-fn new-fn-name fundef split-point)
     (declare (xargs :guard (and (identp target-fn)
                                 (identp new-fn-name)
                                 (fundefp fundef)
                                 (natp split-point))))
     (b* (((reterr) (irr-fundef) nil)
          ((fundef fundef) fundef)
          ((declor fundef.declor) fundef.declor))
      (stmt-case
       fundef.body
       :compound
       (dirdeclor-case
        fundef.declor.direct :function-params
        (b*
         (((unless
             (equal target-fn
                    (c$::dirdeclor->ident fundef.declor.direct.declor)))
           (retok (fundef-fix fundef) nil))
          ((erp new-fn truncated-items)
           (split-fn-block-item-list new-fn-name fundef.body.items
                                     fundef.spec fundef.declor.pointers
                                     (param-declon-list-to-ident-param-declon-map
                                          fundef.declor.direct.params)
                                     split-point)))
         (retok new-fn
                (make-fundef :extension fundef.extension
                             :spec fundef.spec
                             :declor fundef.declor
                             :decls fundef.decls
                             :body (stmt-compound truncated-items))))
        :otherwise (retok (fundef-fix fundef) nil))
       :otherwise (retok (fundef-fix fundef) nil))))

    Theorem: fundefp-of-split-fn-fundef.fundef1

    (defthm fundefp-of-split-fn-fundef.fundef1
      (b* (((mv acl2::?er ?fundef1 ?fundef2)
            (split-fn-fundef target-fn
                             new-fn-name fundef split-point)))
        (fundefp fundef1))
      :rule-classes :rewrite)

    Theorem: fundef-optionp-of-split-fn-fundef.fundef2

    (defthm fundef-optionp-of-split-fn-fundef.fundef2
      (b* (((mv acl2::?er ?fundef1 ?fundef2)
            (split-fn-fundef target-fn
                             new-fn-name fundef split-point)))
        (fundef-optionp fundef2))
      :rule-classes :rewrite)