• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
        • Transformations
        • Language
          • Abstract-syntax
          • Dynamic-semantics
            • Exec
            • Find-fun
            • Init-local
            • Write-vars-values
            • Add-vars-values
            • Add-funs
            • Eoutcome
            • Soutcome
            • Ensure-funscope-disjoint
            • Write-var-value
            • Restrict-vars
              • Add-var-value
              • Funinfo
              • Exec-top-block
              • Values
              • Cstate
              • Funinfo+funenv
              • Read-vars-values
              • Read-var-value
              • Funenv
              • Funscope-for-fundefs
              • Exec-path
              • Path-to-var
              • Funinfo+funenv-result
              • Exec-literal
              • Soutcome-result
              • Mode-set-result
              • Literal-evaluation
              • Funscope-result
              • Funinfo-result
              • Funenv-result
              • Eoutcome-result
              • Cstate-result
              • Paths-to-vars
              • Funinfo-for-fundef
              • Lstate
              • Funscope
              • Mode-set
              • Modes
            • Concrete-syntax
            • Static-soundness
            • Static-semantics
            • Errors
          • Yul-json
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Dynamic-semantics

    Restrict-vars

    Restrict the variables in the local state to a specified set.

    Signature
    (restrict-vars vars cstate) → new-cstate
    Arguments
    vars — Guard (identifier-setp vars).
    cstate — Guard (cstatep cstate).
    Returns
    new-cstate — Type (cstatep new-cstate).

    This is used when a block is exited: any new variable declared in the block is discarded, by retaining only the variables present in the local state before the block; any of the retained variables must retain their values from the block (i.e. the block may modify them).

    Definitions and Theorems

    Function: restrict-vars

    (defun restrict-vars (vars cstate)
      (declare (xargs :guard (and (identifier-setp vars)
                                  (cstatep cstate))))
      (let ((__function__ 'restrict-vars))
        (declare (ignorable __function__))
        (b* ((lstate (cstate->local cstate))
             (new-lstate (omap::restrict (identifier-set-fix vars)
                                         lstate)))
          (change-cstate cstate
                         :local new-lstate))))

    Theorem: cstatep-of-restrict-vars

    (defthm cstatep-of-restrict-vars
      (b* ((new-cstate (restrict-vars vars cstate)))
        (cstatep new-cstate))
      :rule-classes :rewrite)

    Theorem: error-info-wfp-of-restrict-vars

    (defthm error-info-wfp-of-restrict-vars
      (b* ((?new-cstate (restrict-vars vars cstate)))
        (implies (reserrp new-cstate)
                 (error-info-wfp new-cstate))))

    Theorem: restrict-vars-of-identifier-set-fix-vars

    (defthm restrict-vars-of-identifier-set-fix-vars
      (equal (restrict-vars (identifier-set-fix vars)
                            cstate)
             (restrict-vars vars cstate)))

    Theorem: restrict-vars-identifier-set-equiv-congruence-on-vars

    (defthm restrict-vars-identifier-set-equiv-congruence-on-vars
      (implies (identifier-set-equiv vars vars-equiv)
               (equal (restrict-vars vars cstate)
                      (restrict-vars vars-equiv cstate)))
      :rule-classes :congruence)

    Theorem: restrict-vars-of-cstate-fix-cstate

    (defthm restrict-vars-of-cstate-fix-cstate
      (equal (restrict-vars vars (cstate-fix cstate))
             (restrict-vars vars cstate)))

    Theorem: restrict-vars-cstate-equiv-congruence-on-cstate

    (defthm restrict-vars-cstate-equiv-congruence-on-cstate
      (implies (cstate-equiv cstate cstate-equiv)
               (equal (restrict-vars vars cstate)
                      (restrict-vars vars cstate-equiv)))
      :rule-classes :congruence)