Balanced block sizes #
Splitting n items into k contiguous blocks as evenly as possible gives the first n % k
blocks size n / k + 1 and the others size n / k. Together with Mathlib's
finSigmaFinEquiv, these sizes lay out Fin n as consecutive blocks for every n and every
positive k, not only when k divides n.
Main definitions #
Fin.balancedBlockSize: the size of blockiin the balanced split ofnintokblocks.
Main results #
Fin.sum_balancedBlockSize: the block sizes add up tonwhen0 < k.Fin.div_le_balancedBlockSize,Fin.balancedBlockSize_le_div_add_one: every block has sizen / korn / k + 1.
The size of block i when n items are split into k contiguous blocks as evenly as
possible: the first n % k blocks receive one extra item.
Every balanced block has at least n / k items.
Every balanced block has at most n / k + 1 items.
The balanced block sizes cover all n items when there is at least one block.