• 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
        • Soft
        • Bv
        • Imp-language
        • Ethereum
        • Event-macros
          • Evmac-input-hints-p
          • Evmac-input-print-p
          • Event-macro-input-processing
          • Function-definedness
          • Event-macro-screen-printing
          • Make-event-terse
          • Event-macro-applicability-conditions
          • Event-macro-results
          • Template-generators
          • Event-macro-event-generators
            • Evmac-generate-defun
            • Evmac-generate-soft-defun-sk2
            • Evmac-generate-soft-defun2
              • Evmac-generate-defthm
              • Evmac-generate-soft-defunvar
            • Event-macro-proof-preparation
            • Try-event
            • Restore-output?
            • Restore-output
            • Fail-event
            • Cw-event
            • Event-macro-xdoc-constructors
            • Event-macro-intro-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
    • Event-macro-event-generators

    Evmac-generate-soft-defun2

    Generate a SOFT defun2 or defund2 function definition with the specified attributes.

    Signature
    (evmac-generate-soft-defun2 name &key (formals ':absent) 
                                (guard 't) 
                                (body ':absent) 
                                (verify-guards ':absent) 
                                (enable ':absent) 
                                (guard-hints 'nil) 
                                (measure 'nil) 
                                (hints 'nil)) 
     
      → 
    (mv loc-event event)
    Arguments
    name — Guard (symbolp name).
    formals — Guard (symbol-listp formals).
    guard — A term.
    body — A term.
    verify-guards — Guard (booleanp verify-guards).
    enable — Guard (booleanp enable).
    guard-hints — Guard (true-listp guard-hints).
    measure — A term.
    hints — Guard (true-listp hints).
    Returns
    loc-event — Type (pseudo-event-formp loc-event).
    event — Type (pseudo-event-formp event).

    Definitions and Theorems

    Function: evmac-generate-soft-defun2-fn

    (defun evmac-generate-soft-defun2-fn
           (name formals guard body verify-guards
                 enable guard-hints measure hints)
     (declare (xargs :guard (and (symbolp name)
                                 (symbol-listp formals)
                                 (booleanp verify-guards)
                                 (booleanp enable)
                                 (true-listp guard-hints)
                                 (true-listp hints))))
     (let ((__function__ 'evmac-generate-soft-defun2))
      (declare (ignorable __function__))
      (b*
       (((when (eq formals :absent))
         (raise "Internal error: :FORMALS not supplied.")
         (mv '(irrelevant) '(irrelevant)))
        ((when (eq body :absent))
         (raise "Internal error: :BODY not supplied.")
         (mv '(irrelevant) '(irrelevant)))
        ((when (eq verify-guards :absent))
         (raise "Internal error: :VERIFY-GUARDS not supplied.")
         (mv '(irrelevant) '(irrelevant)))
        ((when (eq enable :absent))
         (raise "Internal error: :ENABLE not supplied.")
         (mv '(irrelevant) '(irrelevant)))
        (macro (if enable 'soft::defun2
                 'soft::defund2))
        (measure-decl (and measure (list :measure measure)))
        (hints-decl (and measure hints (list :hints hints)))
        (guard-decl (list :guard guard))
        (verify-guards-decl (list :verify-guards verify-guards))
        (guard-hints-decl (and guard-hints
                               (list :guard-hints guard-hints)))
        (loc-event
         (cons
          'local
          (cons
           (cons
            macro
            (cons
             name
             (cons
              formals
              (cons
               (cons
                'declare
                (cons
                 (cons
                  'xargs
                  (append
                   measure-decl
                   (append
                    hints-decl
                    (append
                        guard-decl
                        (append verify-guards-decl guard-hints-decl)))))
                 'nil))
               (cons body 'nil)))))
           'nil)))
        (event
         (cons
          macro
          (cons
           name
           (cons
            formals
            (cons
             (cons
              'declare
              (cons
                  (cons 'xargs
                        (append measure-decl
                                (append guard-decl verify-guards-decl)))
                  'nil))
             (cons body 'nil)))))))
       (mv loc-event event))))

    Theorem: pseudo-event-formp-of-evmac-generate-soft-defun2.loc-event

    (defthm pseudo-event-formp-of-evmac-generate-soft-defun2.loc-event
      (b* (((mv ?loc-event ?event)
            (evmac-generate-soft-defun2-fn
                 name formals guard body verify-guards
                 enable guard-hints measure hints)))
        (pseudo-event-formp loc-event))
      :rule-classes :rewrite)

    Theorem: pseudo-event-formp-of-evmac-generate-soft-defun2.event

    (defthm pseudo-event-formp-of-evmac-generate-soft-defun2.event
      (b* (((mv ?loc-event ?event)
            (evmac-generate-soft-defun2-fn
                 name formals guard body verify-guards
                 enable guard-hints measure hints)))
        (pseudo-event-formp event))
      :rule-classes :rewrite)