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
11 changes: 10 additions & 1 deletion Cslib/Foundations/Data/OmegaSequence/Flatten.lean
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ theorem flatten_drop [Inhabited α]
(flatten_take_drop h_ls n).2

/-- `ls n` is the segement from position `ls.cumLen n` to position `ls.cumLen (n + 1) - 1`
of ls.flatten` -/
of `ls.flatten` -/
@[simp, scoped grind =]
theorem extract_flatten [Inhabited α] {ls : ωSequence (List α)} (h_ls : ∀ k, (ls k).length > 0)
(n : ℕ) : ls.flatten.extract (ls.cumLen n) (ls.cumLen (n + 1)) = ls n := by
Expand All @@ -159,6 +159,15 @@ theorem extract_flatten [Inhabited α] {ls : ωSequence (List α)} (h_ls : ∀ k
have h_take := flatten_take h_ls' 1
grind [extract_eq_drop_take]

/-- Distributivity of "forall" over `flatten`. -/
theorem forall_flatten_iff [Inhabited α] {ls : ωSequence (List α)} (h_ls : ∀ k, (ls k).length > 0)
(p : α → Prop) : (∀ n, p (ls.flatten n)) ↔ ∀ k, (ls k).Forall p := by
Comment thread
ctchou marked this conversation as resolved.
constructor
· simp only [List.forall_iff_forall_mem, List.forall_mem_iff_getElem, ← extract_flatten h_ls]
grind
· have := segment_upper_bound (cumLen_strictMono h_ls)
grind [List.forall_iff_forall_mem, flatten_def]

/-- Given an ω-sequence `s` and a function `f : ℕ → ℕ`, `s.toSegs f` is the ω-sequence
whose `n`-th element is the list `s.extract (f n) (f (n + 1))`. In all its uses, the
function `f` will always be assumed to be strictly monotonic with `f 0 = 0`. -/
Expand Down
Loading