roseking's picture
Add lean source and binary files (part 5)
d7f9a33 verified
Raw History Blame Contribute Delete
9.37 kB
16
structure ExactProjectiveComplex (P : ChainComplex (ModuleCat.{u} R) ℤ) : Prop where
body · 4 lines
  finite : ∀ n, Module.Finite R (P.X n)
  projective : ∀ n, Module.Projective R (P.X n)
  exactAt : ∀ n, LinearMap.range (P.d (n + 1) n).hom =
    LinearMap.ker (P.d n (n - 1)).hom
22
structure TotallyAcyclicComplex (P : ChainComplex (ModuleCat.{u} R) ℤ) : Prop
    extends ExactProjectiveComplex P where
body · 1 line
  dualExact : ∀ n, HomExactAt (P.d (n + 1) n).hom (P.d n (n - 1)).hom
26
theorem ExactProjectiveComplex.exactAt_of_indices
    {P : ChainComplex (ModuleCat.{u} R) ℤ} (h : ExactProjectiveComplex P)
    {i j k : ℤ} (hi : i = j + 1) (hk : k = j - 1) :
    LinearMap.range (P.d i j).hom = LinearMap.ker (P.d j k).hom := by
proof · 3 lines
  subst i
  subst k
  exact h.exactAt j
34
theorem TotallyAcyclicComplex.dualExact_of_indices
    {P : ChainComplex (ModuleCat.{u} R) ℤ} (h : TotallyAcyclicComplex P)
    {i j k : ℤ} (hi : i = j + 1) (hk : k = j - 1) :
    HomExactAt (P.d i j).hom (P.d j k).hom := by
proof · 3 lines
  subst i
  subst k
  exact h.dualExact j
46
theorem differential_comp (P : ChainComplex (ModuleCat.{u} R) ℤ) (i j k : ℤ) :
    (P.d j k).hom.comp (P.d i j).hom = 0 :=
proof · 1 line
  congrArg (fun f : P.X i ⟶ P.X k => f.hom) (P.d_comp_d i j k)
50
abbrev Cokernel (P : ChainComplex (ModuleCat.{u} R) ℤ) (n : ℤ) :=
body · 1 line
  P.X n ⧸ LinearMap.range (P.d (n + 1) n).hom
53
private structure UpPair (P Q : ChainComplex (ModuleCat.{u} R) ℤ) (n : ℕ) where
body · 3 lines
  lo : P.X (n : ℤ) →ₗ[R] Q.X (n : ℤ)
  hi : P.X ((n + 1 : ℕ) : ℤ) →ₗ[R] Q.X ((n + 1 : ℕ) : ℤ)
  comm : (Q.d (n + 1) n).hom.comp hi = lo.comp (P.d (n + 1) n).hom
58
private theorem exists_upStep (hP : ExactProjectiveComplex P)
    (hQ : ExactProjectiveComplex Q) (n : ℕ) (c : UpPair P Q n) :
    ∃ c' : UpPair P Q (n + 1), c'.lo = c.hi := by
proof · 9 lines
  let := hP.projective (n + 2)
  have hex : LinearMap.range (Q.d (n + 2) (n + 1)).hom =
      LinearMap.ker (Q.d (n + 1) n).hom := by
    exact hQ.exactAt_of_indices (by omega) (by omega)
  obtain ⟨f, hf⟩ := extend_comparison_up
    (P.d (n + 2) (n + 1)).hom (P.d (n + 1) n).hom
    (differential_comp P _ _ _)
    (Q.d (n + 2) (n + 1)).hom (Q.d (n + 1) n).hom hex c.hi c.lo c.comm
  exact ⟨⟨c.hi, f, hf⟩, rfl⟩
71
private noncomputable def upSequence (hP : ExactProjectiveComplex P)
    (hQ : ExactProjectiveComplex Q) (c : UpPair P Q 0) : (n : ℕ) → UpPair P Q n
body · 2 lines
  | 0 => c
  | n + 1 => Classical.choose (exists_upStep hP hQ n (upSequence hP hQ c n))
76
private theorem upSequence_succ_lo (hP : ExactProjectiveComplex P)
    (hQ : ExactProjectiveComplex Q) (c : UpPair P Q 0) (n : ℕ) :
    (upSequence hP hQ c (n + 1)).lo = (upSequence hP hQ c n).hi :=
proof · 1 line
  Classical.choose_spec (exists_upStep hP hQ n (upSequence hP hQ c n))
81
private structure DownPair (P Q : ChainComplex (ModuleCat.{u} R) ℤ) (n : ℕ) where
body · 4 lines
  hi : P.X (-(n : ℤ)) →ₗ[R] Q.X (-(n : ℤ))
  lo : P.X (Int.negSucc n) →ₗ[R] Q.X (Int.negSucc n)
  comm : (Q.d (-(n : ℤ)) (Int.negSucc n)).hom.comp hi =
    lo.comp (P.d (-(n : ℤ)) (Int.negSucc n)).hom
87
private theorem exists_downStep (hP : TotallyAcyclicComplex P)
    (hQ : ExactProjectiveComplex Q) (n : ℕ) (c : DownPair P Q n) :
    ∃ c' : DownPair P Q (n + 1), c'.hi = c.lo := by
proof · 12 lines
  let := hQ.finite (Int.negSucc (n + 1))
  let := hQ.projective (Int.negSucc (n + 1))
  have hd : HomExactAt (P.d (-(n : ℤ)) (Int.negSucc n)).hom
      (P.d (Int.negSucc n) (Int.negSucc (n + 1))).hom := by
    exact hP.dualExact_of_indices (by omega) (by omega)
  obtain ⟨f, hf⟩ := extend_comparison_down
    (P.d (-(n : ℤ)) (Int.negSucc n)).hom
    (P.d (Int.negSucc n) (Int.negSucc (n + 1))).hom hd
    (Q.d (-(n : ℤ)) (Int.negSucc n)).hom
    (Q.d (Int.negSucc n) (Int.negSucc (n + 1))).hom
    (differential_comp Q _ _ _) c.hi c.lo c.comm
  exact ⟨⟨c.lo, f, hf.symm⟩, rfl⟩
103
private noncomputable def downSequence (hP : TotallyAcyclicComplex P)
    (hQ : ExactProjectiveComplex Q) (c : DownPair P Q 0) : (n : ℕ) → DownPair P Q n
body · 2 lines
  | 0 => c
  | n + 1 => Classical.choose (exists_downStep hP hQ n (downSequence hP hQ c n))
108
private theorem downSequence_succ_hi (hP : TotallyAcyclicComplex P)
    (hQ : ExactProjectiveComplex Q) (c : DownPair P Q 0) (n : ℕ) :
    (downSequence hP hQ c (n + 1)).hi = (downSequence hP hQ c n).lo :=
proof · 1 line
  Classical.choose_spec (exists_downStep hP hQ n (downSequence hP hQ c n))
113
private theorem exists_downStart (hP : TotallyAcyclicComplex P)
    (hQ : ExactProjectiveComplex Q) (c : UpPair P Q 0) :
    ∃ d : DownPair P Q 0, d.hi = c.lo := by
proof · 8 lines
  let := hQ.finite (-1)
  let := hQ.projective (-1)
  obtain ⟨f, hf⟩ := extend_comparison_down
    (P.d 1 0).hom (P.d 0 (-1)).hom
    (hP.dualExact_of_indices (by omega) (by omega))
    (Q.d 1 0).hom (Q.d 0 (-1)).hom
    (differential_comp Q _ _ _) c.hi c.lo c.comm
  exact ⟨⟨c.lo, f, hf.symm⟩, rfl⟩
125
private noncomputable def components (hP : TotallyAcyclicComplex P)
    (hQ : ExactProjectiveComplex Q) (c : UpPair P Q 0) (d : DownPair P Q 0) :
    (n : ℤ) → P.X n →ₗ[R] Q.X n
body · 2 lines
  | Int.ofNat n => (upSequence hP.toExactProjectiveComplex hQ c n).lo
  | Int.negSucc n => (downSequence hP hQ d n).lo
131
private noncomputable def fromPairs (hP : TotallyAcyclicComplex P)
    (hQ : ExactProjectiveComplex Q) (c : UpPair P Q 0) (d : DownPair P Q 0)
    (hd : d.hi = c.lo) : P ⟶ Q where
body · 25 lines
  f n := ModuleCat.ofHom (components hP hQ c d n)
  comm' i j hij := by
    change j + 1 = i at hij
    subst i
    apply ModuleCat.hom_ext
    cases j with
    | ofNat n =>
      change (Q.d (n + 1) n).hom.comp
          (upSequence hP.toExactProjectiveComplex hQ c (n + 1)).lo =
        (upSequence hP.toExactProjectiveComplex hQ c n).lo.comp (P.d (n + 1) n).hom
      rw [upSequence_succ_lo]
      exact (upSequence hP.toExactProjectiveComplex hQ c n).comm
    | negSucc n =>
      cases n with
      | zero =>
        change (Q.d 0 (-1)).hom.comp c.lo = d.lo.comp (P.d 0 (-1)).hom
        rw [← hd]
        exact d.comm
      | succ n =>
        change (Q.d (Int.negSucc n) (Int.negSucc (n + 1))).hom.comp
            (downSequence hP hQ d n).lo =
          (downSequence hP hQ d (n + 1)).lo.comp
            (P.d (Int.negSucc n) (Int.negSucc (n + 1))).hom
        rw [← downSequence_succ_hi]
        exact (downSequence hP hQ d (n + 1)).comm
160
theorem lift_cokernels (hP : TotallyAcyclicComplex P) (hQ : ExactProjectiveComplex Q)
    (u : Cokernel P 0 →ₗ[R] Cokernel Q 0) :
    ∃ F : P ⟶ Q,
      (LinearMap.range (Q.d 1 0).hom).mkQ.comp (F.f 0).hom =
        u.comp (LinearMap.range (P.d 1 0).hom).mkQ := by
proof · 6 lines
  let := hP.projective 0
  let := hP.projective 1
  obtain ⟨f₀, f₁, hf₀, hf₁⟩ := lift_cokernel_map (P.d 1 0).hom (Q.d 1 0).hom u
  let c : UpPair P Q 0 := ⟨f₀, f₁, hf₁⟩
  obtain ⟨d, hd⟩ := exists_downStart hP hQ c
  exact ⟨fromPairs hP hQ c d hd, hf₀⟩
172
def cokernelMap (F : P ⟶ Q) (n : ℤ) : Cokernel P n →ₗ[R] Cokernel Q n :=
body · 6 lines
  (LinearMap.range (P.d (n + 1) n).hom).mapQ
    (LinearMap.range (Q.d (n + 1) n).hom) (F.f n).hom (by
      rintro _ ⟨x, rfl⟩
      refine ⟨(F.f (n + 1)).hom x, ?_⟩
      exact DFunLike.congr_fun
        (congrArg (fun f : P.X (n + 1) ⟶ Q.X n => f.hom) (F.comm (n + 1) n)) x)
181
theorem cokernelMap_mkQ (F : P ⟶ Q) (n : ℤ) :
    (cokernelMap F n).comp (LinearMap.range (P.d (n + 1) n).hom).mkQ =
      (LinearMap.range (Q.d (n + 1) n).hom).mkQ.comp (F.f n).hom :=
proof · 1 line
  Submodule.mapQ_mkQ _ _ _
187
theorem cokernelMap_id (n : ℤ) : cokernelMap (𝟙 P) n = LinearMap.id := by
proof · 4 lines
  apply LinearMap.ext
  intro x
  obtain ⟨y, rfl⟩ := Submodule.mkQ_surjective (LinearMap.range (P.d (n + 1) n).hom) x
  rfl
194
theorem cokernelMap_comp {S : ChainComplex (ModuleCat.{u} R) ℤ}
    (F : P ⟶ Q) (G : Q ⟶ S) (n : ℤ) :
    cokernelMap (F ≫ G) n = (cokernelMap G n).comp (cokernelMap F n) := by
proof · 4 lines
  apply LinearMap.ext
  intro x
  obtain ⟨y, rfl⟩ := Submodule.mkQ_surjective (LinearMap.range (P.d (n + 1) n).hom) x
  rfl
203
theorem cokernelMap_add (F G : P ⟶ Q) (n : ℤ) :
    cokernelMap (F + G) n = cokernelMap F n + cokernelMap G n := by
proof · 4 lines
  apply LinearMap.ext
  intro x
  obtain ⟨y, rfl⟩ := Submodule.mkQ_surjective (LinearMap.range (P.d (n + 1) n).hom) x
  exact map_add (LinearMap.range (Q.d (n + 1) n).hom).mkQ _ _
211
theorem cokernelMap_zero (n : ℤ) : cokernelMap (0 : P ⟶ Q) n = 0 := by
proof · 4 lines
  apply LinearMap.ext
  intro x
  obtain ⟨y, rfl⟩ := Submodule.mkQ_surjective (LinearMap.range (P.d (n + 1) n).hom) x
  exact map_zero (LinearMap.range (Q.d (n + 1) n).hom).mkQ
217
theorem cokernelMap_surjective (hP : TotallyAcyclicComplex P)
    (hQ : ExactProjectiveComplex Q) : Function.Surjective (fun F : P ⟶ Q => cokernelMap F 0) := by
proof · 7 lines
  intro u
  obtain ⟨F, hF⟩ := lift_cokernels hP hQ u
  refine ⟨F, ?_⟩
  apply LinearMap.ext
  intro x
  obtain ⟨y, rfl⟩ := Submodule.mkQ_surjective (LinearMap.range (P.d 1 0).hom) x
  exact DFunLike.congr_fun hF y