• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Error-checking
        • Apt
        • Abnf
        • Fty-extensions
        • Isar
        • Kestrel-utilities
          • Omaps
          • Directed-untranslate
          • Include-book-paths
          • Ubi
          • Checkpoint-list
          • Digits-any-base
          • Context-message-pair
          • Numbered-names
          • With-auto-termination
          • Theorems-about-true-list-lists
          • Make-termination-theorem
          • Sublis-expr+
          • Prove$
          • Defthm<w
          • System-utilities-non-built-in
          • Integer-range-fix
          • Add-const-to-untranslate-preprocess
            • Integers-from-to
            • Minimize-ruler-extenders
            • Unsigned-byte-fix
            • Signed-byte-fix
            • Defthmr
            • Paired-names
            • Unsigned-byte-list-fix
            • Signed-byte-list-fix
            • Show-books
            • Checkpoint-list-pretty
            • List-utilities
            • Skip-in-book
            • Typed-tuplep
            • Defunt
            • Keyword-value-list-to-alist
            • Magic-macroexpand
            • Top-command-number-fn
            • Bits-as-digits-in-base-2
            • Show-checkpoint-list
            • Ubyte11s-as-digits-in-base-2048
            • Named-formulas
            • Bytes-as-digits-in-base-256
            • String-utilities
            • Make-keyword-value-list-from-keys-and-value
            • Integer-range-listp
            • Defmacroq
            • Apply-fn-if-known
            • Trans-eval-error-triple
            • Checkpoint-info-list
            • Previous-subsumer-hints
            • Fms!-lst
            • Zp-listp
            • Doublets-to-alist
            • Trans-eval-state
            • Injections
            • Theorems-about-osets
            • Typed-list-utilities
            • Book-runes-alist
            • User-interface
            • Bits/ubyte11s-digit-grouping
            • Bits/bytes-digit-grouping
            • Message-utilities
            • Subsetp-eq-linear
            • Strict-merge-sort-<
            • Miscellaneous-enumerations
            • Maybe-unquote
            • Oset-utilities
            • Thm<w
            • Defthmd<w
          • Prime-field-constraint-systems
          • Soft
          • Bv
          • Imp-language
          • Event-macros
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Java
          • C
          • Syntheto
          • Number-theory
          • Cryptography
          • Lists-light
          • File-io-light
          • Json
          • Built-ins
          • Solidity
          • Axe
          • Std-extensions
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Execloader
        • Axe
      • Testing-utilities
      • Math
    • Kestrel-utilities
    • User-defined-functions-table

    Add-const-to-untranslate-preprocess

    Extend untranslate-preprocess to keep a constant unexpanded in output.

    This macro defines a new function and stores it into the user-defined-functions-table as the untranslation preprocessing function. This new function recognizes a term that is the expanded value of the given constant const and turns it into the symbol that names the constant const, while it delegates all other terms to the previous untranslation preprocessing function. If there was no previous untranslation preprocessing function, the new function returns nil on all other terms, meaning that untranslation preprocessing is finished. The new function is in program mode, in case the previous untranslation preprocessing function is also in program mode.

    Definitions and Theorems

    Function: add-const-to-untranslate-preprocess-fn

    (defun
     add-const-to-untranslate-preprocess-fn
     (const state)
     (declare (xargs :stobjs (state)))
     (declare (xargs :guard (symbolp const)))
     (let
      ((__function__ 'add-const-to-untranslate-preprocess-fn))
      (declare (ignorable __function__))
      (b*
       ((user-defined-functions-table
             (table-alist 'user-defined-functions-table
                          (w state)))
        (old-untranslate-preprocess
             (cdr (assoc-eq 'untranslate-preprocess
                            user-defined-functions-table)))
        (new-untranslate-preprocess
             (intern-in-package-of-symbol
                  (string-append "UNTRANSLATE-PREPROCESS-"
                                 (symbol-name const))
                  const)))
       (cons
        'progn
        (cons
         (cons
          'defun
          (cons
           new-untranslate-preprocess
           (cons
            '(term wrld)
            (cons
             '(declare (xargs :mode :program))
             (cons
              (cons
               'if
               (cons
                (cons
                     'equal
                     (cons 'term
                           (cons (cons 'list
                                       (cons ''quote (cons const 'nil)))
                                 'nil)))
                (cons (cons 'quote (cons const 'nil))
                      (cons (and old-untranslate-preprocess
                                 (cons old-untranslate-preprocess
                                       '(term wrld)))
                            'nil))))
              'nil)))))
         (cons
          (cons
           'table
           (cons
               'user-defined-functions-table
               (cons ''untranslate-preprocess
                     (cons (cons 'quote
                                 (cons new-untranslate-preprocess 'nil))
                           'nil))))
          'nil))))))

    Theorem: pseudo-event-formp-of-add-const-to-untranslate-preprocess-fn

    (defthm
      pseudo-event-formp-of-add-const-to-untranslate-preprocess-fn
      (b* ((event (add-const-to-untranslate-preprocess-fn const state)))
          (pseudo-event-formp event))
      :rule-classes :rewrite)