• 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
        • Instructions
        • States
          • Stat
          • Stat-validp
          • Write-memory-unsigned64
          • Write-memory-unsigned32
          • Write-memory-unsigned8
          • Write-memory-unsigned16
          • Read-xreg-unsigned
          • Write-xreg-32
          • States64
          • Write-xreg
          • Read-memory-unsigned8
          • Read-memory-unsigned64
          • Read-memory-unsigned32
          • Read-memory-unsigned16
          • Read-xreg-signed
          • Read-xreg-unsigned32
          • States32
          • Write-pc
          • Read-xreg-signed32
          • Read-pc
          • Inc4-pc
          • Decoding
          • Encoding
          • Features
          • Semantics
          • Execution
        • 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
        • 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
    • States

    Inc4-pc

    Increment the program counter by 4.

    Signature
    (inc4-pc stat feat) → new-stat
    Arguments
    stat — Guard (statp stat).
    feat — Guard (featp feat).
    Returns
    new-stat — Type (statp new-stat).

    In the normal instruction encodings, instructions take 32 bits each. Thus, it is common to increment the program counter by 4 (bytes), which this function provides a concise way to do.

    We read the program counter, we add 4, and we write the result. Recall that write-pc wraps around if needed [ISA:1.4].

    Definitions and Theorems

    Function: inc4-pc

    (defun inc4-pc (stat feat)
      (declare (xargs :guard (and (statp stat) (featp feat))))
      (declare (xargs :guard (stat-validp stat feat)))
      (let ((__function__ 'inc4-pc))
        (declare (ignorable __function__))
        (write-pc (+ (read-pc stat feat) 4)
                  stat feat)))

    Theorem: statp-of-inc4-pc

    (defthm statp-of-inc4-pc
      (b* ((new-stat (inc4-pc stat feat)))
        (statp new-stat))
      :rule-classes :rewrite)

    Theorem: stat-validp-of-inc4-pc

    (defthm stat-validp-of-inc4-pc
      (implies (stat-validp stat feat)
               (b* ((?new-stat (inc4-pc stat feat)))
                 (stat-validp new-stat feat))))

    Theorem: inc4-pc-of-stat-fix-stat

    (defthm inc4-pc-of-stat-fix-stat
      (equal (inc4-pc (stat-fix stat) feat)
             (inc4-pc stat feat)))

    Theorem: inc4-pc-stat-equiv-congruence-on-stat

    (defthm inc4-pc-stat-equiv-congruence-on-stat
      (implies (stat-equiv stat stat-equiv)
               (equal (inc4-pc stat feat)
                      (inc4-pc stat-equiv feat)))
      :rule-classes :congruence)

    Theorem: inc4-pc-of-feat-fix-feat

    (defthm inc4-pc-of-feat-fix-feat
      (equal (inc4-pc stat (feat-fix feat))
             (inc4-pc stat feat)))

    Theorem: inc4-pc-feat-equiv-congruence-on-feat

    (defthm inc4-pc-feat-equiv-congruence-on-feat
      (implies (feat-equiv feat feat-equiv)
               (equal (inc4-pc stat feat)
                      (inc4-pc stat feat-equiv)))
      :rule-classes :congruence)