• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • 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
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Integer-operations

    Int-rem

    Remainder & on ints [JLS14:4.2.2] [JLS14:15.17.3].

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

    Definitions and Theorems

    Function: int-rem

    (defun int-rem (operand-left operand-right)
      (declare (xargs :guard (and (int-valuep operand-left)
                                  (int-valuep operand-right))))
      (declare (xargs :guard (not (equal (int-value->int operand-right)
                                         0))))
      (b* ((x (int-value->int operand-left))
           (y (int-value->int operand-right)))
        (int-value (logext 32 (rem x y)))))

    Theorem: int-valuep-of-int-rem

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

    Theorem: int-rem-of-int-value-fix-operand-left

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

    Theorem: int-rem-int-value-equiv-congruence-on-operand-left

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

    Theorem: int-rem-of-int-value-fix-operand-right

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

    Theorem: int-rem-int-value-equiv-congruence-on-operand-right

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