import OAI.AlgebraicTopology.DeRham.Comparison.StokesF import OAI.AlgebraicTopology.DeRham.Comparison.CubicalPrism import OAI.AlgebraicTopology.DeRham.Comparison.QuotientImage import Mathlib.LinearAlgebra.Finsupp.Supported /-! # Cubical Support -/ namespace OAI.AlgebraicTopology.DeRham.Comparison.CubicalSupport noncomputable section /-! # Smooth cubical chains in a target subset A cube is supported in `U` when its actual unit-cube image lies in `U`. The free submodule on those cubes is stable under the signed boundary. Its image in the established degeneracy quotient gives normalized chains in `U`. Straight-line prisms preserve this submodule when `U` is convex. -/ open OAI.AlgebraicTopology.DeRham.Comparison.StokesF.SingularCubeStokes variable {n m : ℕ} /-- Cubical chains generated by cubes whose unit-cube images lie in `U`. -/ def supportedCubicalChains (U : Set (Fin m → ℝ)) (n : ℕ) : Submodule ℤ (StokesF.SingularCubeStokes.SingularChain n m) := Finsupp.supported ℤ ℤ {σ | Set.MapsTo σ (StokesF.SingularCubeStokes.unitCube n) U} /-- Coefficients outside the specified target support are exactly zero. -/ theorem mem_supportedCubicalChains_iff (U : Set (Fin m → ℝ)) (c : StokesF.SingularCubeStokes.SingularChain n m) : c ∈ supportedCubicalChains U n ↔ ∀ σ : StokesF.SingularCubeStokes.SmoothSingularCube n m, ¬ Set.MapsTo σ (StokesF.SingularCubeStokes.unitCube n) U → c σ = 0 := Finsupp.mem_supported' ℤ c theorem single_mem_supportedCubicalChains {U : Set (Fin m → ℝ)} (σ : StokesF.SingularCubeStokes.SmoothSingularCube n m) (hσ : Set.MapsTo σ (StokesF.SingularCubeStokes.unitCube n) U) (k : ℤ) : Finsupp.single σ k ∈ supportedCubicalChains U n := Finsupp.single_mem_supported ℤ k hσ /-- Face inclusions at parameters between zero and one preserve unit cubes. -/ theorem faceInclusion_mem_unitCube (i : Fin (n + 1)) {ε : ℝ} (hε : ε ∈ Set.Icc (0 : ℝ) 1) {t : Fin n → ℝ} (ht : t ∈ StokesF.SingularCubeStokes.unitCube n) : StokesF.SingularCubeStokes.faceInclusion i ε t ∈ StokesF.SingularCubeStokes.unitCube (n + 1) := by change (∀ j, (0 : ℝ) ≤ Fin.insertNth (α := fun _ => ℝ) i ε t j) ∧ (∀ j, Fin.insertNth (α := fun _ => ℝ) i ε t j ≤ 1) constructor · intro j rcases Fin.eq_self_or_eq_succAbove i j with rfl | ⟨k, rfl⟩ · simpa only [Fin.insertNth_apply_same] using hε.1 · simpa only [Fin.insertNth_apply_succAbove] using ht.1 k · intro j rcases Fin.eq_self_or_eq_succAbove i j with rfl | ⟨k, rfl⟩ · simpa only [Fin.insertNth_apply_same] using hε.2 · simpa only [Fin.insertNth_apply_succAbove] using ht.2 k /-- Every actual cubical face stays in the same target subset. -/ theorem singularFace_mapsTo {U : Set (Fin m → ℝ)} (σ : StokesF.SingularCubeStokes.SmoothSingularCube (n + 1) m) (hσ : Set.MapsTo σ (StokesF.SingularCubeStokes.unitCube (n + 1)) U) (i : Fin (n + 1)) {ε : ℝ} (hε : ε ∈ Set.Icc (0 : ℝ) 1) : Set.MapsTo (StokesF.SingularCubeStokes.singularFace σ i ε) (StokesF.SingularCubeStokes.unitCube n) U := fun _ ht => hσ (faceInclusion_mem_unitCube i hε ht) theorem boundarySingle_mem_supportedCubicalChains {U : Set (Fin m → ℝ)} (σ : StokesF.SingularCubeStokes.SmoothSingularCube (n + 1) m) (hσ : Set.MapsTo σ (StokesF.SingularCubeStokes.unitCube (n + 1)) U) : StokesF.SingularCubeStokes.singularBoundarySingle σ ∈ supportedCubicalChains U n := by classical apply Submodule.sum_mem intro i _ apply Submodule.add_mem · exact single_mem_supportedCubicalChains _ (singularFace_mapsTo σ hσ i ⟨zero_le_one, le_rfl⟩) _ · exact single_mem_supportedCubicalChains _ (singularFace_mapsTo σ hσ i ⟨le_rfl, zero_le_one⟩) _ /-- The verified cubical boundary preserves the free target-support submodule. -/ theorem cubicalBoundary_preserves_supported (U : Set (Fin m → ℝ)) (n : ℕ) : supportedCubicalChains U (n + 1) ≤ (supportedCubicalChains U n).comap (CubicalDegenerateQ.cubicalBoundaryLinear n m) := by classical intro c hc change StokesF.SingularCubeStokes.singularBoundary c ∈ supportedCubicalChains U n change Finsupp.linearCombination ℤ StokesF.Stokes.boundaryGenerator c ∈ supportedCubicalChains U n rw [Finsupp.linearCombination_apply] change (c.support.sum fun σ => c σ • StokesF.Stokes.boundaryGenerator σ) ∈ supportedCubicalChains U n apply Submodule.sum_mem intro σ hσ apply Submodule.smul_mem exact boundarySingle_mem_supportedCubicalChains σ ((Finsupp.mem_supported ℤ c).mp hc hσ) /-- A prism preserves target support when that target is convex and contains its base point. -/ theorem prismOperator_preserves_supported {U : Set (Fin m → ℝ)} (hU : Convex ℝ U) {x₀ : Fin m → ℝ} (hx₀ : x₀ ∈ U) (n : ℕ) : supportedCubicalChains U n ≤ (supportedCubicalChains U (n + 1)).comap (CubicalPrism.prismOperator n m x₀) := by change Finsupp.supported ℤ ℤ _ ≤ _ rw [Finsupp.supported_eq_span_single] apply Submodule.span_le.mpr rintro _ ⟨σ, hσ, rfl⟩ change CubicalPrism.prismOperator n m x₀ (Finsupp.single σ 1) ∈ supportedCubicalChains U (n + 1) rw [CubicalPrism.prismOperator_single] exact single_mem_supportedCubicalChains _ (CubicalPrism.prismCube_mapsTo_convex hU hx₀ σ hσ) 1 /-- The normalized chains supported in `U`, as the image of the genuine free submodule. -/ def normalizedSupportedCubicalChains (U : Set (Fin m → ℝ)) (n : ℕ) : Submodule ℤ (CubicalDegenerateQ.NormalizedCubicalChain n m) := (supportedCubicalChains U n).map (CubicalDegenerateQ.degenerateSubmodule n m).mkQ /-- The normalized boundary preserves target support. -/ theorem normalizedBoundary_preserves_supported (U : Set (Fin m → ℝ)) (n : ℕ) : normalizedSupportedCubicalChains U (n + 1) ≤ (normalizedSupportedCubicalChains U n).comap (CubicalDegenerateQ.normalizedBoundary n m) := by intro c hc obtain ⟨d, hd, rfl⟩ := (Submodule.mem_map).mp hc change CubicalDegenerateQ.normalizedBoundary n m ((CubicalDegenerateQ.degenerateSubmodule (n + 1) m).mkQ d) ∈ normalizedSupportedCubicalChains U n rw [CubicalDegenerateQ.normalizedBoundary_mk] exact Submodule.mem_map_of_mem (cubicalBoundary_preserves_supported U n hd) /-- The normalized prism preserves support in a convex target. -/ theorem normalizedPrism_preserves_supported {U : Set (Fin m → ℝ)} (hU : Convex ℝ U) {x₀ : Fin m → ℝ} (hx₀ : x₀ ∈ U) (n : ℕ) : normalizedSupportedCubicalChains U n ≤ (normalizedSupportedCubicalChains U (n + 1)).comap (CubicalPrism.normalizedPrism n m x₀) := by intro c hc obtain ⟨d, hd, rfl⟩ := (Submodule.mem_map).mp hc change CubicalPrism.normalizedPrism n m x₀ ((CubicalDegenerateQ.degenerateSubmodule n m).mkQ d) ∈ normalizedSupportedCubicalChains U (n + 1) rw [CubicalPrism.normalizedPrism_mk] exact Submodule.mem_map_of_mem (prismOperator_preserves_supported hU hx₀ n hd) /-- An actual normalized cycle in a convex subset bounds a chain in that subset. -/ theorem normalized_supported_cycle_is_boundary {U : Set (Fin m → ℝ)} (hU : Convex ℝ U) {x₀ : Fin m → ℝ} (hx₀ : x₀ ∈ U) (c : CubicalDegenerateQ.NormalizedCubicalChain (n + 1) m) (hcs : c ∈ normalizedSupportedCubicalChains U (n + 1)) (hc : CubicalDegenerateQ.normalizedBoundary n m c = 0) : ∃ d ∈ normalizedSupportedCubicalChains U (n + 2), CubicalDegenerateQ.normalizedBoundary (n + 1) m d = c := ⟨CubicalPrism.normalizedPrism (n + 1) m x₀ c, normalizedPrism_preserves_supported hU hx₀ (n + 1) hcs, CubicalPrism.normalized_cycle_is_boundary x₀ c hc⟩ /-- The actual boundary restricted to normalized chains in a specified subset. -/ def supportedNormalizedBoundary (U : Set (Fin m → ℝ)) (n : ℕ) : normalizedSupportedCubicalChains U (n + 1) →ₗ[ℤ] normalizedSupportedCubicalChains U n := (CubicalDegenerateQ.normalizedBoundary n m).restrict (fun _ hx => normalizedBoundary_preserves_supported U n hx) /-- The prism restricted to chains in a convex subset. -/ def supportedNormalizedPrism {U : Set (Fin m → ℝ)} (hU : Convex ℝ U) {x₀ : Fin m → ℝ} (hx₀ : x₀ ∈ U) (n : ℕ) : normalizedSupportedCubicalChains U n →ₗ[ℤ] normalizedSupportedCubicalChains U (n + 1) := (CubicalPrism.normalizedPrism n m x₀).restrict (fun _ hx => normalizedPrism_preserves_supported hU hx₀ n hx) theorem supportedNormalizedBoundary_sq_zero (U : Set (Fin m → ℝ)) (n : ℕ) (c : normalizedSupportedCubicalChains U (n + 2)) : supportedNormalizedBoundary U n (supportedNormalizedBoundary U (n + 1) c) = 0 := by apply Subtype.ext exact CubicalDegenerateQ.normalizedBoundary_sq_zero (n := n) (m := m) c.val /-- The concrete contraction identity holds within the supported chain modules themselves. -/ theorem supportedNormalizedPrism_contraction {U : Set (Fin m → ℝ)} (hU : Convex ℝ U) {x₀ : Fin m → ℝ} (hx₀ : x₀ ∈ U) (c : normalizedSupportedCubicalChains U (n + 1)) : supportedNormalizedBoundary U (n + 1) (supportedNormalizedPrism hU hx₀ (n + 1) c) + supportedNormalizedPrism hU hx₀ n (supportedNormalizedBoundary U n c) = c := by apply Subtype.ext exact CubicalPrism.normalized_prism_contraction (n := n) x₀ c.val /-- In the free cubical module, the degenerate span consists exactly of the chains supported on degenerate cubes. -/ theorem degenerateSubmodule_eq_supported (n m : ℕ) : CubicalDegenerateQ.degenerateSubmodule n m = Finsupp.supported ℤ ℤ {σ : StokesF.SingularCubeStokes.SmoothSingularCube n m | CubicalDegeneracyOperators.IsDegenerateCube σ} := (Finsupp.supported_eq_span_single ℤ _).symm /-- Degenerate chains inside the free module of cubes in `U`. -/ def supportedDegenerateSubmodule (U : Set (Fin m → ℝ)) (n : ℕ) : Submodule ℤ (supportedCubicalChains U n) := (CubicalDegenerateQ.degenerateSubmodule n m).comap (supportedCubicalChains U n).subtype /-- The internal degeneracy condition sets precisely the coefficients of nondegenerate cubes to zero. Target support is already imposed by the subtype. -/ theorem mem_supportedDegenerateSubmodule_iff (U : Set (Fin m → ℝ)) (c : supportedCubicalChains U n) : c ∈ supportedDegenerateSubmodule U n ↔ ∀ σ : StokesF.SingularCubeStokes.SmoothSingularCube n m, ¬ CubicalDegeneracyOperators.IsDegenerateCube σ → c.val σ = 0 := by change c.val ∈ CubicalDegenerateQ.degenerateSubmodule n m ↔ _ rw [degenerateSubmodule_eq_supported] exact Finsupp.mem_supported' ℤ c.val /-- The canonical map from the internal degeneracy quotient to the ambient normalized cubical chain module. -/ def supportedNormalizedQuotientMap (U : Set (Fin m → ℝ)) (n : ℕ) : ((supportedCubicalChains U n) ⧸ supportedDegenerateSubmodule U n) →ₗ[ℤ] CubicalDegenerateQ.NormalizedCubicalChain n m := (supportedDegenerateSubmodule U n).mapQ (CubicalDegenerateQ.degenerateSubmodule n m) (supportedCubicalChains U n).subtype le_rfl /-- Passing through the ambient normalized module introduces no additional relations among the internally normalized chains in `U`. -/ theorem supportedNormalizedQuotientMap_injective (U : Set (Fin m → ℝ)) (n : ℕ) : Function.Injective (supportedNormalizedQuotientMap U n) := (QuotientImage.injective_submodule_quotient_map_iff (supportedCubicalChains U n) (CubicalDegenerateQ.degenerateSubmodule n m) (supportedDegenerateSubmodule U n) le_rfl).mpr rfl theorem supportedNormalizedQuotientMap_range (U : Set (Fin m → ℝ)) (n : ℕ) : LinearMap.range (supportedNormalizedQuotientMap U n) = normalizedSupportedCubicalChains U n := QuotientImage.range_submodule_quotient_map (supportedCubicalChains U n) (CubicalDegenerateQ.degenerateSubmodule n m) (supportedDegenerateSubmodule U n) le_rfl /-- The supported submodule model is canonically equivalent to the actual free module on cubes in `U` modulo its own coordinate-degenerate chains. -/ def supportedNormalizedQuotientEquiv (U : Set (Fin m → ℝ)) (n : ℕ) : ((supportedCubicalChains U n) ⧸ supportedDegenerateSubmodule U n) ≃ₗ[ℤ] normalizedSupportedCubicalChains U n := (LinearEquiv.ofInjective (supportedNormalizedQuotientMap U n) (supportedNormalizedQuotientMap_injective U n)).trans (LinearEquiv.ofEq _ _ (supportedNormalizedQuotientMap_range U n)) @[simp] theorem supportedNormalizedQuotientEquiv_mk (U : Set (Fin m → ℝ)) (c : supportedCubicalChains U n) : (supportedNormalizedQuotientEquiv U n ((supportedDegenerateSubmodule U n).mkQ c)).val = (CubicalDegenerateQ.degenerateSubmodule n m).mkQ c.val := rfl end end OAI.AlgebraicTopology.DeRham.Comparison.CubicalSupport