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

Commit e620519

Browse files
committed
feat(order/hom/*): more superclass instances for order_iso_class (#12889)
* Weaken hypotheses on `order_hom_class` and some subclasses * Add more instances deriving specific order hom classes from `order_iso_class`
1 parent 3b8d217 commit e620519

File tree

4 files changed

+60
-32
lines changed

4 files changed

+60
-32
lines changed

src/order/hom/basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ abbreviation order_iso (α β : Type*) [has_le α] [has_le β] := @rel_iso α β
9393
infix ` ≃o `:25 := order_iso
9494

9595
/-- `order_hom_class F α b` asserts that `F` is a type of `≤`-preserving morphisms. -/
96-
abbreviation order_hom_class (F : Type*) (α β : out_param Type*) [preorder α] [preorder β] :=
96+
abbreviation order_hom_class (F : Type*) (α β : out_param Type*) [has_le α] [has_le β] :=
9797
rel_hom_class F ((≤) : α → α → Prop) ((≤) : β → β → Prop)
9898

9999
/-- `order_iso_class F α β` states that `F` is a type of order isomorphisms.
@@ -111,7 +111,7 @@ instance [has_le α] [has_le β] [order_iso_class F α β] : has_coe_t F (α ≃
111111
⟨λ f, ⟨f, λ _ _, map_le_map_iff f⟩⟩
112112

113113
@[priority 100] -- See note [lower instance priority]
114-
instance order_iso_class.to_order_hom_class [preorder α] [preorder β] [order_iso_class F α β] :
114+
instance order_iso_class.to_order_hom_class [has_le α] [has_le β] [order_iso_class F α β] :
115115
order_hom_class F α β :=
116116
{ map_rel := λ f a b, (map_le_map_iff f).2, ..equiv_like.to_embedding_like }
117117

src/order/hom/bounded.lean

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class bot_hom_class (F : Type*) (α β : out_param $ Type*) [has_bot α] [has_bo
6565
/-- `bounded_order_hom_class F α β` states that `F` is a type of bounded order morphisms.
6666
6767
You should extend this class when you extend `bounded_order_hom`. -/
68-
class bounded_order_hom_class (F : Type*) (α β : out_param $ Type*) [preorder α] [preorder β]
68+
class bounded_order_hom_class (F : Type*) (α β : out_param $ Type*) [has_le α] [has_le β]
6969
[bounded_order α] [bounded_order β]
7070
extends rel_hom_class F ((≤) : α → α → Prop) ((≤) : β → β → Prop) :=
7171
(map_top (f : F) : f ⊤ = ⊤)
@@ -76,32 +76,34 @@ export top_hom_class (map_top) bot_hom_class (map_bot)
7676
attribute [simp] map_top map_bot
7777

7878
@[priority 100] -- See note [lower instance priority]
79-
instance bounded_order_hom_class.to_top_hom_class [preorder α] [preorder β]
79+
instance bounded_order_hom_class.to_top_hom_class [has_le α] [has_le β]
8080
[bounded_order α] [bounded_order β] [bounded_order_hom_class F α β] :
8181
top_hom_class F α β :=
8282
{ .. ‹bounded_order_hom_class F α β› }
8383

8484
@[priority 100] -- See note [lower instance priority]
85-
instance bounded_order_hom_class.to_bot_hom_class [preorder α] [preorder β]
85+
instance bounded_order_hom_class.to_bot_hom_class [has_le α] [has_le β]
8686
[bounded_order α] [bounded_order β] [bounded_order_hom_class F α β] :
8787
bot_hom_class F α β :=
8888
{ .. ‹bounded_order_hom_class F α β› }
8989

9090
@[priority 100] -- See note [lower instance priority]
91-
instance order_iso.top_hom_class [partial_order α] [partial_order β] [order_top α] [order_top β] :
92-
top_hom_class (α ≃o β) α β :=
93-
{ map_top := λ f, f.map_top, ..rel_iso.rel_hom_class }
91+
instance order_iso_class.to_top_hom_class [has_le α] [order_top α] [partial_order β] [order_top β]
92+
[order_iso_class F α β] :
93+
top_hom_class F α β :=
94+
⟨λ f, top_le_iff.1 $ (map_inv_le_iff f).1 le_top⟩
9495

9596
@[priority 100] -- See note [lower instance priority]
96-
instance order_iso.bot_hom_class [partial_order α] [partial_order β] [order_bot α] [order_bot β] :
97-
bot_hom_class (α ≃o β) α β :=
98-
{ map_bot := λ f, f.map_bot, ..rel_iso.rel_hom_class }
97+
instance order_iso_class.to_bot_hom_class [has_le α] [order_bot α] [partial_order β] [order_bot β]
98+
[order_iso_class F α β] :
99+
bot_hom_class F α β :=
100+
⟨λ f, le_bot_iff.1 $ (le_map_inv_iff f).1 bot_le⟩
99101

100102
@[priority 100] -- See note [lower instance priority]
101-
instance order_iso.bounded_order_hom_class [partial_order α] [partial_order β]
102-
[bounded_order α] [bounded_order β] :
103-
bounded_order_hom_class (α ≃o β) α β :=
104-
{ ..order_iso.top_hom_class, ..order_iso.bot_hom_class }
103+
instance order_iso_class.to_bounded_order_hom_class [has_le α] [bounded_order α] [partial_order β]
104+
[bounded_order β] [order_iso_class F α β] :
105+
bounded_order_hom_class F α β :=
106+
{ ..order_iso_class.to_top_hom_class, ..order_iso_class.to_bot_hom_class }
105107

106108
instance [has_top α] [has_top β] [top_hom_class F α β] : has_coe_t F (top_hom α β) :=
107109
⟨λ f, ⟨f, map_top f⟩⟩

src/order/hom/complete_lattice.lean

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,22 @@ instance complete_lattice_hom_class.to_bounded_lattice_hom_class [complete_latti
142142
{ ..Sup_hom_class.to_sup_bot_hom_class, ..Inf_hom_class.to_inf_top_hom_class }
143143

144144
@[priority 100] -- See note [lower instance priority]
145-
instance order_iso.complete_lattice_hom_class [complete_lattice α] [complete_lattice β] :
146-
complete_lattice_hom_class (α ≃o β) α β :=
147-
{ map_Sup := λ f s, (f.map_Sup s).trans Sup_image.symm,
148-
map_Inf := λ f s, (f.map_Inf s).trans Inf_image.symm,
149-
..rel_iso.rel_hom_class }
145+
instance order_iso_class.to_Sup_hom_class [complete_lattice α] [complete_lattice β]
146+
[order_iso_class F α β] :
147+
Sup_hom_class F α β :=
148+
⟨λ f s, eq_of_forall_ge_iff $ λ c, by simp only [←le_map_inv_iff, Sup_le_iff, set.ball_image_iff]⟩
149+
150+
@[priority 100] -- See note [lower instance priority]
151+
instance order_iso_class.to_Inf_hom_class [complete_lattice α] [complete_lattice β]
152+
[order_iso_class F α β] :
153+
Inf_hom_class F α β :=
154+
⟨λ f s, eq_of_forall_le_iff $ λ c, by simp only [←map_inv_le_iff, le_Inf_iff, set.ball_image_iff]⟩
155+
156+
@[priority 100] -- See note [lower instance priority]
157+
instance order_iso_class.to_complete_lattice_hom_class [complete_lattice α] [complete_lattice β]
158+
[order_iso_class F α β] :
159+
complete_lattice_hom_class F α β :=
160+
{ ..order_iso_class.to_Sup_hom_class, ..order_iso_class.to_lattice_hom_class }
150161

151162
instance [has_Sup α] [has_Sup β] [Sup_hom_class F α β] : has_coe_t F (Sup_hom α β) :=
152163
⟨λ f, ⟨f, map_Sup f⟩⟩

src/order/hom/lattice.lean

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,24 +168,39 @@ instance bounded_lattice_hom_class.to_bounded_order_hom_class [lattice α] [latt
168168
{ .. ‹bounded_lattice_hom_class F α β› }
169169

170170
@[priority 100] -- See note [lower instance priority]
171-
instance order_iso.sup_hom_class [semilattice_sup α] [semilattice_sup β] :
172-
sup_hom_class (α ≃o β) α β :=
173-
{ map_sup := λ f, f.map_sup, ..rel_iso.rel_hom_class }
171+
instance order_iso_class.to_sup_hom_class [semilattice_sup α] [semilattice_sup β]
172+
[order_iso_class F α β] :
173+
sup_hom_class F α β :=
174+
⟨λ f a b, eq_of_forall_ge_iff $ λ c, by simp only [←le_map_inv_iff, sup_le_iff]⟩
174175

175176
@[priority 100] -- See note [lower instance priority]
176-
instance order_iso.inf_hom_class [semilattice_inf α] [semilattice_inf β] :
177-
inf_hom_class (α ≃o β) α β :=
178-
{ map_inf := λ f, f.map_inf, ..rel_iso.rel_hom_class }
177+
instance order_iso_class.to_inf_hom_class [semilattice_inf α] [semilattice_inf β]
178+
[order_iso_class F α β] :
179+
inf_hom_class F α β :=
180+
⟨λ f a b, eq_of_forall_le_iff $ λ c, by simp only [←map_inv_le_iff, le_inf_iff]⟩
181+
182+
@[priority 100] -- See note [lower instance priority]
183+
instance order_iso_class.to_sup_bot_hom_class [semilattice_sup α] [order_bot α] [semilattice_sup β]
184+
[order_bot β] [order_iso_class F α β] :
185+
sup_bot_hom_class F α β :=
186+
{ ..order_iso_class.to_sup_hom_class, ..order_iso_class.to_bot_hom_class }
187+
188+
@[priority 100] -- See note [lower instance priority]
189+
instance order_iso_class.to_inf_top_hom_class [semilattice_inf α] [order_top α] [semilattice_inf β]
190+
[order_top β] [order_iso_class F α β] :
191+
inf_top_hom_class F α β :=
192+
{ ..order_iso_class.to_inf_hom_class, ..order_iso_class.to_top_hom_class }
179193

180194
@[priority 100] -- See note [lower instance priority]
181-
instance order_iso.lattice_hom_class [lattice α] [lattice β] : lattice_hom_class (α ≃o β) α β :=
182-
{ ..order_iso.sup_hom_class, ..order_iso.inf_hom_class }
195+
instance order_iso_class.to_lattice_hom_class [lattice α] [lattice β] [order_iso_class F α β] :
196+
lattice_hom_class F α β :=
197+
{ ..order_iso_class.to_sup_hom_class, ..order_iso_class.to_inf_hom_class }
183198

184199
@[priority 100] -- See note [lower instance priority]
185-
instance order_iso.bounded_lattice_hom_class [lattice α] [lattice β] [bounded_order α]
186-
[bounded_order β] :
187-
bounded_lattice_hom_class (α ≃o β) α β :=
188-
{ ..order_iso.lattice_hom_class, ..order_iso.bounded_order_hom_class }
200+
instance order_iso_class.to_bounded_lattice_hom_class [lattice α] [lattice β] [bounded_order α]
201+
[bounded_order β] [order_iso_class F α β] :
202+
bounded_lattice_hom_class F α β :=
203+
{ ..order_iso_class.to_lattice_hom_class, ..order_iso_class.to_bounded_order_hom_class }
189204

190205
@[simp] lemma map_finset_sup [semilattice_sup α] [order_bot α] [semilattice_sup β] [order_bot β]
191206
[sup_bot_hom_class F α β] (f : F) (s : finset ι) (g : ι → α) :

0 commit comments

Comments
 (0)