• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
          • Syntax-for-tools
          • Atc
          • Language
            • Abstract-syntax
            • Integer-ranges
            • Implementation-environments
            • Dynamic-semantics
            • Static-semantics
            • Grammar
            • Integer-formats
            • Types
            • Portable-ascii-identifiers
            • Values
            • Integer-operations
            • Computation-states
              • Write-object
              • Objdesign-of-var
              • Compustate-scopes-numbers
              • Create-var
              • Read-object
              • Compustate
              • Frame
              • Enter-scope
              • Compustate-scopes-numbers-aux
              • Compustate-option
              • Push-frame
              • Exit-scope
                • Compustate-frames-number
                • Compustate-option-result
                • Scope-list-result
                • Pop-frame
                • Compustate-result
                • Scope-result
                • Compustate-top-frame-scopes-number
                • Top-frame
                • Heap
                • Scope
                • Scope-list
                • Frame-list
              • Object-designators
              • Operations
              • Errors
              • Tag-environments
              • Function-environments
              • Character-sets
              • Flexible-array-member-removal
              • Arithmetic-operations
              • Pointer-operations
              • Bytes
              • Keywords
              • Real-operations
              • Array-operations
              • Scalar-operations
              • Structure-operations
            • Representation
            • Transformation-tools
            • Insertion-sort
            • Pack
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Computation-states

    Exit-scope

    Exit a scope.

    Signature
    (exit-scope compst) → new-compst
    Arguments
    compst — Guard (compustatep compst).
    Returns
    new-compst — Type (compustatep new-compst).

    We pop the scope stack of the top frame.

    Definitions and Theorems

    Function: exit-scope

    (defun exit-scope (compst)
     (declare (xargs :guard (compustatep compst)))
     (declare
       (xargs :guard (and (> (compustate-frames-number compst) 0)
                          (> (compustate-top-frame-scopes-number compst)
                             1))))
     (let ((__function__ 'exit-scope))
       (declare (ignorable __function__))
       (b* ((frame (top-frame compst))
            (scopes (frame->scopes frame))
            (new-scopes (cdr scopes))
            (new-frame (change-frame frame :scopes new-scopes))
            (new-compst (push-frame new-frame (pop-frame compst))))
         new-compst)))

    Theorem: compustatep-of-exit-scope

    (defthm compustatep-of-exit-scope
      (b* ((new-compst (exit-scope compst)))
        (compustatep new-compst))
      :rule-classes :rewrite)

    Theorem: compustate-frames-number-of-exit-scope

    (defthm compustate-frames-number-of-exit-scope
      (implies (> (compustate-frames-number compst) 0)
               (b* nil
                 (equal (compustate-frames-number (exit-scope compst))
                        (compustate-frames-number compst)))))

    Theorem: compustate-scopes-numbers-of-exit-scope

    (defthm compustate-scopes-numbers-of-exit-scope
      (implies
           (and (> (compustate-frames-number compst) 0)
                (> (compustate-top-frame-scopes-number compst)
                   1))
           (b* ((?new-compst (exit-scope compst)))
             (equal (compustate-scopes-numbers new-compst)
                    (cons (1- (car (compustate-scopes-numbers compst)))
                          (cdr (compustate-scopes-numbers compst)))))))

    Theorem: exit-scope-of-compustate-fix-compst

    (defthm exit-scope-of-compustate-fix-compst
      (equal (exit-scope (compustate-fix compst))
             (exit-scope compst)))

    Theorem: exit-scope-compustate-equiv-congruence-on-compst

    (defthm exit-scope-compustate-equiv-congruence-on-compst
      (implies (compustate-equiv compst compst-equiv)
               (equal (exit-scope compst)
                      (exit-scope compst-equiv)))
      :rule-classes :congruence)