/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. This file has been modified. -/ import OAI.Geometry.Foundations.ConvexStdSimplexMetric import OAI.AlgebraicTopology.LocalHomology.FundamentalClassBoundary import Mathlib.Algebra.Homology.HomologySequence import Mathlib.AlgebraicTopology.SimplicialSet.Homology.HomologyZero import Mathlib.AlgebraicTopology.SimplicialSet.TopAdj import Mathlib.Topology.Homotopy.Equiv import Mathlib.Algebra.Homology.HomologicalComplexAbelian import Mathlib.AlgebraicTopology.SingularHomology.HomotopyInvariance import Mathlib.Analysis.Convex.Contractible import Mathlib.Topology.Homotopy.TopCat.ZerothHomotopy /-! # Euclidean -/ namespace OAI.AlgebraicTopology.LocalHomology.Euclidean.Singular noncomputable section open _root_.AlgebraicTopology /-! # Euclidean local homology This file develops the long exact sequence of the standard punctured Euclidean pair and computes the connecting morphism on the explicit standard local class. These are the chain-level prerequisites for proving that the standard class generates local homology. -/ open _root_.CategoryTheory Limits ContinuousMap open scoped OAI.Geometry.Foundations.ConvexStdSimplexMetric.Convexity.StdSimplex Simplicial /-- The connecting map from relative homology in degree `n + 1` to subspace homology in degree `n`. -/ def relativeSingularBoundary (X : TopPair) (n : ℕ) : Singular.Cohomology.RelativeHomology ℚ X (n + 1) ⟶ Singular.Cohomology.Homology ℚ X.snd n := (Singular.CohomologyTo.relativeChainShortComplex_shortExact ℚ X).δ (n + 1) n (ComplexShape.down_mk (n + 1) n (by lia)) /-- Exactness at relative homology in the long exact sequence of a topological pair. -/ lemma relativeSingular_homology_exact_relative (X : TopPair) (n : ℕ) : (ShortComplex.mk (Singular.CohomologyTo.relativeHomologyProjection ℚ X (n + 1)) (relativeSingularBoundary X n) (by exact (Singular.CohomologyTo.relativeChainShortComplex_shortExact ℚ X).comp_δ (n + 1) n (ComplexShape.down_mk (n + 1) n (by lia)))).Exact := (Singular.CohomologyTo.relativeChainShortComplex_shortExact ℚ X).homology_exact₃ (n + 1) n (ComplexShape.down_mk (n + 1) n (by lia)) lemma standardSubspaceBoundaryChain_inclusion (n : ℕ) : FundamentalClassBoundary.Singular.standardSubspaceBoundaryChain n ≫ ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ (n + 1))).hom.f n = FundamentalClass.Singular.standardAmbientSimplexChain ℚ (n + 1) ≫ ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ (n + 1))).right.d (n + 1) n := by rw [FundamentalClassBoundary.Singular.standardSubspaceBoundaryChain, Preadditive.sum_comp] simp_rw [Preadditive.zsmul_comp, FundamentalClass.Singular.standardFaceChain_inclusion] exact (FundamentalClass.Singular.standardAmbientSimplexChain_boundary ℚ n).symm lemma standardSubspaceBoundaryChain_boundary (n : ℕ) : FundamentalClassBoundary.Singular.standardSubspaceBoundaryChain n ≫ ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ (n + 1))).left.d n ((ComplexShape.down ℕ).next n) = 0 := by let f := ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ (n + 1))).hom let : Mono f := Singular.CohomologyTo.relativeChainMap_mono ℚ (FundamentalClass.Singular.puncturedPair ℝ (n + 1)) rw [← cancel_mono (f.f ((ComplexShape.down ℕ).next n)), Category.assoc, ← f.comm, ← Category.assoc, standardSubspaceBoundaryChain_inclusion, Category.assoc, HomologicalComplex.d_comp_d, comp_zero] simp /-- The boundary of the standard affine simplex as a cycle in punctured Euclidean space. -/ def standardPuncturedBoundaryCycle (n : ℕ) : ModuleCat.of ℚ ℚ ⟶ ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ (n + 1))).left.cycles n := ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ (n + 1))).left.liftCycles (FundamentalClassBoundary.Singular.standardSubspaceBoundaryChain n) ((ComplexShape.down ℕ).next n) rfl (standardSubspaceBoundaryChain_boundary n) /-- The homology class of the boundary of the standard affine simplex in punctured Euclidean space. -/ def standardPuncturedBoundaryClass (n : ℕ) : Singular.Cohomology.Homology ℚ (FundamentalClass.Singular.puncturedPair ℝ (n + 1)).snd n := ((standardPuncturedBoundaryCycle n ≫ ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ (n + 1))).left.homologyπ n).hom) 1 lemma standardLocalCycle_comp_relativeSingularBoundary (n : ℕ) : FundamentalClass.Singular.standardLocalCycle ℚ (n + 1) ≫ (FundamentalClass.Singular.standardLocalRelativeChainComplex ℚ (n + 1)).homologyπ (n + 1) ≫ relativeSingularBoundary (FundamentalClass.Singular.puncturedPair ℝ (n + 1)) n = standardPuncturedBoundaryCycle n ≫ ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ (n + 1))).left.homologyπ n := by let hS := Singular.CohomologyTo.relativeChainShortComplex_shortExact ℚ (FundamentalClass.Singular.puncturedPair ℝ (n + 1)) exact hS.δ_eq (n + 1) n (ComplexShape.down_mk (n + 1) n (by lia)) (FundamentalClass.Singular.standardLocalChain ℚ (n + 1)) (FundamentalClass.Singular.standardLocalChain_boundary_succ ℚ n) (FundamentalClass.Singular.standardAmbientSimplexChain ℚ (n + 1)) rfl (FundamentalClassBoundary.Singular.standardSubspaceBoundaryChain n) (standardSubspaceBoundaryChain_inclusion n) ((ComplexShape.down ℕ).next n) rfl /-- The connecting map sends the standard local class to the homology class of the oriented boundary of the standard affine simplex. -/ lemma relativeSingularBoundary_standardLocalClass (n : ℕ) : (relativeSingularBoundary (FundamentalClass.Singular.puncturedPair ℝ (n + 1)) n).hom (FundamentalClass.Singular.standardLocalClass ℚ (n + 1)) = standardPuncturedBoundaryClass n := ConcreteCategory.congr_hom (standardLocalCycle_comp_relativeSingularBoundary n) 1 /-! ### Contractibility of the ambient Euclidean space -/ /-- A specified homotopy equivalence induces an isomorphism on rational singular homology. -/ def rationalSingularHomologyIsoOfHomotopyEquiv {X Y : Type} [TopologicalSpace X] [TopologicalSpace Y] (k : ℕ) (e : X ≃ₕ Y) : Singular.Cohomology.Homology ℚ (TopCat.of X) k ≅ Singular.Cohomology.Homology ℚ (TopCat.of Y) k := let F := (singularHomologyFunctor (ModuleCat ℚ) k).obj (ModuleCat.of ℚ ℚ) let f : TopCat.of X ⟶ TopCat.of Y := TopCat.ofHom e.toFun let g : TopCat.of Y ⟶ TopCat.of X := TopCat.ofHom e.invFun CategoryTheory.Iso.mk (F.map f) (F.map g) (by rw [← F.map_comp, ← F.map_id] exact TopCat.Homotopy.congr_homologyMap_singularChainComplexFunctor e.left_inv.some (ModuleCat.of ℚ ℚ) k) (by rw [← F.map_comp, ← F.map_id] exact TopCat.Homotopy.congr_homologyMap_singularChainComplexFunctor e.right_inv.some (ModuleCat.of ℚ ℚ) k) /-- Positive-degree rational singular homology of a real coordinate space vanishes. -/ lemma standardRealModel_homology_isZero (d k : ℕ) (hk : k ≠ 0) : IsZero (Singular.Cohomology.Homology ℚ (TopCat.of (Fin d → ℝ)) k) := by let e := (ContractibleSpace.hequiv_unit (Fin d → ℝ)).some exact (AlgebraicTopology.isZero_singularHomologyFunctor_of_totallyDisconnectedSpace (ModuleCat (R := ℚ)) k (ModuleCat.of ℚ ℚ) (TopCat.of Unit) hk).of_iso (rationalSingularHomologyIsoOfHomotopyEquiv k e) /-- In positive degree, the connecting map identifies the local homology of Euclidean space with the preceding homology of its punctured complement. -/ def standardPuncturedRelativeBoundaryIso (n : ℕ) (hn : n ≠ 0) : Singular.Cohomology.RelativeHomology ℚ (FundamentalClass.Singular.puncturedPair ℝ (n + 1)) (n + 1) ≅ Singular.Cohomology.Homology ℚ (FundamentalClass.Singular.puncturedPair ℝ (n + 1)).snd n := (Singular.CohomologyTo.relativeChainShortComplex_shortExact ℚ (FundamentalClass.Singular.puncturedPair ℝ (n + 1))).δIso (n + 1) n (ComplexShape.down_mk (n + 1) n (by lia)) (standardRealModel_homology_isZero (n + 1) (n + 1) (by lia)) (standardRealModel_homology_isZero (n + 1) n hn) lemma standardPuncturedRelativeBoundaryIso_hom (n : ℕ) (hn : n ≠ 0) : (standardPuncturedRelativeBoundaryIso n hn).hom = relativeSingularBoundary (FundamentalClass.Singular.puncturedPair ℝ (n + 1)) n := rfl /-- Above dimension one, nonvanishing of the standard local class is equivalent to nonvanishing of its explicit oriented boundary in the punctured Euclidean space. -/ lemma standardLocalClass_succ_ne_zero_iff (n : ℕ) (hn : n ≠ 0) : FundamentalClass.Singular.standardLocalClass ℚ (n + 1) ≠ 0 ↔ standardPuncturedBoundaryClass n ≠ 0 := by rw [← relativeSingularBoundary_standardLocalClass n, ← standardPuncturedRelativeBoundaryIso_hom n hn] exact (standardPuncturedRelativeBoundaryIso n hn).toLinearEquiv.map_ne_zero_iff.symm /-- Above dimension one, the standard local class spans exactly when its explicit oriented boundary spans the preceding homology of the punctured Euclidean space. -/ lemma span_standardLocalClass_succ_eq_top_iff (n : ℕ) (hn : n ≠ 0) : Submodule.span ℚ {FundamentalClass.Singular.standardLocalClass ℚ (n + 1)} = ⊤ ↔ Submodule.span ℚ {standardPuncturedBoundaryClass n} = ⊤ := by let e := (standardPuncturedRelativeBoundaryIso n hn).toLinearEquiv have he : e (FundamentalClass.Singular.standardLocalClass ℚ (n + 1)) = standardPuncturedBoundaryClass n := by change (standardPuncturedRelativeBoundaryIso n hn).hom.hom (FundamentalClass.Singular.standardLocalClass ℚ (n + 1)) = _ rw [standardPuncturedRelativeBoundaryIso_hom, relativeSingularBoundary_standardLocalClass] have hmap : (Submodule.span ℚ {FundamentalClass.Singular.standardLocalClass ℚ (n + 1)}).map e.toLinearMap = Submodule.span ℚ {standardPuncturedBoundaryClass n} := by rw [Submodule.map_span] simp [he] have etop : (⊤ : Submodule ℚ _).map e.toLinearMap = ⊤ := by rw [Submodule.map_top] exact LinearMap.range_eq_top.mpr e.surjective constructor · intro h rw [← hmap, h, etop] · intro h apply Submodule.map_injective_of_injective e.injective rw [hmap, h, etop] /-! ### The standard class in dimension one -/ /-- The point `-1` of the standard punctured real line. -/ def standardNegativePoint : ({0}ᶜ : Set (Fin 1 → ℝ)) := ⟨fun _ ↦ -1, by simp only [Set.mem_compl_iff, Set.mem_singleton_iff] intro h have := congr_fun h 0 norm_num at this⟩ /-- The point `1` of the standard punctured real line. -/ def standardPositivePoint : ({0}ᶜ : Set (Fin 1 → ℝ)) := ⟨fun _ ↦ 1, by simp only [Set.mem_compl_iff, Set.mem_singleton_iff] intro h have := congr_fun h 0 norm_num at this⟩ /-- The negative and positive points lie in different path components of the punctured line. -/ lemma standardPuncturedLine_components_ne : ZerothHomotopy.mk standardNegativePoint ≠ ZerothHomotopy.mk standardPositivePoint := by intro h have hj : Joined standardNegativePoint standardPositivePoint := Quotient.exact h obtain ⟨p⟩ := hj let g : unitInterval → ℝ := fun t ↦ (p t : Fin 1 → ℝ) 0 have hg : Continuous g := (((continuous_apply (0 : Fin 1)).comp continuous_subtype_val).comp p.continuous) have hg0 : g 0 = -1 := by change (p 0 : Fin 1 → ℝ) 0 = -1 rw [show p 0 = standardNegativePoint from p.source] rfl have hg1 : g 1 = 1 := by change (p 1 : Fin 1 → ℝ) 0 = 1 rw [show p 1 = standardPositivePoint from p.target] rfl have hz : (0 : ℝ) ∈ Set.range g := intermediate_value_univ (0 : unitInterval) (1 : unitInterval) hg (by rw [hg0, hg1] norm_num) obtain ⟨t, ht⟩ := hz apply (p t).property ext j fin_cases j exact ht lemma standardFaceSimplex_zero_point : TopCat.toSSetObj₀Equiv (FundamentalClass.Singular.standardFaceSimplex 0 (0 : Fin 2)) = standardNegativePoint := by change FundamentalClass.Singular.standardFaceMap 0 (0 : Fin 2) (default : Convexity.StdSimplex ℝ (Fin 1)) = standardNegativePoint rw [Subsingleton.elim (default : Convexity.StdSimplex ℝ (Fin 1)) (Convexity.StdSimplex.single 0)] ext j fin_cases j simp [FundamentalClass.Singular.standardFaceMap, FundamentalClass.Singular.standardAffineSimplex, Convexity.StdSimplex.map, standardNegativePoint] lemma standardFaceSimplex_one_point : TopCat.toSSetObj₀Equiv (FundamentalClass.Singular.standardFaceSimplex 0 (1 : Fin 2)) = standardPositivePoint := by change FundamentalClass.Singular.standardFaceMap 0 (1 : Fin 2) (default : Convexity.StdSimplex ℝ (Fin 1)) = standardPositivePoint rw [Subsingleton.elim (default : Convexity.StdSimplex ℝ (Fin 1)) (Convexity.StdSimplex.single 0)] ext j fin_cases j simp [FundamentalClass.Singular.standardFaceMap, FundamentalClass.Singular.standardAffineSimplex, Convexity.StdSimplex.map, standardPositivePoint] /-- The two vertices of the standard one-simplex represent different components of the punctured line. -/ lemma standardFaceSimplex_components_ne : SSet.π₀.mk (FundamentalClass.Singular.standardFaceSimplex 0 (0 : Fin 2)) ≠ SSet.π₀.mk (FundamentalClass.Singular.standardFaceSimplex 0 (1 : Fin 2)) := by intro h have hz := congrArg (TopCat.zerothHomotopyEquiv (X := (FundamentalClass.Singular.puncturedPair ℝ 1).snd)).symm h simp only [TopCat.zerothHomotopyEquiv_symm_mk] at hz rw [standardFaceSimplex_zero_point, standardFaceSimplex_one_point] at hz exact standardPuncturedLine_components_ne hz /-- A vertex of the standard one-simplex, regarded as a zero-cycle in the punctured line. -/ def standardPuncturedFaceCycle (i : Fin 2) : ModuleCat.of ℚ ℚ ⟶ ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ 1)).left.cycles 0 := ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ 1)).left.liftCycles (FundamentalClass.Singular.standardSubspaceFaceChain ℚ 0 i) 0 (by simp) (by simp) lemma standardPuncturedBoundaryCycle_zero_eq : standardPuncturedBoundaryCycle 0 = standardPuncturedFaceCycle 0 - standardPuncturedFaceCycle 1 := by rw [← cancel_mono (((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ 1)).left.iCycles 0)] rw [Preadditive.sub_comp] simp only [standardPuncturedBoundaryCycle, standardPuncturedFaceCycle, HomologicalComplex.liftCycles_i] change (∑ i : Fin 2, (-1 : ℤ) ^ i.val • FundamentalClass.Singular.standardSubspaceFaceChain ℚ 0 i) = FundamentalClass.Singular.standardSubspaceFaceChain ℚ 0 0 - FundamentalClass.Singular.standardSubspaceFaceChain ℚ 0 1 norm_num rw [sub_eq_add_neg] set_option backward.isDefEq.respectTransparency false in lemma standardPuncturedFaceCycle_homology₀Iso (i : Fin 2) : standardPuncturedFaceCycle i ≫ ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ 1)).left.homologyπ 0 ≫ ((TopCat.toSSet.obj (FundamentalClass.Singular.puncturedPair ℝ 1).snd).homology₀Iso (ModuleCat.of ℚ ℚ)).hom = Sigma.ι (fun (_ : (TopCat.toSSet.obj (FundamentalClass.Singular.puncturedPair ℝ 1).snd).π₀) ↦ ModuleCat.of ℚ ℚ) (SSet.π₀.mk (FundamentalClass.Singular.standardFaceSimplex 0 i)) := SSet.liftCycles_ιChainComplex_homologyπ_homology₀Iso_hom (TopCat.toSSet.obj (FundamentalClass.Singular.puncturedPair ℝ 1).snd) (ModuleCat.of ℚ ℚ) (FundamentalClass.Singular.standardFaceSimplex 0 i) set_option backward.isDefEq.respectTransparency false in lemma standardPuncturedBoundaryCycle_homology₀Iso : standardPuncturedBoundaryCycle 0 ≫ ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ 1)).left.homologyπ 0 ≫ ((TopCat.toSSet.obj (FundamentalClass.Singular.puncturedPair ℝ 1).snd).homology₀Iso (ModuleCat.of ℚ ℚ)).hom = Sigma.ι (fun (_ : (TopCat.toSSet.obj (FundamentalClass.Singular.puncturedPair ℝ 1).snd).π₀) ↦ ModuleCat.of ℚ ℚ) (SSet.π₀.mk (FundamentalClass.Singular.standardFaceSimplex 0 0)) - Sigma.ι (fun (_ : (TopCat.toSSet.obj (FundamentalClass.Singular.puncturedPair ℝ 1).snd).π₀) ↦ ModuleCat.of ℚ ℚ) (SSet.π₀.mk (FundamentalClass.Singular.standardFaceSimplex 0 1)) := by rw [standardPuncturedBoundaryCycle_zero_eq, Preadditive.sub_comp, standardPuncturedFaceCycle_homology₀Iso, standardPuncturedFaceCycle_homology₀Iso] open scoped Classical in /-- A linear functional detecting the negative component of the punctured line. -/ def standardPuncturedBoundaryDetector : (∐ (fun (_ : (TopCat.toSSet.obj (FundamentalClass.Singular.puncturedPair ℝ 1).snd).π₀) ↦ ModuleCat.of ℚ ℚ)) ⟶ ModuleCat.of ℚ ℚ := Sigma.desc fun j ↦ if j = SSet.π₀.mk (FundamentalClass.Singular.standardFaceSimplex 0 0) then 𝟙 _ else 0 set_option backward.isDefEq.respectTransparency false in lemma standardPuncturedBoundaryCycle_detect : standardPuncturedBoundaryCycle 0 ≫ ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ 1)).left.homologyπ 0 ≫ ((TopCat.toSSet.obj (FundamentalClass.Singular.puncturedPair ℝ 1).snd).homology₀Iso (ModuleCat.of ℚ ℚ)).hom ≫ standardPuncturedBoundaryDetector = 𝟙 _ := by calc _ = (standardPuncturedBoundaryCycle 0 ≫ ((Singular.Cohomology.chainPairFunctor ℚ).obj (FundamentalClass.Singular.puncturedPair ℝ 1)).left.homologyπ 0 ≫ ((TopCat.toSSet.obj (FundamentalClass.Singular.puncturedPair ℝ 1).snd).homology₀Iso (ModuleCat.of ℚ ℚ)).hom) ≫ standardPuncturedBoundaryDetector := by simp only [Category.assoc] _ = _ := by rw [standardPuncturedBoundaryCycle_homology₀Iso, Preadditive.sub_comp] simp [standardPuncturedBoundaryDetector, Ne.symm standardFaceSimplex_components_ne] set_option backward.isDefEq.respectTransparency false in /-- The oriented boundary of the standard one-simplex is nonzero in the zero-dimensional homology of the punctured line. -/ lemma standardPuncturedBoundaryClass_zero_ne_zero : standardPuncturedBoundaryClass 0 ≠ 0 := by intro h have hdet := ConcreteCategory.congr_hom standardPuncturedBoundaryCycle_detect 1 change (standardPuncturedBoundaryDetector.hom (((TopCat.toSSet.obj (FundamentalClass.Singular.puncturedPair ℝ 1).snd).homology₀Iso (ModuleCat.of ℚ ℚ)).hom.hom (standardPuncturedBoundaryClass 0))) = 1 at hdet rw [h] at hdet norm_num at hdet /-- The explicit standard local class is nonzero in `H₁(ℝ, ℝ ∖ {0}; ℚ)`. -/ lemma standardLocalClass_one_ne_zero : FundamentalClass.Singular.standardLocalClass ℚ 1 ≠ 0 := by intro h apply standardPuncturedBoundaryClass_zero_ne_zero rw [← relativeSingularBoundary_standardLocalClass 0, h, map_zero] end end OAI.AlgebraicTopology.LocalHomology.Euclidean.Singular