Convert a natural number to its non-empty minimum-length big-endian list of digits.
(nat=>bendian+ base nat) → digits
The resulting list is never empty; it is
See also nat=>bendian* and nat=>bendian.
Function:
(defun nat=>bendian+ (base nat) (declare (xargs :guard (and (dab-basep base) (natp nat)))) (let ((__function__ 'nat=>bendian+)) (declare (ignorable __function__)) (b* ((digits (nat=>bendian* base nat))) (or digits (list 0)))))
Theorem:
(defthm return-type-of-nat=>bendian+ (b* ((digits (nat=>bendian+ base nat))) (dab-digit-listp base digits)) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-nat=>bendian+ (b* ((digits (nat=>bendian+ base nat))) (nat-listp digits)) :rule-classes :rewrite)
Theorem:
(defthm nat=>bendian+-of-0 (equal (nat=>bendian+ base 0) (list 0)))
Theorem:
(defthm nat=>bendian+-of-dab-base-fix-base (equal (nat=>bendian+ (dab-base-fix base) nat) (nat=>bendian+ base nat)))
Theorem:
(defthm nat=>bendian+-dab-base-equiv-congruence-on-base (implies (dab-base-equiv base base-equiv) (equal (nat=>bendian+ base nat) (nat=>bendian+ base-equiv nat))) :rule-classes :congruence)
Theorem:
(defthm nat=>bendian+-of-nfix-nat (equal (nat=>bendian+ base (nfix nat)) (nat=>bendian+ base nat)))
Theorem:
(defthm nat=>bendian+-nat-equiv-congruence-on-nat (implies (nat-equiv nat nat-equiv) (equal (nat=>bendian+ base nat) (nat=>bendian+ base nat-equiv))) :rule-classes :congruence)