Rewrite an s-expression with the default rewrite rules, *sexpr-rewrites*.
May be a bit faster than using sexpr-rewrite, because there is only one argument to be memoized. On the other hand, it has to resolve the special variable *sexpr-rewrites*, but probably that's cheaper than an extra hash. Test this sometime?
Function:
(defun sexpr-rewrite-default (x) (declare (xargs :guard t)) (if (atom x) x (b* ((args (sexpr-rewrite-default-list (cdr x)))) (sexpr-rewrite-fncall 100 (car x) args *sexpr-rewrites*))))
Function:
(defun sexpr-rewrite-default-list (x) (declare (xargs :guard t)) (if (atom x) nil (hons (sexpr-rewrite-default (car x)) (sexpr-rewrite-default-list (cdr x)))))
Function:
(defun sexpr-rewrite-default-memoize-condition (x) (declare (ignorable x) (xargs :guard 't)) (consp x))
Theorem:
(defthm sexpr-rewrite-default-is-sexpr-rewrite (equal (sexpr-rewrite-default x) (sexpr-rewrite x *sexpr-rewrites*)))
Theorem:
(defthm sexpr-rewrite-default-list-is-sexpr-rewrite-list (equal (sexpr-rewrite-default-list x) (sexpr-rewrite-list x *sexpr-rewrites*)))
Function:
(defun sexpr-rewrite-default-alist (x) (declare (xargs :guard t)) (if (atom x) nil (if (atom (car x)) (sexpr-rewrite-default-alist (cdr x)) (cons (cons (caar x) (sexpr-rewrite-default (cdar x))) (sexpr-rewrite-default-alist (cdr x))))))
Theorem:
(defthm sexpr-rewrite-default-alist-is-sexpr-rewrite-alist (equal (sexpr-rewrite-default-alist x) (sexpr-rewrite-alist x *sexpr-rewrites*)))
Function:
(defun sexpr-rewrite-default-alists (x) (declare (xargs :guard t)) (if (atom x) nil (cons (sexpr-rewrite-default-alist (car x)) (sexpr-rewrite-default-alists (cdr x)))))