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

Commit 8985a43

Browse files
kim-emmergify[bot]
authored andcommitted
feat(data/set/intervals): some interval lemmas (#942)
* feat(data/set/intervals): a few more lemmas * one-liners
1 parent 361e216 commit 8985a43

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/data/set/intervals.lean

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Each interval has the name `I` + letter for left side + letter for right side
1515
TODO: This is just the beginning; a lot of rules are missing
1616
-/
1717
import data.set.lattice algebra.order algebra.order_functions
18-
import tactic.linarith
1918

2019
namespace set
2120

@@ -57,6 +56,15 @@ def Ioi (a : α) := {x | a < x}
5756
@[simp] lemma mem_Ici : x ∈ Ici a ↔ a ≤ x := iff.rfl
5857
@[simp] lemma mem_Ioi : x ∈ Ioi a ↔ a < x := iff.rfl
5958

59+
@[simp] lemma left_mem_Ioo : a ∈ Ioo a b ↔ false := ⟨λ h, lt_irrefl a h.1, λ h, false.elim h⟩
60+
@[simp] lemma left_mem_Ico : a ∈ Ico a b ↔ a < b := ⟨λ h, h.2, λ h, ⟨le_refl _, h⟩⟩
61+
@[simp] lemma left_mem_Icc : a ∈ Icc a b ↔ a ≤ b := ⟨λ h, h.2, λ h, ⟨le_refl _, h⟩⟩
62+
@[simp] lemma left_mem_Ioc : a ∈ Ioc a b ↔ false := ⟨λ h, lt_irrefl a h.1, λ h, false.elim h⟩
63+
@[simp] lemma right_mem_Ioo : b ∈ Ioo a b ↔ false := ⟨λ h, lt_irrefl b h.2, λ h, false.elim h⟩
64+
@[simp] lemma right_mem_Ico : b ∈ Ico a b ↔ false := ⟨λ h, lt_irrefl b h.2, λ h, false.elim h⟩
65+
@[simp] lemma right_mem_Icc : b ∈ Icc a b ↔ a ≤ b := ⟨λ h, h.1, λ h, ⟨h, le_refl _⟩⟩
66+
@[simp] lemma right_mem_Ioc : b ∈ Ioc a b ↔ a < b := ⟨λ h, h.1, λ h, ⟨h, le_refl _⟩⟩
67+
6068
@[simp] lemma Ioo_eq_empty (h : b ≤ a) : Ioo a b = ∅ :=
6169
eq_empty_iff_forall_not_mem.2 $ λ x ⟨h₁, h₂⟩, not_le_of_lt (lt_trans h₁ h₂) h
6270

@@ -71,6 +79,7 @@ eq_empty_iff_forall_not_mem.2 $ λ x ⟨h₁, h₂⟩, not_lt_of_le (le_trans h
7179

7280
@[simp] lemma Ioo_self (a : α) : Ioo a a = ∅ := Ioo_eq_empty $ le_refl _
7381
@[simp] lemma Ico_self (a : α) : Ico a a = ∅ := Ico_eq_empty $ le_refl _
82+
@[simp] lemma Ioc_self (a : α) : Ioc a a = ∅ := Ioc_eq_empty $ le_refl _
7483

7584
lemma Iio_ne_empty [no_bot_order α] (a : α) : Iio a ≠ ∅ :=
7685
ne_empty_iff_exists_mem.2 (no_bot a)
@@ -114,6 +123,16 @@ Icc_subset_Icc h (le_refl _)
114123
lemma Icc_subset_Icc_right (h : b₁ ≤ b₂) : Icc a b₁ ⊆ Icc a b₂ :=
115124
Icc_subset_Icc (le_refl _) h
116125

126+
lemma Ioc_subset_Ioc (h₁ : a₂ ≤ a₁) (h₂ : b₁ ≤ b₂) :
127+
Ioc a₁ b₁ ⊆ Ioc a₂ b₂ :=
128+
λ x ⟨hx₁, hx₂⟩, ⟨lt_of_le_of_lt h₁ hx₁, le_trans hx₂ h₂⟩
129+
130+
lemma Ioc_subset_Ioc_left (h : a₁ ≤ a₂) : Ioc a₂ b ⊆ Ioc a₁ b :=
131+
Ioc_subset_Ioc h (le_refl _)
132+
133+
lemma Ioc_subset_Ioc_right (h : b₁ ≤ b₂) : Ioc a b₁ ⊆ Ioc a b₂ :=
134+
Ioc_subset_Ioc (le_refl _) h
135+
117136
lemma Ico_subset_Ioo_left (h₁ : a₁ < a₂) : Ico a₂ b ⊆ Ioo a₁ b :=
118137
λ x, and.imp_left $ lt_of_lt_of_le h₁
119138

0 commit comments

Comments
 (0)