Documentation

CslibFrontier.Foundations.Data.List.ToChunks

Chunks of a list #

Batteries' List.toChunks n l cuts l into consecutive chunks of n elements, in order; the last chunk may be shorter, and n = 0 gives the whole list as one chunk. Batteries states no lemmas about it. This file proves its two basic contracts through the accumulator loop toChunks.go.

Main results #

@[simp]
theorem List.flatten_toChunks {α : Type u_1} (n : ℕ) (l : List α) :

The chunks flatten back to the list.

theorem List.length_pos_and_le_of_mem_toChunks {α : Type u_1} {n : ℕ} (hn : 0 < n) {l c : List α} (hc : c ∈ toChunks n l) :

For 0 < n, every chunk has between 1 and n elements.