• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
      • X86isa
        • Program-execution
        • Sdm-instruction-set-summary
        • Tlb
        • Running-linux
        • Introduction
        • Asmtest
        • X86isa-build-instructions
        • Publications
        • Contributors
        • Machine
          • X86isa-state
          • Syscalls
          • Cpuid
          • Linear-memory
          • Rflag-specifications
          • Characterizing-undefined-behavior
          • Top-level-memory
          • App-view
          • X86-decoder
          • Physical-memory
          • Decoding-and-spec-utils
          • Instructions
            • Two-byte-opcodes
            • One-byte-opcodes
            • Fp-opcodes
            • Instruction-semantic-functions
              • Sar-spec
              • Shr-spec
              • Sal/shl-spec
              • Rol-spec
              • Ror-spec
              • Rcl-spec
              • Rcr-spec
              • Simd-sub-spec
              • Simd-add-spec
              • Imul-spec
              • Mul-spec
              • Idiv-spec
              • Div-spec
                • Div-spec-8
                • Div-spec-64
                • Div-spec-32
                  • Div-spec-16
                • Shrd-spec
                • Shld-spec
                • Gpr-arith/logic-spec
                • Shrx-spec
                • Shlx-spec
                • Sarx-spec
                • Floating-point-specifications
              • X86-illegal-instruction
              • Implemented-opcodes
              • Opcode-maps
              • X86-general-protection
              • X86-device-not-available
              • X86-step-unimplemented
              • Privileged-opcodes
              • Three-byte-opcodes
            • Register-readers-and-writers
            • X86-modes
            • Segmentation
            • Other-non-deterministic-computations
            • Environment
            • Paging
          • Implemented-opcodes
          • To-do
          • Proof-utilities
          • Peripherals
          • Model-validation
          • Modelcalls
          • Concrete-simulation-examples
          • Utils
          • Debugging-code-proofs
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Div-spec

    Div-spec-32

    Signature
    (div-spec-32 dst src) → (mv * * *)

    Definitions and Theorems

    Function: div-spec-32

    (defun div-spec-32 (dst src)
      (declare (type (unsigned-byte 64) dst)
               (type (unsigned-byte 32) src))
      (declare (xargs :guard (not (equal src 0))))
      (let ((__function__ 'div-spec-32))
        (declare (ignorable __function__))
        (b* ((dst (mbe :logic (n-size 64 dst) :exec dst))
             (src (mbe :logic (n-size 32 src) :exec src))
             (quotient (the (unsigned-byte 64)
                            (floor dst src)))
             (remainder (the (unsigned-byte 32) (mod dst src)))
             (overflow? (< 4294967295 quotient))
             ((when overflow?)
              (mv (list (cons 'quotient quotient)
                        (cons 'remainder remainder))
                  0 0)))
          (mv overflow? quotient remainder))))

    Theorem: n32-mv-nth-1-div-spec-32

    (defthm n32-mv-nth-1-div-spec-32
     (implies (not (mv-nth 0 (div-spec-32 dst src)))
              (unsigned-byte-p 32 (mv-nth 1 (div-spec-32 dst src))))
     :rule-classes
     (:rewrite
      (:type-prescription
          :corollary (implies (not (mv-nth 0 (div-spec-32 dst src)))
                              (natp (mv-nth 1 (div-spec-32 dst src))))
          :hints
          (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp))))
      (:linear
       :corollary (implies (not (mv-nth 0 (div-spec-32 dst src)))
                           (and (<= 0 (mv-nth 1 (div-spec-32 dst src)))
                                (< (mv-nth 1 (div-spec-32 dst src))
                                   4294967296)))
       :hints
       (("Goal"
            :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))

    Theorem: mv-nth-2-div-spec-32

    (defthm mv-nth-2-div-spec-32
     (implies (and (unsigned-byte-p 32 src) (< 0 src))
              (unsigned-byte-p 32 (mv-nth 2 (div-spec-32 dst src))))
     :rule-classes
     (:rewrite
      (:type-prescription
          :corollary (implies (and (unsigned-byte-p 32 src) (< 0 src))
                              (natp (mv-nth 2 (div-spec-32 dst src))))
          :hints
          (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp))))
      (:linear
       :corollary (implies (and (unsigned-byte-p 32 src) (< 0 src))
                           (and (<= 0 (mv-nth 2 (div-spec-32 dst src)))
                                (< (mv-nth 2 (div-spec-32 dst src))
                                   4294967296)))
       :hints
       (("Goal"
            :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))