nrev-based tail-recursive core for mapping f.
(map-impl x nrev) → nrev
This is essentially similar to map-tr.
The most interesting part of this is the correctness theorem:
Function:
(defun map-impl (x nrev) (declare (xargs :stobjs (nrev))) (declare (xargs :guard t)) (let ((acl2::__function__ 'map-impl)) (declare (ignorable acl2::__function__)) (b* (((when (atom x)) (nrev-fix nrev)) (nrev (nrev-push (f (car x)) nrev))) (map-impl (cdr x) nrev))))
Theorem:
(defthm map-impl-correct (equal (map-impl x nrev) (append nrev (map-spec x))))