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

Commit b55e44d

Browse files
sgouezelmergify[bot]
authored andcommitted
refactor(analysis/normed_space/basic): change normed_space definition (#1112)
1 parent 85ed958 commit b55e44d

File tree

7 files changed

+86
-77
lines changed

7 files changed

+86
-77
lines changed

src/analysis/asymptotics.lean

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ end
570570
theorem is_o_one_iff {f : α → β} {l : filter α} :
571571
is_o f (λ x, (1 : γ)) l ↔ tendsto f l (nhds 0) :=
572572
begin
573-
rw [normed_space.tendsto_nhds_zero, is_o], split,
573+
rw [normed_group.tendsto_nhds_zero, is_o], split,
574574
{ intros h e epos,
575575
filter_upwards [h (e / 2) (half_pos epos)], simp,
576576
intros x hx,
@@ -656,7 +656,7 @@ scalar multiplication is multiplication.
656656
-/
657657

658658
section
659-
variables {K : Type*} [normed_field K] [normed_space K β] [normed_group γ]
659+
variables {K : Type*} [normed_field K] [normed_group β] [normed_space K β] [normed_group γ]
660660

661661
set_option class.instance_max_depth 43
662662

@@ -697,7 +697,7 @@ end
697697
end
698698

699699
section
700-
variables {K : Type*} [normed_group β] [normed_field K] [normed_space K γ]
700+
variables {K : Type*} [normed_group β] [normed_field K] [normed_group γ] [normed_space K γ]
701701

702702
set_option class.instance_max_depth 43
703703

@@ -720,7 +720,8 @@ end
720720
end
721721

722722
section
723-
variables {K : Type*} [normed_field K] [normed_space K β] [normed_space K γ]
723+
variables {K : Type*} [normed_field K] [normed_group β] [normed_space K β]
724+
[normed_group γ] [normed_space K γ]
724725

725726
set_option class.instance_max_depth 43
726727

src/analysis/convex.lean

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ local attribute [instance] classical.prop_decidable
1818

1919
open set
2020

21+
section vector_space
2122
variables {α : Type*} {β : Type*} {ι : Sort _}
2223
[add_comm_group α] [vector_space ℝ α] [add_comm_group β] [vector_space ℝ β]
2324
(A : set α) (B : set α) (x : α)
@@ -748,12 +749,12 @@ calc
748749
add_le_add (mul_le_mul_of_nonneg_left (le_max_left _ _) ha) (mul_le_mul_of_nonneg_left (le_max_right _ _) hb)
749750
... ≤ max (f x) (f y) : by rw [←add_mul, hab, one_mul]
750751

751-
/- This instance is necessary to guide class instance search in the lemma below. -/
752-
noncomputable def real_normed_space.to_has_scalar (α : Type) [normed_space ℝ α] : has_scalar ℝ α :=
753-
mul_action.to_has_scalar ℝ α
754-
local attribute [instance] real_normed_space.to_has_scalar
752+
end vector_space
755753

756-
lemma convex_on_dist {α : Type} [normed_space ℝ α] (z : α) (D : set α) (hD : convex D) :
754+
section normed_space
755+
variables {α : Type*} [normed_group α] [normed_space ℝ α]
756+
757+
lemma convex_on_dist (z : α) (D : set α) (hD : convex D) :
757758
convex_on D (λz', dist z' z) :=
758759
begin
759760
apply and.intro hD,
@@ -769,8 +770,10 @@ begin
769770
by simp [norm_smul, normed_group.dist_eq, real.norm_eq_abs, abs_of_nonneg ha, abs_of_nonneg hb]
770771
end
771772

772-
lemma convex_ball {α : Type} [normed_space ℝ α] (a : α) (r : ℝ) : convex (metric.ball a r) :=
773+
lemma convex_ball (a : α) (r : ℝ) : convex (metric.ball a r) :=
773774
by simpa using convex_lt_of_convex_on univ (λb, dist b a) (convex_on_dist _ _ convex_univ) r
774775

775-
lemma convex_closed_ball {α : Type} [normed_space ℝ α] (a : α) (r : ℝ) : convex (metric.closed_ball a r) :=
776+
lemma convex_closed_ball (a : α) (r : ℝ) : convex (metric.closed_ball a r) :=
776777
by simpa using convex_le_of_convex_on univ (λb, dist b a) (convex_on_dist _ _ convex_univ) r
778+
779+
end normed_space

src/analysis/normed_space/banach.lean

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ local attribute [instance] classical.prop_decidable
1414

1515
open function metric set filter finset
1616

17-
class banach_space (α : Type*) (β : Type*) [normed_field α]
18-
extends normed_space α β, complete_space β
19-
2017
variables {k : Type*} [nondiscrete_normed_field k]
21-
variables {E : Type*} [banach_space k E]
22-
variables {F : Type*} [banach_space k F] {f : E → F}
18+
{E : Type*} [normed_group E] [complete_space E] [normed_space k E]
19+
{F : Type*} [normed_group F] [complete_space F] [normed_space k F]
20+
{f : E → F}
2321
include k
2422

2523
set_option class.instance_max_depth 70

src/analysis/normed_space/basic.lean

Lines changed: 34 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,26 @@ def normed_group.of_add_dist' [has_norm α] [add_comm_group α] [metric_space α
4646
{ rw [sub_eq_add_neg, ← add_right_neg y], apply H2 }
4747
end }
4848

49+
/-- A normed group can be built from a norm that satisfies algebraic properties. This is
50+
formalised in this structure. -/
51+
structure normed_group.core (α : Type*) [add_comm_group α] [has_norm α] :=
52+
(norm_eq_zero_iff : ∀ x : α, ∥x∥ = 0 ↔ x = 0)
53+
(triangle : ∀ x y : α, ∥x + y∥ ≤ ∥x∥ + ∥y∥)
54+
(norm_neg : ∀ x : α, ∥-x∥ = ∥x∥)
55+
56+
noncomputable def normed_group.of_core (α : Type*) [add_comm_group α] [has_norm α]
57+
(C : normed_group.core α) : normed_group α :=
58+
{ dist := λ x y, ∥x - y∥,
59+
dist_eq := assume x y, by refl,
60+
dist_self := assume x, (C.norm_eq_zero_iff (x - x)).mpr (show x - x = 0, by simp),
61+
eq_of_dist_eq_zero := assume x y h, show (x = y), from sub_eq_zero.mp $ (C.norm_eq_zero_iff (x - y)).mp h,
62+
dist_triangle := assume x y z,
63+
calc ∥x - z∥ = ∥x - y + (y - z)∥ : by simp
64+
... ≤ ∥x - y∥ + ∥y - z∥ : C.triangle _ _,
65+
dist_comm := assume x y,
66+
calc ∥x - y∥ = ∥ -(y - x)∥ : by simp
67+
... = ∥y - x∥ : by { rw [C.norm_neg] } }
68+
4969
section normed_group
5070
variables [normed_group α] [normed_group β]
5171

@@ -120,7 +140,7 @@ by rw ←norm_neg; simp
120140
lemma ball_0_eq (ε : ℝ) : ball (0:α) ε = {x | ∥x∥ < ε} :=
121141
set.ext $ assume a, by simp
122142

123-
theorem normed_space.tendsto_nhds_zero {f : γ → α} {l : filter γ} :
143+
theorem normed_group.tendsto_nhds_zero {f : γ → α} {l : filter γ} :
124144
tendsto f l (nhds 0) ↔ ∀ ε > 0, { x | ∥ f x ∥ < ε } ∈ l :=
125145
begin
126146
rw [metric.tendsto_nhds], simp only [normed_group.dist_eq, sub_zero],
@@ -158,7 +178,7 @@ nnreal.coe_le.2 $ dist_norm_norm_le g h
158178

159179
end nnnorm
160180

161-
instance prod.normed_group [normed_group β] : normed_group (α × β) :=
181+
instance prod.normed_group : normed_group (α × β) :=
162182
{ norm := λx, max ∥x.1∥ ∥x.2∥,
163183
dist_eq := assume (x y : α × β),
164184
show max (dist x.1 y.1) (dist x.2 y.2) = (max ∥(x - y).1∥ ∥(x - y).2∥), by simp [dist_eq_norm] }
@@ -169,7 +189,7 @@ begin have : ∥x∥ = max (∥x.fst∥) (∥x.snd∥) := rfl, rw this, simp[le_
169189
lemma norm_snd_le (x : α × β) : ∥x.2∥ ≤ ∥x∥ :=
170190
begin have : ∥x∥ = max (∥x.fst∥) (∥x.snd∥) := rfl, rw this, simp[le_max_right] end
171191

172-
instance fintype.normed_group {π : αType*} [fintype α] [∀i, normed_group (π i)] :
192+
instance fintype.normed_group {π : ιType*} [fintype ι] [∀i, normed_group (π i)] :
173193
normed_group (Πb, π b) :=
174194
{ norm := λf, ((finset.sup finset.univ (λ b, nnnorm (f b)) : nnreal) : ℝ),
175195
dist_eq := assume x y,
@@ -364,15 +384,14 @@ by rw [real.norm_eq_abs, abs_of_nonneg (norm_nonneg _)]
364384

365385
section normed_space
366386

367-
class normed_space (α : Type*) (β : Type*) [normed_field α]
368-
extends normed_group β, vector_space α β :=
369-
(norm_smul : ∀ (a:α) b, norm (a • b) = has_norm.norm a * norm b)
387+
class normed_space (α : Type*) (β : Type*) [normed_field α] [normed_group β]
388+
extends vector_space α β :=
389+
(norm_smul : ∀ (a:α) (b:β), norm (a • b) = has_norm.norm a * norm b)
370390

371-
variables [normed_field α]
391+
variables [normed_field α] [normed_group β]
372392

373393
instance normed_field.to_normed_space : normed_space α α :=
374-
{ dist_eq := normed_field.dist_eq,
375-
norm_smul := normed_field.norm_mul }
394+
{ norm_smul := normed_field.norm_mul }
376395

377396
set_option class.instance_max_depth 43
378397

@@ -382,7 +401,8 @@ normed_space.norm_smul s x
382401
lemma nnnorm_smul [normed_space α β] (s : α) (x : β) : nnnorm (s • x) = nnnorm s * nnnorm x :=
383402
nnreal.eq $ norm_smul s x
384403

385-
variables {E : Type*} {F : Type*} [normed_space α E] [normed_space α F]
404+
variables {E : Type*} {F : Type*}
405+
[normed_group E] [normed_space α E] [normed_group F] [normed_space α F]
386406

387407
lemma tendsto_smul {f : γ → α} { g : γ → F} {e : filter γ} {s : α} {b : F} :
388408
(tendsto f e (nhds s)) → (tendsto g e (nhds b)) → tendsto (λ x, (f x) • (g x)) e (nhds (s • b)) :=
@@ -462,41 +482,12 @@ instance : normed_space α (E × F) :=
462482
..prod.normed_group,
463483
..prod.vector_space }
464484

465-
instance fintype.normed_space {ι : Type*} {E : ι → Type*} [fintype ι] [∀i, normed_space α (E i)] :
466-
normed_space α (Πi, E i) :=
467-
{ norm := λf, ((finset.univ.sup (λb, nnnorm (f b)) : nnreal) : ℝ),
468-
dist_eq :=
469-
assume f g, congr_arg coe $ congr_arg (finset.sup finset.univ) $
470-
by funext i; exact nndist_eq_nnnorm _ _,
471-
norm_smul := λ a f,
485+
instance fintype.normed_space {E : ι → Type*} [fintype ι] [∀i, normed_group (E i)]
486+
[∀i, normed_space α (E i)] : normed_space α (Πi, E i) :=
487+
{ norm_smul := λ a f,
472488
show (↑(finset.sup finset.univ (λ (b : ι), nnnorm (a • f b))) : ℝ) =
473489
nnnorm a * ↑(finset.sup finset.univ (λ (b : ι), nnnorm (f b))),
474-
by simp only [(nnreal.coe_mul _ _).symm, nnreal.mul_finset_sup, nnnorm_smul],
475-
..metric_space_pi,
476-
..pi.vector_space α }
477-
478-
/-- A normed space can be built from a norm that satisfies algebraic properties. This is
479-
formalised in this structure. -/
480-
structure normed_space.core (α : Type*) (β : Type*)
481-
[normed_field α] [add_comm_group β] [has_scalar α β] [has_norm β] :=
482-
(norm_eq_zero_iff : ∀ x : β, ∥x∥ = 0 ↔ x = 0)
483-
(norm_smul : ∀ c : α, ∀ x : β, ∥c • x∥ = ∥c∥ * ∥x∥)
484-
(triangle : ∀ x y : β, ∥x + y∥ ≤ ∥x∥ + ∥y∥)
485-
486-
noncomputable def normed_space.of_core (α : Type*) (β : Type*)
487-
[normed_field α] [add_comm_group β] [vector_space α β] [has_norm β]
488-
(C : normed_space.core α β) : normed_space α β :=
489-
{ dist := λ x y, ∥x - y∥,
490-
dist_eq := assume x y, by refl,
491-
dist_self := assume x, (C.norm_eq_zero_iff (x - x)).mpr (show x - x = 0, by simp),
492-
eq_of_dist_eq_zero := assume x y h, show (x = y), from sub_eq_zero.mp $ (C.norm_eq_zero_iff (x - y)).mp h,
493-
dist_triangle := assume x y z,
494-
calc ∥x - z∥ = ∥x - y + (y - z)∥ : by simp
495-
... ≤ ∥x - y∥ + ∥y - z∥ : C.triangle _ _,
496-
dist_comm := assume x y,
497-
calc ∥x - y∥ = ∥ -(1 : α) • (y - x)∥ : by simp
498-
... = ∥y - x∥ : begin rw[C.norm_smul], simp end,
499-
norm_smul := C.norm_smul }
490+
by simp only [(nnreal.coe_mul _ _).symm, nnreal.mul_finset_sup, nnnorm_smul] }
500491

501492
end normed_space
502493

src/analysis/normed_space/bounded_linear_maps.lean

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ open filter (tendsto)
1717
open metric
1818

1919
variables {k : Type*} [nondiscrete_normed_field k]
20-
variables {E : Type*} [normed_space k E]
21-
variables {F : Type*} [normed_space k F]
22-
variables {G : Type*} [normed_space k G]
20+
variables {E : Type*} [normed_group E] [normed_space k E]
21+
variables {F : Type*} [normed_group F] [normed_space k F]
22+
variables {G : Type*} [normed_group G] [normed_space k G]
2323

24+
set_option class.instance_max_depth 70
2425

25-
set_option class.instance_max_depth 80
26-
27-
structure is_bounded_linear_map (k : Type*) [normed_field k] {E : Type*}
28-
[normed_space k E] {F : Type*} [normed_space k F] (f : E → F)
26+
structure is_bounded_linear_map (k : Type*) [normed_field k]
27+
{E : Type*} [normed_group E] [normed_space k E]
28+
{F : Type*} [normed_group F] [normed_space k F] (f : E → F)
2929
extends is_linear_map k f : Prop :=
3030
(bound : ∃ M > 0, ∀ x : E, ∥ f x ∥ ≤ M * ∥ x ∥)
3131

@@ -135,7 +135,7 @@ end
135135
end is_bounded_linear_map
136136

137137
section
138-
set_option class.instance_max_depth 250
138+
set_option class.instance_max_depth 180
139139

140140
lemma is_bounded_linear_map_prod_iso :
141141
is_bounded_linear_map k (λ(p : (E →L[k] F) × (E →L[k] G)),
@@ -271,10 +271,11 @@ def is_bounded_bilinear_map.deriv (h : is_bounded_bilinear_map k f) (p : E × F)
271271
... = (C * ∥p.1∥ + C * ∥p.2∥) * ∥q∥ : by ring
272272
end
273273

274-
set_option class.instance_max_depth 150
275274
@[simp] lemma is_bounded_bilinear_map_deriv_coe (h : is_bounded_bilinear_map k f) (p q : E × F) :
276275
h.deriv p q = f (p.1, q.2) + f (q.1, p.2) := rfl
277276

277+
set_option class.instance_max_depth 95
278+
278279
/-- Given a bounded bilinear map `f`, the map associating to a point `p` the derivative of `f` at
279280
`p` is itself a bounded linear map. -/
280281
lemma is_bounded_bilinear_map.is_bounded_linear_map_deriv (h : is_bounded_bilinear_map k f) :

src/analysis/normed_space/deriv.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ set_option class.instance_max_depth 100
6565
section
6666

6767
variables {k : Type*} [nondiscrete_normed_field k]
68-
variables {E : Type*} [normed_space k E]
69-
variables {F : Type*} [normed_space k F]
70-
variables {G : Type*} [normed_space k G]
68+
variables {E : Type*} [normed_group E] [normed_space k E]
69+
variables {F : Type*} [normed_group F] [normed_space k F]
70+
variables {G : Type*} [normed_group G] [normed_space k G]
7171

7272
def has_fderiv_at_filter (f : E → F) (f' : E →L[k] F) (x : E) (L : filter E) :=
7373
is_o (λ x', f x' - f x - f' (x' - x)) (λ x', x' - x) L
@@ -1250,9 +1250,9 @@ end
12501250

12511251
section
12521252

1253-
variables {E : Type*} [normed_space ℝ E]
1254-
variables {F : Type*} [normed_space ℝ F]
1255-
variables {G : Type*} [normed_space ℝ G]
1253+
variables {E : Type*} [normed_group E] [normed_space ℝ E]
1254+
variables {F : Type*} [normed_group F] [normed_space ℝ F]
1255+
variables {G : Type*} [normed_group G] [normed_space ℝ G]
12561256

12571257
theorem has_fderiv_at_filter_real_equiv {f : E → F} {f' : E →L[ℝ] F} {x : E} {L : filter E} :
12581258
tendsto (λ x' : E, ∥x' - x∥⁻¹ * ∥f x' - f x - f' (x' - x)∥) L (nhds 0) ↔

src/analysis/normed_space/operator_norm.lean

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ local attribute [instance] classical.prop_decidable
1717
set_option class.instance_max_depth 70
1818

1919
variables {k : Type*} {E : Type*} {F : Type*} {G : Type*}
20-
[nondiscrete_normed_field k] [normed_space k E] [normed_space k F] [normed_space k G]
20+
[nondiscrete_normed_field k]
21+
[normed_group E] [normed_space k E]
22+
[normed_group F] [normed_space k F]
23+
[normed_group G] [normed_space k G]
2124
(c : k) (f g : E →L[k] F) (h : F →L[k] G) (x y z : E)
2225
include k
2326

@@ -193,11 +196,23 @@ le_antisymm
193196
end)
194197
(λ heq, by { rw [←heq, zero_mul], exact hn }))))
195198

199+
lemma op_norm_neg : ∥-f∥ = ∥f∥ := calc
200+
∥-f∥ = ∥(-1:k) • f∥ : by rw neg_one_smul
201+
... = ∥(-1:k)∥ * ∥f∥ : by rw op_norm_smul
202+
... = ∥f∥ : by simp
203+
196204
/-- Continuous linear maps themselves form a normed space with respect to
197205
the operator norm. -/
206+
instance to_normed_group : normed_group (E →L[k] F) :=
207+
normed_group.of_core _ ⟨op_norm_zero_iff, op_norm_triangle, op_norm_neg⟩
208+
209+
/- The next instance should be found automatically, but it is not.
210+
TODO: fix me -/
211+
instance to_normed_group_prod : normed_group (E →L[k] (F × G)) :=
212+
continuous_linear_map.to_normed_group
213+
198214
instance to_normed_space : normed_space k (E →L[k] F) :=
199-
normed_space.of_core _ _
200-
⟨op_norm_zero_iff, op_norm_smul, op_norm_triangle⟩
215+
⟨op_norm_smul⟩
201216

202217
/-- The operator norm is submultiplicative. -/
203218
lemma op_norm_comp_le : ∥comp h f∥ ≤ ∥h∥ * ∥f∥ :=

0 commit comments

Comments
 (0)