Skip to content

Commit 3e8515c

Browse files
committed
chore(Geometry/Manifold/Algebra): golf using custom elaborators (leanprover-community#36007)
1 parent 86514de commit 3e8515c

File tree

4 files changed

+117
-119
lines changed

4 files changed

+117
-119
lines changed

Mathlib/Geometry/Manifold/Algebra/LieGroup.lean

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Nicolò Cavalleri
66
module
77

88
public import Mathlib.Geometry.Manifold.Algebra.Monoid
9+
import Mathlib.Geometry.Manifold.Notation
910

1011
/-!
1112
# Lie groups
@@ -63,7 +64,7 @@ class LieAddGroup {𝕜 : Type*} [NontriviallyNormedField 𝕜] {H : Type*} [Top
6364
(n : WithTop ℕ∞) (G : Type*)
6465
[AddGroup G] [TopologicalSpace G] [ChartedSpace H G] : Prop extends ContMDiffAdd I n G where
6566
/-- Negation is smooth in an additive Lie group. -/
66-
contMDiff_neg : ContMDiff I I n fun a : G => -a
67+
contMDiff_neg : CMDiff n fun a : G -a
6768

6869
-- See note [Design choices about smooth algebraic structures]
6970
/-- A (multiplicative) Lie group is a group and a `C^n` manifold at the same time in which
@@ -74,7 +75,7 @@ class LieGroup {𝕜 : Type*} [NontriviallyNormedField 𝕜] {H : Type*} [Topolo
7475
(n : WithTop ℕ∞) (G : Type*)
7576
[Group G] [TopologicalSpace G] [ChartedSpace H G] : Prop extends ContMDiffMul I n G where
7677
/-- Inversion is smooth in a Lie group. -/
77-
contMDiff_inv : ContMDiff I I n fun a : G => a⁻¹
78+
contMDiff_inv : CMDiff n fun a : G a⁻¹
7879

7980
/-!
8081
### Smoothness of inversion, negation, division and subtraction
@@ -122,7 +123,7 @@ variable (I n)
122123

123124
/-- In a Lie group, inversion is `C^n`. -/
124125
@[to_additive /-- In an additive Lie group, inversion is a smooth map. -/]
125-
theorem contMDiff_inv : ContMDiff I I n fun x : G => x⁻¹ :=
126+
theorem contMDiff_inv : CMDiff n fun x : G x⁻¹ :=
126127
LieGroup.contMDiff_inv
127128

128129
include I n in
@@ -137,41 +138,41 @@ end
137138

138139
@[to_additive]
139140
theorem ContMDiffWithinAt.inv {f : M → G} {s : Set M} {x₀ : M}
140-
(hf : ContMDiffWithinAt I' I n f s x₀) : ContMDiffWithinAt I' I n (fun x => (f x)⁻¹) s x₀ :=
141+
(hf : CMDiffAt[s] n f x₀) : CMDiffAt[s] n (fun x (f x)⁻¹) x₀ :=
141142
(contMDiff_inv I n).contMDiffAt.contMDiffWithinAt.comp x₀ hf <| Set.mapsTo_univ _ _
142143

143144
@[to_additive]
144-
theorem ContMDiffAt.inv {f : M → G} {x₀ : M} (hf : ContMDiffAt I' I n f x₀) :
145-
ContMDiffAt I' I n (fun x => (f x)⁻¹) x₀ :=
145+
theorem ContMDiffAt.inv {f : M → G} {x₀ : M} (hf : CMDiffAt n f x₀) :
146+
CMDiffAt n (fun x (f x)⁻¹) x₀ :=
146147
(contMDiff_inv I n).contMDiffAt.comp x₀ hf
147148

148149
@[to_additive]
149-
theorem ContMDiffOn.inv {f : M → G} {s : Set M} (hf : ContMDiffOn I' I n f s) :
150-
ContMDiffOn I' I n (fun x => (f x)⁻¹) s := fun x hx => (hf x hx).inv
150+
theorem ContMDiffOn.inv {f : M → G} {s : Set M} (hf : CMDiff[s] n f) :
151+
CMDiff[s] n (fun x (f x)⁻¹) := fun x hx (hf x hx).inv
151152

152153
@[to_additive]
153-
theorem ContMDiff.inv {f : M → G} (hf : ContMDiff I' I n f) : ContMDiff I' I n fun x => (f x)⁻¹ :=
154-
fun x => (hf x).inv
154+
theorem ContMDiff.inv {f : M → G} (hf : CMDiff n f) : CMDiff n fun x (f x)⁻¹ :=
155+
fun x (hf x).inv
155156

156157
@[to_additive]
157158
theorem ContMDiffWithinAt.div {f g : M → G} {s : Set M} {x₀ : M}
158-
(hf : ContMDiffWithinAt I' I n f s x₀) (hg : ContMDiffWithinAt I' I n g s x₀) :
159-
ContMDiffWithinAt I' I n (fun x => f x / g x) s x₀ := by
159+
(hf : CMDiffAt[s] n f x₀) (hg : CMDiffAt[s] n g x₀) :
160+
CMDiffAt[s] n (fun x f x / g x) x₀ := by
160161
simp_rw [div_eq_mul_inv]; exact hf.mul hg.inv
161162

162163
@[to_additive]
163-
theorem ContMDiffAt.div {f g : M → G} {x₀ : M} (hf : ContMDiffAt I' I n f x₀)
164-
(hg : ContMDiffAt I' I n g x₀) : ContMDiffAt I' I n (fun x => f x / g x) x₀ := by
164+
theorem ContMDiffAt.div {f g : M → G} {x₀ : M} (hf : CMDiffAt n f x₀)
165+
(hg : CMDiffAt n g x₀) : CMDiffAt n (fun x f x / g x) x₀ := by
165166
simp_rw [div_eq_mul_inv]; exact hf.mul hg.inv
166167

167168
@[to_additive]
168-
theorem ContMDiffOn.div {f g : M → G} {s : Set M} (hf : ContMDiffOn I' I n f s)
169-
(hg : ContMDiffOn I' I n g s) : ContMDiffOn I' I n (fun x => f x / g x) s := by
169+
theorem ContMDiffOn.div {f g : M → G} {s : Set M} (hf : CMDiff[s] n f)
170+
(hg : CMDiff[s] n g) : CMDiff[s] n (fun x f x / g x) := by
170171
simp_rw [div_eq_mul_inv]; exact hf.mul hg.inv
171172

172173
@[to_additive]
173-
theorem ContMDiff.div {f g : M → G} (hf : ContMDiff I' I n f) (hg : ContMDiff I' I n g) :
174-
ContMDiff I' I n fun x => f x / g x := by simp_rw [div_eq_mul_inv]; exact hf.mul hg.inv
174+
theorem ContMDiff.div {f g : M → G} (hf : CMDiff n f) (hg : CMDiff n g) :
175+
CMDiff n fun x f x / g x := by simp_rw [div_eq_mul_inv]; exact hf.mul hg.inv
175176

176177
end PointwiseDivision
177178

@@ -212,7 +213,7 @@ class ContMDiffInv₀ {𝕜 : Type*} [NontriviallyNormedField 𝕜] {H : Type*}
212213
(n : WithTop ℕ∞) (G : Type*)
213214
[Inv G] [Zero G] [TopologicalSpace G] [ChartedSpace H G] : Prop where
214215
/-- Inversion is `C^n` away from `0`. -/
215-
contMDiffAt_inv₀ : ∀ ⦃x : G⦄, x ≠ 0ContMDiffAt I I n (fun y ↦ y⁻¹) x
216+
contMDiffAt_inv₀ : ∀ ⦃x : G⦄, x ≠ 0CMDiffAt n (fun (y : G) ↦ y⁻¹) x
216217

217218
instance {𝕜 : Type*} [NontriviallyNormedField 𝕜] {n : WithTop ℕ∞} : ContMDiffInv₀ 𝓘(𝕜) n 𝕜 where
218219
contMDiffAt_inv₀ x hx := by
@@ -241,7 +242,7 @@ instance {a : WithTop ℕ∞} [ContMDiffInv₀ I ω G] : ContMDiffInv₀ I a G :
241242
instance [ContinuousInv₀ G] : ContMDiffInv₀ I 0 G := by
242243
have : T1Space G := I.t1Space G
243244
constructor
244-
have A : ContMDiffOn I I 0 (fun (x : G) ↦ x⁻¹) {0}ᶜ := by
245+
have A : CMDiff[{0}ᶜ] 0 (fun (x : G) ↦ x⁻¹) := by
245246
rw [contMDiffOn_zero_iff]
246247
exact continuousOn_inv₀
247248
intro x hx
@@ -267,25 +268,24 @@ theorem continuousInv₀_of_contMDiffInv₀ : ContinuousInv₀ G :=
267268
@[deprecated (since := "2025-09-01")] alias hasContinuousInv₀_of_hasContMDiffInv₀ :=
268269
continuousInv₀_of_contMDiffInv₀
269270

270-
theorem contMDiffOn_inv₀ : ContMDiffOn I I n (Inv.inv : G → G) {0}ᶜ := fun _x hx =>
271-
(contMDiffAt_inv₀ hx).contMDiffWithinAt
271+
theorem contMDiffOn_inv₀ : CMDiff[{0}ᶜ] n (Inv.inv : G → G) :=
272+
fun _x hx ↦ (contMDiffAt_inv₀ hx).contMDiffWithinAt
272273

273274
variable {s : Set M} {a : M}
274275

275-
theorem ContMDiffWithinAt.inv₀ (hf : ContMDiffWithinAt I' I n f s a) (ha : f a ≠ 0) :
276-
ContMDiffWithinAt I' I n (fun x => (f x)⁻¹) s a :=
276+
theorem ContMDiffWithinAt.inv₀ (hf : CMDiffAt[s] n f a) (ha : f a ≠ 0) :
277+
CMDiffAt[s] n (fun x (f x)⁻¹) a :=
277278
(contMDiffAt_inv₀ ha).comp_contMDiffWithinAt a hf
278279

279-
theorem ContMDiffAt.inv₀ (hf : ContMDiffAt I' I n f a) (ha : f a ≠ 0) :
280-
ContMDiffAt I' I n (fun x ↦ (f x)⁻¹) a :=
280+
theorem ContMDiffAt.inv₀ (hf : CMDiffAt n f a) (ha : f a ≠ 0) : CMDiffAt n (fun x ↦ (f x)⁻¹) a :=
281281
(contMDiffAt_inv₀ ha).comp a hf
282282

283-
theorem ContMDiff.inv₀ (hf : ContMDiff I' I n f) (h0 : ∀ x, f x ≠ 0) :
284-
ContMDiff I' I n (fun x ↦ (f x)⁻¹) :=
283+
theorem ContMDiff.inv₀ (hf : CMDiff n f) (h0 : ∀ x, f x ≠ 0) :
284+
CMDiff n (fun x ↦ (f x)⁻¹) :=
285285
fun x ↦ ContMDiffAt.inv₀ (hf x) (h0 x)
286286

287-
theorem ContMDiffOn.inv₀ (hf : ContMDiffOn I' I n f s) (h0 : ∀ x ∈ s, f x ≠ 0) :
288-
ContMDiffOn I' I n (fun x => (f x)⁻¹) s :=
287+
theorem ContMDiffOn.inv₀ (hf : CMDiff[s] n f) (h0 : ∀ x ∈ s, f x ≠ 0) :
288+
CMDiff[s] n (fun x (f x)⁻¹) :=
289289
fun x hx ↦ ContMDiffWithinAt.inv₀ (hf x hx) (h0 x hx)
290290

291291
end ContMDiffInv₀
@@ -308,19 +308,18 @@ variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {n : WithTop ℕ∞}
308308
{f g : M → G} {s : Set M} {a : M}
309309

310310
theorem ContMDiffWithinAt.div₀
311-
(hf : ContMDiffWithinAt I' I n f s a) (hg : ContMDiffWithinAt I' I n g s a) (h₀ : g a ≠ 0) :
312-
ContMDiffWithinAt I' I n (f / g) s a := by
311+
(hf : CMDiffAt[s] n f a) (hg : CMDiffAt[s] n g a) (h₀ : g a ≠ 0) : CMDiffAt[s] n (f / g) a := by
313312
simpa [div_eq_mul_inv] using hf.mul (hg.inv₀ h₀)
314313

315-
theorem ContMDiffOn.div₀ (hf : ContMDiffOn I' I n f s) (hg : ContMDiffOn I' I n g s)
316-
(h₀ : ∀ x ∈ s, g x ≠ 0) : ContMDiffOn I' I n (f / g) s := by
314+
theorem ContMDiffOn.div₀ (hf : CMDiff[s] n f) (hg : CMDiff[s] n g)
315+
(h₀ : ∀ x ∈ s, g x ≠ 0) : CMDiff[s] n (f / g) := by
317316
simpa [div_eq_mul_inv] using hf.mul (hg.inv₀ h₀)
318317

319-
theorem ContMDiffAt.div₀ (hf : ContMDiffAt I' I n f a) (hg : ContMDiffAt I' I n g a)
320-
(h₀ : g a ≠ 0) : ContMDiffAt I' I n (f / g) a := by
318+
theorem ContMDiffAt.div₀ (hf : CMDiffAt n f a) (hg : CMDiffAt n g a)
319+
(h₀ : g a ≠ 0) : CMDiffAt n (f / g) a := by
321320
simpa [div_eq_mul_inv] using hf.mul (hg.inv₀ h₀)
322321

323-
theorem ContMDiff.div₀ (hf : ContMDiff I' I n f) (hg : ContMDiff I' I n g) (h₀ : ∀ x, g x ≠ 0) :
324-
ContMDiff I' I n (f / g) := by simpa only [div_eq_mul_inv] using hf.mul (hg.inv₀ h₀)
322+
theorem ContMDiff.div₀ (hf : CMDiff n f) (hg : CMDiff n g) (h₀ : ∀ x, g x ≠ 0) :
323+
CMDiff n (f / g) := by simpa only [div_eq_mul_inv] using hf.mul (hg.inv₀ h₀)
325324

326325
end Div

0 commit comments

Comments
 (0)