Skip to content

Commit 1346526

Browse files
committed
feat: When a \ b = b \ a (#9109)
and other simple order lemmas From LeanAPAP and LeanCamCombi
1 parent d412c82 commit 1346526

File tree

5 files changed

+50
-17
lines changed

5 files changed

+50
-17
lines changed

Mathlib/Order/BooleanAlgebra.lean

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,11 @@ theorem le_sdiff_iff : x ≤ y \ x ↔ x = ⊥ :=
326326
fun h => disjoint_self.1 (disjoint_sdiff_self_right.mono_right h), fun h => h.le.trans bot_le⟩
327327
#align le_sdiff_iff le_sdiff_iff
328328

329+
@[simp] lemma sdiff_eq_right : x \ y = y ↔ x = ⊥ ∧ y = ⊥ := by
330+
rw [disjoint_sdiff_self_left.eq_iff]; aesop
331+
332+
lemma sdiff_ne_right : x \ y ≠ y ↔ x ≠ ⊥ ∨ y ≠ ⊥ := sdiff_eq_right.not.trans not_and_or
333+
329334
theorem sdiff_lt_sdiff_right (h : x < y) (hz : z ≤ x) : x \ z < y \ z :=
330335
(sdiff_le_sdiff_right h.le).lt_of_not_le
331336
fun h' => h.not_le <| le_sdiff_sup.trans <| sup_le_of_le_sdiff_right h' hz
@@ -771,6 +776,14 @@ theorem himp_le : x ⇨ y ≤ z ↔ y ≤ z ∧ Codisjoint x z :=
771776
(@le_sdiff αᵒᵈ _ _ _ _).trans <| and_congr_right' $ @Codisjoint_comm _ (_) _ _ _
772777
#align himp_le himp_le
773778

779+
@[simp] lemma himp_le_iff : x ⇨ y ≤ x ↔ x = ⊤ :=
780+
fun h ↦ codisjoint_self.1 $ codisjoint_himp_self_right.mono_right h, fun h ↦ le_top.trans h.ge⟩
781+
782+
@[simp] lemma himp_eq_left : x ⇨ y = x ↔ x = ⊤ ∧ y = ⊤ := by
783+
rw [codisjoint_himp_self_left.eq_iff]; aesop
784+
785+
lemma himp_ne_right : x ⇨ y ≠ x ↔ x ≠ ⊤ ∨ y ≠ ⊤ := himp_eq_left.not.trans not_and_or
786+
774787
end BooleanAlgebra
775788

776789
instance Prop.booleanAlgebra : BooleanAlgebra Prop :=

Mathlib/Order/ConditionallyCompleteLattice/Basic.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ In this case we have `Sup ∅ = ⊥`, so we can drop some `Nonempty`/`Set.Nonemp
11771177

11781178
section ConditionallyCompleteLinearOrderBot
11791179

1180-
variable [ConditionallyCompleteLinearOrderBot α]
1180+
variable [ConditionallyCompleteLinearOrderBot α] {s : Set α} {f : ι → α} {a : α}
11811181

11821182
@[simp]
11831183
theorem csSup_empty : (sSup ∅ : α) = ⊥ :=
@@ -1223,21 +1223,21 @@ theorem le_ciSup_iff' {s : ι → α} {a : α} (h : BddAbove (range s)) :
12231223

12241224
theorem le_csInf_iff'' {s : Set α} {a : α} (ne : s.Nonempty) :
12251225
a ≤ sInf s ↔ ∀ b : α, b ∈ s → a ≤ b :=
1226-
le_csInf_iff ⟨⊥, fun _ _ => bot_le⟩ ne
1226+
le_csInf_iff (OrderBot.bddBelow _) ne
12271227
#align le_cInf_iff'' le_csInf_iff''
12281228

12291229
theorem le_ciInf_iff' [Nonempty ι] {f : ι → α} {a : α} : a ≤ iInf f ↔ ∀ i, a ≤ f i :=
1230-
le_ciInf_iff ⟨⊥, fun _ _ => bot_le⟩
1230+
le_ciInf_iff (OrderBot.bddBelow _)
12311231
#align le_cinfi_iff' le_ciInf_iff'
12321232

1233-
theorem csInf_le' {s : Set α} {a : α} (h : a ∈ s) : sInf s ≤ a :=
1234-
csInf_le ⟨⊥, fun _ _ => bot_le⟩ h
1233+
theorem csInf_le' (h : a ∈ s) : sInf s ≤ a := csInf_le (OrderBot.bddBelow _) h
12351234
#align cInf_le' csInf_le'
12361235

1237-
theorem ciInf_le' (f : ι → α) (i : ι) : iInf f ≤ f i :=
1238-
ciInf_le ⟨⊥, fun _ _ => bot_le⟩ _
1236+
theorem ciInf_le' (f : ι → α) (i : ι) : iInf f ≤ f i := ciInf_le (OrderBot.bddBelow _) _
12391237
#align cinfi_le' ciInf_le'
12401238

1239+
lemma ciInf_le_of_le' (c : ι) : f c ≤ a → iInf f ≤ a := ciInf_le_of_le (OrderBot.bddBelow _) _
1240+
12411241
theorem exists_lt_of_lt_csSup' {s : Set α} {a : α} (h : a < sSup s) : ∃ b ∈ s, a < b := by
12421242
contrapose! h
12431243
exact csSup_le' h

Mathlib/Order/ConditionallyCompleteLattice/Finset.lean

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ non-empty. As a result, we can translate between the two.
8484

8585

8686
namespace Finset
87+
variable {ι : Type*} [ConditionallyCompleteLattice α]
8788

88-
theorem sup'_eq_csSup_image [ConditionallyCompleteLattice β] (s : Finset α) (H) (f : α → β) :
89-
s.sup' H f = sSup (f '' s) := by
89+
theorem sup'_eq_csSup_image (s : Finset ι) (H) (f : ι → α) : s.sup' H f = sSup (f '' s) := by
9090
apply le_antisymm
9191
· refine' Finset.sup'_le _ _ fun a ha => _
9292
refine' le_csSup ⟨s.sup' H f, _⟩ ⟨a, ha, rfl⟩
@@ -97,18 +97,24 @@ theorem sup'_eq_csSup_image [ConditionallyCompleteLattice β] (s : Finset α) (H
9797
exact Finset.le_sup' _ ha
9898
#align finset.sup'_eq_cSup_image Finset.sup'_eq_csSup_image
9999

100-
theorem inf'_eq_csInf_image [ConditionallyCompleteLattice β] (s : Finset α) (H) (f : α → β) :
101-
s.inf' H f = sInf (f '' s) :=
102-
@sup'_eq_csSup_image _ βᵒᵈ _ _ H _
100+
theorem inf'_eq_csInf_image (s : Finset ι) (hs) (f : ι → α) : s.inf' hs f = sInf (f '' s) :=
101+
sup'_eq_csSup_image (α := αᵒᵈ) _ hs _
103102
#align finset.inf'_eq_cInf_image Finset.inf'_eq_csInf_image
104103

105-
theorem sup'_id_eq_csSup [ConditionallyCompleteLattice α] (s : Finset α) (H) :
106-
s.sup' H id = sSup s := by rw [sup'_eq_csSup_image s H, Set.image_id]
104+
theorem sup'_id_eq_csSup (s : Finset α) (hs) : s.sup' hs id = sSup s := by
105+
rw [sup'_eq_csSup_image s hs, Set.image_id]
107106
#align finset.sup'_id_eq_cSup Finset.sup'_id_eq_csSup
108107

109-
theorem inf'_id_eq_csInf [ConditionallyCompleteLattice α] (s : Finset α) (H) :
110-
s.inf' H id = sInf s :=
111-
@sup'_id_eq_csSup αᵒᵈ _ _ H
108+
theorem inf'_id_eq_csInf (s : Finset α) (hs) : s.inf' hs id = sInf s :=
109+
sup'_id_eq_csSup (α := αᵒᵈ) _ hs
112110
#align finset.inf'_id_eq_cInf Finset.inf'_id_eq_csInf
113111

112+
variable [Fintype ι] [Nonempty ι]
113+
114+
lemma sup'_univ_eq_ciSup (f : ι → α) : univ.sup' univ_nonempty f = ⨆ i, f i := by
115+
simp [sup'_eq_csSup_image, iSup]
116+
117+
lemma inf'_univ_eq_ciInf (f : ι → α) : univ.inf' univ_nonempty f = ⨅ i, f i := by
118+
simp [inf'_eq_csInf_image, iInf]
119+
114120
end Finset

Mathlib/Order/Disjoint.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ theorem Disjoint.eq_bot_of_ge (hab : Disjoint a b) : b ≤ a → b = ⊥ :=
101101
hab.symm.eq_bot_of_le
102102
#align disjoint.eq_bot_of_ge Disjoint.eq_bot_of_ge
103103

104+
lemma Disjoint.eq_iff (hab : Disjoint a b) : a = b ↔ a = ⊥ ∧ b = ⊥ := by aesop
105+
lemma Disjoint.ne_iff (hab : Disjoint a b) : a ≠ b ↔ a ≠ ⊥ ∨ b ≠ ⊥ :=
106+
hab.eq_iff.not.trans not_and_or
107+
104108
end PartialOrderBot
105109

106110
section PartialBoundedOrder
@@ -285,6 +289,10 @@ theorem Codisjoint.eq_top_of_ge (hab : Codisjoint a b) : a ≤ b → b = ⊤ :=
285289
hab.symm.eq_top_of_le
286290
#align codisjoint.eq_top_of_ge Codisjoint.eq_top_of_ge
287291

292+
lemma Codisjoint.eq_iff (hab : Codisjoint a b) : a = b ↔ a = ⊤ ∧ b = ⊤ := by aesop
293+
lemma Codisjoint.ne_iff (hab : Codisjoint a b) : a ≠ b ↔ a ≠ ⊤ ∨ b ≠ ⊤ :=
294+
hab.eq_iff.not.trans not_and_or
295+
288296
end PartialOrderTop
289297

290298
section PartialBoundedOrder

Mathlib/Order/Heyting/Basic.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,9 @@ theorem le_himp_himp : a ≤ (a ⇨ b) ⇨ b :=
442442
le_himp_iff.2 inf_himp_le
443443
#align le_himp_himp le_himp_himp
444444

445+
@[simp] lemma himp_eq_himp_iff : b ⇨ a = a ⇨ b ↔ a = b := by simp [le_antisymm_iff]
446+
lemma himp_ne_himp_iff : b ⇨ a ≠ a ⇨ b ↔ a ≠ b := himp_eq_himp_iff.not
447+
445448
theorem himp_triangle (a b c : α) : (a ⇨ b) ⊓ (b ⇨ c) ≤ a ⇨ c := by
446449
rw [le_himp_iff, inf_right_comm, ← le_himp_iff]
447450
exact himp_inf_le.trans le_himp_himp
@@ -698,6 +701,9 @@ theorem sdiff_sdiff_le : a \ (a \ b) ≤ b :=
698701
sdiff_le_iff.2 le_sdiff_sup
699702
#align sdiff_sdiff_le sdiff_sdiff_le
700703

704+
@[simp] lemma sdiff_eq_sdiff_iff : a \ b = b \ a ↔ a = b := by simp [le_antisymm_iff]
705+
lemma sdiff_ne_sdiff_iff : a \ b ≠ b \ a ↔ a ≠ b := sdiff_eq_sdiff_iff.not
706+
701707
theorem sdiff_triangle (a b c : α) : a \ c ≤ a \ b ⊔ b \ c := by
702708
rw [sdiff_le_iff, sup_left_comm, ← sdiff_le_iff]
703709
exact sdiff_sdiff_le.trans le_sup_sdiff

0 commit comments

Comments
 (0)