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

Commit 8943351

Browse files
urkudmergify[bot]
andauthored
feat(topology/algebra/module): define fst and snd, review (#2247)
* feat(topology/algebra/module): define `fst` and `snd`, review * Fix compile Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 5b44363 commit 8943351

File tree

2 files changed

+57
-21
lines changed

2 files changed

+57
-21
lines changed

src/geometry/manifold/mfderiv.lean

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,15 @@ def mfderiv_within (f : M → M') (s : set M) (x : M) : tangent_space I x →L[
223223
if h : mdifferentiable_within_at I I' f s x then
224224
(fderiv_within 𝕜 (written_in_ext_chart_at I I' x f) ((ext_chart_at I x).inv_fun ⁻¹' s ∩ range I.to_fun)
225225
((ext_chart_at I x).to_fun x) : _)
226-
else continuous_linear_map.zero
226+
else 0
227227

228228
/-- Let `f` be a function between two smooth manifolds. Then `mfderiv I I' f x` is the derivative of
229229
`f` at `x`, as a continuous linear map from the tangent space at `x` to the tangent space at `f x`. -/
230230
def mfderiv (f : M → M') (x : M) : tangent_space I x →L[𝕜] tangent_space I' (f x) :=
231231
if h : mdifferentiable_at I I' f x then
232232
(fderiv_within 𝕜 (written_in_ext_chart_at I I' x f : E → E') (range I.to_fun)
233233
((ext_chart_at I x).to_fun x) : _)
234-
else continuous_linear_map.zero
234+
else 0
235235

236236
set_option class.instance_max_depth 60
237237

@@ -351,11 +351,11 @@ set_option class.instance_max_depth 60
351351

352352
lemma mfderiv_within_zero_of_not_mdifferentiable_within_at
353353
(h : ¬ mdifferentiable_within_at I I' f s x) : mfderiv_within I I' f s x = 0 :=
354-
by { simp [mfderiv_within, h], refl }
354+
by simp [mfderiv_within, h]
355355

356356
lemma mfderiv_zero_of_not_mdifferentiable_at
357357
(h : ¬ mdifferentiable_at I I' f x) : mfderiv I I' f x = 0 :=
358-
by { simp [mfderiv, h], refl }
358+
by simp [mfderiv, h]
359359

360360
theorem has_mfderiv_within_at.mono (h : has_mfderiv_within_at I I' f t x f') (hst : s ⊆ t) :
361361
has_mfderiv_within_at I I' f s x f' :=
@@ -676,8 +676,8 @@ begin
676676
by_cases h : mdifferentiable_within_at I I' f s x,
677677
{ exact ((h.has_mfderiv_within_at).congr_of_mem_nhds_within hL hx).mfderiv_within hs },
678678
{ unfold mfderiv_within,
679-
rw [dif_neg, dif_neg],
680-
assumption,
679+
rw [dif_neg h, dif_neg],
680+
refl,
681681
rwa ← mdifferentiable_within_at_congr_of_mem_nhds_within I I' hL hx }
682682
end
683683

@@ -896,7 +896,7 @@ variables {E' : Type*} [normed_group E'] [normed_space 𝕜 E']
896896

897897
lemma has_mfderiv_at_const (c : M') (x : M) :
898898
has_mfderiv_at I I' (λy : M, c) x
899-
(continuous_linear_map.zero : tangent_space I x →L[𝕜] tangent_space I' c) :=
899+
(0 : tangent_space I x →L[𝕜] tangent_space I' c) :=
900900
begin
901901
refine ⟨continuous_const.continuous_at, _⟩,
902902
have : (ext_chart_at I' c).to_fun ∘ (λ (y : M), c) ∘ (ext_chart_at I x).inv_fun =
@@ -907,7 +907,7 @@ end
907907

908908
theorem has_mfderiv_within_at_const (c : M') (s : set M) (x : M) :
909909
has_mfderiv_within_at I I' (λy : M, c) s x
910-
(continuous_linear_map.zero : tangent_space I x →L[𝕜] tangent_space I' c) :=
910+
(0 : tangent_space I x →L[𝕜] tangent_space I' c) :=
911911
(has_mfderiv_at_const I I' c x).has_mfderiv_within_at
912912

913913
lemma mdifferentiable_at_const : mdifferentiable_at I I' (λy : M, c) x :=
@@ -923,12 +923,12 @@ lemma mdifferentiable_on_const : mdifferentiable_on I I' (λy : M, c) s :=
923923
(mdifferentiable_const I I').mdifferentiable_on
924924

925925
@[simp] lemma mfderiv_const : mfderiv I I' (λy : M, c) x =
926-
(continuous_linear_map.zero : tangent_space I x →L[𝕜] tangent_space I' c) :=
926+
(0 : tangent_space I x →L[𝕜] tangent_space I' c) :=
927927
has_mfderiv_at.mfderiv (has_mfderiv_at_const I I' c x)
928928

929929
lemma mfderiv_within_const (hxs : unique_mdiff_within_at I s x) :
930930
mfderiv_within I I' (λy : M, c) s x =
931-
(continuous_linear_map.zero : tangent_space I x →L[𝕜] tangent_space I' c) :=
931+
(0 : tangent_space I x →L[𝕜] tangent_space I' c) :=
932932
begin
933933
rw mdifferentiable.mfderiv_within (mdifferentiable_at_const I I') hxs,
934934
{ exact mfderiv_const I I' },
@@ -1140,8 +1140,7 @@ begin
11401140
change ¬(∃(f' : tangent_space (model_with_corners_self 𝕜 E) x →L[𝕜]
11411141
tangent_space (model_with_corners_self 𝕜 E') (f x)),
11421142
has_fderiv_within_at f f' s x) at h,
1143-
simp [fderiv_within, h],
1144-
refl }
1143+
simp [fderiv_within, h] }
11451144
end
11461145

11471146
/-- For maps between vector spaces, mfderiv and fderiv coincide -/

src/topology/algebra/module.lean

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ variables
200200
/-- Coerce continuous linear maps to linear maps. -/
201201
instance : has_coe (M →L[R] M₂) (M →ₗ[R] M₂) := ⟨to_linear_map⟩
202202

203-
protected lemma continuous (f : M →L[R] M₂) : continuous f := f.2
204-
205203
/-- Coerce continuous linear maps to functions. -/
206204
instance to_fun : has_coe_to_fun $ M →L[R] M₂ := ⟨_, λ f, f.to_fun⟩
207205

206+
protected lemma continuous (f : M →L[R] M₂) : continuous f := f.2
207+
208208
@[ext] theorem ext {f g : M →L[R] M₂} (h : ∀ x, f x = g x) : f = g :=
209209
by cases f; cases g; congr' 1; ext x; apply h
210210

@@ -223,10 +223,7 @@ variables (c : R) (f g : M →L[R] M₂) (h : M₂ →L[R] M₃) (x y z : M)
223223
@[simp, squash_cast] lemma coe_coe : ((f : M →ₗ[R] M₂) : (M → M₂)) = (f : M → M₂) := rfl
224224

225225
/-- The continuous map that is constantly zero. -/
226-
def zero : M →L[R] M₂ :=
227-
0, by exact continuous_const⟩
228-
229-
instance: has_zero (M →L[R] M₂) := ⟨zero⟩
226+
instance: has_zero (M →L[R] M₂) := ⟨⟨0, continuous_const⟩⟩
230227
instance : inhabited (M →L[R] M₂) := ⟨0
231228

232229
@[simp] lemma zero_apply : (0 : M →L[R] M₂) x = 0 := rfl
@@ -266,8 +263,8 @@ instance : has_neg (M →L[R] M₂) := ⟨λ f, ⟨-f, f.2.neg⟩⟩
266263
@[move_cast] lemma coe_neg' : (((-f) : M →L[R] M₂) : M → M₂) = -(f : M → M₂) := rfl
267264

268265
instance : add_comm_group (M →L[R] M₂) :=
269-
by refine {zero := 0, add := (+), neg := has_neg.neg, ..};
270-
intros; ext; simp; cc
266+
by { refine {zero := 0, add := (+), neg := has_neg.neg, ..}; intros; ext;
267+
apply_rules [zero_add, add_assoc, add_zero, add_left_neg, add_comm] }
271268

272269
lemma sub_apply (x : M) : (f - g) x = f x - g x := rfl
273270
@[simp, move_cast] lemma coe_sub : (((f - g) : M →L[R] M₂) : M →ₗ[R] M₂) = (f : M →ₗ[R] M₂) - g := rfl
@@ -323,10 +320,46 @@ instance [topological_add_group M] : ring (M →L[R] M) :=
323320
..continuous_linear_map.add_comm_group }
324321

325322
/-- The cartesian product of two bounded linear maps, as a bounded linear map. -/
326-
def prod (f₁ : M →L[R] M₂) (f₂ : M →L[R] M₃) : M →L[R] (M₂ × M₃) :=
323+
protected def prod (f₁ : M →L[R] M₂) (f₂ : M →L[R] M₃) : M →L[R] (M₂ × M₃) :=
327324
{ cont := f₁.2.prod_mk f₂.2,
328325
..f₁.to_linear_map.prod f₂.to_linear_map }
329326

327+
@[simp, move_cast] lemma coe_prod (f₁ : M →L[R] M₂) (f₂ : M →L[R] M₃) :
328+
(f₁.prod f₂ : M →ₗ[R] M₂ × M₃) = linear_map.prod f₁ f₂ :=
329+
rfl
330+
331+
@[simp, move_cast] lemma prod_apply (f₁ : M →L[R] M₂) (f₂ : M →L[R] M₃) (x : M) :
332+
f₁.prod f₂ x = (f₁ x, f₂ x) :=
333+
rfl
334+
335+
variables (R M M₂)
336+
337+
/-- `prod.fst` as a `continuous_linear_map`. -/
338+
protected def fst : M × M₂ →L[R] M :=
339+
{ cont := continuous_fst, to_linear_map := linear_map.fst R M M₂ }
340+
341+
/-- `prod.snd` as a `continuous_linear_map`. -/
342+
protected def snd : M × M₂ →L[R] M₂ :=
343+
{ cont := continuous_snd, to_linear_map := linear_map.snd R M M₂ }
344+
345+
variables {R M M₂}
346+
347+
@[simp, move_cast] lemma coe_fst :
348+
(continuous_linear_map.fst R M M₂ : M × M₂ →ₗ[R] M) = linear_map.fst R M M₂ :=
349+
rfl
350+
351+
@[simp, move_cast] lemma coe_fst' :
352+
(continuous_linear_map.fst R M M₂ : M × M₂ → M) = prod.fst :=
353+
rfl
354+
355+
@[simp, move_cast] lemma coe_snd :
356+
(continuous_linear_map.snd R M M₂ : M × M₂ →ₗ[R] M₂) = linear_map.snd R M M₂ :=
357+
rfl
358+
359+
@[simp, move_cast] lemma coe_snd' :
360+
(continuous_linear_map.snd R M M₂ : M × M₂ → M₂) = prod.snd :=
361+
rfl
362+
330363
end general_ring
331364

332365
section comm_ring
@@ -502,6 +535,10 @@ by { ext, refl }
502535
(e₁.trans e₂).to_linear_equiv = e₁.to_linear_equiv.trans e₂.to_linear_equiv :=
503536
by { ext, refl }
504537

538+
theorem bijective (e : M ≃L[R] M₂) : function.bijective e := e.to_linear_equiv.to_equiv.bijective
539+
theorem injective (e : M ≃L[R] M₂) : function.injective e := e.to_linear_equiv.to_equiv.injective
540+
theorem surjective (e : M ≃L[R] M₂) : function.surjective e := e.to_linear_equiv.to_equiv.surjective
541+
505542
@[simp] theorem apply_symm_apply (e : M ≃L[R] M₂) (c : M₂) : e (e.symm c) = c := e.1.6 c
506543
@[simp] theorem symm_apply_apply (e : M ≃L[R] M₂) (b : M) : e.symm (e b) = b := e.1.5 b
507544

0 commit comments

Comments
 (0)