• 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
      • Riscv
        • Specification
        • Executable
        • Specialized
        • Optimized
          • State-stobj
            • Stat1
            • Write1-memory-unsigned64
            • Stat1-iso
            • Read1-memory-unsigned64
            • Stat1-from-stat
            • Write1-memory-unsigned32
            • Read1-memory-unsigned32
            • Write1-memory-unsigned16
            • Write1-memory-unsigned8
            • Read1-memory-unsigned16
            • Read1-instruction
            • Stat-from-stat1
            • Write1-xreg
            • Read1-xreg-unsigned32
            • Read1-xreg-unsigned
            • Read1-memory-unsigned8
            • Write1-xreg-32
            • Stat1-validp
            • Read1-xreg-signed32
            • Read1-xreg-signed
            • Write1-pc
              • Make-stat1
              • Error1
              • Read1-pc
              • Inc41-pc
              • Stat1->memory
              • Errorp1
        • Taspi
        • Bitcoin
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • 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

    Write1-pc

    Refine write-pc to use the stobj states.

    Definitions and Theorems

    Function: write1-pc

    (defun write1-pc (pc stat feat)
     (declare (xargs :non-executable t))
     (declare
        (xargs :guard (non-exec (and (stat1p stat)
                                     (natp pc)
                                     (statp (stat-from-stat1 stat))
                                     (featp feat)
                                     (stat-validp (stat-from-stat1 stat)
                                                  feat)))))
     (prog2$ (acl2::throw-nonexec-error 'write1-pc
                                        (list pc stat feat))
             (let ((change-stat stat)
                   (stat->pc (loghead (feat->xlen feat) (lnfix pc))))
               (if (acl2::mbt$ (stat1p change-stat))
                   (let ((change-stat (stat-from-stat1 change-stat)))
                     (stat (stat->xregs change-stat)
                           stat->pc (stat->memory change-stat)
                           (stat->error change-stat)))
                 0))))

    Theorem: write1-pc-to-write-pc

    (defthm write1-pc-to-write-pc
      (implies (stat1p stat)
               (equal (write1-pc pc stat feat)
                      (write-pc pc (stat-from-stat1 stat)
                                feat)))
      :rule-classes :rewrite)

    Theorem: write-pc-to-write1-pc

    (defthm write-pc-to-write1-pc
      (implies (statp stat)
               (equal (write-pc pc stat feat)
                      (write1-pc pc (stat1-from-stat stat)
                                 feat)))
      :rule-classes :rewrite)