• 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
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
        • Prime-fields
        • Json
        • Syntheto
        • File-io-light
        • Cryptography
        • Number-theory
        • Lists-light
        • Axe
        • Builtins
        • Solidity
          • Values
            • Integer-values
              • Integer-operations
                • Def-uint/int-binary-op
                • Def-uint/int-unary-op
                • Def-uint/int-comparison
                • Uint-mod
                • Uint-div
                • Uint-shr
                • Uint-shl
                • Int-mod
                • Int-div
                • Uint-xor
                • Uint-sub
                • Uint-mul
                • Uint-ior
                • Uint-exp
                • Uint-and
                • Uint-add
                • Int-xor
                • Int-sub
                • Int-mul
                • Int-ior
                • Int-and
                • Int-add
                  • Uint-le
                  • Uint-ge
                  • Uint-ne
                  • Uint-lt
                  • Uint-gt
                  • Uint-eq
                  • Int-ne
                  • Int-lt
                  • Int-le
                  • Int-gt
                  • Int-ge
                  • Int-eq
                  • Uint-minus
                  • Uint-not
                  • Int-not
                  • Int-minus
                • Bit-size
                • Uint
                • Int
              • Boolean-values
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Integer-operations

    Int-add

    Addition of signed integer values.

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

    Definitions and Theorems

    Function: int-add

    (defun int-add (left-operand right-operand)
      (declare (xargs :guard (and (intp left-operand)
                                  (intp right-operand))))
      (b* ((size (int->size left-operand))
           (x (int->value left-operand))
           (y (int->value right-operand)))
        (make-int :size (int->size left-operand)
                  :value (logext size (+ x y)))))

    Theorem: intp-of-int-add

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

    Theorem: int-add-of-int-fix-left-operand

    (defthm int-add-of-int-fix-left-operand
      (equal (int-add (int-fix left-operand)
                      right-operand)
             (int-add left-operand right-operand)))

    Theorem: int-add-int-equiv-congruence-on-left-operand

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

    Theorem: int-add-of-int-fix-right-operand

    (defthm int-add-of-int-fix-right-operand
      (equal (int-add left-operand (int-fix right-operand))
             (int-add left-operand right-operand)))

    Theorem: int-add-int-equiv-congruence-on-right-operand

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