Balanced square-root block sizes #
The partition used in [AB07], Chapter 11 Exercise 2, has Nat.sqrt n contiguous blocks
of size approximately sqrt n. The quotient/remainder split Fin.balancedBlockSize covers every
input length, not just squares. For n ≥ 4 every block has at least Nat.sqrt n ≥ 2 and at most
3 * Nat.sqrt n coordinates.
Main definitions #
Cslib.BitString.sqrtBlockSizes: the block sizes of the balancedNat.sqrt n-block split.
Main results #
Cslib.BitString.sum_sqrtBlockSizes: the blocks cover allncoordinates, for everyn.Cslib.BitString.sqrt_le_sqrtBlockSizes: every block has at leastNat.sqrt ncoordinates.Cslib.BitString.sqrtBlockSizes_le: every block has at most3 * Nat.sqrt ncoordinates.
The square-root blocks cover every coordinate. For n = 0 there are no blocks.
Each square-root block has at least Nat.sqrt n coordinates.
theorem Cslib.BitString.two_le_sqrtBlockSizes {n : ℕ} (hn : 4 ≤ n) (i : Fin n.sqrt) :
2 ≤ sqrtBlockSizes n i
For n ≥ 4 each square-root block has room for an adjacent pair.
Each square-root block has at most three times as many coordinates as there are blocks.