• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
      • Proof-checker-array
      • Soft
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Ethereum
      • Leftist-trees
      • Java
      • Riscv
        • Specification
        • Executable
        • Specialized
        • Optimized
          • State-stobj
            • Stat1
            • Stat1-iso
            • Write1-mem64{0}
            • Stat1-from-stat
            • Read1-mem64{0}
              • Write1-mem32{0}
              • Stat1-validp{1}
              • Stat1-validp{0}
              • Stat-from-stat1
              • Write1-mem16{0}
              • Read1-mem32{0}
              • Write1-xreg{0}
              • Write1-mem8{0}
              • Read1-xreg-unsigned{0}
              • Read1-xreg-unsigned32{0}
              • Read1-xreg-signed32{0}
              • Read1-mem16{0}
              • Read1-instruction{0}
              • Write1-xreg-32{0}
              • Read1-xreg-signed{0}
              • Write1-pc{0}
              • Read1-mem8{0}
              • Make-stat1
              • Inc41-pc{0}
              • Error1{0}
              • Read1-pc{0}
              • Errorp1{0}
              • Stat1->memory
        • 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
    • State-stobj

    Read1-mem64{0}

    Refine read-mem64 to use the stobj states.

    Definitions and Theorems

    Function: read1-mem64{0}

    (defun read1-mem64{0} (addr stat feat)
     (declare (xargs :non-executable t))
     (declare
        (xargs :guard (non-exec (and (stat1p stat)
                                     (integerp addr)
                                     (statp (stat-from-stat1 stat))
                                     (featp feat)
                                     (stat-validp (stat-from-stat1 stat)
                                                  feat)))))
     (prog2$
      (acl2::throw-nonexec-error 'read1-mem64{0}
                                 (list addr stat feat))
      (let ((feat1 (stat1p stat)))
       (cond
        ((acl2::mbt$ feat1)
         (let ((b0 (read-mem8 addr (stat-from-stat1 stat)
                              feat))
               (stat (stat-from-stat1 stat)))
          (let* ((b1 (read-mem8 (+ (lifix addr) 1)
                                stat feat))
                 (b2 (read-mem8 (+ (lifix addr) 2)
                                stat feat))
                 (b3 (read-mem8 (+ (lifix addr) 3)
                                stat feat))
                 (b4 (read-mem8 (+ (lifix addr) 4)
                                stat feat))
                 (b5 (read-mem8 (+ (lifix addr) 5)
                                stat feat))
                 (b6 (read-mem8 (+ (lifix addr) 6)
                                stat feat))
                 (b7 (read-mem8 (+ (lifix addr) 7)
                                stat feat)))
           (cond
            ((feat-little-endianp feat)
             (logapp
              8 b0
              (logapp
               8 b1
               (logapp
                8 b2
                (logapp
                 8 b3
                 (logapp 8 b4
                         (logapp 8
                                 b5 (logapp 8 b6 (logapp 8 b7 0)))))))))
            ((feat-big-endianp feat)
             (logapp
              8 b7
              (logapp
               8 b6
               (logapp
                8 b5
                (logapp
                 8 b4
                 (logapp 8 b3
                         (logapp 8
                                 b2 (logapp 8 b1 (logapp 8 b0 0)))))))))
            (t (acl2::impossible-fn))))))
        (t 0)))))

    Theorem: read1-mem64{0}-to-read-mem64

    (defthm read1-mem64{0}-to-read-mem64
      (implies (stat1p stat)
               (equal (read1-mem64{0} addr stat feat)
                      (read-mem64 addr (stat-from-stat1 stat)
                                  feat)))
      :rule-classes :rewrite)

    Theorem: read-mem64-to-read1-mem64{0}

    (defthm read-mem64-to-read1-mem64{0}
      (implies (statp stat)
               (equal (read-mem64 addr stat feat)
                      (read1-mem64{0} addr (stat1-from-stat stat)
                                      feat)))
      :rule-classes :rewrite)