• 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-defthm

    Generate a defthm or defthmd theorem with the specified attributes.

    Signature
    (evmac-generate-defthm name &key (formula ':absent) 
                           (rule-classes ':rewrite) 
                           (enable ':absent) 
                           (hints 'nil) 
                           (instructions 'nil) 
                           (otf-flg 'nil)) 
     
      → 
    (mv local-event exported-event)
    Arguments
    name — Guard (symbolp name).
    formula — A term.
    rule-classes — Rule classes.
    enable — Guard (or (booleanp enable) (eq enable :absent)).
    hints — Guard (true-listp hints).
    instructions — Guard (true-listp instructions).
    otf-flg — Guard (booleanp otf-flg).
    Returns
    local-event — Type (pseudo-event-formp local-event).
    exported-event — Type (pseudo-event-formp exported-event).

    Definitions and Theorems

    Function: evmac-generate-defthm-fn

    (defun evmac-generate-defthm-fn
           (name formula rule-classes
                 enable hints instructions otf-flg)
     (declare (xargs :guard (and (symbolp name)
                                 (or (booleanp enable)
                                     (eq enable :absent))
                                 (true-listp hints)
                                 (true-listp instructions)
                                 (booleanp otf-flg))))
     (declare (xargs :guard (implies (not rule-classes)
                                     (eq enable :absent))))
     (let ((__function__ 'evmac-generate-defthm))
      (declare (ignorable __function__))
      (b*
       (((when (eq formula :absent))
         (raise "Internal error: :FORMULA must be always supplied.")
         (mv '(irrelevant) '(irrelevant)))
        ((unless (iff (eq rule-classes nil)
                      (eq enable :absent)))
         (prog2$
          (if rule-classes
           (raise
            "Internal error: :ENABLE must be supplied ~
                                          when :RULE-CLASSES is not NIL.")
           (raise
            "Internal error: :ENABLE must not be supplied ~
                                        when :RULE-CLASSES is NIL."))
          (mv '(irrelevant) '(irrelevant))))
        ((when (and hints instructions))
         (raise
          "Internal error: at most one of :HINTS and :INSTRUCTIONS ~
                                    may be non-NIL.")
         (mv '(irrelevant) '(irrelevant)))
        (macro (if enable 'defthm 'defthmd))
        (rule-classes (and rule-classes
                           (list :rule-classes rule-classes)))
        (hints (and hints (list :hints hints)))
        (instructions (and instructions
                           (list :instructions instructions)))
        (otf-flg (and otf-flg (list :otf-flg t)))
        (local-event
         (cons
          'local
          (cons
           (cons
            macro
            (cons
             name
             (cons
                formula
                (append rule-classes
                        (append hints (append instructions otf-flg))))))
           'nil)))
        (exported-event (cons macro
                              (cons name (cons formula rule-classes)))))
       (mv local-event exported-event))))

    Theorem: pseudo-event-formp-of-evmac-generate-defthm.local-event

    (defthm pseudo-event-formp-of-evmac-generate-defthm.local-event
      (b*
        (((mv ?local-event ?exported-event)
          (evmac-generate-defthm-fn name formula rule-classes
                                    enable hints instructions otf-flg)))
        (pseudo-event-formp local-event))
      :rule-classes :rewrite)

    Theorem: pseudo-event-formp-of-evmac-generate-defthm.exported-event

    (defthm pseudo-event-formp-of-evmac-generate-defthm.exported-event
      (b*
        (((mv ?local-event ?exported-event)
          (evmac-generate-defthm-fn name formula rule-classes
                                    enable hints instructions otf-flg)))
        (pseudo-event-formp exported-event))
      :rule-classes :rewrite)