Enter a scope.
(enter-scope compst) → new-compst
We push an empty scope onto the scope stack of the top frame.
Function:
(defun enter-scope (compst) (declare (xargs :guard (compustatep compst))) (declare (xargs :guard (> (compustate-frames-number compst) 0))) (let ((__function__ 'enter-scope)) (declare (ignorable __function__)) (b* ((frame (top-frame compst)) (scopes (frame->scopes frame)) (new-scopes (cons nil scopes)) (new-frame (change-frame frame :scopes new-scopes)) (new-compst (push-frame new-frame (pop-frame compst)))) new-compst)))
Theorem:
(defthm compustatep-of-enter-scope (b* ((new-compst (enter-scope compst))) (compustatep new-compst)) :rule-classes :rewrite)
Theorem:
(defthm compustate-frames-number-of-enter-scope (implies (> (compustate-frames-number compst) 0) (b* ((?new-compst (enter-scope compst))) (equal (compustate-frames-number new-compst) (compustate-frames-number compst)))))
Theorem:
(defthm compustate-scopes-numbers-of-enter-scope (implies (> (compustate-frames-number compst) 0) (b* ((?new-compst (enter-scope compst))) (equal (compustate-scopes-numbers new-compst) (cons (1+ (car (compustate-scopes-numbers compst))) (cdr (compustate-scopes-numbers compst)))))))
Theorem:
(defthm enter-scope-of-compustate-fix-compst (equal (enter-scope (compustate-fix compst)) (enter-scope compst)))
Theorem:
(defthm enter-scope-compustate-equiv-congruence-on-compst (implies (compustate-equiv compst compst-equiv) (equal (enter-scope compst) (enter-scope compst-equiv))) :rule-classes :congruence)