• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
          • Simplify-defun
          • Isodata
          • Tailrec
          • Schemalg
          • Restrict
          • Expdata
            • Expdata-implementation
              • Expdata-event-generation
                • Expdata-gen-everything
                  • Expdata-gen-thm-instances-to-terms-back
                  • Expdata-gen-new-fn-body-nonpred
                  • Expdata-gen-new-fn
                  • Expdata-gen-new-fn-verify-guards
                  • Expdata-gen-new-fn-verify-guards-hints-nonpred-rec-1res/mres
                  • Expdata-gen-back-of-forth-instances-to-terms-back
                  • Expdata-gen-new-fn-verify-guards-hints-nonpred-nonrec-1res/mres
                  • Expdata-gen-forth-image-instances-to-terms-back
                  • Expdata-gen-forth-guard-instances-to-terms-back
                  • Expdata-gen-new-to-old-thm-hints-rec-1res
                  • Expdata-gen-defsurj
                  • Expdata-gen-new-to-old-thm-hints-rec-mres
                  • Expdata-gen-lemma-instances-var-to-new-forth-rec-call-args-back
                  • Expdata-gen-new-fn-verify-guards-hints-pred-rec
                  • Expdata-gen-lemma-instances-x1...xn-to-forth-rec-call-args-back
                  • Expdata-gen-thm-instances-to-x1...xn
                  • Expdata-gen-newp-of-new-thm-hints
                  • Expdata-gen-all-back-guard-instances-to-mv-nth
                  • Expdata-gen-result-vars
                  • Expdata-gen-lemma-instances-x1...xn-to-rec-call-args-back
                  • Expdata-gen-new-to-old-thm-hints-rec-0res
                  • Expdata-gen-new-fn-verify-guards-hints-nonpred-rec-0res
                  • Expdata-gen-newp-of-new-thm
                  • Expdata-gen-new-to-old-thm
                  • Expdata-gen-lemma-instances-var-to-rec-calls-back
                  • Expdata-gen-new-fn-body-pred
                  • Expdata-gen-old-to-new-thm-hints-1res
                  • Expdata-gen-new-fn-verify-guards-hints-nonpred
                  • Expdata-gen-new-fn-verify-guards-hints
                  • Expdata-gen-all-back-of-forth-instances-to-terms-back
                  • Expdata-gen-old-to-new-thm
                  • Expdata-gen-new-to-old-thm-hints
                  • Expdata-gen-new-fn-verify-guards-hints-pred-nonrec
                  • Expdata-gen-all-forth-image-instances-to-terms-back
                  • Expdata-gen-all-forth-guard-instances-to-terms-back
                  • Expdata-gen-old-to-new-thm-hints-mres
                  • Expdata-gen-appconds
                  • Expdata-xform-rec-calls
                  • Expdata-gen-back-of-forth-instances-to-mv-nth
                  • Expdata-gen-lemma-instance-x1...xn-to-forth-of-x1...xn
                  • Expdata-gen-forth-image-instances-to-mv-nth
                  • Expdata-gen-forth-guard-instances-to-mv-nth
                  • Expdata-gen-back-guard-instances-to-mv-nth
                  • Expdata-gen-all-back-of-forth-instances-to-mv-nth
                  • Expdata-gen-old-to-new-thm-formula
                  • Expdata-gen-newp-guard-instances-to-x1...xn
                  • Expdata-gen-new-to-old-thm-formula
                  • Expdata-gen-new-fn-verify-guards-hints-nonpred-nonrec-0res
                  • Expdata-gen-lemma-instance-x1...xn-to-back-of-x1...xn
                  • Expdata-gen-forth-image-instances-to-x1...xn
                  • Expdata-gen-forth-image-instances-to-terms-back-aux
                  • Expdata-gen-forth-guard-instances-to-x1...xn
                  • Expdata-gen-forth-guard-instances-to-terms-back-aux
                  • Expdata-gen-back-of-forth-instances-to-x1...xn
                  • Expdata-gen-back-of-forth-instances-to-terms-back-aux
                  • Expdata-gen-back-image-instances-to-x1...xn
                  • Expdata-gen-back-guard-instances-to-x1...xn
                  • Expdata-gen-newp-of-new-thm-formula
                  • Expdata-gen-fn-of-terms
                  • Expdata-gen-oldp-of-rec-call-args-under-contexts
                  • Expdata-gen-new-fn-termination-hints
                  • Expdata-gen-old-to-new-thm-hints
                  • Expdata-gen-lemma-instance-x1...xn-to-fn-of-x1...xn
                  • Expdata-gen-old-to-new-thm-hints-0res
                  • Expdata-gen-new-fn-verify-guards-hints-pred
                  • Expdata-gen-new-to-old-thm-hints-nonrec
                  • Expdata-gen-subst-x1...xn-with-back-of-x1...xn
                  • Expdata-gen-oldp-of-terms
                  • Expdata-gen-newp-of-terms
                  • Expdata-gen-new-fn-body
                  • Expdata-gen-forth-of-terms
                  • Expdata-gen-defsurjs
                  • Expdata-gen-back-of-terms
                  • Expdata-gen-new-fn-guard
                  • Expdata-gen-result-vars-aux
                  • Expdata-gen-new-fn-measure
                  • Expdata-formal-of-newp
                  • Expdata-formal-of-forth
                  • Expdata-formal-of-back
                  • Expdata-formal-of-unary
                • Expdata-fn
                • Expdata-input-processing
                • Expdata-macro-definition
            • 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
    • Expdata-event-generation

    Expdata-gen-everything

    Generate the top-level event.

    Signature
    (expdata-gen-everything old$ arg-surjmaps res-surjmaps 
                            predicate$ new$ new-enable$ old-to-new$ 
                            old-to-new-enable$ new-to-old$ 
                            new-to-old-enable$ newp-of-new$ 
                            newp-of-new-enable$ verify-guards$ 
                            untranslate$ hints$ print$ show-only$ 
                            names-to-avoid call ctx state) 
     
      → 
    (mv erp event state)
    Arguments
    old$ — Guard (symbolp old$).
    arg-surjmaps — Guard (expdata-symbol-surjmap-alistp arg-surjmaps).
    res-surjmaps — Guard (expdata-pos-surjmap-alistp res-surjmaps).
    predicate$ — Guard (booleanp predicate$).
    new$ — Guard (symbolp new$).
    new-enable$ — Guard (booleanp new-enable$).
    old-to-new$ — Guard (symbolp old-to-new$).
    old-to-new-enable$ — Guard (booleanp old-to-new-enable$).
    new-to-old$ — Guard (symbolp new-to-old$).
    new-to-old-enable$ — Guard (symbolp new-to-old-enable$).
    newp-of-new$ — Guard (symbolp newp-of-new$).
    newp-of-new-enable$ — Guard (symbolp newp-of-new-enable$).
    verify-guards$ — Guard (booleanp verify-guards$).
    untranslate$ — Guard (untranslate-specifier-p untranslate$).
    hints$ — Guard (symbol-truelist-alistp hints$).
    print$ — Guard (evmac-input-print-p print$).
    show-only$ — Guard (booleanp show-only$).
    names-to-avoid — Guard (symbol-listp names-to-avoid).
    call — Guard (pseudo-event-formp call).
    Returns
    event — A pseudo-event-formp.

    This is a progn that consists of the expansion of expdata (the encapsulate), followed by an event to extend the transformation table, optionally followed by events to print the exported events (if specified by the :print input). The progn ends with :invisible to avoid printing a return value.

    The encapsulate starts with some implicitly local events to ensure logic mode and avoid errors due to ignored or irrelevant formals in the generated function. Other implicitly local events remove any default and override hints, to prevent such hints from sabotaging the generated proofs; this removal is done after proving the applicability conditions, in case their proofs rely on the default or override hints.

    The encapsulate also includes events to locally install the non-normalized definitions of the old and new functions, because the generated proofs are based on the unnormalized bodies.

    The encapsulate is stored into the transformation table, associated to the call to the transformation. Thus, the table event and (if present) the screen output events (which are in the progn but not in the encapsulate) are not stored into the transformation table, because they carry no additional information, and because otherwise the table event would have to contain itself.

    If :print is :all, the encapsulate is wrapped to show ACL2's output in response to the submitted events. If :print is :result or :info or :all, the progn includes events to print the exported events on the screen without hints; these are the same event forms that are introduced non-locally and redundantly in the encapsulate. If :print is :info or :all, a blank line is printed just before the result, for visual separation; if :print is :result, the blank line is not printed.

    If :show-only is t, the encapsulate is just printed on the screen and not returned as part of the event to submit, which in this case is just an :invisible form. In this case, if :print is :info or :all, a blank line is printed just before the encapsulate, for visual separation.

    Definitions and Theorems

    Function: expdata-gen-everything

    (defun expdata-gen-everything
           (old$ arg-surjmaps res-surjmaps
                 predicate$ new$ new-enable$ old-to-new$
                 old-to-new-enable$ new-to-old$
                 new-to-old-enable$ newp-of-new$
                 newp-of-new-enable$ verify-guards$
                 untranslate$ hints$ print$ show-only$
                 names-to-avoid call ctx state)
     (declare (xargs :stobjs (state)))
     (declare
         (xargs :guard (and (symbolp old$)
                            (expdata-symbol-surjmap-alistp arg-surjmaps)
                            (expdata-pos-surjmap-alistp res-surjmaps)
                            (booleanp predicate$)
                            (symbolp new$)
                            (booleanp new-enable$)
                            (symbolp old-to-new$)
                            (booleanp old-to-new-enable$)
                            (symbolp new-to-old$)
                            (symbolp new-to-old-enable$)
                            (symbolp newp-of-new$)
                            (symbolp newp-of-new-enable$)
                            (booleanp verify-guards$)
                            (untranslate-specifier-p untranslate$)
                            (symbol-truelist-alistp hints$)
                            (evmac-input-print-p print$)
                            (booleanp show-only$)
                            (symbol-listp names-to-avoid)
                            (pseudo-event-formp call))))
     (let ((__function__ 'expdata-gen-everything))
      (declare (ignorable __function__))
      (b*
       ((wrld (w state))
        (surjmaps (append (strip-cdrs arg-surjmaps)
                          (strip-cdrs res-surjmaps)))
        (surjmaps (remove-duplicates-equal surjmaps))
        (defsurj-events
             (expdata-gen-defsurjs surjmaps verify-guards$ print$))
        (appconds (expdata-gen-appconds old$ arg-surjmaps res-surjmaps
                                        predicate$ verify-guards$ wrld))
        ((er (list appcond-thm-events
                   appcond-thm-names names-to-avoid))
         (evmac-appcond-theorems-no-extra-hints
              appconds
              hints$ names-to-avoid print$ ctx state))
        ((mv old-fn-unnorm-event
             old-fn-unnorm-name names-to-avoid)
         (install-not-normalized-event old$ t names-to-avoid wrld))
        ((mv new-fn-local-event
             new-fn-exported-event)
         (expdata-gen-new-fn old$
                             arg-surjmaps res-surjmaps predicate$
                             new$ new-enable$ verify-guards$
                             untranslate$ appcond-thm-names wrld))
        ((mv new-fn-unnorm-event
             new-fn-unnorm-name &)
         (install-not-normalized-event new$ t names-to-avoid wrld))
        ((mv new-to-old-thm-local-event
             new-to-old-thm-exported-event)
         (expdata-gen-new-to-old-thm
              old$ arg-surjmaps res-surjmaps
              new$ new-to-old$ new-to-old-enable$
              appcond-thm-names old-fn-unnorm-name
              new-fn-unnorm-name wrld))
        ((mv newp-of-new-thm-local-event?
             newp-of-new-thm-exported-event?)
         (if
          (consp res-surjmaps)
          (expdata-gen-newp-of-new-thm old$ arg-surjmaps
                                       res-surjmaps new$ new-to-old$
                                       newp-of-new$ newp-of-new-enable$
                                       appcond-thm-names wrld)
          (mv nil nil)))
        (newp-of-new-thm-local-event?
             (and newp-of-new-thm-local-event?
                  (list newp-of-new-thm-local-event?)))
        (newp-of-new-thm-exported-event?
             (and newp-of-new-thm-exported-event?
                  (list newp-of-new-thm-exported-event?)))
        ((mv old-to-new-thm-local-event
             old-to-new-thm-exported-event)
         (expdata-gen-old-to-new-thm
              appcond-thm-names old$ arg-surjmaps
              res-surjmaps new$ old-to-new$
              old-to-new-enable$ new-to-old$ wrld))
        (new-fn-verify-guards-event?
             (and verify-guards$
                  (list (expdata-gen-new-fn-verify-guards
                             appcond-thm-names
                             old$ arg-surjmaps res-surjmaps
                             predicate$ new$ new-to-old$ old-to-new$
                             old-fn-unnorm-name newp-of-new$ wrld))))
        (theory-invariant
         (cons
          'theory-invariant
          (cons
              (cons 'incompatible
                    (cons (cons ':rewrite (cons new-to-old$ 'nil))
                          (cons (cons ':rewrite (cons old-to-new$ 'nil))
                                'nil)))
              'nil)))
        (new-fn-numbered-name-event (cons 'add-numbered-name-in-use
                                          (cons new$ 'nil)))
        (encapsulate-events
         (cons
          '(logic)
          (cons
           '(set-ignore-ok t)
           (cons
            '(set-irrelevant-formals-ok t)
            (append
             defsurj-events
             (append
              appcond-thm-events
              (cons
               '(evmac-prepare-proofs)
               (cons
                old-fn-unnorm-event
                (cons
                 new-fn-local-event
                 (cons
                  new-fn-unnorm-event
                  (cons
                   new-to-old-thm-local-event
                   (cons
                    old-to-new-thm-local-event
                    (append
                     newp-of-new-thm-local-event?
                     (append
                      new-fn-verify-guards-event?
                      (cons
                       new-fn-exported-event
                       (cons
                        new-to-old-thm-exported-event
                        (cons
                          old-to-new-thm-exported-event
                          (append newp-of-new-thm-exported-event?
                                  (cons theory-invariant
                                        (cons new-fn-numbered-name-event
                                              'nil))))))))))))))))))))
        (encapsulate (cons 'encapsulate
                           (cons 'nil encapsulate-events))
    )
        ((when show-only$)
         (if (member-eq print$ '(:info :all))
             (cw "~%~x0~|" encapsulate)
           (cw "~x0~|" encapsulate))
         (value '(value-triple :invisible)))
        (encapsulate+ (restore-output? (eq print$ :all)
                                       encapsulate))
        (transformation-table-event
             (record-transformation-call-event call encapsulate wrld))
        (print-result
         (and
          (member-eq print$ '(:result :info :all))
          (append
           (and (member-eq print$ '(:info :all))
                '((cw-event "~%")))
           (cons
            (cons 'cw-event
                  (cons '"~x0~|"
                        (cons (cons 'quote
                                    (cons new-fn-exported-event 'nil))
                              'nil)))
            (cons
             (cons
              'cw-event
              (cons
                  '"~x0~|"
                  (cons (cons 'quote
                              (cons new-to-old-thm-exported-event 'nil))
                        'nil)))
             (cons
              (cons
               'cw-event
               (cons
                  '"~x0~|"
                  (cons (cons 'quote
                              (cons old-to-new-thm-exported-event 'nil))
                        'nil)))
              (and
               newp-of-new-thm-exported-event?
               (cons
                (cons
                 'cw-event
                 (cons
                  '"~x0~|"
                  (cons
                       (cons 'quote
                             (cons (car newp-of-new-thm-exported-event?)
                                   'nil))
                       'nil)))
                'nil)))))))))
       (value
          (cons 'progn
                (cons encapsulate+
                      (cons transformation-table-event
                            (append print-result
                                    '((value-triple :invisible))))))))))