Conventional tail-recursive core for mapping f.
(map-tr x acc) → *
This returns the elements in backwards order.
Function:
(defun map-tr (x acc) (declare (xargs :guard t)) (let ((acl2::__function__ 'map-tr)) (declare (ignorable acl2::__function__)) (if (atom x) acc (map-tr (cdr x) (cons (f (car x)) acc)))))
Theorem:
(defthm map-tr-correct (equal (map-tr x acc) (revappend (map-spec x) acc)))