File size: 21,917 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
import Mathlib.Geometry.Manifold.Immersion
import Mathlib.Topology.OpenPartialHomeomorph.Constructions
import Mathlib.Topology.MetricSpace.Pseudo.Constructions

/-! # Normal Pair Recenter -/

namespace OAI

noncomputable section

namespace AlgebraicGeometry.ComplexPoints.Analytic.NormalPairRecenter

/-!
# Genuine local pairs for embedded immersions

A local immersion chart describes the image of one source chart. The embedding
hypothesis supplies an ambient open set whose intersection with the full image
comes entirely from that source chart. After shrinking to a product of balls,
the resulting homeomorphism therefore identifies the actual full image with
the zero normal slice.
-/

open Set Filter
open scoped _root_.Topology _root_.Manifold ContDiff

section TopologicalPairs

variable {M N : Type*} [TopologicalSpace M] [TopologicalSpace N]
  (E F : Type*) [NormedAddCommGroup E] [NormedAddCommGroup F]

/-- An actual ambient coordinate neighborhood, with the full image of `f`
identified with the zero normal slice. The fields are constructed below from
a genuine manifold immersion and a topological embedding. -/
structure ImmersionNormalPair (f : M β†’ N) (x : M) where
  radius : ℝ
  radius_pos : 0 < radius
  ambientChart : OpenPartialHomeomorph N (E Γ— F)
  product_subset_target :
    Metric.ball (0 : E) radius Γ—Λ’ Metric.ball (0 : F) radius βŠ† ambientChart.target
  point_mem_source : f x ∈ ambientChart.source
  point_coordinates : ambientChart (f x) = (0, 0)
  range_iff : βˆ€ y ∈ ambientChart.symm ''
      (Metric.ball (0 : E) radius Γ—Λ’ Metric.ball (0 : F) radius),
    y ∈ Set.range f ↔ (ambientChart y).2 = 0

namespace ImmersionNormalPair

variable {E F} {f : M β†’ N} {x : M} (P : ImmersionNormalPair E F f x)

omit [TopologicalSpace M]

/-- The actual ambient open neighborhood, obtained by pulling back the balls. -/
def neighborhood : Set N :=
  P.ambientChart.symm ''
    (Metric.ball (0 : E) P.radius Γ—Λ’ Metric.ball (0 : F) P.radius)

theorem isOpen_neighborhood : IsOpen P.neighborhood :=
  P.ambientChart.isOpen_image_symm_of_subset_target
    (Metric.isOpen_ball.prod Metric.isOpen_ball) P.product_subset_target

theorem neighborhood_subset_source : P.neighborhood βŠ† P.ambientChart.source := by
  rintro y ⟨z, hz, rfl⟩
  exact P.ambientChart.map_target (P.product_subset_target hz)

theorem point_mem_neighborhood : f x ∈ P.neighborhood := by
  refine ⟨(0, 0), ⟨Metric.mem_ball_self P.radius_pos, Metric.mem_ball_self P.radius_pos⟩, ?_⟩
  rw [← P.point_coordinates, P.ambientChart.left_inv P.point_mem_source]

/-- The genuine homeomorphism onto the product of the two open balls. -/
def homeomorph : P.neighborhood β‰ƒβ‚œ
    (Metric.ball (0 : E) P.radius Γ— Metric.ball (0 : F) P.radius) :=
  (P.ambientChart.homeomorphOfImageSubsetSource P.neighborhood_subset_source
    (P.ambientChart.image_symm_image_of_subset_target P.product_subset_target)).trans
      (Homeomorph.Set.prod _ _)

@[simp]
theorem homeomorph_apply_val (y : P.neighborhood) :
    ((P.homeomorph y).1.val, (P.homeomorph y).2.val) = P.ambientChart y.val := rfl

theorem homeomorph_point :
    P.homeomorph ⟨f x, P.point_mem_neighborhood⟩ =
      (⟨0, Metric.mem_ball_self P.radius_pos⟩, ⟨0, Metric.mem_ball_self P.radius_pos⟩) := by
  apply Prod.ext <;> apply Subtype.ext
  Β· exact congrArg Prod.fst P.point_coordinates
  Β· exact congrArg Prod.snd P.point_coordinates

/-- This equivalence uses the full range of `f`, not a restricted source image. -/
theorem mem_range_iff (y : P.neighborhood) :
    y.val ∈ Set.range f ↔ (P.homeomorph y).2.val = 0 :=
  P.range_iff y.val y.property

theorem mem_complement_iff (y : P.neighborhood) :
    y.val βˆ‰ Set.range f ↔ (P.homeomorph y).2.val β‰  0 :=
  not_congr (P.mem_range_iff y)

/-- Restriction to the subspace in the pair is an actual homeomorphism. -/
def supportHomeomorph : {y : P.neighborhood // y.val ∈ Set.range f} β‰ƒβ‚œ
    {z : Metric.ball (0 : E) P.radius Γ— Metric.ball (0 : F) P.radius // z.2.val = 0} :=
  P.homeomorph.subtype P.mem_range_iff

/-- The complements in the local pair are also homeomorphic. -/
def complementHomeomorph : {y : P.neighborhood // y.val βˆ‰ Set.range f} β‰ƒβ‚œ
    {z : Metric.ball (0 : E) P.radius Γ— Metric.ball (0 : F) P.radius // z.2.val β‰  0} :=
  P.homeomorph.subtype P.mem_complement_iff

/-- The entire image in the ambient neighborhood is precisely the normal
zero plane in the coordinate product. -/
theorem ambientChart_image_support :
    P.ambientChart '' (P.neighborhood ∩ Set.range f) =
      Metric.ball (0 : E) P.radius Γ—Λ’ ({0} : Set F) := by
  ext z
  constructor
  · rintro ⟨y, ⟨hy, hyf⟩, rfl⟩
    exact ⟨(P.homeomorph ⟨y, hy⟩).1.property, (P.range_iff y hy).mp hyf⟩
  · rintro ⟨hz1, hz2⟩
    have hprod : z ∈ Metric.ball (0 : E) P.radius Γ—Λ’ Metric.ball (0 : F) P.radius := by
      refine ⟨hz1, ?_⟩
      rw [show z.2 = 0 from hz2]
      exact Metric.mem_ball_self P.radius_pos
    have ht := P.product_subset_target hprod
    refine ⟨P.ambientChart.symm z, ⟨⟨z, hprod, rfl⟩, ?_⟩, P.ambientChart.right_inv ht⟩
    apply (P.range_iff _ ⟨z, hprod, rfl⟩).mpr
    rw [P.ambientChart.right_inv ht]
    exact hz2

/-- Shrinking both coordinate radii preserves the exact full-image pair. -/
def restrictRadius (r : ℝ) (hr : 0 < r) (hle : r ≀ P.radius) :
    ImmersionNormalPair E F f x where
  radius := r
  radius_pos := hr
  ambientChart := P.ambientChart
  product_subset_target := fun _ hz => P.product_subset_target
    ⟨Metric.ball_subset_ball hle hz.1, Metric.ball_subset_ball hle hz.2⟩
  point_mem_source := P.point_mem_source
  point_coordinates := P.point_coordinates
  range_iff := fun y hy => P.range_iff y (by
    obtain ⟨z, hz, rfl⟩ := hy
    exact ⟨z, ⟨Metric.ball_subset_ball hle hz.1, Metric.ball_subset_ball hle hz.2⟩, rfl⟩)

@[simp]
theorem restrictRadius_ambientChart (r : ℝ) (hr : 0 < r) (hle : r ≀ P.radius) :
    (P.restrictRadius r hr hle).ambientChart = P.ambientChart := rfl

theorem restrictRadius_neighborhood_subset (r : ℝ) (hr : 0 < r) (hle : r ≀ P.radius) :
    (P.restrictRadius r hr hle).neighborhood βŠ† P.neighborhood := by
  rintro y ⟨z, hz, rfl⟩
  exact ⟨z, ⟨Metric.ball_subset_ball hle hz.1, Metric.ball_subset_ball hle hz.2⟩, rfl⟩

/-- Such product neighborhoods can be chosen inside every ambient neighborhood
of the base point, while retaining the same actual coordinate map. -/
theorem exists_restrictRadius_subset (U : Set N) (hU : U ∈ 𝓝 (f x)) :
    βˆƒ (r : ℝ) (hr : 0 < r) (hle : r ≀ P.radius),
      (P.restrictRadius r hr hle).neighborhood βŠ† U := by
  have h0t : (0, 0) ∈ P.ambientChart.target := by
    rw [← P.point_coordinates]
    exact P.ambientChart.map_source P.point_mem_source
  have hinv : P.ambientChart.symm (0, 0) = f x := by
    rw [← P.point_coordinates, P.ambientChart.left_inv P.point_mem_source]
  have hpre : P.ambientChart.symm ⁻¹' U ∈ 𝓝 (0, 0) :=
    (P.ambientChart.continuousAt_symm h0t).preimage_mem_nhds (by rwa [hinv])
  obtain ⟨Ρ, hΡ, hball⟩ := Metric.mem_nhds_iff.mp hpre
  refine ⟨min Ρ P.radius, lt_min hΡ P.radius_pos, min_le_right _ _, ?_⟩
  rintro y ⟨z, hz, rfl⟩
  apply hball
  apply Metric.ball_subset_ball (min_le_left Ξ΅ P.radius)
  change z ∈ Metric.ball (0 : E) (min Ξ΅ P.radius) Γ—Λ’
    Metric.ball (0 : F) (min Ξ΅ P.radius) at hz
  simpa only [ball_prod_same] using hz

/-- Cofinality stated directly in terms of genuine normal pairs. -/
theorem exists_subpair (U : Set N) (hU : U ∈ 𝓝 (f x)) :
    βˆƒ Q : ImmersionNormalPair E F f x,
      Q.ambientChart = P.ambientChart ∧ Q.neighborhood βŠ† U := by
  obtain ⟨r, hr, hle, hsub⟩ := P.exists_restrictRadius_subset U hU
  exact ⟨P.restrictRadius r hr hle, rfl, hsub⟩

end ImmersionNormalPair

variable {E F} {f : M β†’ N} {x : M}

/-- The embedding hypothesis excludes all other source points from a suitable
ambient neighborhood. The local normal form then describes the full image. -/
theorem exists_normalPairRadius (hf : Topology.IsEmbedding f)
    (u : OpenPartialHomeomorph M E) (v : OpenPartialHomeomorph N (E Γ— F))
    (hx : x ∈ u.source) (hmap : u.source βŠ† f ⁻¹' v.source)
    (hnormal : βˆ€ y ∈ u.source, v (f y) = (u y, 0)) (hcenter : u x = 0) :
    βˆƒ r : ℝ, 0 < r ∧
      Metric.ball (0 : E) r Γ—Λ’ Metric.ball (0 : F) r βŠ† v.target ∧
      βˆ€ y ∈ v.symm '' (Metric.ball (0 : E) r Γ—Λ’ Metric.ball (0 : F) r),
        y ∈ Set.range f ↔ (v y).2 = 0 := by
  obtain ⟨O, hO, hpre⟩ := hf.isInducing.isOpen_iff.mp u.open_source
  have hfxO : f x ∈ O := by
    change x ∈ f ⁻¹' O
    rw [hpre]
    exact hx
  have hzero : v (f x) = (0, 0) := by simpa only [hcenter] using hnormal x hx
  let V : Set (E Γ— F) := v '' (v.source ∩ O) ∩ Prod.fst ⁻¹' u.target
  have hV : IsOpen V :=
    (v.isOpen_image_source_inter hO).inter (u.open_target.preimage continuous_fst)
  have h0 : (0, 0) ∈ V := by
    refine ⟨⟨f x, ⟨hmap hx, hfxO⟩, hzero⟩, ?_⟩
    change (0 : E) ∈ u.target
    simpa only [hcenter] using u.map_source hx
  obtain ⟨r, hr, hball⟩ := Metric.mem_nhds_iff.mp (hV.mem_nhds h0)
  have hprod : Metric.ball (0 : E) r Γ—Λ’ Metric.ball (0 : F) r βŠ† V := by
    simpa only [ball_prod_same] using hball
  have htarget : Metric.ball (0 : E) r Γ—Λ’ Metric.ball (0 : F) r βŠ† v.target := by
    intro z hz
    obtain ⟨w, hw, he⟩ := (hprod hz).1
    exact he β–Έ v.map_source hw.1
  refine ⟨r, hr, htarget, ?_⟩
  rintro y ⟨z, hz, rfl⟩
  have hzt : z ∈ v.target := htarget hz
  have hys : v.symm z ∈ v.source := v.map_target hzt
  have hright : v (v.symm z) = z := v.right_inv hzt
  have hyO : v.symm z ∈ O := by
    obtain ⟨w, hw, he⟩ := (hprod hz).1
    rw [← he, v.left_inv hw.1]
    exact hw.2
  have huT : z.1 ∈ u.target := (hprod hz).2
  constructor
  · rintro ⟨a, ha⟩
    have haU : a ∈ u.source := by
      rw [← hpre]
      change f a ∈ O
      rwa [ha]
    rw [← ha, hnormal a haU]
  Β· intro hzero'
    refine ⟨u.symm z.1, ?_⟩
    have haU : u.symm z.1 ∈ u.source := u.map_target huT
    apply v.injOn (hmap haU) hys
    rw [hnormal _ haU, u.right_inv huT, hright]
    apply Prod.ext
    Β· rfl
    Β· rw [hright] at hzero'
      exact hzero'.symm

/-- Package the radius just proved, without assuming any full-image claim. -/
def normalPairOfCharts (hf : Topology.IsEmbedding f)
    (u : OpenPartialHomeomorph M E) (v : OpenPartialHomeomorph N (E Γ— F))
    (hx : x ∈ u.source) (hmap : u.source βŠ† f ⁻¹' v.source)
    (hnormal : βˆ€ y ∈ u.source, v (f y) = (u y, 0)) (hcenter : u x = 0) :
    ImmersionNormalPair E F f x :=
  let h := exists_normalPairRadius hf u v hx hmap hnormal hcenter
  { radius := Classical.choose h
    radius_pos := (Classical.choose_spec h).1
    ambientChart := v
    product_subset_target := (Classical.choose_spec h).2.1
    point_mem_source := hmap hx
    point_coordinates := by simpa only [hcenter] using hnormal x hx
    range_iff := (Classical.choose_spec h).2.2 }

end TopologicalPairs

variable {π•œ E G C M N : Type*} [NontriviallyNormedField π•œ]
  [NormedAddCommGroup E] [NormedSpace π•œ E]
  [NormedAddCommGroup G] [NormedSpace π•œ G]
  [NormedAddCommGroup C] [NormedSpace π•œ C]
  [TopologicalSpace M] [ChartedSpace E M]
  [TopologicalSpace N] [ChartedSpace G N]
  {n : β„•βˆžΟ‰} {f : M β†’ N} {x : M}

/-- The source chart supplied by the genuine immersion, centered at `x`. -/
def immersionSourceCoordinates
    (h : Manifold.IsImmersionAtOfComplement C π“˜(π•œ, E) π“˜(π•œ, G) n f x) :
    OpenPartialHomeomorph M E :=
  h.domChart.transHomeomorph (Homeomorph.subRight (h.domChart x))

/-- The genuine immersion chart split into tangential and normal coordinates,
and centered at `(x,0)` in those coordinates. -/
def immersionNormalCoordinates
    (h : Manifold.IsImmersionAtOfComplement C π“˜(π•œ, E) π“˜(π•œ, G) n f x) :
    OpenPartialHomeomorph N (E Γ— C) :=
  h.codChart.transHomeomorph
    (h.equiv.symm.toHomeomorph.trans
      ((Homeomorph.subRight (h.domChart x)).prodCongr (Homeomorph.refl C)))

@[simp]
theorem immersionSourceCoordinates_source
    (h : Manifold.IsImmersionAtOfComplement C π“˜(π•œ, E) π“˜(π•œ, G) n f x) :
    (immersionSourceCoordinates h).source = h.domChart.source := rfl

@[simp]
theorem immersionNormalCoordinates_source
    (h : Manifold.IsImmersionAtOfComplement C π“˜(π•œ, E) π“˜(π•œ, G) n f x) :
    (immersionNormalCoordinates h).source = h.codChart.source := rfl

@[simp]
theorem immersionSourceCoordinates_center
    (h : Manifold.IsImmersionAtOfComplement C π“˜(π•œ, E) π“˜(π•œ, G) n f x) :
    immersionSourceCoordinates h x = 0 := by
  change h.domChart x - h.domChart x = 0
  exact sub_self _

/-- Removing the trivial corner models from the genuine normal-form equation. -/
theorem immersion_codChart_apply
    (h : Manifold.IsImmersionAtOfComplement C π“˜(π•œ, E) π“˜(π•œ, G) n f x)
    {y : M} (hy : y ∈ h.domChart.source) :
    h.codChart (f y) = h.equiv (h.domChart y, 0) := by
  have ht : h.domChart y ∈ (h.domChart.extend π“˜(π•œ, E)).target := by
    rw [OpenPartialHomeomorph.extend_target', modelWithCornersSelf_coe]
    exact ⟨h.domChart y, h.domChart.map_source hy, rfl⟩
  have he := h.writtenInCharts ht
  simpa only [OpenPartialHomeomorph.extend_coe, OpenPartialHomeomorph.extend_coe_symm,
    modelWithCornersSelf_coe, modelWithCornersSelf_coe_symm, Function.comp_apply,
    id_eq, h.domChart.left_inv hy] using he

/-- In the centered coordinates, the actual immersion is the zero section. -/
theorem immersionNormalCoordinates_apply
    (h : Manifold.IsImmersionAtOfComplement C π“˜(π•œ, E) π“˜(π•œ, G) n f x)
    {y : M} (hy : y ∈ (immersionSourceCoordinates h).source) :
    immersionNormalCoordinates h (f y) = (immersionSourceCoordinates h y, 0) := by
  change ((h.equiv.symm (h.codChart (f y))).1 - h.domChart x,
      (h.equiv.symm (h.codChart (f y))).2) = (h.domChart y - h.domChart x, 0)
  rw [immersion_codChart_apply h hy, h.equiv.symm_apply_apply]

/-- A genuine immersion which is a topological embedding has an actual local
normal pair for its full image. No additional normal form is assumed. -/
def normalPairOfImmersion
    (h : Manifold.IsImmersionAtOfComplement C π“˜(π•œ, E) π“˜(π•œ, G) n f x)
    (hf : Topology.IsEmbedding f) : ImmersionNormalPair E C f x :=
  normalPairOfCharts hf (immersionSourceCoordinates h) (immersionNormalCoordinates h)
    h.mem_domChart_source h.source_subset_preimage_source
    (fun _ hy => immersionNormalCoordinates_apply h hy) (immersionSourceCoordinates_center h)

@[simp]
theorem normalPairOfImmersion_ambientChart
    (h : Manifold.IsImmersionAtOfComplement C π“˜(π•œ, E) π“˜(π•œ, G) n f x)
    (hf : Topology.IsEmbedding f) :
    (normalPairOfImmersion h hf).ambientChart = immersionNormalCoordinates h := rfl

/-- The same local pair, using the complement proved to exist by mathlib's
standard `IsImmersionAt` proposition. -/
def immersionNormalPair
    (h : Manifold.IsImmersionAt π“˜(π•œ, E) π“˜(π•œ, G) n f x)
    (hf : Topology.IsEmbedding f) : ImmersionNormalPair E h.complement f x :=
  normalPairOfImmersion h.isImmersionAtOfComplement_complement hf

end AlgebraicGeometry.ComplexPoints.Analytic.NormalPairRecenter

namespace AlgebraicGeometry.ComplexPoints.Analytic.NormalPairRecenter.ImmersionNormalPair

/-!
# Recentering genuine normal pairs

At another point of the image in a verified normal-pair neighborhood, translate
only the tangential coordinate. A sufficiently small positive product ball
stays inside the original verified neighborhood and any requested neighborhood
of the new point. The resulting pair therefore still describes the full image.
-/

open Set Filter
open scoped _root_.Topology

variable {M N E F : Type*} [TopologicalSpace N]
  [NormedAddCommGroup E] [NormedAddCommGroup F]
  {f : M β†’ N} {x : M} (P : ImmersionNormalPair E F f x)

/-- Translate only the tangential coordinate to recenter the actual ambient chart. -/
def recenterChart (z : M) : OpenPartialHomeomorph N (E Γ— F) :=
  P.ambientChart.transHomeomorph
    ((Homeomorph.subRight (P.ambientChart (f z)).1).prodCongr (Homeomorph.refl F))

@[simp]
theorem recenterChart_source (z : M) :
    (P.recenterChart z).source = P.ambientChart.source := rfl

@[simp]
theorem recenterChart_apply (z : M) (y : N) :
    P.recenterChart z y =
      ((P.ambientChart y).1 - (P.ambientChart (f z)).1, (P.ambientChart y).2) := rfl

@[simp]
theorem recenterChart_symm_apply (z : M) (w : E Γ— F) :
    (P.recenterChart z).symm w =
      P.ambientChart.symm (w.1 + (P.ambientChart (f z)).1, w.2) := rfl

/-- In particular, normal coordinates are unchanged everywhere, not merely at the center. -/
@[simp]
theorem recenterChart_normalCoordinate (z : M) (y : N) :
    (P.recenterChart z y).2 = (P.ambientChart y).2 := rfl

theorem recenterChart_point_mem_source (z : M) (hz : f z ∈ P.neighborhood) :
    f z ∈ (P.recenterChart z).source :=
  P.neighborhood_subset_source hz

/-- The full-image property proves that the new image point has zero normal coordinate. -/
@[simp]
theorem recenterChart_point (z : M) (hz : f z ∈ P.neighborhood) :
    P.recenterChart z (f z) = (0, 0) := by
  have hn : (P.ambientChart (f z)).2 = 0 :=
    (P.range_iff (f z) hz).mp ⟨z, rfl⟩
  simp only [recenterChart_apply, sub_self, hn]

theorem recenterChart_zero_mem_target (z : M) (hz : f z ∈ P.neighborhood) :
    (0, 0) ∈ (P.recenterChart z).target := by
  rw [← P.recenterChart_point z hz]
  exact (P.recenterChart z).map_source (P.recenterChart_point_mem_source z hz)

@[simp]
theorem recenterChart_symm_zero (z : M) (hz : f z ∈ P.neighborhood) :
    (P.recenterChart z).symm (0, 0) = f z := by
  rw [← P.recenterChart_point z hz,
    (P.recenterChart z).left_inv (P.recenterChart_point_mem_source z hz)]

/-- A positive product ball in the recentered chart can be chosen inside the
original verified pair and any requested neighborhood of the new point. -/
theorem exists_recenterRadius (z : M) (hz : f z ∈ P.neighborhood)
    (U : Set N) (hU : U ∈ 𝓝 (f z)) :
    βˆƒ r : ℝ, 0 < r ∧
      Metric.ball (0 : E) r Γ—Λ’ Metric.ball (0 : F) r βŠ† (P.recenterChart z).target ∧
      (P.recenterChart z).symm ''
        (Metric.ball (0 : E) r Γ—Λ’ Metric.ball (0 : F) r) βŠ† P.neighborhood ∩ U := by
  have ht := P.recenterChart_zero_mem_target z hz
  have hn : P.neighborhood ∩ U ∈ 𝓝 (f z) :=
    inter_mem (P.isOpen_neighborhood.mem_nhds hz) hU
  have hp : (P.recenterChart z).symm ⁻¹' (P.neighborhood ∩ U) ∈ 𝓝 (0, 0) :=
    ((P.recenterChart z).continuousAt_symm ht).preimage_mem_nhds
      (by rwa [P.recenterChart_symm_zero z hz])
  have hv : (P.recenterChart z).target ∩
      (P.recenterChart z).symm ⁻¹' (P.neighborhood ∩ U) ∈ 𝓝 (0, 0) :=
    inter_mem ((P.recenterChart z).open_target.mem_nhds ht) hp
  obtain ⟨r, hr, hball⟩ := Metric.mem_nhds_iff.mp hv
  have hprod : Metric.ball (0 : E) r Γ—Λ’ Metric.ball (0 : F) r βŠ†
      (P.recenterChart z).target ∩
        (P.recenterChart z).symm ⁻¹' (P.neighborhood ∩ U) := by
    simpa only [ball_prod_same] using hball
  refine ⟨r, hr, fun w hw => (hprod hw).1, ?_⟩
  rintro y ⟨w, hw, rfl⟩
  exact (hprod hw).2

/-- A genuine normal pair centered at any image point in the original pair,
with its entire verified neighborhood contained in the requested overlap. -/
def recenterWithin (z : M) (hz : f z ∈ P.neighborhood)
    (U : Set N) (hU : U ∈ 𝓝 (f z)) : ImmersionNormalPair E F f z :=
  let h := P.exists_recenterRadius z hz U hU
  { radius := Classical.choose h
    radius_pos := (Classical.choose_spec h).1
    ambientChart := P.recenterChart z
    product_subset_target := (Classical.choose_spec h).2.1
    point_mem_source := P.recenterChart_point_mem_source z hz
    point_coordinates := P.recenterChart_point z hz
    range_iff := fun y hy => P.range_iff y ((Classical.choose_spec h).2.2 hy).1 }

@[simp]
theorem recenterWithin_ambientChart (z : M) (hz : f z ∈ P.neighborhood)
    (U : Set N) (hU : U ∈ 𝓝 (f z)) :
    (P.recenterWithin z hz U hU).ambientChart = P.recenterChart z := rfl

@[simp]
theorem recenterWithin_ambientChart_apply (z : M) (hz : f z ∈ P.neighborhood)
    (U : Set N) (hU : U ∈ 𝓝 (f z)) (y : N) :
    (P.recenterWithin z hz U hU).ambientChart y =
      ((P.ambientChart y).1 - (P.ambientChart (f z)).1, (P.ambientChart y).2) := rfl

@[simp]
theorem recenterWithin_normalCoordinate (z : M) (hz : f z ∈ P.neighborhood)
    (U : Set N) (hU : U ∈ 𝓝 (f z)) (y : N) :
    ((P.recenterWithin z hz U hU).ambientChart y).2 = (P.ambientChart y).2 := rfl

/-- The new normal slice is the original normal fiber over the new tangential coordinate. -/
@[simp]
theorem recenterWithin_normalSlice (z : M) (hz : f z ∈ P.neighborhood)
    (U : Set N) (hU : U ∈ 𝓝 (f z)) (v : F) :
    (P.recenterWithin z hz U hU).ambientChart.symm (0, v) =
      P.ambientChart.symm ((P.ambientChart (f z)).1, v) := by
  simp only [recenterWithin_ambientChart, recenterChart_symm_apply, zero_add]

theorem recenterWithin_neighborhood_subset (z : M) (hz : f z ∈ P.neighborhood)
    (U : Set N) (hU : U ∈ 𝓝 (f z)) :
    (P.recenterWithin z hz U hU).neighborhood βŠ† P.neighborhood ∩ U :=
  (Classical.choose_spec (P.exists_recenterRadius z hz U hU)).2.2

/-- An existence version records both the exact translated chart and the overlap containment. -/
theorem exists_recentered_subpair (z : M) (hz : f z ∈ P.neighborhood)
    (U : Set N) (hU : U ∈ 𝓝 (f z)) :
    βˆƒ Q : ImmersionNormalPair E F f z,
      Q.ambientChart = P.recenterChart z ∧ Q.neighborhood βŠ† P.neighborhood ∩ U :=
  ⟨P.recenterWithin z hz U hU, rfl, P.recenterWithin_neighborhood_subset z hz U hU⟩

end AlgebraicGeometry.ComplexPoints.Analytic.NormalPairRecenter.ImmersionNormalPair

end

end OAI