Copyright (c) 2022 Julian Kuelshammer. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Julian Kuelshammer
import Mathlib.CategoryTheory.Preadditive.Basic
import Mathlib.CategoryTheory.Endofunctor.Algebra
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
# Preadditive structure on algebras over a monad
If `C` is a preadditive category and `F` is an additive endofunctor on `C` then `Algebra F` is
also preadditive. Dually, the category `Coalgebra F` is also preadditive.
-- morphism levels before object levels. See note [category_theory universes].
variable (C : Type u₁) [Category.{v₁} C] [Preadditive C] (F : C ⥤ C) [Functor.Additive (F : C ⥤ C)]
open CategoryTheory.Limits Preadditive
/-- The category of algebras over an additive endofunctor on a preadditive category is preadditive.
instance Endofunctor.algebraPreadditive : Preadditive (Endofunctor.Algebra F) where
h := by simp only [Functor.map_add, add_comp, Endofunctor.Algebra.Hom.h, comp_add] }
h := by simp only [Functor.map_zero, zero_comp, comp_zero] }
h := by rw [comp_nsmul, Functor.map_nsmul, nsmul_comp, Endofunctor.Algebra.Hom.h] }
h := by simp only [Functor.map_neg, neg_comp, Endofunctor.Algebra.Hom.h, comp_neg] }
h := by simp only [Functor.map_sub, sub_comp, Endofunctor.Algebra.Hom.h, comp_sub] }
h := by rw [comp_zsmul, Functor.map_zsmul, zsmul_comp, Endofunctor.Algebra.Hom.h] }
simp only [natCast_zsmul, succ_nsmul]
simp only [negSucc_zsmul, neg_inj, ← Nat.cast_smul_eq_nsmul ℤ]
instance Algebra.forget_additive : (Endofunctor.Algebra.forget F).Additive where
instance Endofunctor.coalgebraPreadditive : Preadditive (Endofunctor.Coalgebra F) where
h := by simp only [Functor.map_add, comp_add, Endofunctor.Coalgebra.Hom.h, add_comp] }
h := by simp only [Functor.map_zero, zero_comp, comp_zero] }
h := by rw [Functor.map_nsmul, comp_nsmul, Endofunctor.Coalgebra.Hom.h, nsmul_comp] }
h := by simp only [Functor.map_neg, comp_neg, Endofunctor.Coalgebra.Hom.h, neg_comp] }
h := by simp only [Functor.map_sub, comp_sub, Endofunctor.Coalgebra.Hom.h, sub_comp] }
h := by rw [Functor.map_zsmul, comp_zsmul, Endofunctor.Coalgebra.Hom.h, zsmul_comp] }
simp only [natCast_zsmul, succ_nsmul]
simp only [negSucc_zsmul, neg_inj, ← Nat.cast_smul_eq_nsmul ℤ]
instance Coalgebra.forget_additive : (Endofunctor.Coalgebra.forget F).Additive where