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

Commit a71628a

Browse files
sgouezeldigama0
authored andcommitted
feat(algebra/order,...): material on orders (#554)
1 parent a04c7e2 commit a71628a

File tree

7 files changed

+61
-25
lines changed

7 files changed

+61
-25
lines changed

algebra/order.lean

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,26 @@ lemma le_of_forall_le [preorder α] {a b : α}
104104
(H : ∀ c, c ≤ a → c ≤ b) : a ≤ b :=
105105
H _ (le_refl _)
106106

107+
lemma le_of_forall_le' [preorder α] {a b : α}
108+
(H : ∀ c, a ≤ c → b ≤ c) : b ≤ a :=
109+
H _ (le_refl _)
110+
107111
lemma le_of_forall_lt [linear_order α] {a b : α}
108112
(H : ∀ c, c < a → c < b) : a ≤ b :=
109113
le_of_not_lt $ λ h, lt_irrefl _ (H _ h)
110114

115+
lemma le_of_forall_lt' [linear_order α] {a b : α}
116+
(H : ∀ c, a < c → b < c) : b ≤ a :=
117+
le_of_not_lt $ λ h, lt_irrefl _ (H _ h)
118+
111119
lemma eq_of_forall_ge_iff [partial_order α] {a b : α}
112120
(H : ∀ c, a ≤ c ↔ b ≤ c) : a = b :=
113121
le_antisymm ((H _).2 (le_refl _)) ((H _).1 (le_refl _))
114122

115123
/-- monotonicity of `≤` with respect to `→` -/
116124
lemma le_implies_le_of_le_of_le {a b c d : α} [preorder α]
117125
(h₀ : c ≤ a) (h₁ : b ≤ d) :
118-
a ≤ b -> c ≤ d :=
126+
a ≤ b c ≤ d :=
119127
assume h₂ : a ≤ b,
120128
calc c
121129
≤ a : h₀

algebra/order_functions.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ section
1616
variables [decidable_linear_order α] [decidable_linear_order β] {f : α → β} {a b c d : α}
1717

1818
-- translate from lattices to linear orders (sup → max, inf → min)
19-
lemma le_min_iff : c ≤ min a b ↔ c ≤ a ∧ c ≤ b := le_inf_iff
20-
lemma max_le_iff : max a b ≤ c ↔ a ≤ c ∧ b ≤ c := sup_le_iff
19+
@[simp] lemma le_min_iff : c ≤ min a b ↔ c ≤ a ∧ c ≤ b := le_inf_iff
20+
@[simp] lemma max_le_iff : max a b ≤ c ↔ a ≤ c ∧ b ≤ c := sup_le_iff
2121
lemma max_le_max : a ≤ c → b ≤ d → max a b ≤ max c d := sup_le_sup
2222
lemma min_le_min : a ≤ c → b ≤ d → min a b ≤ min c d := inf_le_inf
2323
lemma le_max_left_of_le : a ≤ b → a ≤ max b c := le_sup_left_of_le
@@ -32,30 +32,30 @@ lemma min_max_distrib_right : min (max a b) c = max (min a c) (min b c) := inf_s
3232
instance max_idem : is_idempotent α max := by apply_instance
3333
instance min_idem : is_idempotent α min := by apply_instance
3434

35-
lemma min_le_iff : min a b ≤ c ↔ a ≤ c ∨ b ≤ c :=
35+
@[simp] lemma min_le_iff : min a b ≤ c ↔ a ≤ c ∨ b ≤ c :=
3636
have a ≤ b → (a ≤ c ∨ b ≤ c ↔ a ≤ c),
3737
from assume h, or_iff_left_of_imp $ le_trans h,
3838
have b ≤ a → (a ≤ c ∨ b ≤ c ↔ b ≤ c),
3939
from assume h, or_iff_right_of_imp $ le_trans h,
4040
by cases le_total a b; simp *
4141

42-
lemma le_max_iff : a ≤ max b c ↔ a ≤ b ∨ a ≤ c :=
42+
@[simp] lemma le_max_iff : a ≤ max b c ↔ a ≤ b ∨ a ≤ c :=
4343
have b ≤ c → (a ≤ b ∨ a ≤ c ↔ a ≤ c),
4444
from assume h, or_iff_right_of_imp $ assume h', le_trans h' h,
4545
have c ≤ b → (a ≤ b ∨ a ≤ c ↔ a ≤ b),
4646
from assume h, or_iff_left_of_imp $ assume h', le_trans h' h,
4747
by cases le_total b c; simp *
4848

49-
lemma max_lt_iff : max a b < c ↔ (a < c ∧ b < c) :=
49+
@[simp] lemma max_lt_iff : max a b < c ↔ (a < c ∧ b < c) :=
5050
by rw [lt_iff_not_ge]; simp [(≥), le_max_iff, not_or_distrib]
5151

52-
lemma lt_min_iff : a < min b c ↔ (a < b ∧ a < c) :=
52+
@[simp] lemma lt_min_iff : a < min b c ↔ (a < b ∧ a < c) :=
5353
by rw [lt_iff_not_ge]; simp [(≥), min_le_iff, not_or_distrib]
5454

55-
lemma lt_max_iff : a < max b c ↔ a < b ∨ a < c :=
55+
@[simp] lemma lt_max_iff : a < max b c ↔ a < b ∨ a < c :=
5656
by rw [lt_iff_not_ge]; simp [(≥), max_le_iff, not_and_distrib]
5757

58-
lemma min_lt_iff : min a b < c ↔ a < c ∨ b < c :=
58+
@[simp] lemma min_lt_iff : min a b < c ↔ a < c ∨ b < c :=
5959
by rw [lt_iff_not_ge]; simp [(≥), le_min_iff, not_and_distrib]
6060

6161
theorem min_right_comm (a b c : α) : min (min a b) c = min (min a c) b :=

algebra/ordered_group.lean

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,15 @@ coe_lt_coe
277277
lemma add_eq_top [ordered_comm_monoid α] (a b : with_top α) : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ :=
278278
by cases a; cases b; simp [none_eq_top, some_eq_coe, coe_add.symm]
279279

280+
lemma add_lt_top [ordered_comm_monoid α] (a b : with_top α) : a + b < ⊤ ↔ a < ⊤ ∧ b < ⊤ :=
281+
begin
282+
apply not_iff_not.1,
283+
simp [lt_top_iff_ne_top, add_eq_top],
284+
finish,
285+
apply classical.dec _,
286+
apply classical.dec _,
287+
end
288+
280289
instance [canonically_ordered_monoid α] : canonically_ordered_monoid (with_top α) :=
281290
{ le_iff_exists_add := assume a b,
282291
match a, b with
@@ -440,6 +449,10 @@ lemma with_top.add_lt_add_iff_left :
440449
exact add_lt_add_iff_left _ }
441450
end
442451

452+
lemma with_top.add_lt_add_iff_right
453+
{a b c : with_top α} : a < ⊤ → (c + a < b + a ↔ c < b) :=
454+
by simpa [add_comm] using @with_top.add_lt_add_iff_left _ _ a b c
455+
443456
end ordered_cancel_comm_monoid
444457

445458
section ordered_comm_group

algebra/ordered_ring.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,15 @@ begin
367367
simp [ha, hb, mul_def, option.bind_comm a b, mul_comm]
368368
end
369369

370+
@[simp] lemma mul_eq_top_iff {a b : with_top α} : a * b = ⊤ ↔ (a ≠ 0 ∧ b = ⊤) ∨ (a = ⊤ ∧ b ≠ 0) :=
371+
begin
372+
have H : ∀x:α, (¬x = 0) ↔ (⊤ : with_top α) * ↑x = ⊤ :=
373+
λx, ⟨λhx, by simp [top_mul, hx], λhx f, by simpa [f] using hx⟩,
374+
cases a; cases b; simp [none_eq_top, top_mul, coe_ne_top, some_eq_coe, coe_mul.symm],
375+
{ rw [H b] },
376+
{ rw [H a, comm] }
377+
end
378+
370379
private lemma distrib' (a b c : with_top α) : (a + b) * c = a * c + b * c :=
371380
begin
372381
cases c,

data/finset.lean

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,15 +1299,8 @@ lemma sup_mono (h : s₁ ⊆ s₂) : s₁.sup f ≤ s₂.sup f :=
12991299
sup_le $ assume b hb, le_sup (h hb)
13001300

13011301
lemma sup_lt [is_total α (≤)] {a : α} : (⊥ < a) → (∀b ∈ s, f b < a) → s.sup f < a :=
1302-
have A : ∀ x y, x < a → y < a → x ⊔ y < a :=
1303-
begin
1304-
assume x y hx hy,
1305-
cases (is_total.total (≤) x y) with h,
1306-
{ simpa [sup_of_le_right h] using hy },
1307-
{ simpa [sup_of_le_left h] using hx }
1308-
end,
13091302
by letI := classical.dec_eq β; from
1310-
finset.induction_on s (by simp) (by simp [A] {contextual := tt})
1303+
finset.induction_on s (by simp) (by simp {contextual := tt})
13111304

13121305
lemma comp_sup_eq_sup_comp [is_total α (≤)] {γ : Type} [semilattice_sup_bot γ]
13131306
(g : α → γ) (mono_g : monotone g) (bot : g ⊥ = ⊥) : g (s.sup f) = s.sup (g ∘ f) :=
@@ -1377,15 +1370,8 @@ lemma inf_mono (h : s₁ ⊆ s₂) : s₂.inf f ≤ s₁.inf f :=
13771370
le_inf $ assume b hb, inf_le (h hb)
13781371

13791372
lemma lt_inf [is_total α (≤)] {a : α} : (a < ⊤) → (∀b ∈ s, a < f b) → a < s.inf f :=
1380-
have A : ∀ x y, a < x → a < y → a < x ⊓ y :=
1381-
begin
1382-
assume x y hx hy,
1383-
cases (is_total.total (≤) x y) with h,
1384-
{ simpa [inf_of_le_left h] using hy },
1385-
{ simpa [inf_of_le_right h] using hx }
1386-
end,
13871373
by letI := classical.dec_eq β; from
1388-
finset.induction_on s (by simp) (by simp [A] {contextual := tt})
1374+
finset.induction_on s (by simp) (by simp {contextual := tt})
13891375

13901376
lemma comp_inf_eq_inf_comp [is_total α (≤)] {γ : Type} [semilattice_inf_top γ]
13911377
(g : α → γ) (mono_g : monotone g) (top : g ⊤ = ⊤) : g (s.inf f) = s.inf (g ∘ f) :=

order/bounded_lattice.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ begin
6161
by simp [-top_le_iff, lt_iff_le_not_le, not_iff_not.2 (@top_le_iff _ _ a)]
6262
end
6363

64+
lemma ne_top_of_lt (h : a < b) : a ≠ ⊤ :=
65+
lt_top_iff_ne_top.1 $ lt_of_lt_of_le h le_top
66+
6467
end order_top
6568

6669
theorem order_top.ext_top {α} {A B : order_top α}
@@ -113,6 +116,9 @@ begin
113116
simp [-le_bot_iff, lt_iff_le_not_le, not_iff_not.2 (@le_bot_iff _ _ a)]
114117
end
115118

119+
lemma ne_bot_of_gt (h : a < b) : b ≠ ⊥ :=
120+
bot_lt_iff_ne_bot.1 $ lt_of_le_of_lt bot_le h
121+
116122
end order_bot
117123

118124
theorem order_bot.ext_bot {α} {A B : order_bot α}

order/lattice.lean

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ by finish
9393
theorem le_of_sup_eq (h : a ⊔ b = b) : a ≤ b :=
9494
by finish
9595

96+
@[simp] lemma sup_lt_iff [is_total α (≤)] {a b c : α} : b ⊔ c < a ↔ b < a ∧ c < a :=
97+
begin
98+
cases (is_total.total (≤) b c) with h,
99+
{ simp [sup_of_le_right h], exact ⟨λI, ⟨lt_of_le_of_lt h I, I⟩, λH, H.2⟩ },
100+
{ simp [sup_of_le_left h], exact ⟨λI, ⟨I, lt_of_le_of_lt h I⟩, λH, H.1⟩ }
101+
end
102+
96103
@[simp] theorem sup_idem : a ⊔ a = a :=
97104
by apply le_antisymm; finish
98105

@@ -179,6 +186,13 @@ by finish
179186
theorem le_of_inf_eq (h : a ⊓ b = a) : a ≤ b :=
180187
by finish
181188

189+
@[simp] lemma lt_inf_iff [is_total α (≤)] {a b c : α} : a < b ⊓ c ↔ a < b ∧ a < c :=
190+
begin
191+
cases (is_total.total (≤) b c) with h,
192+
{ simp [inf_of_le_left h], exact ⟨λI, ⟨I, lt_of_lt_of_le I h⟩, λH, H.1⟩ },
193+
{ simp [inf_of_le_right h], exact ⟨λI, ⟨lt_of_lt_of_le I h, I⟩, λH, H.2⟩ }
194+
end
195+
182196
@[simp] theorem inf_idem : a ⊓ a = a :=
183197
by apply le_antisymm; finish
184198

0 commit comments

Comments
 (0)