Addition of unsigned integer values.
Function:
(defun uint-add (left-operand right-operand) (declare (xargs :guard (and (uintp left-operand) (uintp right-operand)))) (b* ((size (uint->size left-operand)) (x (uint->value left-operand)) (y (uint->value right-operand))) (make-uint :size (uint->size left-operand) :value (loghead size (+ x y)))))
Theorem:
(defthm uintp-of-uint-add (b* ((result (uint-add left-operand right-operand))) (uintp result)) :rule-classes :rewrite)
Theorem:
(defthm uint-add-of-uint-fix-left-operand (equal (uint-add (uint-fix left-operand) right-operand) (uint-add left-operand right-operand)))
Theorem:
(defthm uint-add-uint-equiv-congruence-on-left-operand (implies (uint-equiv left-operand left-operand-equiv) (equal (uint-add left-operand right-operand) (uint-add left-operand-equiv right-operand))) :rule-classes :congruence)
Theorem:
(defthm uint-add-of-uint-fix-right-operand (equal (uint-add left-operand (uint-fix right-operand)) (uint-add left-operand right-operand)))
Theorem:
(defthm uint-add-uint-equiv-congruence-on-right-operand (implies (uint-equiv right-operand right-operand-equiv) (equal (uint-add left-operand right-operand) (uint-add left-operand right-operand-equiv))) :rule-classes :congruence)