File size: 3,743 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
import Mathlib.Algebra.Homology.Single
import Mathlib.Algebra.Homology.Linear

/-! # Three Complex -/

namespace OAI.NumberTheory.PadicHodge.GeometricComparison.FirstThree.ThreeComplex.FirstThreeComplex

noncomputable section

/-! The native quotient complex retaining degrees zero, one and two. -/

open _root_.CategoryTheory _root_.CategoryTheory.Limits ZeroObject

universe u v

variable {C : Type u} [Category.{v} C] [Preadditive C] [HasZeroObject C]

def term (K : CochainComplex C ℕ) : ℕ → C
  | 0 => K.X 0
  | 1 => K.X 1
  | 2 => K.X 2
  | _ + 3 => 0

def differential (K : CochainComplex C ℕ) : ∀ n, term K n ⟶ term K (n + 1)
  | 0 => K.d 0 1
  | 1 => K.d 1 2
  | _ + 2 => 0

def complex (K : CochainComplex C ℕ) : CochainComplex C ℕ :=
  CochainComplex.of (term K) (differential K) (by
    intro n
    rcases n with _ | (_ | n)
    · exact K.d_comp_d 0 1 2
    · exact comp_zero
    · exact zero_comp)

def projectionTerm (K : CochainComplex C ℕ) : ∀ n, K.X n ⟶ term K n
  | 0 => 𝟙 _
  | 1 => 𝟙 _
  | 2 => 𝟙 _
  | _ + 3 => 0

def projection (K : CochainComplex C ℕ) : K ⟶ complex K where
  f n := projectionTerm K n
  comm' n m hnm := by
    change n + 1 = m at hnm
    subst m
    rw [show (complex K).d n (n + 1) = differential K n from CochainComplex.of_d _ _ n]
    rcases n with _ | (_ | n)
    · exact (Category.id_comp _).trans (Category.comp_id _).symm
    · exact (Category.id_comp _).trans (Category.comp_id _).symm
    · exact (isZero_zero C).eq_of_tgt _ _

def mapTerm {K L : CochainComplex C ℕ} (f : K ⟶ L) : ∀ n, term K n ⟶ term L n
  | 0 => f.f 0
  | 1 => f.f 1
  | 2 => f.f 2
  | _ + 3 => 0

def map {K L : CochainComplex C ℕ} (f : K ⟶ L) : complex K ⟶ complex L where
  f n := mapTerm f n
  comm' n m hnm := by
    change n + 1 = m at hnm
    subst m
    rw [show (complex K).d n (n + 1) = differential K n from CochainComplex.of_d _ _ n,
      show (complex L).d n (n + 1) = differential L n from CochainComplex.of_d _ _ n]
    rcases n with _ | (_ | n)
    · exact f.comm 0 1
    · exact f.comm 1 2
    · exact (isZero_zero C).eq_of_tgt _ _

theorem projection_naturality {K L : CochainComplex C ℕ} (f : K ⟶ L) :
    projection K ≫ FirstThreeComplex.map f = f ≫ projection L := by
  apply HomologicalComplex.Hom.ext
  funext n
  rcases n with _ | (_ | (_ | n))
  · exact (Category.id_comp _).trans (Category.comp_id _).symm
  · exact (Category.id_comp _).trans (Category.comp_id _).symm
  · exact (Category.id_comp _).trans (Category.comp_id _).symm
  · exact zero_comp.trans comp_zero.symm

def functor (C : Type u) [Category.{v} C] [Preadditive C] [HasZeroObject C] :
    CochainComplex C ℕ ⥤ CochainComplex C ℕ where
  obj := complex
  map := FirstThreeComplex.map
  map_id K := by
    apply HomologicalComplex.Hom.ext
    funext n
    rcases n with _ | (_ | (_ | n))
    · rfl
    · rfl
    · rfl
    · exact (isZero_zero C).eq_of_tgt _ _
  map_comp f g := by
    apply HomologicalComplex.Hom.ext
    funext n
    rcases n with _ | (_ | (_ | n))
    · rfl
    · rfl
    · rfl
    · exact (isZero_zero C).eq_of_tgt _ _

instance additive : (functor C).Additive where
  map_add {K L} f g := by
    apply HomologicalComplex.Hom.ext
    funext n
    rcases n with _ | (_ | (_ | n))
    · rfl
    · rfl
    · rfl
    · exact (isZero_zero C).eq_of_tgt _ _

instance linear (R : Type*) [CommRing R] [Linear R C] : (functor C).Linear R where
  map_smul {K L} f r := by
    apply HomologicalComplex.Hom.ext
    funext n
    rcases n with _ | (_ | (_ | n))
    · rfl
    · rfl
    · rfl
    · exact (isZero_zero C).eq_of_tgt _ _

end

end OAI.NumberTheory.PadicHodge.GeometricComparison.FirstThree.ThreeComplex.FirstThreeComplex