@@ -132,6 +132,65 @@ lemma DirectedOn.isCofinalFor_fst_image_prod_snd_image {β : Type*} [Preorder β
132132 obtain ⟨z, hz, hxz, hyz⟩ := hs _ hx _ hy
133133 exact ⟨z, hz, hxz.1 , hyz.2 ⟩
134134
135+ theorem IsCofinalFor.union_left (hc : IsCofinalFor s t) : IsCofinalFor (s ∪ t) t := by
136+ rintro a (has | hat)
137+ · exact hc has
138+ · exact ⟨a, hat, le_rfl⟩
139+
140+ theorem IsCofinalFor.union_right (hc : IsCofinalFor s t) : IsCofinalFor (t ∪ s) t := by
141+ rw [union_comm]
142+ exact hc.union_left
143+
144+ theorem DirectedOn.of_isCofinalFor (hd : DirectedOn (· ≤ ·) t)
145+ (hst : s ⊆ t) (hc : IsCofinalFor t s) : DirectedOn (· ≤ ·) s := by
146+ intro x hx y hy
147+ obtain ⟨z, hz, hxz, hyz⟩ := hd x (hst hx) y (hst hy)
148+ obtain ⟨w, hw, hzw⟩ := hc hz
149+ exact ⟨w, hw, hxz.trans hzw, hyz.trans hzw⟩
150+
151+ theorem isCofinalFor_or_isCofinalFor_of_directedOn_union (h : DirectedOn (· ≤ ·) (s ∪ t)) :
152+ IsCofinalFor t s ∨ IsCofinalFor s t := by
153+ rw [or_iff_not_imp_left]
154+ intro hts x hx
155+ simp only [IsCofinalFor, not_forall, not_exists, not_and] at hts
156+ obtain ⟨y, hy, hys⟩ := hts
157+ obtain ⟨z, (hzs | hzt), hxz, hyz⟩ := h x (.inl hx) y (.inr hy)
158+ · cases hys z hzs hyz
159+ · exact ⟨z, hzt, hxz⟩
160+
161+ theorem directedOn_union_iff :
162+ DirectedOn (· ≤ ·) (s ∪ t) ↔
163+ DirectedOn (· ≤ ·) s ∧ IsCofinalFor t s ∨ DirectedOn (· ≤ ·) t ∧ IsCofinalFor s t := by
164+ refine ⟨fun h ↦ ?_, ?_⟩
165+ · rcases isCofinalFor_or_isCofinalFor_of_directedOn_union h with hts | hst
166+ · exact .inl ⟨DirectedOn.of_isCofinalFor h subset_union_left hts.union_right, hts⟩
167+ · exact .inr ⟨DirectedOn.of_isCofinalFor h subset_union_right hst.union_left, hst⟩
168+ · rintro (⟨hs, hts⟩ | ⟨ht, hst⟩) x hx y hy
169+ · obtain ⟨x', hx', hxx'⟩ := hts.union_right hx
170+ obtain ⟨y', hy', hyy'⟩ := hts.union_right hy
171+ obtain ⟨z, hz, hx'z, hy'z⟩ := hs x' hx' y' hy'
172+ exact ⟨z, .inl hz, hxx'.trans hx'z, hyy'.trans hy'z⟩
173+ · obtain ⟨x', hx', hxx'⟩ := hst.union_left hx
174+ obtain ⟨y', hy', hyy'⟩ := hst.union_left hy
175+ obtain ⟨z, hz, hx'z, hy'z⟩ := ht x' hx' y' hy'
176+ exact ⟨z, .inr hz, hxx'.trans hx'z, hyy'.trans hy'z⟩
177+
178+ theorem directedOn_or_directedOn_of_union (h : DirectedOn (· ≤ ·) (s ∪ t)) :
179+ DirectedOn (· ≤ ·) s ∨ DirectedOn (· ≤ ·) t := by
180+ rw [directedOn_union_iff] at h
181+ tauto
182+
183+ theorem directedOn_or_directedOn_of_union'
184+ (hn : (s ∪ t).Nonempty) (h : DirectedOn (· ≤ ·) (s ∪ t)) :
185+ DirectedOn (· ≤ ·) s ∧ s.Nonempty ∨ DirectedOn (· ≤ ·) t ∧ t.Nonempty := by
186+ obtain h | h := directedOn_or_directedOn_of_union h
187+ · obtain rfl | hs := s.eq_empty_or_nonempty
188+ · aesop
189+ · exact .inl ⟨h, hs⟩
190+ · obtain rfl | ht := t.eq_empty_or_nonempty
191+ · aesop
192+ · exact .inr ⟨h, ht⟩
193+
135194/-!
136195### Monotonicity
137196-/
0 commit comments