Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cslib/Foundations/Data/OmegaSequence/Flatten.lean
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ theorem append_flatten [Inhabited α] {ls : ωSequence (List α)} (h_ls : ∀ k,
(n : ℕ) : (ls.take n).flatten ++ω (ls.drop n).flatten = ls.flatten := by
induction n generalizing ls <;> grind [tail_eq_drop, take_succ]

/-- The length of `(ls.take n).flatten` is `ls.cumLen n`. -/
@[simp, nolint simpNF, scoped grind =]
theorem length_flatten_take {ls : ωSequence (List α)} (n : ℕ) :
(ls.take n).flatten.length = ls.cumLen n := by
/-- The sum of `List.map List.length (take n ls)` is `ls.cumLen n`. -/
@[simp, scoped grind =]
theorem map_length_take_sum {ls : ωSequence (List α)} (n : ℕ) :
(List.map List.length (take n ls)).sum = ls.cumLen n := by
induction n <;> grind [take_succ']

/-- `In fact, (ls.take n).flatten` is `ls.flatten.take (ls.cumLen n)`
Expand All @@ -137,7 +137,7 @@ theorem flatten_take_drop [Inhabited α]
(ls.drop n).flatten = ls.flatten.drop (ls.cumLen n) := by
apply append_left_right_injective
· rw [append_flatten h_ls n, append_take_drop (ls.cumLen n) ls.flatten]
· rw [length_flatten_take, length_take]
· simp

theorem flatten_take [Inhabited α]
{ls : ωSequence (List α)} (h_ls : ∀ k, (ls k).length > 0) (n : ℕ) :
Expand Down
Loading