• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vwsim
      • Vl
      • X86isa
        • Program-execution
        • Sdm-instruction-set-summary
        • Tlb
        • Running-linux
        • Introduction
        • Asmtest
        • X86isa-build-instructions
        • Publications
        • Contributors
        • Machine
          • X86isa-state
          • Syscalls
          • Cpuid
          • Linear-memory
            • Reasoning-about-memory-reads-and-writes
            • Wml256
            • Rml256
            • Wml512
            • Rml512
            • Rml128
            • Rml80
            • Program-location
            • Rml64
            • Wml128
            • Rml48
            • Rml32
            • Rml08
            • Rml16
            • Wml80
            • Wml64
            • Wml08
            • Byte-listp
            • Wml48
            • Parametric-memory-reads-and-writes
            • Combine-n-bytes
              • Wml32
              • Program-at
              • Wml16
              • Combine-bytes
              • Write-canonical-address-to-memory-user-exec
              • Write-canonical-address-to-memory
              • Riml64
              • Wml-size
              • Rml-size
              • Riml32
              • Riml16
              • Riml08
              • Wiml64
              • Wiml32
              • Wiml16
              • Wiml08
              • Wiml-size
              • Generate-xr-over-write-thms
              • Generate-write-fn-over-xw-thms
              • Generate-read-fn-over-xw-thms
              • Riml-size
            • Rflag-specifications
            • Characterizing-undefined-behavior
            • Top-level-memory
            • App-view
            • X86-decoder
            • Physical-memory
            • Decoding-and-spec-utils
            • Instructions
            • 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
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Linear-memory

    Combine-n-bytes

    Signature
    (combine-n-bytes low num bytes) → *
    Arguments
    low — Index of the first byte.
        Guard (natp low).
    num — Number of bytes to combine, starting at pos.
        Guard (natp num).
    bytes — LSB first.
        Guard (byte-listp bytes).

    Definitions and Theorems

    Function: combine-n-bytes

    (defun combine-n-bytes (low num bytes)
      (declare (xargs :guard (and (natp low)
                                  (natp num)
                                  (byte-listp bytes))))
      (declare (xargs :guard (<= (+ low num) (len bytes))))
      (let ((__function__ 'combine-n-bytes))
        (declare (ignorable __function__))
        (if (mbt (and (<= (+ low num) (len bytes))
                      (byte-listp bytes)
                      (natp low)
                      (natp num)))
            (combine-bytes (take num (nthcdr low bytes)))
          0)))

    Theorem: combine-bytes-and-take-degenerate-case-1

    (defthm combine-bytes-and-take-degenerate-case-1
      (implies (zp n)
               (equal (combine-bytes (take n bytes))
                      0)))

    Theorem: combine-bytes-and-take-degenerate-case-2

    (defthm combine-bytes-and-take-degenerate-case-2
      (equal (combine-bytes (take n nil)) 0))

    Theorem: natp-of-combine-bytes-of-take

    (defthm natp-of-combine-bytes-of-take
      (implies (byte-listp bytes)
               (<= 0 (combine-bytes (take num bytes)))))

    Theorem: natp-combine-n-bytes

    (defthm natp-combine-n-bytes
     (implies (force (byte-listp bytes))
              (natp (combine-n-bytes low num bytes)))
     :rule-classes
     ((:type-prescription)
      (:linear
          :corollary (implies (byte-listp bytes)
                              (<= 0 (combine-n-bytes low num bytes))))))

    Theorem: unsigned-byte-p-of-combine-n-bytes

    (defthm unsigned-byte-p-of-combine-n-bytes
      (implies (and (equal n (ash num 3)) (natp num))
               (unsigned-byte-p n (combine-n-bytes low num bytes))))

    Theorem: size-of-combine-n-bytes

    (defthm size-of-combine-n-bytes
      (< (combine-n-bytes low num bytes)
         (expt 2 (ash num 3)))
      :rule-classes :linear)