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

Commit e473c31

Browse files
committed
refactor: redefine bundle.total_space (#19221)
- Use a custom structure for `bundle.total_space`. - Use `bundle.total_space.mk` instead of `bundle.total_space_mk`. - Use `bundle.total_space.to_prod` instead of `equiv.sigma_equiv_prod`. - Use `bundle.total_space.mk'` (scoped notation) to specify `F`. - Rename `bundle.trivial.proj_snd` to `bundle.total_space.trivial_snd` to allow dot notation. Should we just use `bundle.total_space.snd` since `bundle.trivial` is now reducible? - Add an unused argument to `bundle.total_space`. - Make `bundle.trivial` and `bundle.continuous_linear_map` reducible. - Drop instances that are no longer needed.
1 parent a176cb1 commit e473c31

File tree

15 files changed

+501
-548
lines changed

15 files changed

+501
-548
lines changed

src/data/bundle.lean

Lines changed: 61 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -15,133 +15,129 @@ should contain all possible results that do not involve any topology.
1515
1616
We represent a bundle `E` over a base space `B` as a dependent type `E : B → Type*`.
1717
18-
We provide a type synonym of `Σ x, E x` as `bundle.total_space E`, to be able to endow it with
19-
a topology which is not the disjoint union topology `sigma.topological_space`. In general, the
20-
constructions of fiber bundles we will make will be of this form.
18+
We define `bundle.total_space F E` to be the type of pairs `⟨b, x⟩`, where `b : B` and `x : E x`.
19+
This type is isomorphic to `Σ x, E x` and uses an extra argument `F` for reasons explained below. In
20+
general, the constructions of fiber bundles we will make will be of this form.
2121
2222
## Main Definitions
2323
2424
* `bundle.total_space` the total space of a bundle.
2525
* `bundle.total_space.proj` the projection from the total space to the base space.
26-
* `bundle.total_space_mk` the constructor for the total space.
26+
* `bundle.total_space.mk` the constructor for the total space.
27+
28+
## Implementation Notes
29+
30+
- We use a custom structure for the total space of a bundle instead of using a type synonym for the
31+
canonical disjoint union `Σ x, E x` because the total space usually has a different topology and
32+
Lean 4 `simp` fails to apply lemmas about `Σ x, E x` to elements of the total space.
33+
34+
- The definition of `bundle.total_space` has an unused argument `F`. The reason is that in some
35+
constructions (e.g., `bundle.continuous_linear_map.vector_bundle`) we need access to the atlas of
36+
trivializations of original fiber bundles to construct the topology on the total space of the new
37+
fiber bundle.
2738
2839
## References
2940
- https://en.wikipedia.org/wiki/Bundle_(mathematics)
3041
-/
3142

3243
namespace bundle
3344

34-
variables {B : Type*} (E : B → Type*)
45+
variables {B F : Type*} (E : B → Type*)
3546

3647
/--
37-
`bundle.total_space E` is the total space of the bundle `Σ x, E x`.
38-
This type synonym is used to avoid conflicts with general sigma types.
48+
`bundle.total_space E` is the total space of the bundle. It consists of pairs
49+
`(proj : B, snd : E proj)`.
3950
-/
40-
def total_space := Σ x, E x
51+
@[ext]
52+
structure total_space (F : Type*) (E : B → Type*) :=
53+
(proj : B)
54+
(snd : E proj)
4155

4256
instance [inhabited B] [inhabited (E default)] :
43-
inhabited (total_space E) := ⟨⟨default, default⟩⟩
57+
inhabited (total_space F E) := ⟨⟨default, default⟩⟩
4458

4559
variables {E}
4660

4761
/-- `bundle.total_space.proj` is the canonical projection `bundle.total_space E → B` from the
4862
total space to the base space. -/
49-
@[simp, reducible] def total_space.proj : total_space E → B := sigma.fst
63+
add_decl_doc total_space.proj
5064

5165
-- this notation won't be used in the pretty-printer
5266
localized "notation `π` := @bundle.total_space.proj _" in bundle
5367

54-
/-- Constructor for the total space of a bundle. -/
55-
@[simp, reducible] def total_space_mk (b : B) (a : E b) :
56-
bundle.total_space E := ⟨b, a⟩
57-
58-
lemma total_space.proj_mk {x : B} {y : E x} : (total_space_mk x y).proj = x :=
59-
rfl
60-
61-
lemma sigma_mk_eq_total_space_mk {x : B} {y : E x} : sigma.mk x y = total_space_mk x y :=
62-
rfl
68+
-- TODO: try `abbrev` in Lean 4
69+
localized "notation `total_space.mk'` F:max := @bundle.total_space.mk _ F _" in bundle
6370

6471
lemma total_space.mk_cast {x x' : B} (h : x = x') (b : E x) :
65-
total_space_mk x' (cast (congr_arg E h) b) = total_space_mk x b :=
72+
total_space.mk' F x' (cast (congr_arg E h) b) = total_space.mk x b :=
6673
by { subst h, refl }
6774

68-
lemma total_space.eta (z : total_space E) :
69-
total_space_mk z.proj z.2 = z :=
70-
sigma.eta z
75+
instance {x : B} : has_coe_t (E x) (total_space F E) := ⟨total_space.mk x⟩
7176

72-
instance {x : B} : has_coe_t (E x) (total_space E) := ⟨total_space_mk x⟩
77+
@[simp] lemma total_space.coe_proj (x : B) (v : E x) : (v : total_space F E).proj = x := rfl
78+
@[simp] lemma total_space.coe_snd {x : B} {y : E x} : (y : total_space F E).snd = y := rfl
7379

74-
@[simp] lemma coe_fst (x : B) (v : E x) : (v : total_space E).fst = x := rfl
75-
@[simp] lemma coe_snd {x : B} {y : E x} : (y : total_space E).snd = y := rfl
80+
lemma total_space.coe_eq_mk {x : B} (v : E x) : (v : total_space F E) = total_space.mk x v := rfl
7681

77-
lemma to_total_space_coe {x : B} (v : E x) : (v : total_space E) = total_space_mk x v := rfl
82+
lemma total_space.eta (z : total_space F E) :
83+
total_space.mk z.proj z.2 = z :=
84+
by cases z; refl
7885

7986
-- notation for the direct sum of two bundles over the same base
8087
notation E₁ ` ×ᵇ `:100 E₂ := λ x, E₁ x × E₂ x
8188

8289
/-- `bundle.trivial B F` is the trivial bundle over `B` of fiber `F`. -/
83-
def trivial (B : Type*) (F : Type*) : B → Type* := function.const B F
84-
85-
instance {F : Type*} [inhabited F] {b : B} : inhabited (bundle.trivial B F b) := ⟨(default : F)⟩
90+
@[reducible, nolint unused_arguments]
91+
def trivial (B : Type*) (F : Type*) : B → Type* := λ _, F
8692

8793
/-- The trivial bundle, unlike other bundles, has a canonical projection on the fiber. -/
88-
def trivial.proj_snd (B : Type*) (F : Type*) : total_space (bundle.trivial B F) → F := sigma.snd
94+
def total_space.trivial_snd (B : Type*) (F : Type*) : total_space F (bundle.trivial B F) → F :=
95+
total_space.snd
96+
97+
/-- A trivial bundle is equivalent to the product `B × F`. -/
98+
@[simps { attrs := [`simp, `mfld_simps] }]
99+
def total_space.to_prod (B F : Type*) : total_space F (λ _ : B, F) ≃ B × F :=
100+
{ to_fun := λ x, (x.1, x.2),
101+
inv_fun := λ x, ⟨x.1, x.2⟩,
102+
left_inv := λ ⟨_, _⟩, rfl,
103+
right_inv := λ ⟨_, _⟩, rfl }
89104

90105
section pullback
91106

92107
variable {B' : Type*}
93108

94109
/-- The pullback of a bundle `E` over a base `B` under a map `f : B' → B`, denoted by `pullback f E`
95110
or `f *ᵖ E`, is the bundle over `B'` whose fiber over `b'` is `E (f b')`. -/
96-
@[nolint has_nonempty_instance] def pullback (f : B' → B) (E : B → Type*) := λ x, E (f x)
111+
def pullback (f : B' → B) (E : B → Type*) : B' → Type* := λ x, E (f x)
112+
113+
notation f ` *ᵖ ` E:max := pullback f E
97114

98-
notation f ` *ᵖ ` E := pullback f E
115+
instance {f : B' → B} {x : B'} [nonempty (E (f x))] : nonempty (f *ᵖ E x) := ‹nonempty (E (f x))›
99116

100117
/-- Natural embedding of the total space of `f *ᵖ E` into `B' × total_space E`. -/
101118
@[simp] def pullback_total_space_embedding (f : B' → B) :
102-
total_space (f *ᵖ E) → B' × total_space E :=
103-
λ z, (z.proj, total_space_mk (f z.proj) z.2)
119+
total_space F (f *ᵖ E) → B' × total_space F E :=
120+
λ z, (z.proj, total_space.mk (f z.proj) z.2)
104121

105122
/-- The base map `f : B' → B` lifts to a canonical map on the total spaces. -/
106-
def pullback.lift (f : B' → B) : total_space (f *ᵖ E) → total_space E :=
107-
λ z, total_space_mk (f z.proj) z.2
123+
@[simps { attrs := [`simp, `mfld_simps] }]
124+
def pullback.lift (f : B' → B) : total_space F (f *ᵖ E) → total_space F E :=
125+
λ z, ⟨f z.proj, z.2
108126

109-
@[simp] lemma pullback.proj_lift (f : B' → B) (x : total_space (f *ᵖ E)) :
110-
(pullback.lift f x).proj = f x.1 :=
111-
rfl
112-
113-
@[simp] lemma pullback.lift_mk (f : B' → B) (x : B') (y : E (f x)) :
114-
pullback.lift f (total_space_mk x y) = total_space_mk (f x) y :=
115-
rfl
116-
117-
lemma pullback_total_space_embedding_snd (f : B' → B) (x : total_space (f *ᵖ E)) :
118-
(pullback_total_space_embedding f x).2 = pullback.lift f x :=
127+
@[simp, mfld_simps] lemma pullback.lift_mk (f : B' → B) (x : B') (y : E (f x)) :
128+
pullback.lift f (total_space.mk' F x y) = ⟨f x, y⟩ :=
119129
rfl
120130

121131
end pullback
122132

123133
section fiber_structures
124134

125-
variable [∀ x, add_comm_monoid (E x)]
126-
127-
@[simp] lemma coe_snd_map_apply (x : B) (v w : E x) :
128-
(↑(v + w) : total_space E).snd = (v : total_space E).snd + (w : total_space E).snd := rfl
135+
@[simp] lemma coe_snd_map_apply [∀ x, has_add (E x)] (x : B) (v w : E x) :
136+
(↑(v + w) : total_space F E).snd = (v : total_space F E).snd + (w : total_space F E).snd := rfl
129137

130-
variables (R : Type*) [semiring R] [∀ x, module R (E x)]
131-
132-
@[simp] lemma coe_snd_map_smul (x : B) (r : R) (v : E x) :
133-
(↑(r • v) : total_space E).snd = r • (v : total_space E).snd := rfl
138+
@[simp] lemma coe_snd_map_smul {R} [∀ x, has_smul R (E x)] (x : B) (r : R) (v : E x) :
139+
(↑(r • v) : total_space F E).snd = r • (v : total_space F E).snd := rfl
134140

135141
end fiber_structures
136142

137-
section trivial_instances
138-
139-
variables {F : Type*} {R : Type*} [semiring R] (b : B)
140-
141-
instance [add_comm_monoid F] : add_comm_monoid (bundle.trivial B F b) := ‹add_comm_monoid F›
142-
instance [add_comm_group F] : add_comm_group (bundle.trivial B F b) := ‹add_comm_group F›
143-
instance [add_comm_monoid F] [module R F] : module R (bundle.trivial B F b) := ‹module R F›
144-
145-
end trivial_instances
146-
147143
end bundle

src/geometry/manifold/cont_mdiff_mfderiv.lean

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ space are model spaces in models with corners. The general fact is proved in
248248
lemma cont_mdiff_on.continuous_on_tangent_map_within_aux
249249
{f : H → H'} {s : set H}
250250
(hf : cont_mdiff_on I I' n f s) (hn : 1 ≤ n) (hs : unique_mdiff_on I s) :
251-
continuous_on (tangent_map_within I I' f s) (π (tangent_space I) ⁻¹' s) :=
251+
continuous_on (tangent_map_within I I' f s) (π E (tangent_space I) ⁻¹' s) :=
252252
begin
253253
suffices h : continuous_on (λ (p : H × E), (f p.fst,
254254
(fderiv_within 𝕜 (written_in_ext_chart_at I I' p.fst f) (I.symm ⁻¹' s ∩ range I)
@@ -258,7 +258,7 @@ begin
258258
have B := ((tangent_bundle_model_space_homeomorph H' I').symm.continuous.comp_continuous_on h)
259259
.comp' A,
260260
have : (univ ∩ ⇑(tangent_bundle_model_space_homeomorph H I) ⁻¹' (prod.fst ⁻¹' s)) =
261-
π (tangent_space I) ⁻¹' s,
261+
π E (tangent_space I) ⁻¹' s,
262262
by { ext ⟨x, v⟩, simp only with mfld_simps },
263263
rw this at B,
264264
apply B.congr,
@@ -307,7 +307,8 @@ are model spaces in models with corners. The general fact is proved in
307307
lemma cont_mdiff_on.cont_mdiff_on_tangent_map_within_aux
308308
{f : H → H'} {s : set H}
309309
(hf : cont_mdiff_on I I' n f s) (hmn : m + 1 ≤ n) (hs : unique_mdiff_on I s) :
310-
cont_mdiff_on I.tangent I'.tangent m (tangent_map_within I I' f s) (π (tangent_space I) ⁻¹' s) :=
310+
cont_mdiff_on I.tangent I'.tangent m (tangent_map_within I I' f s)
311+
(π E (tangent_space I) ⁻¹' s) :=
311312
begin
312313
have m_le_n : m ≤ n,
313314
{ apply le_trans _ hmn,
@@ -324,13 +325,13 @@ begin
324325
rw cont_mdiff_on_iff,
325326
refine ⟨hf.continuous_on_tangent_map_within_aux one_le_n hs, λp q, _⟩,
326327
have A : range I ×ˢ univ ∩
327-
((equiv.sigma_equiv_prod H E).symm ∘ λ (p : E × E), ((I.symm) p.fst, p.snd)) ⁻¹'
328-
(π (tangent_space I) ⁻¹' s)
328+
((total_space.to_prod H E).symm ∘ λ (p : E × E), ((I.symm) p.fst, p.snd)) ⁻¹'
329+
E (tangent_space I) ⁻¹' s)
329330
= (range I ∩ I.symm ⁻¹' s) ×ˢ univ,
330-
by { ext ⟨x, v⟩, simp only with mfld_simps },
331+
by { ext ⟨x, v⟩, simp only with mfld_simps, },
331332
suffices h : cont_diff_on 𝕜 m (((λ (p : H' × E'), (I' p.fst, p.snd)) ∘
332-
(equiv.sigma_equiv_prod H' E')) ∘ tangent_map_within I I' f s ∘
333-
((equiv.sigma_equiv_prod H E).symm) ∘ λ (p : E × E), (I.symm p.fst, p.snd))
333+
(total_space.to_prod H' E')) ∘ tangent_map_within I I' f s ∘
334+
((total_space.to_prod H E).symm) ∘ λ (p : E × E), (I.symm p.fst, p.snd))
334335
((range ⇑I ∩ ⇑(I.symm) ⁻¹' s) ×ˢ univ),
335336
by simpa [A] using h,
336337
change cont_diff_on 𝕜 m (λ (p : E × E),
@@ -369,7 +370,7 @@ is `C^m` when `m+1 ≤ n`. -/
369370
theorem cont_mdiff_on.cont_mdiff_on_tangent_map_within
370371
(hf : cont_mdiff_on I I' n f s) (hmn : m + 1 ≤ n) (hs : unique_mdiff_on I s) :
371372
cont_mdiff_on I.tangent I'.tangent m (tangent_map_within I I' f s)
372-
(π (tangent_space I) ⁻¹' s) :=
373+
E (tangent_space I) ⁻¹' s) :=
373374
begin
374375
/- The strategy of the proof is to avoid unfolding the definitions, and reduce by functoriality
375376
to the case of functions on the model spaces, where we have already proved the result.
@@ -407,20 +408,20 @@ begin
407408
let il := chart_at (model_prod H E) (tangent_map I I l p),
408409
let ir := chart_at (model_prod H' E') (tangent_map I I' (r ∘ f) p),
409410
let s' := f ⁻¹' r.source ∩ s ∩ l.source,
410-
let s'_lift := π (tangent_space I) ⁻¹' s',
411+
let s'_lift := π E (tangent_space I) ⁻¹' s',
411412
let s'l := l.target ∩ l.symm ⁻¹' s',
412-
let s'l_lift := π (tangent_space I) ⁻¹' s'l,
413+
let s'l_lift := π E (tangent_space I) ⁻¹' s'l,
413414
rcases continuous_on_iff'.1 hf'.1 r.source r.open_source with ⟨o, o_open, ho⟩,
414415
suffices h : cont_mdiff_on I.tangent I'.tangent m (tangent_map_within I I' f s) s'_lift,
415-
{ refine ⟨π (tangent_space I) ⁻¹' (o ∩ l.source), _, _, _⟩,
416-
show is_open (π (tangent_space I) ⁻¹' (o ∩ l.source)), from
416+
{ refine ⟨π E (tangent_space I) ⁻¹' (o ∩ l.source), _, _, _⟩,
417+
show is_open (π E (tangent_space I) ⁻¹' (o ∩ l.source)), from
417418
(is_open.inter o_open l.open_source).preimage (continuous_proj E _) ,
418-
show p ∈ π (tangent_space I) ⁻¹' (o ∩ l.source),
419+
show p ∈ π E (tangent_space I) ⁻¹' (o ∩ l.source),
419420
{ simp,
420421
have : p.proj ∈ f ⁻¹' r.source ∩ s, by simp [hp],
421422
rw ho at this,
422423
exact this.1 },
423-
{ have : π (tangent_space I) ⁻¹' s ∩ π (tangent_space I) ⁻¹' (o ∩ l.source) = s'_lift,
424+
{ have : π E (tangent_space I) ⁻¹' s ∩ π E (tangent_space I) ⁻¹' (o ∩ l.source) = s'_lift,
424425
{ dsimp only [s'_lift, s'], rw [ho], mfld_set_tac },
425426
rw this,
426427
exact h } },
@@ -547,10 +548,10 @@ end
547548
derivative is continuous there. -/
548549
theorem cont_mdiff_on.continuous_on_tangent_map_within
549550
(hf : cont_mdiff_on I I' n f s) (hmn : 1 ≤ n) (hs : unique_mdiff_on I s) :
550-
continuous_on (tangent_map_within I I' f s) (π (tangent_space I) ⁻¹' s) :=
551+
continuous_on (tangent_map_within I I' f s) (π E (tangent_space I) ⁻¹' s) :=
551552
begin
552553
have : cont_mdiff_on I.tangent I'.tangent 0 (tangent_map_within I I' f s)
553-
(π (tangent_space I) ⁻¹' s) :=
554+
E (tangent_space I) ⁻¹' s) :=
554555
hf.cont_mdiff_on_tangent_map_within hmn hs,
555556
exact this.continuous_on
556557
end
@@ -599,15 +600,15 @@ may seem.
599600
600601
TODO define splittings of vector bundles; state this result invariantly. -/
601602
lemma tangent_map_tangent_bundle_pure (p : tangent_bundle I M) :
602-
tangent_map I I.tangent (zero_section (tangent_space I)) p = ⟨⟨p.proj, 0⟩, ⟨p.2, 0⟩⟩ :=
603+
tangent_map I I.tangent (zero_section E (tangent_space I)) p = ⟨⟨p.proj, 0⟩, ⟨p.2, 0⟩⟩ :=
603604
begin
604605
rcases p with ⟨x, v⟩,
605606
have N : I.symm ⁻¹' (chart_at H x).target ∈ 𝓝 (I ((chart_at H x) x)),
606607
{ apply is_open.mem_nhds,
607608
apply (local_homeomorph.open_target _).preimage I.continuous_inv_fun,
608609
simp only with mfld_simps },
609-
have A : mdifferentiable_at I I.tangent (λ x, @total_space_mk M (tangent_space I) x 0) x,
610-
{ have : smooth I (I.prod 𝓘(𝕜, E)) (zero_section (tangent_space I : M → Type*)) :=
610+
have A : mdifferentiable_at I I.tangent (λ x, @total_space.mk M E (tangent_space I) x 0) x,
611+
{ have : smooth I (I.prod 𝓘(𝕜, E)) (zero_section E (tangent_space I : M → Type*)) :=
611612
bundle.smooth_zero_section 𝕜 (tangent_space I : M → Type*),
612613
exact this.mdifferentiable_at },
613614
have B : fderiv_within 𝕜 (λ (x' : E), (x', (0 : E))) (set.range ⇑I) (I ((chart_at H x) x)) v
@@ -618,12 +619,12 @@ begin
618619
{ exact differentiable_at_const _ },
619620
{ exact model_with_corners.unique_diff_at_image I },
620621
{ exact differentiable_at_id'.prod (differentiable_at_const _) } },
621-
simp only [bundle.zero_section, tangent_map, mfderiv, total_space.proj_mk, A,
622-
if_pos, chart_at, fiber_bundle.charted_space_chart_at, tangent_bundle.trivialization_at_apply,
622+
simp only [bundle.zero_section, tangent_map, mfderiv, A, if_pos, chart_at,
623+
fiber_bundle.charted_space_chart_at, tangent_bundle.trivialization_at_apply,
623624
tangent_bundle_core, function.comp, continuous_linear_map.map_zero] with mfld_simps,
624625
rw [← fderiv_within_inter N] at B,
625626
rw [← fderiv_within_inter N, ← B],
626-
congr' 2,
627+
congr' 1,
627628
refine fderiv_within_congr (λ y hy, _) _,
628629
{ simp only with mfld_simps at hy,
629630
simp only [hy, prod.mk.inj_iff] with mfld_simps },

0 commit comments

Comments
 (0)