Go to the previous scope or frame.
(prev-scope/frame compst) → compst1
That is, exit a scope if the top frame has more than one, otherwise pop a frame.
This function is used to express the exception, noted in variable-resolution-preservation, for the execution of object declarations, block items, and lists of block items. Those block items always execute in a frame (which justifies the guard of this function), but that frame may have one or more scopes, with the object declarations or block items executing in the top scope; thus, in order to always exclude the scope in which the object declarations or block items are executing, we need to pop frame if that is the only scope. Note that just using exit-scope, or just using peel-scopes with argument 1, would not work, and so we need to introduce this function here.
Function:
(defun prev-scope/frame (compst) (declare (xargs :guard (compustatep compst))) (declare (xargs :guard (> (compustate-frames-number compst) 0))) (if (> (compustate-top-frame-scopes-number compst) 1) (exit-scope compst) (pop-frame compst)))
Theorem:
(defthm compustatep-of-prev-scope/frame (b* ((compst1 (prev-scope/frame compst))) (compustatep compst1)) :rule-classes :rewrite)
Theorem:
(defthm prev-scope/frame-of-compustate-fix-compst (equal (prev-scope/frame (compustate-fix compst)) (prev-scope/frame compst)))
Theorem:
(defthm prev-scope/frame-compustate-equiv-congruence-on-compst (implies (compustate-equiv compst compst-equiv) (equal (prev-scope/frame compst) (prev-scope/frame compst-equiv))) :rule-classes :congruence)