File tree Expand file tree Collapse file tree
Cslib/Foundations/Data/OmegaSequence Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ theorem flatten_drop [Inhabited α]
150150 (flatten_take_drop h_ls n).2
151151
152152/-- `ls n` is the segement from position `ls.cumLen n` to position `ls.cumLen (n + 1) - 1`
153- of ls.flatten` -/
153+ of ` ls.flatten` -/
154154@ [simp, scoped grind =]
155155theorem extract_flatten [Inhabited α] {ls : ωSequence (List α)} (h_ls : ∀ k, (ls k).length > 0 )
156156 (n : ℕ) : ls.flatten.extract (ls.cumLen n) (ls.cumLen (n + 1 )) = ls n := by
@@ -159,6 +159,15 @@ theorem extract_flatten [Inhabited α] {ls : ωSequence (List α)} (h_ls : ∀ k
159159 have h_take := flatten_take h_ls' 1
160160 grind [extract_eq_drop_take]
161161
162+ /-- Distributivity of "forall" over `flatten`. -/
163+ theorem forall_flatten_iff [Inhabited α] {ls : ωSequence (List α)} (h_ls : ∀ k, (ls k).length > 0 )
164+ (p : α → Prop ) : (∀ n, p (ls.flatten n)) ↔ ∀ k, (ls k).Forall p := by
165+ constructor
166+ · simp only [List.forall_iff_forall_mem, List.forall_mem_iff_getElem, ← extract_flatten h_ls]
167+ grind
168+ · have := segment_upper_bound (cumLen_strictMono h_ls)
169+ grind [List.forall_iff_forall_mem, flatten_def]
170+
162171/-- Given an ω-sequence `s` and a function `f : ℕ → ℕ`, `s.toSegs f` is the ω-sequence
163172whose `n`-th element is the list `s.extract (f n) (f (n + 1))`. In all its uses, the
164173function `f` will always be assumed to be strictly monotonic with `f 0 = 0`. -/
You can’t perform that action at this time.
0 commit comments