If writing an object not in the top scope causes no error, neither does writing the object after exiting the scope.
Theorem:
(defthm not-errorp-of-write-object-top-static/alloc-of-exit-scope (implies (and (member-equal (objdesign-kind (objdesign-top objdes)) '(:static :alloc)) (not (errorp (write-object objdes val compst)))) (not (errorp (write-object objdes val (exit-scope compst))))))
Theorem:
(defthm not-errorp-of-write-object-auto-of-exit-scope (implies (and (equal (objdesign-kind objdes) :auto) (or (not (equal (objdesign-auto->frame objdes) (1- (compustate-frames-number compst)))) (not (equal (objdesign-auto->scope objdes) (1- (compustate-top-frame-scopes-number compst))))) (not (errorp (write-object objdes val compst)))) (not (errorp (write-object objdes val (exit-scope compst))))))
Theorem:
(defthm not-errorp-of-write-object-top-auto-of-exit-scope (implies (and (equal (objdesign-kind (objdesign-top objdes)) :auto) (or (not (equal (objdesign-auto->frame (objdesign-top objdes)) (1- (compustate-frames-number compst)))) (not (equal (objdesign-auto->scope (objdesign-top objdes)) (1- (compustate-top-frame-scopes-number compst))))) (not (errorp (write-object objdes val compst)))) (not (errorp (write-object objdes val (exit-scope compst))))))
Theorem:
(defthm not-errorp-of-write-object-of-exit-scope (implies (and (or (member-equal (objdesign-kind (objdesign-top objdes)) '(:static :alloc)) (not (equal (objdesign-auto->frame (objdesign-top objdes)) (1- (compustate-frames-number compst)))) (not (equal (objdesign-auto->scope (objdesign-top objdes)) (1- (compustate-top-frame-scopes-number compst))))) (not (errorp (write-object objdes val compst)))) (not (errorp (write-object objdes val (exit-scope compst))))))