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
Function:
(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:
(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)