• 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
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
          • Transformations
          • Language
            • Abstract-syntax
              • Escape
              • Swcase-list->value-list
              • Hex-digit-list->chars
              • Fundef-list->name-list
              • Literal
              • Path
              • Hex-string-rest-element
              • Plain-string
              • String-element
              • Hex-string-content-option
              • Hex-string-content
              • Identifier
              • Funcall-option
              • Expression-option
              • Statement-option
              • Literal-option
              • Identifier-option
              • Hex-string
              • Hex-quad
              • Hex-digit
              • Hex-pair
              • Data-value
              • Data-item
              • Statements-to-fundefs
                • String-element-list-result
                • Identifier-identifier-map-result
                • Swcase-result
                • String-element-result
                • Statement-result
                • Literal-result
                • Identifier-set-result
                • Identifier-result
                • Identifier-list-result
                • Fundef-result
                • Funcall-result
                • Expression-result
                • Escape-result
                • Path-result
                • Block-result
                • Objects
                • Statements/blocks/cases/fundefs
                • Identifier-list
                • Identifier-set
                • Identifier-identifier-map
                • Identifier-identifier-alist
                • Hex-string-rest-element-list
                • String-element-list
                • Path-list
                • Hex-digit-list
                • Literal-list
                • Fundef-list
                • Expressions/funcalls
                • Abstract-syntax-induction-schemas
              • Dynamic-semantics
              • Concrete-syntax
              • Static-soundness
              • Static-semantics
              • Errors
            • Yul-json
          • 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
    • Abstract-syntax

    Statements-to-fundefs

    Filter function definitions out of a list of statements.

    Signature
    (statements-to-fundefs stmts) → fundefs
    Arguments
    stmts — Guard (statement-listp stmts).
    Returns
    fundefs — Type (fundef-listp fundefs).

    The function definitions are in the same order as they appear in the list of statements. We discard all the statements that are not function definitions, and we eliminate the :statement-fundef wrappers.

    Definitions and Theorems

    Function: statements-to-fundefs

    (defun statements-to-fundefs (stmts)
      (declare (xargs :guard (statement-listp stmts)))
      (let ((__function__ 'statements-to-fundefs))
        (declare (ignorable __function__))
        (cond ((endp stmts) nil)
              ((statement-case (car stmts) :fundef)
               (cons (statement-fundef->get (car stmts))
                     (statements-to-fundefs (cdr stmts))))
              (t (statements-to-fundefs (cdr stmts))))))

    Theorem: fundef-listp-of-statements-to-fundefs

    (defthm fundef-listp-of-statements-to-fundefs
      (b* ((fundefs (statements-to-fundefs stmts)))
        (fundef-listp fundefs))
      :rule-classes :rewrite)

    Theorem: statements-to-fundefs-of-statement-list-fix-stmts

    (defthm statements-to-fundefs-of-statement-list-fix-stmts
      (equal (statements-to-fundefs (statement-list-fix stmts))
             (statements-to-fundefs stmts)))

    Theorem: statements-to-fundefs-statement-list-equiv-congruence-on-stmts

    (defthm
         statements-to-fundefs-statement-list-equiv-congruence-on-stmts
      (implies (statement-list-equiv stmts stmts-equiv)
               (equal (statements-to-fundefs stmts)
                      (statements-to-fundefs stmts-equiv)))
      :rule-classes :congruence)