Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 77dc679

Browse files
committed
chore(data/set/intervals): more lemmas (#4662)
1 parent 9585210 commit 77dc679

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

src/data/set/intervals/basic.lean

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ lemma Icc_subset_Ici_self : Icc a b ⊆ Ici a := λ x, and.left
221221

222222
lemma Icc_subset_Iic_self : Icc a b ⊆ Iic b := λ x, and.right
223223

224+
lemma Ioc_subset_Iic_self : Ioc a b ⊆ Iic b := λ x, and.right
225+
224226
lemma Ioc_subset_Ioc (h₁ : a₂ ≤ a₁) (h₂ : b₁ ≤ b₂) :
225227
Ioc a₁ b₁ ⊆ Ioc a₂ b₂ :=
226228
λ x ⟨hx₁, hx₂⟩, ⟨lt_of_le_of_lt h₁ hx₁, le_trans hx₂ h₂⟩
@@ -263,6 +265,8 @@ lemma Ioi_subset_Ici_self : Ioi a ⊆ Ici a := λx hx, le_of_lt hx
263265

264266
lemma Iio_subset_Iic_self : Iio a ⊆ Iic a := λx hx, le_of_lt hx
265267

268+
lemma Ico_subset_Ici_self : Ico a b ⊆ Ici a := λ x, and.left
269+
266270
lemma Icc_subset_Icc_iff (h₁ : a₁ ≤ b₁) :
267271
Icc a₁ b₁ ⊆ Icc a₂ b₂ ↔ a₂ ≤ a₁ ∧ b₁ ≤ b₂ :=
268272
⟨λ h, ⟨(h ⟨le_refl _, h₁⟩).1, (h ⟨h₁, le_refl _⟩).2⟩,
@@ -378,6 +382,20 @@ by rw [← Iic_diff_right, diff_diff_cancel_left (singleton_subset_iff.2 right_m
378382

379383
@[simp] lemma Iio_union_right : Iio a ∪ {a} = Iic a := ext $ λ x, le_iff_lt_or_eq.symm
380384

385+
lemma Ioo_union_left (hab : a < b) : Ioo a b ∪ {a} = Ico a b :=
386+
by rw [← Ico_diff_left, diff_union_self,
387+
union_eq_self_of_subset_right (singleton_subset_iff.2 $ left_mem_Ico.2 hab)]
388+
389+
lemma Ioo_union_right (hab : a < b) : Ioo a b ∪ {b} = Ioc a b :=
390+
by simpa only [dual_Ioo, dual_Ico] using @Ioo_union_left (order_dual α) _ b a hab
391+
392+
lemma Ioc_union_left (hab : a ≤ b) : Ioc a b ∪ {a} = Icc a b :=
393+
by rw [← Icc_diff_left, diff_union_self,
394+
union_eq_self_of_subset_right (singleton_subset_iff.2 $ left_mem_Icc.2 hab)]
395+
396+
lemma Ico_union_right (hab : a ≤ b) : Ico a b ∪ {b} = Icc a b :=
397+
by simpa only [dual_Ioc, dual_Icc] using @Ioc_union_left (order_dual α) _ b a hab
398+
381399
lemma mem_Ici_Ioi_of_subset_of_subset {s : set α} (ho : Ioi a ⊆ s) (hc : s ⊆ Ici a) :
382400
s ∈ ({Ici a, Ioi a} : set (set α)) :=
383401
classical.by_cases
@@ -447,13 +465,27 @@ lemma Iic_singleton_of_bot {a : α} (h_bot : ∀ x, a ≤ x) : Iic a = {a} :=
447465

448466
end partial_order
449467

450-
section order_top_or_bot
451-
variables {α : Type u}
468+
section order_top
469+
470+
variables {α : Type u} [order_top α] {a : α}
471+
472+
@[simp] lemma Ici_top : Ici (⊤ : α) = {⊤} := Ici_singleton_of_top (λ _, le_top)
473+
@[simp] lemma Iic_top : Iic (⊤ : α) = univ := eq_univ_of_forall $ λ x, le_top
474+
@[simp] lemma Icc_top : Icc a ⊤ = Ici a := by simp [← Ici_inter_Iic]
475+
@[simp] lemma Ioc_top : Ioc a ⊤ = Ioi a := by simp [← Ioi_inter_Iic]
476+
477+
end order_top
478+
479+
section order_bot
480+
481+
variables {α : Type u} [order_bot α] {a : α}
452482

453-
@[simp] lemma Ici_top [order_top α] : Ici (⊤ : α) = {⊤} := Ici_singleton_of_top (λ _, le_top)
454-
@[simp] lemma Ici_bot [order_bot α] : Iic (⊥ : α) = {⊥} := Iic_singleton_of_bot (λ _, bot_le)
483+
@[simp] lemma Iic_bot : Iic (⊥ : α) = {⊥} := Iic_singleton_of_bot (λ _, bot_le)
484+
@[simp] lemma Ici_bot : Ici (⊥ : α) = univ := @Iic_top (order_dual α) _
485+
@[simp] lemma Icc_bot : Icc ⊥ a = Iic a := by simp [← Ici_inter_Iic]
486+
@[simp] lemma Ico_bot : Ico ⊥ a = Iio a := by simp [← Ici_inter_Iio]
455487

456-
end order_top_or_bot
488+
end order_bot
457489

458490
section linear_order
459491
variables {α : Type u} [linear_order α] {a a₁ a₂ b b₁ b₂ : α}

0 commit comments

Comments
 (0)