• 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
        • Apt
        • Error-checking
        • Abnf
        • Fty-extensions
        • Isar
        • Kestrel-utilities
          • Omaps
          • Directed-untranslate
          • Include-book-paths
          • Ubi
          • Digits-any-base
          • Context-message-pair
          • Numbered-names
          • With-auto-termination
          • Make-termination-theorem
          • Theorems-about-true-list-lists
          • Checkpoint-list
          • Sublis-expr+
          • Prove$
          • Defthm<w
          • System-utilities-non-built-in
          • Integer-range-fix
          • Add-const-to-untranslate-preprocess
            • Minimize-ruler-extenders
            • Integers-from-to
            • Unsigned-byte-fix
            • Signed-byte-fix
            • Defthmr
            • Paired-names
            • Unsigned-byte-list-fix
            • Signed-byte-list-fix
            • Show-books
            • List-utilities
            • Skip-in-book
            • Typed-tuplep
            • Checkpoint-list-pretty
            • 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
            • Defmacroq
            • Integer-range-listp
            • Apply-fn-if-known
            • Trans-eval-error-triple
            • Checkpoint-info-list
            • Previous-subsumer-hints
            • Fms!-lst
            • Zp-listp
            • Trans-eval-state
            • Injections
            • Doublets-to-alist
            • Theorems-about-osets
            • Typed-list-utilities
            • Book-runes-alist
            • User-interface
            • Bits/ubyte11s-digit-grouping
            • Bits/bytes-digit-grouping
            • Message-utilities
            • Subsetp-eq-linear
            • Oset-utilities
            • Strict-merge-sort-<
            • Miscellaneous-enumerations
            • Maybe-unquote
            • Thm<w
            • Defthmd<w
            • Io-utilities
          • Pfcs
          • Soft
          • Bv
          • Imp-language
          • Event-macros
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Java
          • C
          • Syntheto
          • File-io-light
          • Number-theory
          • Cryptography
          • Lists-light
          • Json
          • Axe
          • Builtins
          • Solidity
          • Std-extensions
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • 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)