Perform at most a given number of evaluation steps.
(stepn estate n program) → new-estate
We repeatedly call step until either we reach a final or error state (from where no further evaluation step may take place) or we exhaust the given (maximum) number of steps.
Function:
(defun stepn (estate n program) (declare (xargs :guard (and (eval-state-p estate) (natp n) (programp program)))) (let ((__function__ 'stepn)) (declare (ignorable __function__)) (b* (((when (zp n)) (eval-state-fix estate)) ((when (member-eq (eval-state-kind estate) '(:final :error))) (eval-state-fix estate)) (estate (step estate program))) (stepn estate (1- n) program))))
Theorem:
(defthm eval-state-p-of-stepn (b* ((new-estate (stepn estate n program))) (eval-state-p new-estate)) :rule-classes :rewrite)
Theorem:
(defthm stepn-of-eval-state-fix-estate (equal (stepn (eval-state-fix estate) n program) (stepn estate n program)))
Theorem:
(defthm stepn-eval-state-equiv-congruence-on-estate (implies (eval-state-equiv estate estate-equiv) (equal (stepn estate n program) (stepn estate-equiv n program))) :rule-classes :congruence)
Theorem:
(defthm stepn-of-nfix-n (equal (stepn estate (nfix n) program) (stepn estate n program)))
Theorem:
(defthm stepn-nat-equiv-congruence-on-n (implies (acl2::nat-equiv n n-equiv) (equal (stepn estate n program) (stepn estate n-equiv program))) :rule-classes :congruence)
Theorem:
(defthm stepn-of-program-fix-program (equal (stepn estate n (program-fix program)) (stepn estate n program)))
Theorem:
(defthm stepn-program-equiv-congruence-on-program (implies (program-equiv program program-equiv) (equal (stepn estate n program) (stepn estate n program-equiv))) :rule-classes :congruence)