• 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
            • Constant-propagation
            • Specialize
            • Split-fn
            • Split-fn-when
              • Split-fn-when-implementation
                • Ext-declon-list-try-split-fn-when
                • Transunit-ensemble-split-fn-when
                • Ext-declon-try-split-fn-when
                • Filepath-transunit-map-try-split-fn-when
                • Fundef-try-split-fn-when
                  • Transunit-try-split-fn-when
                  • Transunit-ensemble-try-split-fn-when
                  • Transunit-ensemble-split-fn-when-loop
                  • Code-ensemble-split-fn-when
                  • Split-fn-when-fn
                  • Block-item-list-try-split-fn-when-loop
                  • Block-item-list-try-split-fn-when
                  • Block-item-triggerp
                  • Split-fn-when-event-generation
                  • Split-fn-when-input-processing
              • 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
    • Split-fn-when-implementation

    Fundef-try-split-fn-when

    Signature
    (fundef-try-split-fn-when fundef triggers transunits) 
      → 
    (mv er? fundef1 fundef2)
    Arguments
    fundef — Guard (fundefp fundef).
    triggers — Guard (ident-setp triggers).
    transunits — Guard (transunit-ensemblep transunits).
    Returns
    er? — Type (maybe-msgp er?).
    fundef1 — Type (fundefp fundef1).
    fundef2 — Type (fundef-optionp fundef2).

    Definitions and Theorems

    Function: fundef-try-split-fn-when

    (defun fundef-try-split-fn-when (fundef triggers transunits)
     (declare (xargs :guard (and (fundefp fundef)
                                 (ident-setp triggers)
                                 (transunit-ensemblep transunits))))
     (b*
      (((reterr) (irr-fundef) nil)
       (fundef (fundef-fix fundef))
       ((fundef fundef) fundef)
       ((declor fundef.declor) fundef.declor)
       (position? (block-item-list-try-split-fn-when
                       (comp-stmt->items fundef.body)
                       triggers))
       ((unless position?) (retok fundef nil))
       ((erp fun-name)
        (b* (((reterr) nil))
         (dirdeclor-case
              fundef.declor.direct
              :function-params
              (retok (c$::dirdeclor->ident fundef.declor.direct.declor))
              :function-names
              (retok (c$::dirdeclor->ident fundef.declor.direct.declor))
              :otherwise (retmsg$ "Malformed syntax.")))))
      (split-fn-fundef
           fun-name
           (transunit-ensemble-fresh-ident fun-name transunits)
           fundef position?)))

    Theorem: maybe-msgp-of-fundef-try-split-fn-when.er?

    (defthm maybe-msgp-of-fundef-try-split-fn-when.er?
      (b* (((mv ?er? ?fundef1 ?fundef2)
            (fundef-try-split-fn-when fundef triggers transunits)))
        (maybe-msgp er?))
      :rule-classes :rewrite)

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

    (defthm fundefp-of-fundef-try-split-fn-when.fundef1
      (b* (((mv ?er? ?fundef1 ?fundef2)
            (fundef-try-split-fn-when fundef triggers transunits)))
        (fundefp fundef1))
      :rule-classes :rewrite)

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

    (defthm fundef-optionp-of-fundef-try-split-fn-when.fundef2
      (b* (((mv ?er? ?fundef1 ?fundef2)
            (fundef-try-split-fn-when fundef triggers transunits)))
        (fundef-optionp fundef2))
      :rule-classes :rewrite)