• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
        • Syntax-for-tools
        • Atc
        • Transformation-tools
        • Language
          • Abstract-syntax
          • Integer-ranges
          • Implementation-environments
          • Dynamic-semantics
          • Static-semantics
          • Grammar
          • Types
          • Integer-formats-definitions
          • Computation-states
            • Write-object
            • Objdesign-of-var
            • Create-var
            • Compustate-scopes-numbers
            • Read-object
            • Compustate
            • Enter-scope
            • Frame
            • Exit-scope
            • Read-object-of-create-var
              • Compustate-scopes-numbers-aux
              • Compustate-option
              • Push-frame
              • Read-object-of-write-object
              • Pop-frame
              • Compustate-frames-number
              • Exit-scope-of-write-object
              • Compustate-option-result
              • Scope-list-result
              • Not-errorp-of-write-object-of-exit-scope
              • Compustate-result
              • Scope-result
              • Pop-frame-of-write-object
              • Compustate-top-frame-scopes-number
              • Not-errorp-of-write-object-of-pop-frame
              • Read-object-of-exit-scope
              • Heap
              • Top-frame
              • Read-object-of-pop-frame
              • Scope
              • Objdesign-of-var-of-create-var
              • Scope-list
              • Push/pop/top-frame-theorems
              • Objdesign-of-var-of-write-object
              • Frame-list
              • Compustatep-of-write-object-of-objdesign-of-var
              • Valuep-of-read-object-of-objdesign-of-var
              • Read-object-of-enter-scope
              • Objdesign-of-var-of-enter-scope
              • Entr/exit-scope-theorems
            • Portable-ascii-identifiers
            • Values
            • Integer-operations
            • Object-designators
            • Operations
            • Errors
            • Tag-environments
            • Function-environments
            • Character-sets
            • Flexible-array-member-removal
            • Arithmetic-operations
            • Pointer-operations
            • Real-operations
            • Array-operations
            • Scalar-operations
            • Structure-operations
          • Representation
          • Insertion-sort
          • Pack
        • Proof-checker-array
        • Soft
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Ethereum
        • Leftist-trees
        • Java
        • Riscv
        • Taspi
        • Bitcoin
        • Zcash
        • Des
        • X86isa
        • Sha-2
        • Yul
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Axe
        • Poseidon
        • Where-do-i-place-my-book
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Computation-states

    Read-object-of-create-var

    How read-object changes under create-var.

    The theorem that equates read-object after create-var to a conditional term is limited to top-level object designators. Handling other kinds of object designators is more complicated, due to the possibility of partial overlap of objects; we plan to tackle these eventually.

    The theorem that assumes the existence of the object before the variable creation works with every kind of object designator.

    Definitions and Theorems

    Theorem: read-object-of-create-var-when-static

    (defthm read-object-of-create-var-when-static
      (implies (and (equal (objdesign-kind objdes) :static)
                    (not (errorp (create-var var val compst)))
                    (identp var))
               (equal (read-object objdes (create-var var val compst))
                      (if (and (equal (compustate-frames-number compst)
                                      0)
                               (equal (objdesign-static->name objdes)
                                      var))
                          (remove-flexible-array-member val)
                        (read-object objdes compst)))))

    Theorem: read-object-of-create-var-when-alloc

    (defthm read-object-of-create-var-when-alloc
      (implies (and (equal (objdesign-kind objdes) :alloc)
                    (not (errorp (create-var var val compst)))
                    (identp var))
               (equal (read-object objdes (create-var var val compst))
                      (read-object objdes compst))))

    Theorem: read-object-of-create-var-when-auto

    (defthm read-object-of-create-var-when-auto
     (implies
      (and (equal (objdesign-kind objdes) :auto)
           (not (errorp (create-var var val compst)))
           (identp var))
      (equal
         (read-object objdes (create-var var val compst))
         (if (and (> (compustate-frames-number compst) 0)
                  (equal (objdesign-auto->name objdes)
                         var)
                  (equal (objdesign-auto->frame objdes)
                         (1- (compustate-frames-number compst)))
                  (equal (objdesign-auto->scope objdes)
                         (1- (len (frame->scopes (top-frame compst))))))
             (remove-flexible-array-member val)
           (read-object objdes compst)))))

    Theorem: read-object-of-create-var-when-auto/static/alloc

    (defthm read-object-of-create-var-when-auto/static/alloc
     (implies
      (and (member-equal (objdesign-kind objdes)
                         '(:auto :static :alloc))
           (not (errorp (create-var var val compst)))
           (identp var))
      (equal
       (read-object objdes (create-var var val compst))
       (if
        (or (and (equal (objdesign-kind objdes) :static)
                 (equal (compustate-frames-number compst)
                        0)
                 (equal (objdesign-static->name objdes)
                        var))
            (and (equal (objdesign-kind objdes) :auto)
                 (> (compustate-frames-number compst) 0)
                 (equal (objdesign-auto->name objdes)
                        var)
                 (equal (objdesign-auto->frame objdes)
                        (1- (compustate-frames-number compst)))
                 (equal (objdesign-auto->scope objdes)
                        (1- (len (frame->scopes (top-frame compst)))))))
        (remove-flexible-array-member val)
        (read-object objdes compst)))))

    Theorem: read-object-of-create-var-when-existing

    (defthm read-object-of-create-var-when-existing
      (b* ((compst1 (create-var var val compst)))
        (implies (and (not (errorp compst1))
                      (not (errorp (read-object objdes compst))))
                 (equal (read-object objdes compst1)
                        (read-object objdes compst)))))