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

Commit c0c52ab

Browse files
committed
feat(order/upper_lower/basic): Linear order (#19068)
Upper/lower sets on a linear order themselves form a linear order.
1 parent 4be5890 commit c0c52ab

File tree

3 files changed

+56
-14
lines changed

3 files changed

+56
-14
lines changed

src/algebra/order/upper_lower.lean

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,10 @@ section ordered_comm_group
3434
variables {α : Type*} [ordered_comm_group α] {s t : set α} {a : α}
3535

3636
@[to_additive] lemma is_upper_set.smul (hs : is_upper_set s) : is_upper_set (a • s) :=
37-
begin
38-
rintro _ y hxy ⟨x, hx, rfl⟩,
39-
exact mem_smul_set_iff_inv_smul_mem.2 (hs (le_inv_mul_iff_mul_le.2 hxy) hx),
40-
end
37+
hs.image $ order_iso.mul_left _
4138

4239
@[to_additive] lemma is_lower_set.smul (hs : is_lower_set s) : is_lower_set (a • s) :=
43-
hs.of_dual.smul
40+
hs.image $ order_iso.mul_left _
4441

4542
@[to_additive] lemma set.ord_connected.smul (hs : s.ord_connected) : (a • s).ord_connected :=
4643
begin
@@ -55,10 +52,10 @@ by { rw [←smul_eq_mul, ←bUnion_smul_set], exact is_upper_set_Union₂ (λ x
5552
by { rw mul_comm, exact hs.mul_left }
5653

5754
@[to_additive] lemma is_lower_set.mul_left (ht : is_lower_set t) : is_lower_set (s * t) :=
58-
ht.of_dual.mul_left
55+
ht.to_dual.mul_left
5956

6057
@[to_additive] lemma is_lower_set.mul_right (hs : is_lower_set s) : is_lower_set (s * t) :=
61-
hs.of_dual.mul_right
58+
hs.to_dual.mul_right
6259

6360
@[to_additive] lemma is_upper_set.inv (hs : is_upper_set s) : is_lower_set s⁻¹ :=
6461
λ x y h, hs $ inv_le_inv' h
@@ -73,10 +70,10 @@ by { rw div_eq_mul_inv, exact ht.inv.mul_left }
7370
by { rw div_eq_mul_inv, exact hs.mul_right }
7471

7572
@[to_additive] lemma is_lower_set.div_left (ht : is_lower_set t) : is_upper_set (s / t) :=
76-
ht.of_dual.div_left
73+
ht.to_dual.div_left
7774

7875
@[to_additive] lemma is_lower_set.div_right (hs : is_lower_set s) : is_lower_set (s / t) :=
79-
hs.of_dual.div_right
76+
hs.to_dual.div_right
8077

8178
namespace upper_set
8279

src/order/upper_lower/basic.lean

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Yaël Dillies, Sara Rousta
66
import data.set_like.basic
77
import data.set.intervals.ord_connected
88
import data.set.intervals.order_iso
9+
import tactic.by_contra
910

1011
/-!
1112
# Up-sets and down-sets
@@ -135,10 +136,10 @@ iff.rfl
135136
@[simp] lemma is_upper_set_preimage_to_dual_iff {s : set αᵒᵈ} :
136137
is_upper_set (to_dual ⁻¹' s) ↔ is_lower_set s := iff.rfl
137138

138-
alias is_lower_set_preimage_of_dual_iff ↔ _ is_upper_set.of_dual
139-
alias is_upper_set_preimage_of_dual_iff ↔ _ is_lower_set.of_dual
140-
alias is_lower_set_preimage_to_dual_iff ↔ _ is_upper_set.to_dual
141-
alias is_upper_set_preimage_to_dual_iff ↔ _ is_lower_set.to_dual
139+
alias is_lower_set_preimage_of_dual_iff ↔ _ is_upper_set.to_dual
140+
alias is_upper_set_preimage_of_dual_iff ↔ _ is_lower_set.to_dual
141+
alias is_lower_set_preimage_to_dual_iff ↔ _ is_upper_set.of_dual
142+
alias is_upper_set_preimage_to_dual_iff ↔ _ is_lower_set.of_dual
142143

143144
end has_le
144145

@@ -266,6 +267,24 @@ alias is_lower_set_iff_Iio_subset ↔ is_lower_set.Iio_subset _
266267

267268
end partial_order
268269

270+
section linear_order
271+
variables [linear_order α] {s t : set α}
272+
273+
lemma is_upper_set.total (hs : is_upper_set s) (ht : is_upper_set t) : s ⊆ t ∨ t ⊆ s :=
274+
begin
275+
by_contra' h,
276+
simp_rw set.not_subset at h,
277+
obtain ⟨⟨a, has, hat⟩, b, hbt, hbs⟩ := h,
278+
obtain hab | hba := le_total a b,
279+
{ exact hbs (hs hab has) },
280+
{ exact hat (ht hba hbt) }
281+
end
282+
283+
lemma is_lower_set.total (hs : is_lower_set s) (ht : is_lower_set t) : s ⊆ t ∨ t ⊆ s :=
284+
hs.to_dual.total ht.to_dual
285+
286+
end linear_order
287+
269288
/-! ### Bundled upper/lower sets -/
270289

271290
section has_le
@@ -519,6 +538,32 @@ end lower_set
519538

520539
end has_le
521540

541+
section linear_order
542+
variables [linear_order α]
543+
544+
instance upper_set.is_total_le : is_total (upper_set α) (≤) := ⟨λ s t, t.upper.total s.upper⟩
545+
instance lower_set.is_total_le : is_total (lower_set α) (≤) := ⟨λ s t, s.lower.total t.lower⟩
546+
547+
noncomputable instance : complete_linear_order (upper_set α) :=
548+
{ le_total := is_total.total,
549+
decidable_le := classical.dec_rel _,
550+
decidable_eq := classical.dec_rel _,
551+
decidable_lt := classical.dec_rel _,
552+
max_def := by classical; exact sup_eq_max_default,
553+
min_def := by classical; exact inf_eq_min_default,
554+
..upper_set.complete_distrib_lattice }
555+
556+
noncomputable instance : complete_linear_order (lower_set α) :=
557+
{ le_total := is_total.total,
558+
decidable_le := classical.dec_rel _,
559+
decidable_eq := classical.dec_rel _,
560+
decidable_lt := classical.dec_rel _,
561+
max_def := by classical; exact sup_eq_max_default,
562+
min_def := by classical; exact inf_eq_min_default,
563+
..lower_set.complete_distrib_lattice }
564+
565+
end linear_order
566+
522567
/-! #### Map -/
523568

524569
section

src/topology/algebra/order/upper_lower.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected lemma is_upper_set.interior (h : is_upper_set s) : is_upper_set (inter
8585
by { rw [←is_lower_set_compl, ←closure_compl], exact h.compl.closure }
8686

8787
protected lemma is_lower_set.interior (h : is_lower_set s) : is_lower_set (interior s) :=
88-
h.of_dual.interior
88+
h.to_dual.interior
8989

9090
protected lemma set.ord_connected.interior (h : s.ord_connected) : (interior s).ord_connected :=
9191
begin

0 commit comments

Comments
 (0)