-
Notifications
You must be signed in to change notification settings - Fork 384
/
Copy pathDifferentialObject.lean
140 lines (116 loc) · 4.79 KB
/
DifferentialObject.lean
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/-
Copyright (c) 2021 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.Algebra.Homology.HomologicalComplex
import Mathlib.CategoryTheory.DifferentialObject
/-!
# Homological complexes are differential graded objects.
We verify that a `HomologicalComplex` indexed by an `AddCommGroup` is
essentially the same thing as a differential graded object.
This equivalence is probably not particularly useful in practice;
it's here to check that definitions match up as expected.
-/
open CategoryTheory CategoryTheory.Limits
noncomputable section
/-!
We first prove some results about differential graded objects.
Porting note: after the port, move these to their own file.
-/
namespace CategoryTheory.DifferentialObject
variable {β : Type*} [AddCommGroup β] {b : β}
variable {V : Type*} [Category V] [HasZeroMorphisms V]
variable (X : DifferentialObject ℤ (GradedObjectWithShift b V))
/-- Since `eqToHom` only preserves the fact that `X.X i = X.X j` but not `i = j`, this definition
is used to aid the simplifier. -/
abbrev objEqToHom {i j : β} (h : i = j) :
X.obj i ⟶ X.obj j :=
eqToHom (congr_arg X.obj h)
@[simp]
theorem objEqToHom_refl (i : β) : X.objEqToHom (refl i) = 𝟙 _ :=
rfl
@[reassoc (attr := simp)]
theorem objEqToHom_d {x y : β} (h : x = y) :
X.objEqToHom h ≫ X.d y = X.d x ≫ X.objEqToHom (by cases h; rfl) := by cases h; dsimp; simp
@[reassoc (attr := simp)]
theorem d_squared_apply {x : β} : X.d x ≫ X.d _ = 0 := congr_fun X.d_squared _
@[reassoc (attr := simp)]
theorem eqToHom_f' {X Y : DifferentialObject ℤ (GradedObjectWithShift b V)} (f : X ⟶ Y) {x y : β}
(h : x = y) : X.objEqToHom h ≫ f.f y = f.f x ≫ Y.objEqToHom h := by cases h; simp
end CategoryTheory.DifferentialObject
open CategoryTheory.DifferentialObject
namespace HomologicalComplex
variable {β : Type*} [AddCommGroup β] (b : β)
variable (V : Type*) [Category V] [HasZeroMorphisms V]
-- Porting note: this should be moved to an earlier file.
-- Porting note: simpNF linter silenced, both `d_eqToHom` and its `_assoc` version
-- do not simplify under themselves
@[reassoc (attr := simp, nolint simpNF)]
theorem d_eqToHom (X : HomologicalComplex V (ComplexShape.up' b)) {x y z : β} (h : y = z) :
X.d x y ≫ eqToHom (congr_arg X.X h) = X.d x z := by cases h; simp
open Classical in
set_option maxHeartbeats 400000 in
/-- The functor from differential graded objects to homological complexes.
-/
@[simps]
def dgoToHomologicalComplex :
DifferentialObject ℤ (GradedObjectWithShift b V) ⥤
HomologicalComplex V (ComplexShape.up' b) where
obj X :=
{ X := fun i => X.obj i
d := fun i j =>
if h : i + b = j then X.d i ≫ X.objEqToHom (show i + (1 : ℤ) • b = j by simp [h]) else 0
shape := fun i j w => by dsimp at w; convert dif_neg w
d_comp_d' := fun i j k hij hjk => by
dsimp at hij hjk; substs hij hjk
simp }
map {X Y} f :=
{ f := f.f
comm' := fun i j h => by
dsimp at h ⊢
subst h
simp only [dite_true, Category.assoc, eqToHom_f']
-- Porting note: this `rw` used to be part of the `simp`.
have : f.f i ≫ Y.d i = X.d i ≫ f.f _ := (congr_fun f.comm i).symm
rw [reassoc_of% this] }
/-- The functor from homological complexes to differential graded objects.
-/
@[simps]
def homologicalComplexToDGO :
HomologicalComplex V (ComplexShape.up' b) ⥤
DifferentialObject ℤ (GradedObjectWithShift b V) where
obj X :=
{ obj := fun i => X.X i
d := fun i => X.d i _ }
map {X Y} f := { f := f.f }
/-- The unit isomorphism for `dgoEquivHomologicalComplex`.
-/
@[simps!]
def dgoEquivHomologicalComplexUnitIso :
𝟭 (DifferentialObject ℤ (GradedObjectWithShift b V)) ≅
dgoToHomologicalComplex b V ⋙ homologicalComplexToDGO b V :=
NatIso.ofComponents (fun X =>
{ hom := { f := fun i => 𝟙 (X.obj i) }
inv := { f := fun i => 𝟙 (X.obj i) } })
/-- The counit isomorphism for `dgoEquivHomologicalComplex`.
-/
@[simps!]
def dgoEquivHomologicalComplexCounitIso :
homologicalComplexToDGO b V ⋙ dgoToHomologicalComplex b V ≅
𝟭 (HomologicalComplex V (ComplexShape.up' b)) :=
NatIso.ofComponents (fun X =>
{ hom := { f := fun i => 𝟙 (X.X i) }
inv := { f := fun i => 𝟙 (X.X i) } })
/-- The category of differential graded objects in `V` is equivalent
to the category of homological complexes in `V`.
-/
@[simps]
def dgoEquivHomologicalComplex :
DifferentialObject ℤ (GradedObjectWithShift b V) ≌
HomologicalComplex V (ComplexShape.up' b) where
functor := dgoToHomologicalComplex b V
inverse := homologicalComplexToDGO b V
unitIso := dgoEquivHomologicalComplexUnitIso b V
counitIso := dgoEquivHomologicalComplexCounitIso b V
end HomologicalComplex