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

Commit 40de35a

Browse files
committed
feat(order/conditionally_complete_lattice, topology/algebra/ordered): inherited order properties for ord_connected subset (#3991)
If `α` is `densely_ordered`, then so is the subtype `s`, for any `ord_connected` subset `s` of `α`. Same result for `order_topology`. Same result for `conditionally_complete_linear_order`, under the hypothesis `inhabited s`.
1 parent 2ab31f9 commit 40de35a

File tree

4 files changed

+229
-0
lines changed

4 files changed

+229
-0
lines changed

src/data/set/intervals/ord_connected.lean

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ the `order_topology`, then this condition is equivalent to `is_preconnected s`.
2929
this condition is also equivalent to `convex s`.
3030
-/
3131
def ord_connected (s : set α) : Prop := ∀ ⦃x⦄ (hx : x ∈ s) ⦃y⦄ (hy : y ∈ s), Icc x y ⊆ s
32+
attribute [class] ord_connected
3233

3334
/-- It suffices to prove `[x, y] ⊆ s` for `x y ∈ s`, `x ≤ y`. -/
3435
lemma ord_connected_iff : ord_connected s ↔ ∀ (x ∈ s) (y ∈ s), x ≤ y → Icc x y ⊆ s :=
@@ -86,6 +87,9 @@ ord_connected_Ioi.inter ord_connected_Iic
8687
lemma ord_connected_Ioo {a b : α} : ord_connected (Ioo a b) :=
8788
ord_connected_Ioi.inter ord_connected_Iio
8889

90+
attribute [instance] ord_connected_Ici ord_connected_Iic ord_connected_Ioi ord_connected_Iio
91+
ord_connected_Icc ord_connected_Ico ord_connected_Ioc ord_connected_Ioo
92+
8993
lemma ord_connected_singleton {α : Type*} [partial_order α] {a : α} :
9094
ord_connected ({a} : set α) :=
9195
by { rw ← Icc_self, exact ord_connected_Icc }
@@ -94,6 +98,17 @@ lemma ord_connected_empty : ord_connected (∅ : set α) := λ x, false.elim
9498

9599
lemma ord_connected_univ : ord_connected (univ : set α) := λ _ _ _ _, subset_univ _
96100

101+
/-- In a dense order `α`, the subtype from an `ord_connected` set is also densely ordered. -/
102+
instance [densely_ordered α] {s : set α} [hs : ord_connected s] :
103+
densely_ordered s :=
104+
begin
105+
intros a₁ a₂ ha,
106+
have ha' : ↑a₁ < ↑a₂ := ha,
107+
obtain ⟨x, ha₁x, hxa₂⟩ := dense ha',
108+
refine ⟨⟨x, _⟩, ⟨ha₁x, hxa₂⟩⟩,
109+
exact (hs a₁.2 a₂.2) (Ioo_subset_Icc_self ⟨ha₁x, hxa₂⟩),
110+
end
111+
97112
variables {β : Type*} [decidable_linear_order β]
98113

99114
lemma ord_connected_interval {a b : β} : ord_connected (interval a b) :=

src/order/basic.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ instance subtype.decidable_linear_order {α} [decidable_linear_order α] (p : α
341341
decidable_linear_order (subtype p) :=
342342
decidable_linear_order.lift subtype.val subtype.val_injective
343343

344+
lemma strict_mono_coe [preorder α] (t : set α) : strict_mono (coe : (subtype t) → α) := λ x y, id
345+
344346
instance prod.has_le (α : Type u) (β : Type v) [has_le α] [has_le β] : has_le (α × β) :=
345347
⟨λp q, p.1 ≤ q.1 ∧ p.2 ≤ q.2
346348

src/order/conditionally_complete_lattice.lean

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Sébastien Gouëzel
55
-/
66
import data.nat.enat
7+
import data.set.intervals.ord_connected
78

89
/-!
910
# Theory of conditionally complete lattices.
@@ -607,6 +608,30 @@ instance (α : Type*) [conditionally_complete_linear_order α] :
607608

608609
end order_dual
609610

611+
namespace monotone
612+
variables [preorder α] [conditionally_complete_lattice β] {f : α → β} (h_mono : monotone f)
613+
614+
/-! A monotone function into a conditionally complete lattice preserves the ordering properties of
615+
`Sup` and `Inf`. -/
616+
617+
lemma le_cSup_image {s : set α} {c : α} (hcs : c ∈ s) (h_bdd : bdd_above s) :
618+
f c ≤ Sup (f '' s) :=
619+
le_cSup (map_bdd_above h_mono h_bdd) (mem_image_of_mem f hcs)
620+
621+
lemma cSup_image_le {s : set α} (hs : s.nonempty) {B : α} (hB: B ∈ upper_bounds s) :
622+
Sup (f '' s) ≤ f B :=
623+
cSup_le (nonempty.image f hs) (h_mono.mem_upper_bounds_image hB)
624+
625+
lemma cInf_image_le {s : set α} {c : α} (hcs : c ∈ s) (h_bdd : bdd_below s) :
626+
Inf (f '' s) ≤ f c :=
627+
@le_cSup_image (order_dual α) (order_dual β) _ _ _ (λ x y hxy, h_mono hxy) _ _ hcs h_bdd
628+
629+
lemma le_cInf_image {s : set α} (hs : s.nonempty) {B : α} (hB: B ∈ lower_bounds s) :
630+
f B ≤ Inf (f '' s) :=
631+
@cSup_image_le (order_dual α) (order_dual β) _ _ _ (λ x y hxy, h_mono hxy) _ hs _ hB
632+
633+
end monotone
634+
610635
section with_top_bot
611636

612637
/-!
@@ -692,3 +717,141 @@ noncomputable instance with_top.with_bot.complete_lattice {α : Type*}
692717
..with_top.with_bot.bounded_lattice }
693718

694719
end with_top_bot
720+
721+
section subtype
722+
variables (s : set α)
723+
724+
/-! ### Subtypes of conditionally complete linear orders
725+
726+
In this section we give conditions on a subset of a conditionally complete linear order, to ensure
727+
that the subtype is itself conditionally complete.
728+
729+
We check that an `ord_connected` set satisfies these conditions.
730+
731+
TODO There are several possible variants; the `conditionally_complete_linear_order` could be changed
732+
to `conditionally_complete_linear_order_bot` or `complete_linear_order`.
733+
-/
734+
735+
open_locale classical
736+
737+
section has_Sup
738+
variables [has_Sup α]
739+
740+
/-- `has_Sup` structure on a nonempty subset `s` of an object with `has_Sup`. This definition is
741+
non-canonical (it uses `default s`); it should be used only as here, as an auxiliary instance in the
742+
construction of the `conditionally_complete_linear_order` structure. -/
743+
noncomputable def subset_has_Sup [inhabited s] : has_Sup s := {Sup := λ t,
744+
if ht : Sup (coe '' t : set α) ∈ s then ⟨Sup (coe '' t : set α), ht⟩ else default s}
745+
746+
local attribute [instance] subset_has_Sup
747+
748+
@[simp] lemma subset_Sup_def [inhabited s] :
749+
@Sup s _ = λ t,
750+
if ht : Sup (coe '' t : set α) ∈ s then ⟨Sup (coe '' t : set α), ht⟩ else default s :=
751+
rfl
752+
753+
lemma subset_Sup_of_within [inhabited s] {t : set s} (h : Sup (coe '' t : set α) ∈ s) :
754+
Sup (coe '' t : set α) = (@Sup s _ t : α) :=
755+
by simp [dif_pos h]
756+
757+
end has_Sup
758+
759+
section has_Inf
760+
variables [has_Inf α]
761+
762+
/-- `has_Inf` structure on a nonempty subset `s` of an object with `has_Inf`. This definition is
763+
non-canonical (it uses `default s`); it should be used only as here, as an auxiliary instance in the
764+
construction of the `conditionally_complete_linear_order` structure. -/
765+
noncomputable def subset_has_Inf [inhabited s] : has_Inf s := {Inf := λ t,
766+
if ht : Inf (coe '' t : set α) ∈ s then ⟨Inf (coe '' t : set α), ht⟩ else default s}
767+
768+
local attribute [instance] subset_has_Inf
769+
770+
@[simp] lemma subset_Inf_def [inhabited s] :
771+
@Inf s _ = λ t,
772+
if ht : Inf (coe '' t : set α) ∈ s then ⟨Inf (coe '' t : set α), ht⟩ else default s :=
773+
rfl
774+
775+
lemma subset_Inf_of_within [inhabited s] {t : set s} (h : Inf (coe '' t : set α) ∈ s) :
776+
Inf (coe '' t : set α) = (@Inf s _ t : α) :=
777+
by simp [dif_pos h]
778+
779+
end has_Inf
780+
781+
variables [conditionally_complete_linear_order α]
782+
783+
local attribute [instance] subset_has_Sup
784+
local attribute [instance] subset_has_Inf
785+
786+
/-- For a nonempty subset of a conditionally complete linear order to be a conditionally complete
787+
linear order, it suffices that it contain the `Sup` of all its nonempty bounded-above subsets, and
788+
the `Inf` of all its nonempty bounded-below subsets. -/
789+
noncomputable def subset_conditionally_complete_linear_order [inhabited s]
790+
(h_Sup : ∀ {t : set s} (ht : t.nonempty) (h_bdd : bdd_above t), Sup (coe '' t : set α) ∈ s)
791+
(h_Inf : ∀ {t : set s} (ht : t.nonempty) (h_bdd : bdd_below t), Inf (coe '' t : set α) ∈ s) :
792+
conditionally_complete_linear_order s :=
793+
{ le_cSup := begin
794+
rintros t c h_bdd hct,
795+
-- The following would be a more natural way to finish, but gives a "deep recursion" error:
796+
-- simpa [subset_Sup_of_within (h_Sup t)] using (strict_mono_coe s).monotone.le_cSup_image hct h_bdd,
797+
have := (strict_mono_coe s).monotone.le_cSup_image hct h_bdd,
798+
rwa subset_Sup_of_within s (h_Sup ⟨c, hct⟩ h_bdd) at this,
799+
end,
800+
cSup_le := begin
801+
rintros t B ht hB,
802+
have := (strict_mono_coe s).monotone.cSup_image_le ht hB,
803+
rwa subset_Sup_of_within s (h_Sup ht ⟨B, hB⟩) at this,
804+
end,
805+
le_cInf := begin
806+
intros t B ht hB,
807+
have := (strict_mono_coe s).monotone.le_cInf_image ht hB,
808+
rwa subset_Inf_of_within s (h_Inf ht ⟨B, hB⟩) at this,
809+
end,
810+
cInf_le := begin
811+
rintros t c h_bdd hct,
812+
have := (strict_mono_coe s).monotone.cInf_image_le hct h_bdd,
813+
rwa subset_Inf_of_within s (h_Inf ⟨c, hct⟩ h_bdd) at this,
814+
end,
815+
..subset_has_Sup s,
816+
..subset_has_Inf s,
817+
..distrib_lattice.to_lattice s,
818+
..classical.DLO s }
819+
820+
section ord_connected
821+
822+
/-- The `Sup` function on a nonempty `ord_connected` set `s` in a conditionally complete linear
823+
order takes values within `s`, for all nonempty bounded-above subsets of `s`. -/
824+
lemma Sup_within_of_ord_connected
825+
{s : set α} [hs : ord_connected s] ⦃t : set s⦄ (ht : t.nonempty) (h_bdd : bdd_above t) :
826+
Sup (coe '' t : set α) ∈ s :=
827+
begin
828+
obtain ⟨c, hct⟩ : ∃ c, c ∈ t := ht,
829+
obtain ⟨B, hB⟩ : ∃ B, B ∈ upper_bounds t := h_bdd,
830+
refine hs c.2 B.2 ⟨_, _⟩,
831+
{ exact (strict_mono_coe s).monotone.le_cSup_image hct ⟨B, hB⟩ },
832+
{ exact (strict_mono_coe s).monotone.cSup_image_le ⟨c, hct⟩ hB },
833+
end
834+
835+
/-- The `Inf` function on a nonempty `ord_connected` set `s` in a conditionally complete linear
836+
order takes values within `s`, for all nonempty bounded-below subsets of `s`. -/
837+
lemma Inf_within_of_ord_connected
838+
{s : set α} [hs : ord_connected s] ⦃t : set s⦄ (ht : t.nonempty) (h_bdd : bdd_below t) :
839+
Inf (coe '' t : set α) ∈ s :=
840+
begin
841+
obtain ⟨c, hct⟩ : ∃ c, c ∈ t := ht,
842+
obtain ⟨B, hB⟩ : ∃ B, B ∈ lower_bounds t := h_bdd,
843+
refine hs B.2 c.2 ⟨_, _⟩,
844+
{ exact (strict_mono_coe s).monotone.le_cInf_image ⟨c, hct⟩ hB },
845+
{ exact (strict_mono_coe s).monotone.cInf_image_le hct ⟨B, hB⟩ },
846+
end
847+
848+
/-- A nonempty `ord_connected` set in a conditionally complete linear order is naturally a
849+
conditionally complete linear order. -/
850+
noncomputable instance ord_connected_subset_conditionally_complete_linear_order
851+
[inhabited s] [ord_connected s] :
852+
conditionally_complete_linear_order s :=
853+
subset_conditionally_complete_linear_order s Sup_within_of_ord_connected Inf_within_of_ord_connected
854+
855+
end ord_connected
856+
857+
end subtype

src/topology/algebra/ordered.lean

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,55 @@ induced_order_topology' f @hf
721721
(λ a x xa, let ⟨b, xb, ba⟩ := H xa in ⟨b, hf.1 ba, le_of_lt xb⟩)
722722
(λ a x ax, let ⟨b, ab, bx⟩ := H ax in ⟨b, hf.1 ab, le_of_lt bx⟩)
723723

724+
/-- On an `ord_connected` subset of a linear order, the order topology for the restriction of the
725+
order is the same as the restriction to the subset of the order topology. -/
726+
instance order_topology_of_ord_connected {α : Type u}
727+
[ta : topological_space α] [decidable_linear_order α] [order_topology α]
728+
{t : set α} [ht : ord_connected t] :
729+
order_topology t :=
730+
begin
731+
letI := induced (coe : t → α) ta,
732+
refine ⟨eq_of_nhds_eq_nhds (λ a, _)⟩,
733+
rw [nhds_induced, nhds_generate_from, nhds_eq_order (a : α)],
734+
apply le_antisymm,
735+
{ refine le_infi (λ s, le_infi $ λ hs, le_principal_iff.2 _),
736+
rcases hs with ⟨ab, b, rfl|rfl⟩,
737+
{ refine ⟨Ioi b, _, λ _, id⟩,
738+
refine mem_inf_sets_of_left (mem_infi_sets b _),
739+
exact mem_infi_sets ab (mem_principal_self (Ioi ↑b)) },
740+
{ refine ⟨Iio b, _, λ _, id⟩,
741+
refine mem_inf_sets_of_right (mem_infi_sets b _),
742+
exact mem_infi_sets ab (mem_principal_self (Iio b)) } },
743+
{ rw [← map_le_iff_le_comap],
744+
refine le_inf _ _,
745+
{ refine le_infi (λ x, le_infi $ λ h, le_principal_iff.2 _),
746+
by_cases hx : x ∈ t,
747+
{ refine mem_infi_sets (Ioi ⟨x, hx⟩) (mem_infi_sets ⟨h, ⟨⟨x, hx⟩, or.inl rfl⟩⟩ _),
748+
exact λ _, id },
749+
simp only [set_coe.exists, mem_set_of_eq, mem_map],
750+
convert univ_sets _,
751+
suffices hx' : ∀ (y : t), ↑y ∈ Ioi x,
752+
{ simp [hx'] },
753+
intros y,
754+
revert hx,
755+
contrapose!,
756+
-- here we use the `ord_connected` hypothesis
757+
exact λ hx, ht y.2 a.2 ⟨le_of_not_gt hx, le_of_lt h⟩ },
758+
{ refine le_infi (λ x, le_infi $ λ h, le_principal_iff.2 _),
759+
by_cases hx : x ∈ t,
760+
{ refine mem_infi_sets (Iio ⟨x, hx⟩) (mem_infi_sets ⟨h, ⟨⟨x, hx⟩, or.inr rfl⟩⟩ _),
761+
exact λ _, id },
762+
simp only [set_coe.exists, mem_set_of_eq, mem_map],
763+
convert univ_sets _,
764+
suffices hx' : ∀ (y : t), ↑y ∈ Iio x,
765+
{ simp [hx'] },
766+
intros y,
767+
revert hx,
768+
contrapose!,
769+
-- here we use the `ord_connected` hypothesis
770+
exact λ hx, ht a.2 y.2 ⟨le_of_lt h, le_of_not_gt hx⟩ } }
771+
end
772+
724773
lemma nhds_top_order [topological_space α] [order_top α] [order_topology α] :
725774
𝓝 (⊤:α) = (⨅l (h₂ : l < ⊤), 𝓟 (Ioi l)) :=
726775
by simp [nhds_eq_order (⊤:α)]

0 commit comments

Comments
 (0)