Execute the top block.
(exec-top-block block limit) → cstate
This is used for the top-level block. Starting with the empty computation state and the empty function environment, we execute the block, propagating errors. Since the top-level block is not inside a function or loop, we defensively check that the execution terminates regularly, returning an error if it does not. In case of success, we return the final computation state.
Function:
(defun exec-top-block (block limit) (declare (xargs :guard (and (blockp block) (natp limit)))) (let ((__function__ 'exec-top-block)) (declare (ignorable __function__)) (b* ((cstate (make-cstate :local nil)) (funenv nil) ((okf (soutcome outcome)) (exec-block block cstate funenv limit)) ((unless (equal outcome.mode (mode-regular))) (reserrf (list :top-block-move outcome.mode)))) outcome.cstate)))
Theorem:
(defthm cstate-resultp-of-exec-top-block (b* ((cstate (exec-top-block block limit))) (cstate-resultp cstate)) :rule-classes :rewrite)
Theorem:
(defthm error-info-wfp-of-exec-top-block (b* ((?cstate (exec-top-block block limit))) (implies (reserrp cstate) (error-info-wfp cstate))))
Theorem:
(defthm exec-top-block-of-block-fix-block (equal (exec-top-block (block-fix block) limit) (exec-top-block block limit)))
Theorem:
(defthm exec-top-block-block-equiv-congruence-on-block (implies (block-equiv block block-equiv) (equal (exec-top-block block limit) (exec-top-block block-equiv limit))) :rule-classes :congruence)
Theorem:
(defthm exec-top-block-of-nfix-limit (equal (exec-top-block block (nfix limit)) (exec-top-block block limit)))
Theorem:
(defthm exec-top-block-nat-equiv-congruence-on-limit (implies (acl2::nat-equiv limit limit-equiv) (equal (exec-top-block block limit) (exec-top-block block limit-equiv))) :rule-classes :congruence)