Skip to content

Commit cb8d553

Browse files
committed
feat: port Order.Hom.Set (#1059)
mathlib3 SHA: 198161d833f2c01498c39c266b0b3dbe2c7a8c07 porting notes: none
1 parent c455292 commit cb8d553

File tree

2 files changed

+163
-0
lines changed

2 files changed

+163
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ import Mathlib.Order.GameAdd
319319
import Mathlib.Order.Heyting.Basic
320320
import Mathlib.Order.Heyting.Boundary
321321
import Mathlib.Order.Hom.Basic
322+
import Mathlib.Order.Hom.Set
322323
import Mathlib.Order.InitialSeg
323324
import Mathlib.Order.Iterate
324325
import Mathlib.Order.Lattice

Mathlib/Order/Hom/Set.lean

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
/-
2+
Copyright (c) 2020 Johan Commelin. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Johan Commelin
5+
6+
! This file was ported from Lean 3 source module order.hom.set
7+
! leanprover-community/mathlib commit 198161d833f2c01498c39c266b0b3dbe2c7a8c07
8+
! Please do not edit these lines, except to modify the commit id
9+
! if you have ported upstream changes.
10+
-/
11+
import Mathlib.Order.Hom.Basic
12+
import Mathlib.Logic.Equiv.Set
13+
import Mathlib.Data.Set.Image
14+
15+
/-!
16+
# Order homomorphisms and sets
17+
-/
18+
19+
20+
open OrderDual
21+
22+
variable {F α β γ δ : Type _}
23+
24+
namespace OrderIso
25+
26+
section LE
27+
28+
variable [LE α] [LE β] [LE γ]
29+
30+
theorem range_eq (e : α ≃o β) : Set.range e = Set.univ :=
31+
e.surjective.range_eq
32+
#align order_iso.range_eq OrderIso.range_eq
33+
34+
@[simp]
35+
theorem symm_image_image (e : α ≃o β) (s : Set α) : e.symm '' (e '' s) = s :=
36+
e.toEquiv.symm_image_image s
37+
#align order_iso.symm_image_image OrderIso.symm_image_image
38+
39+
@[simp]
40+
theorem image_symm_image (e : α ≃o β) (s : Set β) : e '' (e.symm '' s) = s :=
41+
e.toEquiv.image_symm_image s
42+
#align order_iso.image_symm_image OrderIso.image_symm_image
43+
44+
theorem image_eq_preimage (e : α ≃o β) (s : Set α) : e '' s = e.symm ⁻¹' s :=
45+
e.toEquiv.image_eq_preimage s
46+
#align order_iso.image_eq_preimage OrderIso.image_eq_preimage
47+
48+
@[simp]
49+
theorem preimage_symm_preimage (e : α ≃o β) (s : Set α) : e ⁻¹' (e.symm ⁻¹' s) = s :=
50+
e.toEquiv.preimage_symm_preimage s
51+
#align order_iso.preimage_symm_preimage OrderIso.preimage_symm_preimage
52+
53+
@[simp]
54+
theorem symm_preimage_preimage (e : α ≃o β) (s : Set β) : e.symm ⁻¹' (e ⁻¹' s) = s :=
55+
e.toEquiv.symm_preimage_preimage s
56+
#align order_iso.symm_preimage_preimage OrderIso.symm_preimage_preimage
57+
58+
@[simp]
59+
theorem image_preimage (e : α ≃o β) (s : Set β) : e '' (e ⁻¹' s) = s :=
60+
e.toEquiv.image_preimage s
61+
#align order_iso.image_preimage OrderIso.image_preimage
62+
63+
@[simp]
64+
theorem preimage_image (e : α ≃o β) (s : Set α) : e ⁻¹' (e '' s) = s :=
65+
e.toEquiv.preimage_image s
66+
#align order_iso.preimage_image OrderIso.preimage_image
67+
68+
end LE
69+
70+
open Set
71+
72+
variable [Preorder α] [Preorder β] [Preorder γ]
73+
74+
/-- Order isomorphism between two equal sets. -/
75+
def setCongr (s t : Set α) (h : s = t) :
76+
s ≃o t where
77+
toEquiv := Equiv.setCongr h
78+
map_rel_iff' := Iff.rfl
79+
#align order_iso.set_congr OrderIso.setCongr
80+
81+
/-- Order isomorphism between `univ : set α` and `α`. -/
82+
def Set.univ : (Set.univ : Set α) ≃o
83+
α where
84+
toEquiv := Equiv.Set.univ α
85+
map_rel_iff' := Iff.rfl
86+
#align order_iso.set.univ OrderIso.Set.univ
87+
88+
end OrderIso
89+
90+
/-- If a function `f` is strictly monotone on a set `s`, then it defines an order isomorphism
91+
between `s` and its image. -/
92+
protected noncomputable def StrictMonoOn.orderIso {α β} [LinearOrder α] [Preorder β] (f : α → β)
93+
(s : Set α) (hf : StrictMonoOn f s) :
94+
s ≃o f '' s where
95+
toEquiv := hf.injOn.bijOn_image.equiv _
96+
map_rel_iff' := hf.le_iff_le (Subtype.property _) (Subtype.property _)
97+
#align strict_mono_on.order_iso StrictMonoOn.orderIso
98+
99+
namespace StrictMono
100+
101+
variable [LinearOrder α] [Preorder β]
102+
103+
variable (f : α → β) (h_mono : StrictMono f) (h_surj : Function.Surjective f)
104+
105+
/-- A strictly monotone function from a linear order is an order isomorphism between its domain and
106+
its range. -/
107+
@[simps apply]
108+
protected noncomputable def orderIso :
109+
α ≃o Set.range f where
110+
toEquiv := Equiv.ofInjective f h_mono.injective
111+
map_rel_iff' := h_mono.le_iff_le
112+
#align strict_mono.order_iso StrictMono.orderIso
113+
114+
/-- A strictly monotone surjective function from a linear order is an order isomorphism. -/
115+
noncomputable def orderIsoOfSurjective : α ≃o β :=
116+
(h_mono.orderIso f).trans <|
117+
(OrderIso.setCongr _ _ h_surj.range_eq).trans OrderIso.Set.univ
118+
#align strict_mono.order_iso_of_surjective StrictMono.orderIsoOfSurjective
119+
120+
@[simp]
121+
theorem coe_orderIsoOfSurjective : (orderIsoOfSurjective f h_mono h_surj : α → β) = f :=
122+
rfl
123+
#align strict_mono.coe_order_iso_of_surjective StrictMono.coe_orderIsoOfSurjective
124+
125+
@[simp]
126+
theorem orderIsoOfSurjective_symm_apply_self (a : α) :
127+
(orderIsoOfSurjective f h_mono h_surj).symm (f a) = a :=
128+
(orderIsoOfSurjective f h_mono h_surj).symm_apply_apply _
129+
#align strict_mono.order_iso_of_surjective_symm_apply_self
130+
StrictMono.orderIsoOfSurjective_symm_apply_self
131+
132+
theorem orderIsoOfSurjective_self_symm_apply (b : β) :
133+
f ((orderIsoOfSurjective f h_mono h_surj).symm b) = b :=
134+
(orderIsoOfSurjective f h_mono h_surj).apply_symm_apply _
135+
#align strict_mono.order_iso_of_surjective_self_symm_apply
136+
StrictMono.orderIsoOfSurjective_self_symm_apply
137+
138+
end StrictMono
139+
140+
section BooleanAlgebra
141+
142+
variable (α) [BooleanAlgebra α]
143+
144+
/-- Taking complements as an order isomorphism to the order dual. -/
145+
@[simps]
146+
def OrderIso.compl : α ≃o αᵒᵈ where
147+
toFun := OrderDual.toDual ∘ HasCompl.compl
148+
invFun := HasCompl.compl ∘ OrderDual.ofDual
149+
left_inv := compl_compl
150+
right_inv := compl_compl (α := αᵒᵈ)
151+
map_rel_iff' := compl_le_compl_iff_le
152+
#align order_iso.compl OrderIso.compl
153+
154+
theorem compl_strictAnti : StrictAnti (compl : α → α) :=
155+
(OrderIso.compl α).strictMono
156+
#align compl_strict_anti compl_strictAnti
157+
158+
theorem compl_antitone : Antitone (compl : α → α) :=
159+
(OrderIso.compl α).monotone
160+
#align compl_antitone compl_antitone
161+
162+
end BooleanAlgebra

0 commit comments

Comments
 (0)