Convert a natural number to its little-endian list of bytes, seen as digits in base 256, of specified length.
(nat=>lebytes width nat) → digits
Function:
(defun nat=>lebytes (width nat) (declare (xargs :guard (and (natp width) (natp nat)))) (declare (xargs :guard (< nat (expt 256 width)))) (let ((__function__ 'nat=>lebytes)) (declare (ignorable __function__)) (nat=>lendian 256 width nat)))
Theorem:
(defthm byte-listp-of-nat=>lebytes (b* ((digits (nat=>lebytes width nat))) (byte-listp digits)) :rule-classes :rewrite)
Theorem:
(defthm nat=>lebytes-of-nfix-width (equal (nat=>lebytes (nfix width) nat) (nat=>lebytes width nat)))
Theorem:
(defthm nat=>lebytes-nat-equiv-congruence-on-width (implies (nat-equiv width width-equiv) (equal (nat=>lebytes width nat) (nat=>lebytes width-equiv nat))) :rule-classes :congruence)
Theorem:
(defthm nat=>lebytes-of-nfix-nat (equal (nat=>lebytes width (nfix nat)) (nat=>lebytes width nat)))
Theorem:
(defthm nat=>lebytes-nat-equiv-congruence-on-nat (implies (nat-equiv nat nat-equiv) (equal (nat=>lebytes width nat) (nat=>lebytes width nat-equiv))) :rule-classes :congruence)
Theorem:
(defthm len-of-nat=>lebytes (equal (len (nat=>lebytes width nat)) (nfix width)))