(general-cf-spec-fn result-nbits raw-result) → *
General
Carry flag Set if an arithmetic operation generates a carry or a borrow out of the most-significant bit of the result; cleared otherwise. This flag indicates an overflow condition for unsigned-integer arithmetic. It is also used in multiple-precision arithmetic.
Function:
(defun general-cf-spec-fn$inline (result-nbits raw-result) (declare (xargs :guard (and (natp result-nbits) (natp raw-result)))) (bool->bit (not (unsigned-byte-p result-nbits raw-result))))
Theorem:
(defthm n01p-general-cf-spec-fn (unsigned-byte-p 1 (general-cf-spec-fn result-nbits raw-result)) :rule-classes (:rewrite (:type-prescription :corollary (natp (general-cf-spec-fn result-nbits raw-result)) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (and (<= 0 (general-cf-spec-fn result-nbits raw-result)) (< (general-cf-spec-fn result-nbits raw-result) 2)) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))