• 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
          • Isodata
          • Simplify-defun
          • Tailrec
            • Tailrec-implementation
              • Tailrec-event-generation
                • Tailrec-gen-new-to-old-thm
                • Tailrec-gen-new-fn
                • Tailrec-gen-everything
                • Tailrec-gen-old-to-new-thm
                • Tailrec-gen-wrapper-fn
                • Tailrec-gen-domain-of-old-thm
                • Tailrec-gen-combine-left-identity-ground-thm
                • Tailrec-gen-appconds
                • Tailrec-gen-wrapper-to-old-thm
                • Tailrec-gen-old-to-wrapper-thm
                  • Tailrec-gen-old-guard-of-alpha-thm
                  • Tailrec-gen-alpha-fn
                  • Tailrec-gen-domain-of-ground-base-thm
                  • Tailrec-gen-test-of-alpha-thm
                  • Tailrec-gen-old-as-new-term
                  • Tailrec-gen-base-guard-thm
                  • Tailrec-gen-alpha-component-terms
                  • Tailrec-gen-combine-op
                  • Tailrec-gen-id-var-u
                  • Tailrec-gen-alpha-component-terms-aux
                  • Tailrec-gen-var-v
                  • Tailrec-gen-var-u
                  • Tailrec-gen-var-w
                • Tailrec-fn
                • Tailrec-macro-definition
                • Tailrec-input-processing
            • Schemalg
            • Restrict
            • Expdata
            • Casesplit
            • Simplify-term
            • Simplify-defun-sk
            • Parteval
            • Solve
            • Wrap-output
            • Propagate-iso
            • Simplify
            • Finite-difference
            • Drop-irrelevant-params
            • Copy-function
            • Lift-iso
            • Rename-params
            • Utilities
            • Simplify-term-programmatic
            • Simplify-defun-sk-programmatic
            • Simplify-defun-programmatic
            • Simplify-defun+
            • Common-options
            • Common-concepts
          • Error-checking
          • Fty-extensions
          • Isar
          • Kestrel-utilities
          • Set
          • C
          • 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
    • Tailrec-event-generation

    Tailrec-gen-old-to-wrapper-thm

    Generate the theorem that relates the old function to the wrapper function (f{}\tilde{f} in the design notes).

    Signature
    (tailrec-gen-old-to-wrapper-thm 
         old$ wrapper-name$ old-to-wrapper-name$ 
         old-to-wrapper-enable$ old-to-new-name$ 
         wrapper-unnorm-name wrld) 
     
      → 
    (mv local-event exported-event)
    Arguments
    old$ — Guard (symbolp old$).
    wrapper-name$ — Guard (symbolp wrapper-name$).
    old-to-wrapper-name$ — Guard (symbolp old-to-wrapper-name$).
    old-to-wrapper-enable$ — Guard (booleanp old-to-wrapper-enable$).
    old-to-new-name$ — Guard (symbolp old-to-new-name$).
    wrapper-unnorm-name — Guard (symbolp wrapper-unnorm-name).
    wrld — Guard (plist-worldp wrld).
    Returns
    local-event — A pseudo-event-formp.
    exported-event — A pseudo-event-formp.

    The macro used to introduce the theorem is determined by whether the theorem must be enabled or not.

    The theorem's formula has the form (equal (old x1 ... xn) (wrapper x1 ... xn)).

    The theorem is proved by expanding the (non-normalized) definition of the wrapper function and using the theorem that relates the old function to the new function.

    This function is called only if the :wrapper input is t.

    Definitions and Theorems

    Function: tailrec-gen-old-to-wrapper-thm

    (defun tailrec-gen-old-to-wrapper-thm
           (old$ wrapper-name$ old-to-wrapper-name$
                 old-to-wrapper-enable$ old-to-new-name$
                 wrapper-unnorm-name wrld)
     (declare (xargs :guard (and (symbolp old$)
                                 (symbolp wrapper-name$)
                                 (symbolp old-to-wrapper-name$)
                                 (booleanp old-to-wrapper-enable$)
                                 (symbolp old-to-new-name$)
                                 (symbolp wrapper-unnorm-name)
                                 (plist-worldp wrld))))
     (let ((__function__ 'tailrec-gen-old-to-wrapper-thm))
      (declare (ignorable __function__))
      (b*
       ((formals (formals old$ wrld))
        (formula
             (untranslate
                  (cons 'equal
                        (cons (apply-term old$ formals)
                              (cons (apply-term wrapper-name$ formals)
                                    'nil)))
                  t wrld))
        (hints
         (cons
           (cons '"Goal"
                 (cons ':in-theory
                       (cons (cons 'quote
                                   (cons (cons wrapper-unnorm-name 'nil)
                                         'nil))
                             (cons ':use
                                   (cons old-to-new-name$ 'nil)))))
           'nil)))
       (evmac-generate-defthm old-to-wrapper-name$
                              :formula formula
                              :hints hints
                              :enable old-to-wrapper-enable$))))