File size: 30,115 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
import OAI.AlgebraicGeometry.CycleClass.Geometric.RelativeCohomologySections
import OAI.AlgebraicGeometry.CycleClass.Geometric.GlobalSupportPurity
import OAI.AlgebraicGeometry.CycleClass.Geometric.FlasqueSectionComparison
import OAI.AlgebraicGeometry.CycleClass.Geometric.ComplexNormalAtlas
import OAI.AlgebraicGeometry.CycleClass.Geometric.NormalGermCompatibility
import OAI.AlgebraicGeometry.CycleClass.Geometric.ImmersionNormalRecenter
import OAI.AlgebraicGeometry.ComplexPoints.Analytic.NormalCoordinatesDifferentiable
import OAI.AlgebraicGeometry.CycleClass.Geometric.NormalRestriction
import OAI.AlgebraicGeometry.CycleClass.Geometric.SupportedGerms

/-! # Complex Thom -/

namespace OAI.AlgebraicGeometry.CycleClass.Geometric.ComplexThom

noncomputable section

/-!
# A global rational Thom class for a closed complex immersion

The first constructions identify the canonical global relative-to-sheaf map
with the proved flasque edge isomorphism and lift actual sections through it.
The hypotheses in these general lemmas are explicit stalk-vanishing results;
they are not a definition of geometric purity or a postulated cycle map.

The final construction proves existence and uniqueness for an actual closed
complex-analytic immersion with injective manifold differential. The ambient
space is metrizable. Its restriction to every genuine differentiable normal
chart is the pullback of the fixed generator of the actual standard normal
group. No assertion of that generator's sign relative to a differential-form
volume convention is made here.
-/

open _root_.CategoryTheory _root_.CategoryTheory.Limits Opposite _root_.TopologicalSpace

set_option backward.defeqAttrib.useBackward true
set_option backward.isDefEq.respectTransparency false
set_option backward.isDefEq.respectTransparency.types false

namespace Cycles

section General

variable (X : TopCat.{0}) [MetrizableSpace X] (O : Opens X) (d : β„•)
  (hs : βˆ€ (x : X) (n : β„•), n < d β†’ IsZero
    ((AlgebraicTopology.Cohomology.Singular.SheafQuasiIso.sheafStalkCochainComplex
      (SupportStalkVanishes.Cohomology.supportedSingularSheafComplex (ModuleCat.of β„š β„š) X O) x).homology n))

include hs

/-- The relative flasque edge isomorphism is exactly the canonical map
obtained from the actual relative cochain comparison and section map. -/
theorem supportedGlobalFirstCohomologyIso_hom_eq_sectionMap :
    (GlobalSupportPurity.Cycles.supportedGlobalFirstCohomologyIso_of_stalk X O d hs).hom =
      RelativeCohomologySections.Cycles.relativeCohomologyGlobalSectionMap (ModuleCat.of β„š β„š) X O d := by
  unfold GlobalSupportPurity.Cycles.supportedGlobalFirstCohomologyIso_of_stalk
  rw [Iso.trans_hom, GlobalSupportPurity.Cycles.relativeSupportedGlobalCohomologyIso_hom]
  unfold GlobalSupportPurity.Cycles.supportedSheafGlobalFirstCohomologyIso_of_stalk
    GlobalSupportPurity.Cycles.rationalFlasqueFirstCohomologyIso_of_stalk
  rw [FlasqueSectionComparison.Cycles.rationalFlasqueFirstCohomologyIso_hom_eq_sectionMap]
  unfold AlgebraicTopology.Cohomology.Singular.SupportedRelativeComparison.relativeToSupportedSheafGlobalSections
  rw [HomologicalComplex.homologyMap_comp]
  unfold RelativeCohomologySections.Cycles.relativeCohomologyGlobalSectionMap
  rw [RelativeCohomologySections.Cycles.relativeCohomologySectionMap_def, Category.assoc]
  rfl

/-- Under proved lower stalk vanishing, the actual canonical global map
is invertible, with no choice of a comparison map. -/
theorem relativeCohomologyGlobalSectionMap_isIso :
    IsIso (RelativeCohomologySections.Cycles.relativeCohomologyGlobalSectionMap (ModuleCat.of β„š β„š) X O d) := by
  rw [← supportedGlobalFirstCohomologyIso_hom_eq_sectionMap X O d hs]
  infer_instance

/-- Lift a genuine global cohomology-sheaf section to the original-space
relative singular cohomology group via the proved edge isomorphism. -/
def supportedClassOfSection
    (s : ((SupportStalkVanishes.Cohomology.supportedSingularSheafComplex (ModuleCat.of β„š β„š) X O).homology d).obj.obj
      (op (⊀ : Opens X))) :
    AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) X (O : Set X) d :=
  (GlobalSupportPurity.Cycles.supportedGlobalFirstCohomologyIso_of_stalk X O d hs).inv s

/-- The lifted class has exactly the supplied section under the actual
global relative-to-supported map. -/
@[simp]
theorem supportedClassOfSection_image
    (s : ((SupportStalkVanishes.Cohomology.supportedSingularSheafComplex (ModuleCat.of β„š β„š) X O).homology d).obj.obj
      (op (⊀ : Opens X))) :
    RelativeCohomologySections.Cycles.relativeCohomologyGlobalSectionMap (ModuleCat.of β„š β„š) X O d
      (supportedClassOfSection X O d hs s) = s := by
  rw [← supportedGlobalFirstCohomologyIso_hom_eq_sectionMap X O d hs]
  exact (GlobalSupportPurity.Cycles.supportedGlobalFirstCohomologyIso_of_stalk X O d hs).toLinearEquiv.apply_symm_apply s

/-- The section completely determines the original relative class. -/
theorem supportedClassOfSection_unique
    (s : ((SupportStalkVanishes.Cohomology.supportedSingularSheafComplex (ModuleCat.of β„š β„š) X O).homology d).obj.obj
      (op (⊀ : Opens X)))
    (a : AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) X (O : Set X) d)
    (ha : RelativeCohomologySections.Cycles.relativeCohomologyGlobalSectionMap (ModuleCat.of β„š β„š) X O d a = s) :
    a = supportedClassOfSection X O d hs s := by
  apply (GlobalSupportPurity.Cycles.supportedGlobalFirstCohomologyIso_of_stalk X O d hs).toLinearEquiv.injective
  change (GlobalSupportPurity.Cycles.supportedGlobalFirstCohomologyIso_of_stalk X O d hs).hom a =
    (GlobalSupportPurity.Cycles.supportedGlobalFirstCohomologyIso_of_stalk X O d hs).hom
      (supportedClassOfSection X O d hs s)
  rw [supportedGlobalFirstCohomologyIso_hom_eq_sectionMap, ha,
    supportedClassOfSection_image]

/-- The actual lifting operation respects rational scaling. This makes
its dependence on the chosen primitive normal generator explicit. -/
theorem supportedClassOfSection_smul (q : β„š)
    (s : ((SupportStalkVanishes.Cohomology.supportedSingularSheafComplex (ModuleCat.of β„š β„š) X O).homology d).obj.obj
      (op (⊀ : Opens X))) :
    supportedClassOfSection X O d hs (q β€’ s) =
      q β€’ supportedClassOfSection X O d hs s :=
  map_smul (GlobalSupportPurity.Cycles.supportedGlobalFirstCohomologyIso_of_stalk X O d hs).inv.hom q s

/-- On every actual open neighborhood, the lifted class produces the
restriction of the given global cohomology-sheaf section. -/
theorem supportedClassOfSection_restrict
    (s : ((SupportStalkVanishes.Cohomology.supportedSingularSheafComplex (ModuleCat.of β„š β„š) X O).homology d).obj.obj
      (op (⊀ : Opens X))) (U : Opens X) :
    RelativeCohomologySections.Cycles.relativeCohomologySectionMap (ModuleCat.of β„š β„š) X O U d
      (RelativeCohomologySections.Cycles.relativeCohomologyOpenRestriction (ModuleCat.of β„š β„š) X (O : Set X) U d
        (supportedClassOfSection X O d hs s)) =
      ((SupportStalkVanishes.Cohomology.supportedSingularSheafComplex (ModuleCat.of β„š β„š) X O).homology d).obj.map
        (homOfLE (le_top : U ≀ ⊀)).op s := by
  have h := ConcreteCategory.congr_hom
    (RelativeCohomologySections.Cycles.relativeCohomologyGlobalSectionMap_restrict (ModuleCat.of β„š β„š) X O U d)
    (supportedClassOfSection X O d hs s)
  simpa only [ConcreteCategory.comp_apply, supportedClassOfSection_image] using h.symm

omit hs in
/-- The actual supported image of a global relative class agrees with
specified local relative classes, and is zero on the open complement. -/
def HasSupportedLocalImages {ΞΉ : Type*} (U : ΞΉ β†’ Opens X)
    (a : βˆ€ i, AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) (TopCat.of (U i))
      (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeOpenSubspace (O : Set X) (U i)) d)
    (b : AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) X (O : Set X) d) : Prop :=
  (βˆ€ i, ((SupportStalkVanishes.Cohomology.supportedSingularSheafComplex (ModuleCat.of β„š β„š) X O).homology d).obj.map
      (homOfLE (le_top : U i ≀ ⊀)).op
      (RelativeCohomologySections.Cycles.relativeCohomologyGlobalSectionMap (ModuleCat.of β„š β„š) X O d b) =
    RelativeCohomologySections.Cycles.relativeCohomologySectionMap (ModuleCat.of β„š β„š) X O (U i) d (a i)) ∧
  ((SupportStalkVanishes.Cohomology.supportedSingularSheafComplex (ModuleCat.of β„š β„š) X O).homology d).obj.map
    (homOfLE (le_top : O ≀ ⊀)).op
    (RelativeCohomologySections.Cycles.relativeCohomologyGlobalSectionMap (ModuleCat.of β„š β„š) X O d b) = 0

omit hs [MetrizableSpace X] in
/-- Actual relative restriction equalities imply the corresponding
supported images; zero on the complement follows from the proved stalk
vanishing of the actual supported sheaf. -/
theorem hasSupportedLocalImages_of_restrictions
    {ΞΉ : Type*} (U : ΞΉ β†’ Opens X)
    (a : βˆ€ i, AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) (TopCat.of (U i))
      (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeOpenSubspace (O : Set X) (U i)) d)
    (b : AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) X (O : Set X) d)
    (hb : βˆ€ i, RelativeCohomologySections.Cycles.relativeCohomologyOpenRestriction (ModuleCat.of β„š β„š) X
      (O : Set X) (U i) d b = a i) : HasSupportedLocalImages X O d U a b := by
  constructor
  Β· intro i
    have h := ConcreteCategory.congr_hom
      (RelativeCohomologySections.Cycles.relativeCohomologyGlobalSectionMap_restrict (ModuleCat.of β„š β„š) X O (U i) d) b
    exact h.trans (congrArg (RelativeCohomologySections.Cycles.relativeCohomologySectionMap (ModuleCat.of β„š β„š) X O (U i) d)
      (hb i))
  Β· apply SupportedGerms.Cycles.supportedCohomologySection_ext_on_support (ModuleCat.of β„š β„š) X O O d
    intro x hx hnot
    exact (hnot hx).elim

/-- Actual relative classes with compatible germs on a closed support
determine a unique global relative class in the first possible degree. -/
theorem existsUnique_supportedClass_of_germs_off_open
    {ΞΉ : Type*} (U : ΞΉ β†’ Opens X) (hcover : iSup U βŠ” O = ⊀)
    (a : βˆ€ i, AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) (TopCat.of (U i))
      (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeOpenSubspace (O : Set X) (U i)) d)
    (ha : βˆ€ i j (x : X) (hi : x ∈ U i) (hj : x ∈ U j), x βˆ‰ O β†’
      TopCat.Presheaf.germ
          (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeCohomologyPresheaf (ModuleCat.of β„š β„š) X (O : Set X) d)
          (U i) x hi (a i) =
        TopCat.Presheaf.germ
          (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeCohomologyPresheaf (ModuleCat.of β„š β„š) X (O : Set X) d)
          (U j) x hj (a j)) :
    βˆƒ! b : AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) X (O : Set X) d,
      HasSupportedLocalImages X O d U a b := by
  obtain ⟨s, hs_local, hs_unique⟩ :=
    NormalGermCompatibility.Cycles.existsUnique_relativeCohomologySection_of_germs_off_open
      (ModuleCat.of β„š β„š) X O U hcover d a ha
  refine ⟨supportedClassOfSection X O d hs s, ?_, ?_⟩
  Β· change (βˆ€ i, _ = _) ∧ _ = 0
    simpa only [supportedClassOfSection_image] using hs_local
  Β· intro b hb
    apply supportedClassOfSection_unique X O d hs s b
    exact hs_unique _ hb

/-- The global class is selected from the proved unique lifting statement;
all gluing and lower-degree hypotheses remain explicit in this general API. -/
def supportedClassFromRelativeGerms
    {ΞΉ : Type*} (U : ΞΉ β†’ Opens X) (hcover : iSup U βŠ” O = ⊀)
    (a : βˆ€ i, AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) (TopCat.of (U i))
      (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeOpenSubspace (O : Set X) (U i)) d)
    (ha : βˆ€ i j (x : X) (hi : x ∈ U i) (hj : x ∈ U j), x βˆ‰ O β†’
      TopCat.Presheaf.germ
          (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeCohomologyPresheaf (ModuleCat.of β„š β„š) X (O : Set X) d)
          (U i) x hi (a i) =
        TopCat.Presheaf.germ
          (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeCohomologyPresheaf (ModuleCat.of β„š β„š) X (O : Set X) d)
          (U j) x hj (a j)) :
    AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) X (O : Set X) d :=
  Classical.choose (existsUnique_supportedClass_of_germs_off_open X O d hs U hcover a ha)

/-- The constructed global class has precisely the supplied local images. -/
theorem supportedClassFromRelativeGerms_hasLocalImages
    {ΞΉ : Type*} (U : ΞΉ β†’ Opens X) (hcover : iSup U βŠ” O = ⊀)
    (a : βˆ€ i, AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) (TopCat.of (U i))
      (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeOpenSubspace (O : Set X) (U i)) d)
    (ha : βˆ€ i j (x : X) (hi : x ∈ U i) (hj : x ∈ U j), x βˆ‰ O β†’
      TopCat.Presheaf.germ
          (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeCohomologyPresheaf (ModuleCat.of β„š β„š) X (O : Set X) d)
          (U i) x hi (a i) =
        TopCat.Presheaf.germ
          (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeCohomologyPresheaf (ModuleCat.of β„š β„š) X (O : Set X) d)
          (U j) x hj (a j)) :
    HasSupportedLocalImages X O d U a
      (supportedClassFromRelativeGerms X O d hs U hcover a ha) :=
  (Classical.choose_spec
    (existsUnique_supportedClass_of_germs_off_open X O d hs U hcover a ha)).1

/-- No other global relative class has these same local supported images. -/
theorem supportedClassFromRelativeGerms_unique
    {ΞΉ : Type*} (U : ΞΉ β†’ Opens X) (hcover : iSup U βŠ” O = ⊀)
    (a : βˆ€ i, AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) (TopCat.of (U i))
      (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeOpenSubspace (O : Set X) (U i)) d)
    (ha : βˆ€ i j (x : X) (hi : x ∈ U i) (hj : x ∈ U j), x βˆ‰ O β†’
      TopCat.Presheaf.germ
          (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeCohomologyPresheaf (ModuleCat.of β„š β„š) X (O : Set X) d)
          (U i) x hi (a i) =
        TopCat.Presheaf.germ
          (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeCohomologyPresheaf (ModuleCat.of β„š β„š) X (O : Set X) d)
          (U j) x hj (a j))
    (b : AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) X (O : Set X) d)
    (hb : HasSupportedLocalImages X O d U a b) :
    b = supportedClassFromRelativeGerms X O d hs U hcover a ha :=
  (Classical.choose_spec
    (existsUnique_supportedClass_of_germs_off_open X O d hs U hcover a ha)).2 b hb

end General

open scoped _root_.Manifold ContDiff

variable {E F M N : Type}
  [NormedAddCommGroup E] [NormedSpace β„‚ E] [FiniteDimensional β„‚ E]
  [NormedAddCommGroup F] [NormedSpace β„‚ F] [FiniteDimensional β„‚ F]
  [TopologicalSpace M] [ChartedSpace E M] [IsManifold π“˜(β„‚, E) Ο‰ M]
  [TopologicalSpace N] [ChartedSpace F N] [IsManifold π“˜(β„‚, F) Ο‰ N]
  (f : M β†’ N) (hf : ContMDiff π“˜(β„‚, E) π“˜(β„‚, F) Ο‰ f)
  (hi : βˆ€ x, Function.Injective (mfderiv π“˜(β„‚, E) π“˜(β„‚, F) f x))
  (he : Topology.IsClosedEmbedding f)

/-- The normalized class in the actual normal neighborhood supplied by
the inverse function theorem for this immersion. -/
def complexImmersionLocalClass (x : M) :
    AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š)
      (TopCat.of (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x))
      (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeOpenSubspace (X := TopCat.of N) (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he : Set N)
        (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x))
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) := by
  letI : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ β„‚ E
  exact (ComplexNormalAtlas.Cycles.complexImmersionNormalPair f hf hi he x).rationalClassFin

/-- The actual constructed ambient normal chart is complex differentiable
in both directions, as a consequence of the immersion normal form. -/
theorem complexImmersionNormalPair_mdifferentiable (x : M) :
    (ComplexNormalAtlas.Cycles.complexImmersionNormalPair f hf hi he x).ambientChart.MDifferentiable
      π“˜(β„‚, F) π“˜(β„‚, E Γ— (Fin (ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) β†’ β„‚)) :=
  ComplexPoints.Analytic.NormalCoordinatesDifferentiable.normalPairOfImmersion_ambientChart_mdifferentiable
    (ComplexNormalAtlas.Cycles.complexImmersion_standardComplement f hf hi x) he.isEmbedding (by simp)

/-- Normalized local classes agree as genuine relative-cohomology germs
at every support point in every overlap. Both the charts and their
differentiability are constructed from the original geometric hypotheses. -/
theorem complexImmersionLocalClass_germs
    (i j : M) (y : N)
    (hyi : y ∈ ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he i)
    (hyj : y ∈ ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he j)
    (hy : y βˆ‰ EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he) :
    TopCat.Presheaf.germ
        (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeCohomologyPresheaf (ModuleCat.of β„š β„š) (TopCat.of N)
          (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he : Set N) (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F))
        (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he i) y hyi
        (complexImmersionLocalClass f hf hi he i) =
      TopCat.Presheaf.germ
        (AlgebraicTopology.Cohomology.Singular.RelativeOpenSupport.relativeCohomologyPresheaf (ModuleCat.of β„š β„š) (TopCat.of N)
          (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he : Set N) (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F))
        (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he j) y hyj
        (complexImmersionLocalClass f hf hi he j) := by
  let : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ β„‚ E
  have hymem : y ∈ Set.range f := by
    simpa only [EmbeddedSupportComplement.Cycles.mem_embeddedSupportComplement, not_not] using hy
  obtain ⟨z, rfl⟩ := hymem
  exact (ComplexNormalAtlas.Cycles.complexImmersionNormalPair f hf hi he i).rationalClassFin_germ_eq_on_overlap
    (ComplexNormalAtlas.Cycles.complexImmersionNormalPair f hf hi he j)
    (complexImmersionNormalPair_mdifferentiable f hf hi he i)
    (complexImmersionNormalPair_mdifferentiable f hf hi he j) z hyi hyj

variable [MetrizableSpace N]

/-- The global rational Thom class of the actual closed complex immersion,
normalized by the fixed primitive class in the standard complex normal
model. No local purity, chart compatibility, or class existence is assumed. -/
def complexThomClass :
    AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) (TopCat.of N) (Set.range f)ᢜ
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) :=
  supportedClassFromRelativeGerms (TopCat.of N) (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he)
    (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F)
    (GlobalSupportPurity.Cycles.closedComplexImmersion_supportedStalk_homology_isZero f he hf hi)
    (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he) (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen_cover f hf hi he)
    (complexImmersionLocalClass f hf hi he) (complexImmersionLocalClass_germs f hf hi he)

/-- The constructed global Thom class has exactly the normalized local
supported images and vanishes on the actual open complement. -/
theorem complexThomClass_hasLocalImages :
    HasSupportedLocalImages (TopCat.of N) (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he)
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he)
      (complexImmersionLocalClass f hf hi he) (complexThomClass f hf hi he) :=
  supportedClassFromRelativeGerms_hasLocalImages (TopCat.of N)
    (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he) (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F)
    (GlobalSupportPurity.Cycles.closedComplexImmersion_supportedStalk_homology_isZero f he hf hi)
    (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he) (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen_cover f hf hi he)
    (complexImmersionLocalClass f hf hi he) (complexImmersionLocalClass_germs f hf hi he)

/-- The normalized local supported images uniquely determine the actual
global relative class. -/
theorem complexThomClass_unique_of_localImages
    (a : AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) (TopCat.of N) (Set.range f)ᢜ
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F))
    (ha : HasSupportedLocalImages (TopCat.of N) (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he)
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he)
      (complexImmersionLocalClass f hf hi he) a) :
    a = complexThomClass f hf hi he :=
  supportedClassFromRelativeGerms_unique (TopCat.of N)
    (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he) (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F)
    (GlobalSupportPurity.Cycles.closedComplexImmersion_supportedStalk_homology_isZero f he hf hi)
    (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he) (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen_cover f hf hi he)
    (complexImmersionLocalClass f hf hi he) (complexImmersionLocalClass_germs f hf hi he) a ha

/-- Restriction of the global class to an actual normal neighborhood gives
the same section of the genuine cohomology sheaf as the local normal class. -/
theorem complexThomClass_restrict_section (x : M) :
    RelativeCohomologySections.Cycles.relativeCohomologySectionMap (ModuleCat.of β„š β„š) (TopCat.of N)
      (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he) (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x)
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F)
      (RelativeCohomologySections.Cycles.relativeCohomologyOpenRestriction (ModuleCat.of β„š β„š) (TopCat.of N)
        (Set.range f)ᢜ (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x)
        (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) (complexThomClass f hf hi he)) =
    RelativeCohomologySections.Cycles.relativeCohomologySectionMap (ModuleCat.of β„š β„š) (TopCat.of N)
      (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he) (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x)
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) (complexImmersionLocalClass f hf hi he x) := by
  have h := ConcreteCategory.congr_hom
    (RelativeCohomologySections.Cycles.relativeCohomologyGlobalSectionMap_restrict (ModuleCat.of β„š β„š) (TopCat.of N)
      (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he) (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x)
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F)) (complexThomClass f hf hi he)
  exact h.symm.trans ((complexThomClass_hasLocalImages f hf hi he).1 x)

/-- On every chosen normal neighborhood, the actual relative restriction
of the global class equals the normalized local class, not only its image
in an auxiliary sheaf. -/
theorem complexThomClass_restrict (x : M) :
    RelativeCohomologySections.Cycles.relativeCohomologyOpenRestriction (ModuleCat.of β„š β„š) (TopCat.of N)
      (Set.range f)ᢜ (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x)
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) (complexThomClass f hf hi he) =
        complexImmersionLocalClass f hf hi he x := by
  let : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ β„‚ E
  let P := ComplexNormalAtlas.Cycles.complexImmersionNormalPair f hf hi he x
  apply (P.relativeCohomologyGermIso (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F)).toLinearEquiv.injective
  apply (NormalGermCompatibility.Cycles.relativeCohomologySectionMap_germ_eq_iff β„š (TopCat.of N)
    (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he)
    (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x) (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x)
    (f x) (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen_contains f hf hi he x)
    (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen_contains f hf hi he x)
    (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) _ _).1
  exact congrArg
    (TopCat.Presheaf.germ
      ((SupportStalkVanishes.Cohomology.supportedSingularSheafComplex (ModuleCat.of β„š β„š) (TopCat.of N)
        (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he)).homology
        (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F)).obj
      (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x) (f x)
      (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen_contains f hf hi he x))
    (complexThomClass_restrict_section f hf hi he x)

/-- Actual local relative-cohomology normalization uniquely determines
the global Thom class; no auxiliary zero-section hypothesis is needed. -/
theorem complexThomClass_unique
    (a : AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) (TopCat.of N) (Set.range f)ᢜ
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F))
    (ha : βˆ€ x : M, RelativeCohomologySections.Cycles.relativeCohomologyOpenRestriction (ModuleCat.of β„š β„š) (TopCat.of N)
      (Set.range f)ᢜ (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x)
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) a = complexImmersionLocalClass f hf hi he x) :
    a = complexThomClass f hf hi he :=
  complexThomClass_unique_of_localImages f hf hi he a
    (hasSupportedLocalImages_of_restrictions (TopCat.of N) (EmbeddedSupportComplement.Cycles.embeddedSupportComplement f he)
      (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he)
      (complexImmersionLocalClass f hf hi he) a ha)

/-- Existence and uniqueness of the genuinely normalized global relative
class for a closed complex immersion, with every local and global
cohomology group the actual singular group. -/
theorem existsUnique_complexThomClass :
    βˆƒ! a : AlgebraicTopology.Cohomology.Singular.RelativeSequence.relativeSingularCohomology (ModuleCat.of β„š β„š) (TopCat.of N) (Set.range f)ᢜ
        (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F),
      βˆ€ x : M, RelativeCohomologySections.Cycles.relativeCohomologyOpenRestriction (ModuleCat.of β„š β„š) (TopCat.of N)
        (Set.range f)ᢜ (ComplexNormalAtlas.Cycles.complexImmersionNormalOpen f hf hi he x)
        (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) a = complexImmersionLocalClass f hf hi he x :=
  ⟨complexThomClass f hf hi he, complexThomClass_restrict f hf hi he,
    complexThomClass_unique f hf hi he⟩

/-- The class is normalized on every genuine differentiable normal pair,
independently of the normal charts selected by the construction. The
right side is the actual pullback of the fixed standard normal class. -/
theorem complexThomClass_restrict_normalPair (x : M)
    (P : ComplexPoints.Analytic.NormalPairRecenter.ImmersionNormalPair E (Fin (ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) β†’ β„‚) f x)
    (hP : P.ambientChart.MDifferentiable
      π“˜(β„‚, F) π“˜(β„‚, E Γ— (Fin (ComplexNormalAtlas.Cycles.complexImmersionCodimension E F) β†’ β„‚))) :
    RelativeCohomologySections.Cycles.relativeCohomologyOpenRestriction (ModuleCat.of β„š β„š) (TopCat.of N)
      (Set.range f)ᢜ P.openNeighborhood (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F)
      (complexThomClass f hf hi he) =
        P.normalCohomologyMap (ModuleCat.of β„š β„š) (2 * ComplexNormalAtlas.Cycles.complexImmersionCodimension E F)
          (RationalLocalPurity.Cycles.complexNormalRationalDualClass (ComplexNormalAtlas.Cycles.complexImmersionCodimension E F)) := by
  let : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ β„‚ E
  rw [← P.rationalClassFin_eq_normalPullback]
  exact (ComplexNormalAtlas.Cycles.complexImmersionNormalPair f hf hi he x).rationalClassFin_restriction_eq_of_charts
    P (complexImmersionNormalPair_mdifferentiable f hf hi he x) hP
    (complexThomClass f hf hi he) (complexThomClass_restrict f hf hi he x)

/-- A nonempty immersed support has a nonzero global class because its
actual restriction is a nonzero local normal class. -/
theorem complexThomClass_ne_zero (x : M) : complexThomClass f hf hi he β‰  0 := by
  let : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ β„‚ E
  exact (ComplexNormalAtlas.Cycles.complexImmersionNormalPair f hf hi he x).relativeClass_ne_zero_of_normalization
    (complexThomClass f hf hi he) (complexThomClass_restrict f hf hi he x)

end Cycles

end

end OAI.AlgebraicGeometry.CycleClass.Geometric.ComplexThom