@@ -21,29 +21,41 @@ We define the notation `ℍ` for the upper half plane available in the locale
2121noncomputable section
2222
2323/-- The open upper half plane, denoted as `ℍ` within the `UpperHalfPlane` namespace -/
24- def UpperHalfPlane :=
25- { point : ℂ // 0 < point.im }
24+ @[ext]
25+ structure UpperHalfPlane where
26+ /-- Canonical embedding of the upper half-plane into `ℂ`. -/
27+ protected coe : ℂ
28+ coe_im_pos : 0 < coe.im
2629
2730@[inherit_doc] scoped [UpperHalfPlane] notation "ℍ" => UpperHalfPlane
2831
2932open UpperHalfPlane
3033
3134namespace UpperHalfPlane
3235
33- /-- Canonical embedding of the upper half-plane into `ℂ`. -/
34- @[coe] protected def coe (z : ℍ) : ℂ := z.1
36+ attribute [coe] UpperHalfPlane.coe
3537
3638instance : CoeOut ℍ ℂ := ⟨UpperHalfPlane.coe⟩
3739
38- instance : Inhabited ℍ :=
39- ⟨⟨Complex.I, by simp⟩⟩
40+ /-- Define I := √-1 as an element on the upper half plane. -/
41+ def I : ℍ := ⟨Complex.I, zero_lt_one⟩
42+
43+ instance : Inhabited ℍ := ⟨.I⟩
44+
45+ @ [simp, norm_cast] theorem coe_inj {a b : ℍ} : (a : ℂ) = b ↔ a = b := UpperHalfPlane.ext_iff.symm
46+
47+ @ [deprecated (since := "2026-01-31" )] alias ext_iff' := coe_inj
48+
49+ theorem coe_injective : Function.Injective UpperHalfPlane.coe := fun _ _ ↦ UpperHalfPlane.ext
4050
41- @[ext] theorem ext {a b : ℍ} (h : (a : ℂ) = b) : a = b := Subtype.ext h
51+ instance canLift : CanLift ℂ ℍ ((↑) : ℍ → ℂ) fun z => 0 < z.im where
52+ prf z hz := ⟨⟨z, hz⟩, rfl⟩
4253
43- @ [simp, norm_cast] theorem ext_iff' {a b : ℍ} : (a : ℂ) = b ↔ a = b := UpperHalfPlane.ext_iff.symm
54+ protected theorem «forall » {P : ℍ → Prop } : (∀ z, P z) ↔ ∀ z hz, P ⟨z, hz⟩ :=
55+ ⟨fun h z hz ↦ h ⟨z, hz⟩, fun h z ↦ h z.1 z.2 ⟩
4456
45- instance canLift : CanLift ℂ ℍ ((↑) : ℍ → ℂ) fun z => 0 < z.im :=
46- Subtype.canLift fun (z : ℂ) => 0 < z.im
57+ protected theorem « exists » {P : ℍ → Prop } : (∃ z, P z) ↔ ∃ z hz, P ⟨z, hz⟩ :=
58+ ⟨ fun ⟨⟨z, hz⟩, hP⟩ ↦ ⟨z, hz, hP⟩, fun ⟨z, hz, hP⟩ ↦ ⟨⟨z, hz⟩, hP⟩⟩
4759
4860/-- Imaginary part -/
4961def im (z : ℍ) :=
@@ -54,13 +66,11 @@ def re (z : ℍ) :=
5466 (z : ℂ).re
5567
5668/-- Extensionality lemma in terms of `UpperHalfPlane.re` and `UpperHalfPlane.im`. -/
57- theorem ext' {a b : ℍ} (hre : a.re = b.re) (him : a.im = b.im) : a = b :=
58- ext <| Complex.ext hre him
69+ theorem ext_re_im {a b : ℍ} (hre : a.re = b.re) (him : a.im = b.im) : a = b :=
70+ UpperHalfPlane. ext <| Complex.ext hre him
5971
60- /-- Constructor for `UpperHalfPlane`. It is useful if `⟨z, h⟩` makes Lean use a wrong
61- typeclass instance. -/
62- def mk (z : ℂ) (h : 0 < z.im) : ℍ :=
63- ⟨z, h⟩
72+ @ [deprecated (since := "2026-01-29" )]
73+ alias ext' := ext_re_im
6474
6575@[simp]
6676theorem coe_im (z : ℍ) : (z : ℂ).im = z.im :=
@@ -78,48 +88,38 @@ theorem mk_re (z : ℂ) (h : 0 < z.im) : (mk z h).re = z.re :=
7888theorem mk_im (z : ℂ) (h : 0 < z.im) : (mk z h).im = z.im :=
7989 rfl
8090
81- @[simp]
8291theorem coe_mk (z : ℂ) (h : 0 < z.im) : (mk z h : ℂ) = z :=
8392 rfl
8493
8594@[simp]
86- lemma coe_mk_subtype {z : ℂ} (hz : 0 < z.im) :
87- UpperHalfPlane.coe ⟨z, hz⟩ = z := by
95+ theorem mk_coe (z : ℍ) (h : 0 < (z : ℂ).im := z.2 ) : mk z h = z :=
8896 rfl
8997
90- instance : Nontrivial ℍ := by
91- constructor
92- use ⟨Complex.I, by simp⟩, ⟨2 * Complex.I, by simp⟩
93- simp [ne_eq, UpperHalfPlane.ext_iff]
98+ @[simp]
99+ lemma I_im : I.im = 1 := rfl
94100
95101@[simp]
96- theorem mk_coe (z : ℍ) (h : 0 < (z : ℂ).im := z.2 ) : mk z h = z :=
102+ lemma I_re : I.re = 0 := rfl
103+
104+ @ [simp, norm_cast]
105+ lemma coe_I : I = Complex.I := rfl
106+
107+ @ [deprecated coe_mk (since := "2026-01-29" )]
108+ lemma coe_mk_subtype {z : ℂ} (hz : 0 < z.im) :
109+ UpperHalfPlane.coe ⟨z, hz⟩ = z :=
97110 rfl
98111
99112theorem re_add_im (z : ℍ) : (z.re + z.im * Complex.I : ℂ) = z :=
100113 Complex.re_add_im z
101114
102- theorem im_pos (z : ℍ) : 0 < z.im :=
103- z.2
115+ theorem im_pos (z : ℍ) : 0 < z.im := z.coe_im_pos
104116
105117theorem im_ne_zero (z : ℍ) : z.im ≠ 0 :=
106118 z.im_pos.ne'
107119
108120theorem ne_zero (z : ℍ) : (z : ℂ) ≠ 0 :=
109121 mt (congr_arg Complex.im) z.im_ne_zero
110122
111- /-- Define I := √-1 as an element on the upper half plane. -/
112- def I : ℍ := ⟨Complex.I, by simp⟩
113-
114- @[simp]
115- lemma I_im : I.im = 1 := rfl
116-
117- @[simp]
118- lemma I_re : I.re = 0 := rfl
119-
120- @ [simp, norm_cast]
121- lemma coe_I : I = Complex.I := rfl
122-
123123end UpperHalfPlane
124124
125125namespace Mathlib.Meta.Positivity
@@ -155,30 +155,31 @@ theorem normSq_ne_zero (z : ℍ) : Complex.normSq (z : ℂ) ≠ 0 :=
155155 (normSq_pos z).ne'
156156
157157theorem im_inv_neg_coe_pos (z : ℍ) : 0 < (-z : ℂ)⁻¹.im := by
158- simpa [neg_div] using div_pos z.property (normSq_pos z)
158+ simpa [neg_div] using div_pos z.im_pos (normSq_pos z)
159159
160160lemma im_pnat_div_pos (n : ℕ) [NeZero n] (z : ℍ) : 0 < (-(n : ℂ) / z).im := by
161161 suffices 0 < n * z.im / Complex.normSq z by simpa [Complex.div_im, neg_div]
162162 positivity [NeZero.ne n, z.normSq_pos]
163163
164- lemma ne_nat (z : ℍ) : ∀ n : ℕ, z.1 ≠ n := by
165- intro n
166- have h1 := z.2
167- aesop
164+ lemma ne_ofReal (z : ℍ) (x : ℝ) : (z : ℂ) ≠ x :=
165+ ne_of_apply_ne Complex.im <| by simp [im_ne_zero]
166+
167+ lemma ne_intCast (z : ℍ) (n : ℤ) : (z : ℂ) ≠ n := mod_cast ne_ofReal z n
168+
169+ @ [deprecated (since := "2026-01-29" )] alias ne_int := ne_intCast
168170
169- lemma ne_int (z : ℍ) : ∀ n : ℤ, z.1 ≠ n := by
170- intro n
171- have h1 := z.2
172- aesop
171+ lemma ne_natCast (z : ℍ) (n : ℕ) : (z : ℂ) ≠ n := mod_cast ne_intCast z n
172+
173+ @ [deprecated (since := "2026-01-29" )] alias ne_nat := ne_natCast
173174
174175section PosRealAction
175176
176- instance posRealAction : MulAction { x : ℝ // 0 < x } ℍ where
177- smul x z := mk ((x : ℝ) • (z : ℂ)) <| by simpa using mul_pos x.2 z.2
178- one_smul _ := Subtype .ext <| one_smul _ _
179- mul_smul x y z := Subtype .ext <| mul_smul (x : ℝ) y (z : ℂ)
177+ instance posRealAction : MulAction {x : ℝ // 0 < x} ℍ where
178+ smul x z := mk ((x : ℝ) • (z : ℂ)) <| by simpa using mul_pos x.2 z.im_pos
179+ one_smul _ := UpperHalfPlane .ext <| one_smul _ _
180+ mul_smul x y z := UpperHalfPlane .ext <| mul_smul (x : ℝ) y (z : ℂ)
180181
181- variable (x : { x : ℝ // 0 < x }) (z : ℍ)
182+ variable (x : {x : ℝ // 0 < x}) (z : ℍ)
182183
183184@[simp]
184185theorem coe_pos_real_smul : ↑(x • z) = (x : ℝ) • (z : ℂ) :=
@@ -192,14 +193,19 @@ theorem pos_real_im : (x • z).im = x * z.im :=
192193theorem pos_real_re : (x • z).re = x * z.re :=
193194 Complex.smul_re _ _
194195
196+ theorem pos_real_smul_injective (z : ℍ) :
197+ Function.Injective fun x : {x : ℝ // 0 < x} ↦ x • z := by
198+ rintro ⟨x, hx⟩ ⟨y, hy⟩ h
199+ simp_all [UpperHalfPlane.ext_iff, ne_zero]
200+
195201end PosRealAction
196202
197203section RealAddAction
198204
199205instance : AddAction ℝ ℍ where
200206 vadd x z := mk (x + z) <| by simpa using z.im_pos
201- zero_vadd _ := Subtype.ext <| by simp [HVAdd.hVAdd]
202- add_vadd x y z := Subtype.ext <| by simp [HVAdd.hVAdd, add_assoc]
207+ zero_vadd _ := by simp [HVAdd.hVAdd]
208+ add_vadd x y z := by simp [HVAdd.hVAdd, add_assoc]
203209
204210variable (x : ℝ) (z : ℍ)
205211
@@ -215,18 +221,34 @@ theorem vadd_re : (x +ᵥ z).re = x + z.re :=
215221theorem vadd_im : (x +ᵥ z).im = z.im :=
216222 zero_add _
217223
224+ @[simp]
225+ protected theorem vadd_right_cancel_iff {x y : ℝ} (z : ℍ) : x +ᵥ z = y +ᵥ z ↔ x = y := by
226+ simp [UpperHalfPlane.ext_iff]
227+
228+ protected theorem vadd_left_injective (z : ℍ) : Function.Injective fun x : ℝ ↦ x +ᵥ z := by
229+ simp [Function.Injective]
230+
231+ instance : Infinite ℍ :=
232+ .of_injective _ <| UpperHalfPlane.vadd_left_injective I
233+
234+ instance : Nontrivial ℍ := inferInstance
235+
218236end RealAddAction
219237
220238section upperHalfPlaneSet
221239
222- /-- The upper half plane as a subset of `ℂ`. This is convenient for taking derivatives of functions
223- on the upper half plane. -/
240+ /-- The upper half plane as a subset of `ℂ`.
241+ This is convenient for taking derivatives of functions on the upper half plane. -/
224242abbrev upperHalfPlaneSet := {z : ℂ | 0 < z.im}
225243
226244local notation "ℍₒ" => upperHalfPlaneSet
227245
228246lemma isOpen_upperHalfPlaneSet : IsOpen ℍₒ := isOpen_lt continuous_const Complex.continuous_im
229247
248+ @[simp]
249+ theorem range_coe : Set.range UpperHalfPlane.coe = ℍₒ := by
250+ ext; simp [UpperHalfPlane.exists]
251+
230252end upperHalfPlaneSet
231253
232254end UpperHalfPlane
0 commit comments