Aligned packing of power-size blocks #
Blocks of sizes b ^ ℓ i, for i in a finite set s, fit side by side into
[0, ∑ i ∈ s, b ^ ℓ i) so that every block starts at a multiple of its own size
(Nat.exists_aligned_packing). Place the blocks in decreasing order of size: each starting point is
then a sum of larger powers of b, all divisible by the next block's size.
For b = 2 an aligned block is a binary address prefix: the numbers in the block of i are those
whose bits above position ℓ i are the bits of its start. A circuit reading a table of all the
blocks at an address in block i therefore needs only the bits of the start above ℓ i and the
offset bits below, with no addition.
Main results #
Nat.exists_aligned_packing: blocks of sizesb ^ ℓ ipack into their total size with aligned starting points.
Aligned packing. Blocks of sizes b ^ ℓ i, for i ∈ s, can be placed at pairwise disjoint
positions o i inside [0, ∑ i ∈ s, b ^ ℓ i) so that each starts at a multiple of its size:
place them in decreasing order of size.