Subtraction of unsigned integer values.
Function:
(defun uint-sub (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-sub (b* ((result (uint-sub left-operand right-operand))) (uintp result)) :rule-classes :rewrite)
Theorem:
(defthm uint-sub-of-uint-fix-left-operand (equal (uint-sub (uint-fix left-operand) right-operand) (uint-sub left-operand right-operand)))
Theorem:
(defthm uint-sub-uint-equiv-congruence-on-left-operand (implies (uint-equiv left-operand left-operand-equiv) (equal (uint-sub left-operand right-operand) (uint-sub left-operand-equiv right-operand))) :rule-classes :congruence)
Theorem:
(defthm uint-sub-of-uint-fix-right-operand (equal (uint-sub left-operand (uint-fix right-operand)) (uint-sub left-operand right-operand)))
Theorem:
(defthm uint-sub-uint-equiv-congruence-on-right-operand (implies (uint-equiv right-operand right-operand-equiv) (equal (uint-sub left-operand right-operand) (uint-sub left-operand right-operand-equiv))) :rule-classes :congruence)