• 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
          • Schemalg
            • Schemalg-implementation
              • Schemalg-event-generation
                • Schemalg-gen-everything
                • Schemalg-gen-x-z1...zm
                • Schemalg-gen-old-if-new
                  • Schemalg-gen-equal-algo
                  • Schemalg-gen-algo-divconq-list-0-1-2
                  • Schemalg-gen-algo-correct-divconq-list-0-1-2
                  • Schemalg-gen-algo-correct-divconq-list-0-1
                  • Schemalg-gen-spec-2
                  • Schemalg-gen-algo-correct-divconq-oset-0-1
                  • Schemalg-gen-algo-correct
                  • Schemalg-gen-algo-divconq-oset-0-1
                  • Schemalg-gen-spec-1-divconq-oset-0-1
                  • Schemalg-gen-spec-1-divconq-list-0-1
                  • Schemalg-gen-algo-divconq-list-0-1
                  • Schemalg-gen-algo
                  • Schemalg-gen-spec-1
                  • Schemalg-gen-spec-1-divconq-list-0-1-2
                  • Schemalg-gen-spec-0
                  • Schemalg-gen-spec-0-divconq-oset-0-1
                  • Schemalg-gen-spec-0-divconq-list-0-1-2
                  • Schemalg-gen-spec-0-divconq-list-0-1
                  • Schemalg-gen-new
                  • Schemalg-gen-?f1...?fp
                  • Schemalg-gen-x-z1...zm-aux
                • Schemalg-fn
                • Schemalg-macro-definition
                • Schemalg-input-processing
              • Schemalg-divconq-oset-0-1
              • Schemalg-divconq-list-0-1
            • 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
    • Schemalg-event-generation

    Schemalg-gen-old-if-new

    Generate the theorem old-if-new.

    Signature
    (schemalg-gen-old-if-new old-if-new old-if-new-enable 
                             old ?f x-x1...xn x-z1...zm x-a1...am 
                             x equal-algo new algo algo-correct) 
     
      → 
    (mv local-event exported-event)
    Arguments
    old-if-new — Guard (symbolp old-if-new).
    old-if-new-enable — Guard (booleanp old-if-new-enable).
    old — Guard (symbolp old).
    ?f — Guard (symbolp ?f).
    x-x1...xn — Guard (symbol-listp x-x1...xn).
    x-z1...zm — Guard (symbol-listp x-z1...zm).
    x-a1...am — Guard (symbol-listp x-a1...am).
    x — Guard (symbolp x).
    equal-algo — Guard (symbolp equal-algo).
    new — Guard (symbolp new).
    algo — Guard (symbolp algo).
    algo-correct — Guard (symbolp algo-correct).
    Returns
    local-event — Type (pseudo-event-formp local-event).
    exported-event — Type (pseudo-event-formp exported-event).

    Definitions and Theorems

    Function: schemalg-gen-old-if-new

    (defun schemalg-gen-old-if-new
           (old-if-new old-if-new-enable
                       old ?f x-x1...xn x-z1...zm x-a1...am
                       x equal-algo new algo algo-correct)
     (declare (xargs :guard (and (symbolp old-if-new)
                                 (booleanp old-if-new-enable)
                                 (symbolp old)
                                 (symbolp ?f)
                                 (symbol-listp x-x1...xn)
                                 (symbol-listp x-z1...zm)
                                 (symbol-listp x-a1...am)
                                 (symbolp x)
                                 (symbolp equal-algo)
                                 (symbolp new)
                                 (symbolp algo)
                                 (symbolp algo-correct))))
     (let ((__function__ 'schemalg-gen-old-if-new))
      (declare (ignorable __function__))
      (b*
       ((formula (cons 'implies
                       (cons (cons new 'nil)
                             (cons (cons old 'nil) 'nil))))
        (old-witness (add-suffix-to-fn old "-WITNESS"))
        (equal-algo-l2r (packn-pos (list ?f '-to- algo)
                                   equal-algo))
        (x-x1...xn-subst
         (if
          (>= (len x-x1...xn) 2)
          (loop$
               for var in x-x1...xn
               as i from 0 to (1- (len x-x1...xn))
               collect
               (cons var
                     (cons 'mv-nth
                           (cons i
                                 (cons (cons old-witness 'nil) 'nil)))))
          (list (cons x (cons old-witness 'nil)))))
        (x-x1...xn-instantiation (alist-to-doublets x-x1...xn-subst))
        (x-z1...zm-instantiation
             (loop$ for
                    z in x-z1...zm as a in x-a1...am collect
                    (cons z
                          (cons (sublis-var x-x1...xn-subst a)
                                'nil))))
        (hints
         (cons
          (cons
           '"Goal"
           (cons
            ':in-theory
            (cons
             (cons 'quote
                   (cons (cons old (cons new 'nil)) 'nil))
             (cons
              ':use
              (cons
               (cons
                (cons ':instance
                      (cons equal-algo-l2r x-z1...zm-instantiation))
                (cons (cons ':instance
                            (cons algo-correct x-x1...xn-instantiation))
                      'nil))
               'nil)))))
          'nil)))
       (evmac-generate-defthm old-if-new
                              :formula formula
                              :hints hints
                              :enable old-if-new-enable))))

    Theorem: pseudo-event-formp-of-schemalg-gen-old-if-new.local-event

    (defthm pseudo-event-formp-of-schemalg-gen-old-if-new.local-event
      (b*
        (((mv ?local-event ?exported-event)
          (schemalg-gen-old-if-new old-if-new old-if-new-enable
                                   old ?f x-x1...xn x-z1...zm x-a1...am
                                   x equal-algo new algo algo-correct)))
        (pseudo-event-formp local-event))
      :rule-classes :rewrite)

    Theorem: pseudo-event-formp-of-schemalg-gen-old-if-new.exported-event

    (defthm pseudo-event-formp-of-schemalg-gen-old-if-new.exported-event
      (b*
        (((mv ?local-event ?exported-event)
          (schemalg-gen-old-if-new old-if-new old-if-new-enable
                                   old ?f x-x1...xn x-z1...zm x-a1...am
                                   x equal-algo new algo algo-correct)))
        (pseudo-event-formp exported-event))
      :rule-classes :rewrite)