• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Pfcs
      • Wp-gen
      • Dimacs-reader
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Riscv
      • 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
        • Aleobft
        • Aleovm
          • Circuits
          • Language
            • Grammar
            • Early-version
              • Abstract-syntax
                • Binary-op
                • Literal
                • Instruction
                • Hash-op
                • Literal-type
                • Operand
                • Unary-op
                • Identifier
                • Commit-op
                • Mapping
                • Function
                  • Function-fix
                  • Make-function
                  • Function-equiv
                  • Function->outputs
                  • Change-function
                  • Function->instrs
                  • Function->inputs
                  • Function->finalize
                  • Functionp
                    • Function->name
                  • Programdef
                  • Finalize-type
                  • Closure
                  • Register-type
                  • Finalizer
                  • Value-type
                  • Record-type
                  • Command
                  • Plaintext-type
                  • Finalization-option
                  • Visibility
                  • Register
                  • Reference
                  • Programid
                  • Locator
                  • Finalization
                  • Entry-type
                  • Regaccess
                  • Program
                  • Interface-type
                  • Ident+ptype
                  • Ident+etype
                  • Function-output
                  • Finalize-output
                  • Finalize-input
                  • Closure-output
                  • Closure-input
                  • Assert-op
                  • Function-input
                  • Equal-op
                  • Finalize-command
                  • Ternary-op
                  • Import
                  • Ident+ptype-list
                  • Operand-list
                  • Ident+etype-list
                  • Programdef-list
                  • Instruction-list
                  • Import-list
                  • Identifier-list
                  • Function-output-list
                  • Function-input-list
                  • Finalize-output-list
                  • Finalize-input-list
                  • Command-list
                  • Closure-output-list
                  • Closure-input-list
                • Parser
                • Concrete-syntax
              • Concrete-syntax
          • Leo
        • 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
    • Function

    Functionp

    Recognizer for function structures.

    Signature
    (functionp x) → *

    Definitions and Theorems

    Function: functionp

    (defun functionp (x)
     (declare (xargs :guard t))
     (let ((__function__ 'functionp))
      (declare (ignorable __function__))
      (and
       (consp x)
       (eq (car x) :function)
       (mbe
         :logic (and (alistp (cdr x))
                     (equal (strip-cars (cdr x))
                            '(name inputs instrs outputs finalize)))
         :exec
         (fty::alist-with-carsp (cdr x)
                                '(name inputs instrs outputs finalize)))
       (b* ((name (cdr (std::da-nth 0 (cdr x))))
            (inputs (cdr (std::da-nth 1 (cdr x))))
            (instrs (cdr (std::da-nth 2 (cdr x))))
            (outputs (cdr (std::da-nth 3 (cdr x))))
            (finalize (cdr (std::da-nth 4 (cdr x)))))
         (and (identifierp name)
              (function-input-listp inputs)
              (instruction-listp instrs)
              (function-output-listp outputs)
              (finalizationp finalize))))))

    Theorem: consp-when-functionp

    (defthm consp-when-functionp
      (implies (functionp x) (consp x))
      :rule-classes :compound-recognizer)