• 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
      • Des
      • Ethereum
      • 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
                • Imul-spec-64
                  • Imul-spec-8
                  • Imul-spec-32
                  • Imul-spec-16
                • Mul-spec
                • Idiv-spec
                • Div-spec
                • 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
        • 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
    • Imul-spec

    Imul-spec-64

    Signature
    (imul-spec-64 dst src) → (mv * * * *)

    Definitions and Theorems

    Function: imul-spec-64

    (defun imul-spec-64 (dst src)
     (declare (type (unsigned-byte 64) dst)
              (type (unsigned-byte 64) src))
     (let ((__function__ 'imul-spec-64))
      (declare (ignorable __function__))
      (b*
       ((dst-int (the (signed-byte 64) (ntoi 64 dst)))
        (src-int (the (signed-byte 64) (ntoi 64 src)))
        (product-int (the (signed-byte 128)
                          (* (the (signed-byte 64) dst-int)
                             (the (signed-byte 64) src-int))))
        (product (the (unsigned-byte 128)
                      (n-size 128 product-int)))
        (product-high
             (mbe :logic (part-select product :low 64 :width 64)
                  :exec (the (unsigned-byte 64)
                             (ash (the (unsigned-byte 128) product)
                                  -64))))
        (product-low
             (mbe :logic (part-select product :low 0 :width 64)
                  :exec (the (unsigned-byte 64)
                             (logand 18446744073709551615 product))))
        (product-low-int (the (signed-byte 64)
                              (ntoi 64 product-low)))
        (cf-and-of
         (the
           (unsigned-byte 1)
           (bool->bit (not (equal (the (signed-byte 64) product-low-int)
                                  (the (signed-byte 128)
                                       product-int)))))))
       (mv product-high
           product-low product cf-and-of))))

    Theorem: n64-mv-nth-0-imul-spec-64

    (defthm n64-mv-nth-0-imul-spec-64
     (unsigned-byte-p 64 (mv-nth 0 (imul-spec-64 dst src)))
     :rule-classes
     (:rewrite
      (:type-prescription
          :corollary (natp (mv-nth 0 (imul-spec-64 dst src)))
          :hints
          (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp))))
      (:linear
       :corollary (and (<= 0 (mv-nth 0 (imul-spec-64 dst src)))
                       (< (mv-nth 0 (imul-spec-64 dst src))
                          18446744073709551616))
       :hints
       (("Goal"
            :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))

    Theorem: mv-nth-1-imul-spec-64

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

    Theorem: mv-nth-2-imul-spec-64

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

    Theorem: mv-nth-3-imul-spec-64

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