• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
          • Simplify-defun
          • Isodata
          • 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
          • Soft
          • C
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • Ethereum
          • Yul
          • 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
    • Tailrec-event-generation

    Tailrec-gen-base-guard-thm

    Generate the theorem asserting that the guard of the base term is satisfied if the guard of the target function is (G{}b in the design notes).

    Signature
    (tailrec-gen-base-guard-thm old$ base alpha-name test-of-alpha-name 
                                old-guard-of-alpha-name 
                                names-to-avoid state) 
     
      → 
    (mv event name updated-names-to-avoid)
    Arguments
    old$ — Guard (symbolp old$).
    base — Guard (pseudo-termp base).
    alpha-name — Guard (symbolp alpha-name).
    test-of-alpha-name — Guard (symbolp test-of-alpha-name).
    old-guard-of-alpha-name — Guard (symbolp old-guard-of-alpha-name).
    names-to-avoid — Guard (symbol-listp names-to-avoid).
    Returns
    event — A pseudo-event-formp.
    name — A symbolp that names the theorem.
    updated-names-to-avoid — A symbol-listp.

    The hints follow the proof in the design notes.

    This theorem is local, because it is just a lemma used to prove other theorems.

    Definitions and Theorems

    Function: tailrec-gen-base-guard-thm

    (defun tailrec-gen-base-guard-thm
           (old$ base alpha-name test-of-alpha-name
                 old-guard-of-alpha-name
                 names-to-avoid state)
     (declare (xargs :stobjs (state)))
     (declare (xargs :guard (and (symbolp old$)
                                 (pseudo-termp base)
                                 (symbolp alpha-name)
                                 (symbolp test-of-alpha-name)
                                 (symbolp old-guard-of-alpha-name)
                                 (symbol-listp names-to-avoid))))
     (let ((__function__ 'tailrec-gen-base-guard-thm))
      (declare (ignorable __function__))
      (b*
       ((wrld (w state))
        ((mv name names-to-avoid)
         (fresh-logical-name-with-$s-suffix 'base-guard
                                            nil names-to-avoid wrld))
        (formula (implicate (guard old$ nil wrld)
                            (term-guard-obligation base
                                                   :limited state)))
        (formals (formals old$ wrld))
        (alpha-comps
             (tailrec-gen-alpha-component-terms alpha-name old$ wrld))
        (hints
         (cons
          (cons
           '"Goal"
           (cons
            ':in-theory
            (cons
             'nil
             (cons
              ':use
              (cons
               (cons
                old-guard-of-alpha-name
                (cons
                 test-of-alpha-name
                 (cons
                  (cons
                     ':instance
                     (cons (cons ':guard-theorem (cons old$ 'nil))
                           (cons ':extra-bindings-ok
                                 (alist-to-doublets
                                      (pairlis$ formals alpha-comps)))))
                  'nil)))
               'nil)))))
          'nil))
        (event
         (cons
          'local
          (cons
           (cons
            'defthm
            (cons
                 name
                 (cons formula
                       (cons ':rule-classes
                             (cons 'nil
                                   (cons ':hints (cons hints 'nil)))))))
           'nil))))
       (mv event name names-to-avoid))))