Arithmetic negation of unsigned integer values.
Function:
(defun uint-minus (operand) (declare (xargs :guard (uintp operand))) (b* ((size (uint->size operand)) (x (uint->value operand))) (make-uint :size (uint->size operand) :value (loghead size (- x)))))
Theorem:
(defthm uintp-of-uint-minus (b* ((result (uint-minus operand))) (uintp result)) :rule-classes :rewrite)
Theorem:
(defthm uint-minus-of-uint-fix-operand (equal (uint-minus (uint-fix operand)) (uint-minus operand)))
Theorem:
(defthm uint-minus-uint-equiv-congruence-on-operand (implies (uint-equiv operand operand-equiv) (equal (uint-minus operand) (uint-minus operand-equiv))) :rule-classes :congruence)