AlgebraicAnalysis library · bbbbf3fc358ca8100b158cec4cf47f336ab70163
1 module 2 public import AlgebraicAnalysis.Module.FilteredTwoTermPageEquivalences 3 public import AlgebraicAnalysis.Module.FilteredTwoTermPageActions 4 public import Mathlib.Algebra.DirectSum.Module 5 6 @[expose] public section 7 8 /-! 9 # Total direct sums of the filtered two-term pages 10 11 The page differential has target component indexed by `p + r`. This file 12 packages the component maps into one direct-sum map; no successor-page 13 interface is assumed here. 14 -/ 15 16 namespace AlgebraicAnalysis.FilteredTwoTermPages 17 18 universe u v 19 20 variable {k : Type u} [Ring k] 21 variable {M : Type v} [AddCommGroup M] [Module k M] 22 23 namespace FilteredTwoTerm 24 25 variable (K : FilteredTwoTerm k M) 26 27 /-- The direct sum of the source pages at page `r`. -/ 28 abbrev SourceTotal (r : ℕ) := 29 DirectSum ℤ (fun p : ℤ => K.SourcePage r p) 30 31 /-- The direct sum of the target pages at page `r`. -/ 32 abbrev TargetTotal (r : ℕ) := 33 DirectSum ℤ (fun p : ℤ => K.TargetPage r p) 34 35 /-- The total page differential, with the component at `p` landing at `p+r`. 36 37 The reindexing is expressed by the corresponding direct-sum inclusion, so the 38 formula keeps the target shift visible at the definition site. 39 -/ 40 def totalDrop (r : ℕ) : K.SourceTotal r →ₗ[k] K.TargetTotal r := 41 DirectSum.toModule k ℤ (K.TargetTotal r) (fun p : ℤ => 42 (DirectSum.lof k ℤ (fun q : ℤ => K.TargetPage r q) (p + r)).comp 43 (K.drop r p)) 44 45 /-- Component formula for the total differential. -/ 46 @[simp] theorem totalDrop_lof (r : ℕ) (p : ℤ) (x : K.SourcePage r p) : 47 K.totalDrop r (DirectSum.lof k ℤ (fun q : ℤ => K.SourcePage r q) p x) = 48 DirectSum.lof k ℤ (fun q : ℤ => K.TargetPage r q) (p + r) (K.drop r p x) := by 49 rw [totalDrop, DirectSum.toModule_lof] 50 rfl 51 52 /-- Representative formula for a source-page quotient representative. 53 54 This compatibility lemma intentionally retains the quotient representative on 55 the right-hand side, although the simplifier can reduce it further. -/ 56 @[simp, nolint simpNF] theorem totalDrop_lof_mk (r : ℕ) (p : ℤ) 57 (x : K.cycles r p) : 58 K.totalDrop r 59 (DirectSum.lof k ℤ (fun q : ℤ => K.SourcePage r q) p 60 (Submodule.Quotient.mk x)) = 61 DirectSum.lof k ℤ (fun q : ℤ => K.TargetPage r q) (p + r) 62 (K.drop r p (Submodule.Quotient.mk x)) := by 63 rw [K.totalDrop_lof, K.drop_mk] 64 65 private theorem totalDrop_apply_component (r : ℕ) (p : ℤ) 66 (x : K.SourceTotal r) : 67 K.totalDrop r x (p + r) = K.drop r p (x p) := by 68 classical 69 induction x using DirectSum.induction_on with 70 | zero => simp 71 | of q y => 72 rw [show DirectSum.of (fun q : ℤ => K.SourcePage r q) q y = 73 DirectSum.lof k ℤ (fun q : ℤ => K.SourcePage r q) q y from rfl, 74 K.totalDrop_lof] 75 by_cases h : q = p 76 · subst q 77 simp 78 · have hshift : q + (r : ℤ) ≠ p + (r : ℤ) := by omega 79 change (DFinsupp.single (q + (r : ℤ)) (K.drop r q y)) (p + r) = 80 K.drop r p ((DFinsupp.single q y) p) 81 rw [DFinsupp.single_apply, DFinsupp.single_apply, dif_neg hshift, dif_neg h] 82 simp 83 | add x y hx hy => simpa using congrArg₂ (· + ·) hx hy 84 85 #print axioms totalDrop 86 #print axioms totalDrop_lof 87 #print axioms totalDrop_lof_mk 88 #print axioms totalDrop_apply_component 89 90 /-- The componentwise successor map on the total source page. -/ 91 noncomputable def sourceTotalSuccMap (r : ℕ) : 92 K.SourceTotal (r + 1) →ₗ[k] K.SourceTotal r := 93 DirectSum.lmap (fun p => 94 (LinearMap.ker (K.drop r p)).subtype.comp 95 (K.sourceSuccEquivKerDrop r p).toLinearMap) 96 97 theorem totalSourceSuccMap_injective (r : ℕ) : 98 Function.Injective (K.sourceTotalSuccMap r) := by 99 apply (DirectSum.lmap_injective _).mpr 100 intro p 101 exact (Submodule.subtype_injective _).comp 102 (K.sourceSuccEquivKerDrop r p).injective 103 104 theorem range_totalSourceSuccMap (r : ℕ) : 105 (K.sourceTotalSuccMap r).range = (K.totalDrop r).ker := by 106 rw [sourceTotalSuccMap, DirectSum.range_lmap] 107 ext x 108 change (∀ p ∈ Set.univ, x p ∈ LinearMap.range 109 ((LinearMap.ker (K.drop r p)).subtype.comp 110 (K.sourceSuccEquivKerDrop r p).toLinearMap)) ↔ K.totalDrop r x = 0 111 constructor 112 · intro hx 113 apply DFinsupp.ext 114 intro q 115 have hq : q = (q - r) + r := by omega 116 rw [hq, K.totalDrop_apply_component] 117 obtain ⟨y, hy⟩ := hx (q - r) (Set.mem_univ _) 118 have hmem := (K.sourceSuccEquivKerDrop r (q - r) y).property 119 simpa only [LinearMap.comp_apply, LinearEquiv.coe_toLinearMap, 120 Submodule.subtype_apply] using hy ▸ hmem 121 · intro hx p _ 122 have hzero : K.drop r p (x p) = 0 := by 123 rw [← K.totalDrop_apply_component, hx] 124 rfl 125 refine ⟨(K.sourceSuccEquivKerDrop r p).symm ⟨x p, hzero⟩, ?_⟩ 126 simp 127 128 /-- The total successor source is the actual kernel of the total differential. -/ 129 noncomputable def sourceTotalSuccEquivKerDrop (r : ℕ) : 130 K.SourceTotal (r + 1) ≃ₗ[k] (K.totalDrop r).ker := 131 LinearEquiv.ofInjective (K.sourceTotalSuccMap r) 132 (K.totalSourceSuccMap_injective r) ≪≫ₗ 133 LinearEquiv.ofEq _ _ (K.range_totalSourceSuccMap r) 134 135 private def targetReindex (r : ℕ) : 136 K.TargetTotal r ≃ₗ[k] DirectSum ℤ (fun p => K.TargetPage r (p + r)) := 137 DirectSum.lequivCongrLeft k 138 { toFun := fun p : ℤ => p - r 139 invFun := fun p => p + r 140 left_inv := by intro p; dsimp; omega 141 right_inv := by intro p; dsimp; omega } 142 143 private theorem targetReindex_totalDrop (r : ℕ) (x : K.SourceTotal r) : 144 K.targetReindex r (K.totalDrop r x) = DirectSum.lmap (K.drop r) x := by 145 ext p 146 exact K.totalDrop_apply_component r p x 147 148 /-- The componentwise quotient map on the total target page. -/ 149 def targetTotalSuccMap (r : ℕ) : 150 K.TargetTotal r →ₗ[k] K.TargetTotal (r + 1) := 151 DirectSum.lmap (K.targetSuccMap r) 152 153 theorem ker_totalTargetSuccMap (r : ℕ) : 154 (K.targetTotalSuccMap r).ker = (K.totalDrop r).range := by 155 ext y 156 constructor 157 · intro hy 158 have hlocal : ∀ p, K.targetSuccMap r p (y p) = 0 := by 159 intro p 160 exact congrArg (fun z => z p) (LinearMap.mem_ker.mp hy) 161 have hmem : K.targetReindex r y ∈ (DirectSum.lmap (K.drop r)).range := by 162 rw [DirectSum.range_lmap] 163 change ∀ p ∈ Set.univ, y (p + r) ∈ (K.drop r p).range 164 intro p _ 165 rw [← K.ker_targetSuccMap_eq_range_drop] 166 exact hlocal (p + r) 167 obtain ⟨x, hx⟩ := hmem 168 refine ⟨x, (K.targetReindex r).injective ?_⟩ 169 rw [K.targetReindex_totalDrop] 170 exact hx 171 · rintro ⟨x, rfl⟩ 172 apply LinearMap.mem_ker.mpr 173 apply DFinsupp.ext 174 intro q 175 have hq : q = (q - r) + r := by omega 176 change K.targetSuccMap r q (K.totalDrop r x q) = 0 177 rw [hq, K.totalDrop_apply_component] 178 apply LinearMap.mem_ker.mp 179 rw [K.ker_targetSuccMap_eq_range_drop] 180 exact ⟨x (q - r), rfl⟩ 181 182 /-- The total successor target is the actual cokernel of the total differential. -/ 183 noncomputable def targetTotalSuccEquivCokerDrop (r : ℕ) : 184 K.TargetTotal (r + 1) ≃ₗ[k] (K.TargetTotal r ⧸ (K.totalDrop r).range) := 185 ((Submodule.quotEquivOfEq _ _ (K.ker_totalTargetSuccMap r).symm) ≪≫ₗ 186 (K.targetTotalSuccMap r).quotKerEquivOfSurjective 187 ((DirectSum.lmap_surjective _).mpr (K.targetSuccMap_surjective r))).symm 188 189 #print axioms sourceTotalSuccEquivKerDrop 190 #print axioms targetTotalSuccEquivCokerDrop 191 192 end FilteredTwoTerm 193 194 end AlgebraicAnalysis.FilteredTwoTermPages 195