Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
import algebra.homology.exact | |
import category_theory.abelian.opposite | |
import category_theory.abelian.exact | |
import category_theory.limits.constructions.epi_mono | |
import category_theory.abelian.pseudoelements | |
noncomputable theory | |
open category_theory | |
open category_theory.limits | |
universes w v u | |
namespace list | |
variables {Ξ± : Type*} (a : Ξ±) (L : list Ξ±) (m n : β) | |
/-- Returns the sublist of `L` starting at index `m` of length `n` | |
(or shorter, if `L` is too short). -/ | |
def extract := (L.drop m).take n | |
@[simp] lemma extract_nil : [].extract m n = ([] : list Ξ±) := | |
by { cases n, refl, cases m, refl, refl } | |
@[simp] lemma extract_zero_right : L.extract m 0 = [] := rfl | |
@[simp] lemma extract_cons_succ_left : (a :: L).extract m.succ n = L.extract m n := rfl | |
end list | |
example : [0,1,2,3,4,5,6,7,8,9].extract 4 3 = [4,5,6] := rfl | |
namespace category_theory | |
variables (π : Type u) [category.{v} π] | |
variables [has_zero_morphisms π] [has_images π] [has_kernels π] | |
variables {π : Type u} [category.{v} π] [abelian π] | |
namespace exact -- move this | |
variables {A B C : π} (f : A βΆ B) (g : B βΆ C) | |
def kernel_op_iso : (kernel f.op).unop β cokernel f := | |
{ hom := (kernel.lift _ (cokernel.Ο f).op begin | |
simp [β op_comp, limits.cokernel.condition], | |
end).unop β« eq_to_hom (opposite.unop_op (cokernel f)), | |
inv := cokernel.desc _ (eq_to_hom (opposite.unop_op B).symm β« (kernel.ΞΉ f.op).unop) begin | |
dsimp, | |
rw [category.id_comp, β f.unop_op, β unop_comp, f.unop_op, kernel.condition], | |
refl, | |
end, | |
hom_inv_id' := begin | |
dsimp, | |
simp, | |
rw [β unop_id, β (cokernel.desc f (kernel.ΞΉ f.op).unop _).unop_op, β unop_comp], | |
congr' 1, | |
apply limits.equalizer.hom_ext, | |
dsimp, | |
simp [β op_comp], | |
end, | |
inv_hom_id' := begin | |
apply limits.coequalizer.hom_ext, | |
dsimp, | |
simp [β unop_comp], | |
end } | |
def cokernel_op_iso : (cokernel f.op).unop β kernel f := | |
{ hom := kernel.lift _ ((cokernel.Ο f.op).unop β« eq_to_hom (opposite.unop_op _)) begin | |
simp only [eq_to_hom_refl, category.comp_id], | |
rw [β f.unop_op, β unop_comp, f.op.op_unop, cokernel.condition], | |
refl, | |
end, | |
inv := eq_to_hom (opposite.unop_op _).symm β« (cokernel.desc _ (kernel.ΞΉ f).op (by simp [β op_comp])).unop, | |
hom_inv_id' := begin | |
simp only [category.id_comp, eq_to_hom_refl, category.comp_id, β unop_id, β unop_comp], | |
rw [β (kernel.lift f (cokernel.Ο f.op).unop _).unop_op, β unop_comp], | |
congr' 1, | |
apply limits.coequalizer.hom_ext, | |
dsimp, | |
simp [β op_comp], | |
end, | |
inv_hom_id' := begin | |
apply limits.equalizer.hom_ext, | |
dsimp, | |
simp [β unop_comp] | |
end } . | |
@[simp] | |
lemma kernel.ΞΉ_op : (kernel.ΞΉ f.op).unop = | |
eq_to_hom (opposite.unop_op _) β« cokernel.Ο f β« (kernel_op_iso f).inv := | |
begin | |
dsimp [kernel_op_iso], | |
simp, | |
end | |
@[simp] | |
lemma cokernel.Ο_op : (cokernel.Ο f.op).unop = | |
(cokernel_op_iso f).hom β« kernel.ΞΉ f β« eq_to_hom (opposite.unop_op _).symm := | |
begin | |
dsimp [cokernel_op_iso], | |
simp, | |
end | |
variables {f g} | |
lemma op (h : exact f g) : exact g.op f.op := | |
begin | |
rw abelian.exact_iff, | |
refine β¨_, _β©, | |
{ simp only [β op_comp, h.w, op_zero], }, | |
apply_fun quiver.hom.unop, | |
swap, { exact quiver.hom.unop_inj }, | |
simp only [h, unop_comp, cokernel.Ο_op, eq_to_hom_refl, kernel.ΞΉ_op, category.id_comp, | |
category.assoc, kernel_comp_cokernel_assoc, zero_comp, comp_zero, unop_zero], | |
end | |
variables (f g) | |
def kernel_unop_iso {C B : πα΅α΅} (f : C βΆ B) : opposite.op (kernel f.unop) β cokernel f := | |
{ hom := (kernel.lift _ (cokernel.Ο f).unop (by simp [β unop_comp])).op β« | |
eq_to_hom (opposite.op_unop (cokernel f)), | |
inv := cokernel.desc _ (eq_to_hom (opposite.op_unop _).symm β« (kernel.ΞΉ f.unop).op) begin | |
dsimp, | |
rw [β f.op_unop, category.id_comp, β op_comp, f.op_unop, kernel.condition], | |
refl, | |
end, | |
hom_inv_id' := begin | |
dsimp, | |
simp, | |
rw [β (cokernel.desc f (kernel.ΞΉ f.unop).op _).op_unop, β op_comp, β op_id], | |
congr' 1, | |
apply limits.equalizer.hom_ext, | |
dsimp, | |
simp [β unop_comp], | |
end, | |
inv_hom_id' := begin | |
apply limits.coequalizer.hom_ext, | |
dsimp, | |
simp [β op_comp], | |
end } | |
def cokernel_unop_iso {C B : πα΅α΅} (f : C βΆ B) : opposite.op (cokernel f.unop) β kernel f := | |
{ hom := kernel.lift _ ((cokernel.Ο f.unop).op β« eq_to_hom (opposite.op_unop _)) begin | |
dsimp, | |
rw [β f.op_unop, category.comp_id, β op_comp, f.op_unop, cokernel.condition], | |
refl, | |
end, | |
inv := eq_to_hom (opposite.op_unop _).symm β« | |
(cokernel.desc _ (kernel.ΞΉ f).unop (by simp [β unop_comp])).op, | |
hom_inv_id' := begin | |
dsimp, | |
rw category.id_comp, | |
rw [β (kernel.lift f ((cokernel.Ο f.unop).op β« π C) _).op_unop, β op_comp, β op_id], | |
congr' 1, | |
apply limits.coequalizer.hom_ext, | |
dsimp, | |
simp [β unop_comp], | |
end, | |
inv_hom_id' := begin | |
apply limits.equalizer.hom_ext, | |
dsimp, | |
simp [β op_comp] | |
end } | |
@[simp] | |
lemma cokernel.Ο_unop {C B : πα΅α΅} (f : C βΆ B) : (cokernel.Ο f.unop).op = | |
(cokernel_unop_iso f).hom β« kernel.ΞΉ f β« eq_to_hom (opposite.op_unop _).symm := | |
begin | |
dsimp [cokernel_unop_iso], | |
simp, | |
end | |
@[simp] | |
lemma kernel.ΞΉ_unop {C B : πα΅α΅} (f : C βΆ B) : (kernel.ΞΉ f.unop).op = | |
eq_to_hom (opposite.op_unop _) β« cokernel.Ο f β« (kernel_unop_iso f).inv := | |
begin | |
dsimp [kernel_unop_iso], | |
simp, | |
end | |
lemma unop {C B A : πα΅α΅} {g : C βΆ B} {f : B βΆ A} (h : exact g f) : exact f.unop g.unop := | |
begin | |
rw abelian.exact_iff, | |
refine β¨by simp only [β unop_comp, h.w, unop_zero], _β©, | |
apply_fun quiver.hom.op, | |
swap, { exact quiver.hom.op_inj }, | |
simp [h], | |
end | |
end exact | |
/-- A sequence `[f, g, ...]` of morphisms is exact if the pair `(f,g)` is exact, | |
and the sequence `[g, ...]` is exact. | |
Recall that the pair `(f,g)` is exact if `f β« g = 0` | |
and the natural map from the image of `f` to the kernel of `g` is an epimorphism | |
(equivalently, in abelian categories: isomorphism). -/ | |
inductive exact_seq : list (arrow π) β Prop | |
| nil : exact_seq [] | |
| single : β f, exact_seq [f] | |
| cons : β {A B C : π} (f : A βΆ B) (g : B βΆ C) (hfg : exact f g) (L) (hgL : exact_seq (g :: L)), | |
exact_seq (f :: g :: L) | |
variable {π} | |
lemma exact_iff_exact_seq {A B C : π} (f : A βΆ B) (g : B βΆ C) : | |
exact f g β exact_seq π [f, g] := | |
begin | |
split, | |
{ intro h, exact exact_seq.cons f g h _ (exact_seq.single _), }, | |
{ rintro (_ | _ | β¨A, B, C, f, g, hfg, _, _ | _ | _β©), exact hfg, } | |
end | |
namespace exact_seq | |
lemma extract : β {L : list (arrow π)} (h : exact_seq π L) (m n : β), | |
exact_seq π (L.extract m n) | |
| L (nil) m n := by { rw list.extract_nil, exact nil } | |
| L (single f) m 0 := nil | |
| L (single f) 0 (n+1) := by { cases n; exact single f } | |
| L (single f) (m+1) (n+1) := by { cases m; exact nil } | |
| _ (cons f g hfg L hL) (m+1) n := extract hL m n | |
| _ (cons f g hfg L hL) 0 0 := nil | |
| _ (cons f g hfg L hL) 0 1 := single f | |
| _ (cons f g hfg L hL) 0 (n+2) := cons f g hfg (L.take n) (extract hL 0 (n+1)) | |
inductive arrow_congr : Ξ (L L' : list (arrow π)), Prop | |
| nil : arrow_congr [] [] | |
| cons : β {A B : π} {f f' : A βΆ B} {L L' : list (arrow π)} (h : f = f') (H : arrow_congr L L'), | |
arrow_congr (f :: L) (f' :: L') | |
lemma congr : β {L L' : list (arrow π)}, exact_seq π L β arrow_congr L L' β exact_seq π L' | |
| _ _ h arrow_congr.nil := exact_seq.nil | |
| _ _ h (arrow_congr.cons hβ arrow_congr.nil) := exact_seq.single _ | |
| _ _ h (arrow_congr.cons hβ ((arrow_congr.cons hβ H))) := | |
begin | |
substs hβ hβ, | |
rcases h with _ | _ | β¨A, B, C, f, g, hfg, _, hLβ©, | |
refine exact_seq.cons _ _ hfg _ (congr hL (arrow_congr.cons rfl H)), | |
end | |
lemma append : β {Lβ Lβ Lβ : list (arrow π)} | |
(hββ : exact_seq π (Lβ ++ Lβ)) (hββ : exact_seq π (Lβ ++ Lβ)) (hβ : Lβ β []), | |
exact_seq π (Lβ ++ Lβ ++ Lβ) | |
| Lβ [] Lβ hββ hββ h := (h rfl).elim | |
| [] Lβ Lβ hββ hββ h := by rwa list.nil_append | |
| (_::[]) (_::Lβ) Lβ (cons f g hfg L hL) hββ h := cons f g hfg _ hββ | |
| (_::_::Lβ) Lβ Lβ (cons f g hfg L hL) hββ h := | |
suffices exact_seq π ([f] ++ ([g] ++ Lβ ++ Lβ) ++ Lβ), { simpa only [list.append_assoc] }, | |
cons _ _ hfg _ $ | |
suffices exact_seq π ((g :: Lβ) ++ Lβ ++ Lβ), { simpa only [list.append_assoc] }, | |
append (by simpa only using hL) hββ h | |
end exact_seq | |
namespace arrow | |
open _root_.opposite | |
variables {C : Type*} [category C] | |
@[simps] | |
def op (f : arrow C) : arrow Cα΅α΅ := | |
{ left := op f.right, | |
right := op f.left, | |
hom := f.hom.op } | |
@[simps] | |
def unop (f : arrow Cα΅α΅) : arrow C := | |
{ left := unop f.right, | |
right := unop f.left, | |
hom := f.hom.unop } | |
@[simp] lemma op_unop (f : arrow C) : f.op.unop = f := by { cases f, dsimp [op, unop], refl } | |
@[simp] lemma unop_op (f : arrow Cα΅α΅) : f.unop.op = f := by { cases f, dsimp [op, unop], refl } | |
@[simp] lemma op_comp_unop : (op β unop : arrow Cα΅α΅ β arrow Cα΅α΅) = id := by { ext, exact unop_op _ } | |
@[simp] lemma unop_comp_op : (unop β op : arrow C β arrow C ) = id := by { ext, exact op_unop _ } | |
end arrow | |
namespace exact_seq | |
lemma op : β {L : list (arrow π)}, exact_seq π L β exact_seq πα΅α΅ (L.reverse.map arrow.op) | |
| _ nil := nil | |
| _ (single f) := single f.op | |
| _ (cons f g hfg L hL) := | |
begin | |
have := op hL, | |
simp only [list.reverse_cons, list.map_append] at this β’, | |
refine this.append _ (list.cons_ne_nil _ _), | |
exact cons _ _ hfg.op _ (single _), | |
end | |
lemma unop : β {L : list (arrow πα΅α΅)}, exact_seq πα΅α΅ L β exact_seq π (L.reverse.map arrow.unop) | |
| _ nil := nil | |
| _ (single f) := single f.unop | |
| _ (cons f g hfg L hL) := | |
begin | |
have := unop hL, | |
simp only [list.reverse_cons, list.map_append] at this β’, | |
refine this.append _ (list.cons_ne_nil _ _), | |
exact cons _ _ hfg.unop _ (single _), | |
end | |
lemma of_op {L : list (arrow π)} (h : exact_seq πα΅α΅ (L.reverse.map arrow.op)) : exact_seq π L := | |
by simpa only [list.map_reverse, list.reverse_reverse, list.map_map, | |
arrow.unop_comp_op, list.map_id] using h.unop | |
lemma of_unop {L : list (arrow πα΅α΅)} (h : exact_seq π (L.reverse.map arrow.unop)) : | |
exact_seq πα΅α΅ L := | |
by simpa only [list.map_reverse, list.reverse_reverse, list.map_map, | |
arrow.op_comp_unop, list.map_id] using h.op | |
end exact_seq | |
end category_theory | |