• 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
        • Atj
        • Aij
        • Language
          • Syntax
          • Semantics
            • Primitive-function-macros
            • Primitive-values
            • Floating-point-placeholders
            • Pointers
            • Floating-point-value-set-parameters
            • Values
            • Primitive-operations
              • Integer-operations
                • Long-long-ushiftr
                • Long-int-ushiftr
                • Int-long-ushiftr
                  • Int-int-ushiftr
                  • Long-long-shiftr
                  • Long-long-shiftl
                  • Long-int-shiftr
                  • Long-int-shiftl
                  • Int-long-shiftr
                  • Int-int-shiftr
                  • Int-long-shiftl
                  • Int-int-shiftl
                  • Long-xor
                  • Long-neq
                  • Long-lesseq
                  • Long-ior
                  • Long-greateq
                  • Long-and
                  • Int-xor
                  • Int-ior
                  • Int-greateq
                  • Long-rem
                  • Long-mul
                  • Long-less
                  • Long-great
                  • Long-eq
                  • Long-div
                  • Long-add
                  • Int-neq
                  • Int-mul
                  • Int-lesseq
                  • Int-great
                  • Int-eq
                  • Int-and
                  • Int-add
                  • Long-sub
                  • Int-sub
                  • Int-rem
                  • Int-less
                  • Int-div
                  • Long-plus
                  • Long-not
                  • Long-minus
                  • Int-not
                  • Int-minus
                  • Int-plus
                • Floating-point-operations
                • Boolean-operations
              • Primitive-conversions
              • Reference-values
        • Taspi
        • Riscv
        • 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
      • Std
      • Community
      • Proof-automation
      • ACL2
      • Macro-libraries
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Integer-operations

    Int-long-ushiftr

    Unsigned right shift of an int by a long [JLS14:4.2.2] [JLS14:15.19].

    Signature
    (int-long-ushiftr operand-left operand-right) → result
    Arguments
    operand-left — Guard (int-valuep operand-left).
    operand-right — Guard (long-valuep operand-right).
    Returns
    result — Type (int-valuep result).

    We first convert the left operand to unsigned.

    Only the low 5 bits of the distance are used [JLS14:15.19].

    Definitions and Theorems

    Function: int-long-ushiftr

    (defun int-long-ushiftr (operand-left operand-right)
      (declare (xargs :guard (and (int-valuep operand-left)
                                  (long-valuep operand-right))))
      (b* ((x (int-value->int operand-left))
           (y (long-value->int operand-right)))
        (int-value (logext 32
                           (ash (loghead 32 x)
                                (- (loghead 5 y)))))))

    Theorem: int-valuep-of-int-long-ushiftr

    (defthm int-valuep-of-int-long-ushiftr
      (b* ((result (int-long-ushiftr operand-left operand-right)))
        (int-valuep result))
      :rule-classes :rewrite)

    Theorem: int-long-ushiftr-of-int-value-fix-operand-left

    (defthm int-long-ushiftr-of-int-value-fix-operand-left
      (equal (int-long-ushiftr (int-value-fix operand-left)
                               operand-right)
             (int-long-ushiftr operand-left operand-right)))

    Theorem: int-long-ushiftr-int-value-equiv-congruence-on-operand-left

    (defthm int-long-ushiftr-int-value-equiv-congruence-on-operand-left
      (implies
           (int-value-equiv operand-left operand-left-equiv)
           (equal (int-long-ushiftr operand-left operand-right)
                  (int-long-ushiftr operand-left-equiv operand-right)))
      :rule-classes :congruence)

    Theorem: int-long-ushiftr-of-long-value-fix-operand-right

    (defthm int-long-ushiftr-of-long-value-fix-operand-right
      (equal (int-long-ushiftr operand-left
                               (long-value-fix operand-right))
             (int-long-ushiftr operand-left operand-right)))

    Theorem: int-long-ushiftr-long-value-equiv-congruence-on-operand-right

    (defthm
          int-long-ushiftr-long-value-equiv-congruence-on-operand-right
      (implies
           (long-value-equiv operand-right operand-right-equiv)
           (equal (int-long-ushiftr operand-left operand-right)
                  (int-long-ushiftr operand-left operand-right-equiv)))
      :rule-classes :congruence)