File: Mathlib/Algebra/Category/ModuleCat/Differentials/Presheaf.lean

full_name: PresheafOfModules.Derivation
code: /-- Given a morphism of presheaves of commutative rings `φ : S ⟶ F.op ⋙ R`,
this is the type of relative `φ`-derivation of a presheaf of `R`-modules `M`. -/
@[ext]
structure Derivation where
  /-- the underlying additive map `R.obj X →+ M.obj X` of a derivation -/
  d {X : Dᵒᵖ} : R.obj X →+ M.obj X
  d_mul {X : Dᵒᵖ} (a b : R.obj X) : d (a * b) = a • d b + b • d a := by aesop_cat
  d_map {X Y : Dᵒᵖ} (f : X ⟶ Y) (x : R.obj X) :
    d (R.map f x) = M.map f (d x) := by aesop_cat
  d_app {X : Cᵒᵖ} (a : S.obj X) : d (φ.app X a) = 0 := by aesop_cat
goal: Type (max (max u u₂) v)

full_name: PresheafOfModules.Derivation.d
code: /-- Given a morphism of presheaves of commutative rings `φ : S ⟶ F.op ⋙ R`,
this is the type of relative `φ`-derivation of a presheaf of `R`-modules `M`. -/
@[ext]
structure Derivation where
  /-- the underlying additive map `R.obj X →+ M.obj X` of a derivation -/
  d {X : Dᵒᵖ} : R.obj X →+ M.obj X
  d_mul {X : Dᵒᵖ} (a b : R.obj X) : d (a * b) = a • d b + b • d a := by aesop_cat
  d_map {X Y : Dᵒᵖ} (f : X ⟶ Y) (x : R.obj X) :
    d (R.map f x) = M.map f (d x) := by aesop_cat
  d_app {X : Cᵒᵖ} (a : S.obj X) : d (φ.app X a) = 0 := by aesop_cat
goal: ↑(R.obj X) →+ ↑(M.obj X)

full_name: PresheafOfModules.Derivation.d_app
code: /-- Given a morphism of presheaves of commutative rings `φ : S ⟶ F.op ⋙ R`,
this is the type of relative `φ`-derivation of a presheaf of `R`-modules `M`. -/
@[ext]
structure Derivation where
  /-- the underlying additive map `R.obj X →+ M.obj X` of a derivation -/
  d {X : Dᵒᵖ} : R.obj X →+ M.obj X
  d_mul {X : Dᵒᵖ} (a b : R.obj X) : d (a * b) = a • d b + b • d a := by aesop_cat
  d_map {X Y : Dᵒᵖ} (f : X ⟶ Y) (x : R.obj X) :
    d (R.map f x) = M.map f (d x) := by aesop_cat
  d_app {X : Cᵒᵖ} (a : S.obj X) : d (φ.app X a) = 0 := by aesop_cat
goal: self.d ((φ.app X) a) = 0

full_name: PresheafOfModules.Derivation.d_map
code: /-- Given a morphism of presheaves of commutative rings `φ : S ⟶ F.op ⋙ R`,
this is the type of relative `φ`-derivation of a presheaf of `R`-modules `M`. -/
@[ext]
structure Derivation where
  /-- the underlying additive map `R.obj X →+ M.obj X` of a derivation -/
  d {X : Dᵒᵖ} : R.obj X →+ M.obj X
  d_mul {X : Dᵒᵖ} (a b : R.obj X) : d (a * b) = a • d b + b • d a := by aesop_cat
  d_map {X Y : Dᵒᵖ} (f : X ⟶ Y) (x : R.obj X) :
    d (R.map f x) = M.map f (d x) := by aesop_cat
  d_app {X : Cᵒᵖ} (a : S.obj X) : d (φ.app X a) = 0 := by aesop_cat
goal: self.d ((R.map f) x) = (M.map f) (self.d x)

full_name: PresheafOfModules.Derivation.d_mul
code: /-- Given a morphism of presheaves of commutative rings `φ : S ⟶ F.op ⋙ R`,
this is the type of relative `φ`-derivation of a presheaf of `R`-modules `M`. -/
@[ext]
structure Derivation where
  /-- the underlying additive map `R.obj X →+ M.obj X` of a derivation -/
  d {X : Dᵒᵖ} : R.obj X →+ M.obj X
  d_mul {X : Dᵒᵖ} (a b : R.obj X) : d (a * b) = a • d b + b • d a := by aesop_cat
  d_map {X Y : Dᵒᵖ} (f : X ⟶ Y) (x : R.obj X) :
    d (R.map f x) = M.map f (d x) := by aesop_cat
  d_app {X : Cᵒᵖ} (a : S.obj X) : d (φ.app X a) = 0 := by aesop_cat
goal: self.d (a * b) = a • self.d b + b • self.d a

full_name: PresheafOfModules.Derivation.congr_d
code: lemma congr_d {d d' : M.Derivation φ} (h : d = d') {X : Dᵒᵖ} (b : R.obj X) :
    d.d b = d'.d b 
goal: d.d b = d'.d b

full_name: PresheafOfModules.Derivation.d_one
code: @[simp] lemma d_one (X : Dᵒᵖ) : d.d (X := X) 1 = 0 
goal: d.d 1 = 0

full_name: PresheafOfModules.Derivation.postcomp_d_apply
code: /-- The postcomposition of a derivation by a morphism of presheaves of modules. -/
@[simps! d_apply]
def postcomp (f : M ⟶ N) : N.Derivation φ 
goal: ∀ {X : Dᵒᵖ} (a : ↑(R.obj X)), (d.postcomp f).d a = (PresheafOfModules.Hom.app f X) (d.d a)

full_name: PresheafOfModules.Derivation.postcomp
code: /-- The postcomposition of a derivation by a morphism of presheaves of modules. -/
@[simps! d_apply]
def postcomp (f : M ⟶ N) : N.Derivation φ 
goal: N.Derivation φ

full_name: PresheafOfModules.Derivation.Universal.postcomp_injective
code: /-- The universal property that a derivation `d : M.Derivation φ` must
satisfy so that the presheaf of modules `M` can be considered as the presheaf of
(relative) differentials of a presheaf of commutative rings `φ : S ⟶ F.op ⋙ R`. -/
structure Universal where
  /-- An absolyte derivation of `M'` descends as a morphism `M ⟶ M'`. -/
  desc {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (d' : M'.Derivation φ) : M ⟶ M'
  fac {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (d' : M'.Derivation φ) : d.postcomp (desc d') = d' := by aesop_cat
  postcomp_injective {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (φ φ' : M ⟶ M') (h : d.postcomp φ = d.postcomp φ') : φ = φ' := by aesop_cat
goal: ∀ (φ_1 φ' : M ⟶ M'), d.postcomp φ_1 = d.postcomp φ' → φ_1 = φ'

full_name: PresheafOfModules.Derivation.Universal.fac
code: /-- The universal property that a derivation `d : M.Derivation φ` must
satisfy so that the presheaf of modules `M` can be considered as the presheaf of
(relative) differentials of a presheaf of commutative rings `φ : S ⟶ F.op ⋙ R`. -/
structure Universal where
  /-- An absolyte derivation of `M'` descends as a morphism `M ⟶ M'`. -/
  desc {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (d' : M'.Derivation φ) : M ⟶ M'
  fac {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (d' : M'.Derivation φ) : d.postcomp (desc d') = d' := by aesop_cat
  postcomp_injective {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (φ φ' : M ⟶ M') (h : d.postcomp φ = d.postcomp φ') : φ = φ' := by aesop_cat
goal: d.postcomp (self.desc d') = d'

full_name: PresheafOfModules.Derivation.Universal
code: /-- The universal property that a derivation `d : M.Derivation φ` must
satisfy so that the presheaf of modules `M` can be considered as the presheaf of
(relative) differentials of a presheaf of commutative rings `φ : S ⟶ F.op ⋙ R`. -/
structure Universal where
  /-- An absolyte derivation of `M'` descends as a morphism `M ⟶ M'`. -/
  desc {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (d' : M'.Derivation φ) : M ⟶ M'
  fac {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (d' : M'.Derivation φ) : d.postcomp (desc d') = d' := by aesop_cat
  postcomp_injective {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (φ φ' : M ⟶ M') (h : d.postcomp φ = d.postcomp φ') : φ = φ' := by aesop_cat
goal: Type (max (max (max u u₂) (v + 1)) v₂)

full_name: PresheafOfModules.Derivation.Universal.desc
code: /-- The universal property that a derivation `d : M.Derivation φ` must
satisfy so that the presheaf of modules `M` can be considered as the presheaf of
(relative) differentials of a presheaf of commutative rings `φ : S ⟶ F.op ⋙ R`. -/
structure Universal where
  /-- An absolyte derivation of `M'` descends as a morphism `M ⟶ M'`. -/
  desc {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (d' : M'.Derivation φ) : M ⟶ M'
  fac {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (d' : M'.Derivation φ) : d.postcomp (desc d') = d' := by aesop_cat
  postcomp_injective {M' : PresheafOfModules (R ⋙ forget₂ CommRingCat RingCat)}
    (φ φ' : M ⟶ M') (h : d.postcomp φ = d.postcomp φ') : φ = φ' := by aesop_cat
goal: M ⟶ M'

full_name: PresheafOfModules.Derivation.instSubsingletonUniversal
code: instance : Subsingleton d.Universal 
goal: Subsingleton d.Universal

full_name: PresheafOfModules.HasDifferentials.exists_universal_derivation
code: /-- The property that there exists a universal derivation for
a morphism of presheaves of commutative rings `S ⟶ F.op ⋙ R`. -/
class HasDifferentials : Prop where
  exists_universal_derivation : ∃ (M : PresheafOfModules.{u} (R ⋙ forget₂ _ _))
      (d : M.Derivation φ), Nonempty d.Universal
goal: ∃ M d, Nonempty d.Universal

full_name: PresheafOfModules.HasDifferentials
code: /-- The property that there exists a universal derivation for
a morphism of presheaves of commutative rings `S ⟶ F.op ⋙ R`. -/
class HasDifferentials : Prop where
  exists_universal_derivation : ∃ (M : PresheafOfModules.{u} (R ⋙ forget₂ _ _))
      (d : M.Derivation φ), Nonempty d.Universal
goal: Prop

full_name: PresheafOfModules.Derivation'
code: /-- Given a morphism of presheaves of commutative rings `φ : S ⟶ R`,
this is the type of relative `φ`-derivation of a presheaf of `R`-modules `M`. -/
abbrev Derivation' : Type _ 
goal: Type (max (max u₂ u) v)

full_name: PresheafOfModules.Derivation'.d_app
code: @[simp]
nonrec lemma d_app (d : M.Derivation' φ') {X : Dᵒᵖ} (a : S'.obj X) :
    d.d (φ'.app X a) = 0 
goal: d.d ((φ'.app X) a) = 0

full_name: PresheafOfModules.Derivation'.app
code: /-- The derivation relative to the morphism of commutative rings `φ'.app X` induced by
a derivation relative to a morphism of presheaves of commutative rings. -/
noncomputable def app (d : M.Derivation' φ') (X : Dᵒᵖ) : (M.obj X).Derivation (φ'.app X) 
goal: (M.obj X).Derivation (φ'.app X)

full_name: PresheafOfModules.Derivation'.app_apply
code: @[simp]
lemma app_apply (d : M.Derivation' φ') {X : Dᵒᵖ} (b : R.obj X) :
    (d.app X).d b = d.d b 
goal: (d.app X).d b = d.d b

full_name: PresheafOfModules.Derivation'.mk
code: /-- Given a morphism of presheaves of commutative rings `φ'`, this is the
in derivation `M.Derivation' φ'` that is given by a compatible family of derivations
with values in the modules `M.obj X` for all `X`. -/
def mk : M.Derivation' φ' 
goal: M.Derivation' φ'

full_name: PresheafOfModules.Derivation'.mk_app
code: @[simp]
lemma mk_app (X : Dᵒᵖ) : (mk d d_map).app X = d X 
goal: (PresheafOfModules.Derivation'.mk d d_map).app X = d X

full_name: PresheafOfModules.Derivation'.Universal.mk
code: /-- Constructor for `Derivation.Universal` in the case `F` is the identity functor. -/
def Universal.mk {d : M.Derivation' φ'}
    (desc : ∀ {M' : PresheafOfModules (R ⋙ forget₂ _ _)}
      (_ : M'.Derivation' φ'), M ⟶ M')
    (fac : ∀ {M' : PresheafOfModules (R ⋙ forget₂ _ _)}
      (d' : M'.Derivation' φ'), d.postcomp (desc d') = d')
    (postcomp_injective : ∀ {M' : PresheafOfModules (R ⋙ forget₂ _ _)}
      (α β : M ⟶ M'), d.postcomp α = d.postcomp β → α = β) : d.Universal 
goal: PresheafOfModules.Derivation.Universal d

full_name: PresheafOfModules.DifferentialsConstruction.relativeDifferentials'BundledCore
code: /-- Auxiliary definition for `relativeDifferentials'`. -/
noncomputable def relativeDifferentials'BundledCore :
    BundledCorePresheafOfModules.{u} (R ⋙ forget₂ _ _) 
goal: BundledCorePresheafOfModules (R ⋙ CategoryTheory.forget₂ CommRingCat RingCat)

full_name: PresheafOfModules.DifferentialsConstruction.relativeDifferentials'
code: /-- The presheaf of relative differentials of a morphism of presheaves of
commutative rings. -/
noncomputable def relativeDifferentials' :
    PresheafOfModules.{u} (R ⋙ forget₂ _ _) 
goal: PresheafOfModules (R ⋙ CategoryTheory.forget₂ CommRingCat RingCat)

full_name: PresheafOfModules.DifferentialsConstruction.relativeDifferentials'_obj
code: @[simp]
lemma relativeDifferentials'_obj (X : Dᵒᵖ) :
    (relativeDifferentials' φ').obj X =
      CommRingCat.KaehlerDifferential (φ'.app X) 
goal: (PresheafOfModules.DifferentialsConstruction.relativeDifferentials' φ').obj X =
  CommRingCat.KaehlerDifferential (φ'.app X)

full_name: PresheafOfModules.DifferentialsConstruction.relativeDifferentials'_map_apply
code: lemma relativeDifferentials'_map_apply {X Y : Dᵒᵖ} (f : X ⟶ Y)
    (x : CommRingCat.KaehlerDifferential (φ'.app X)) :
    (relativeDifferentials' φ').map f x =
        CommRingCat.KaehlerDifferential.map (φ'.naturality f) x 
goal: ((PresheafOfModules.DifferentialsConstruction.relativeDifferentials' φ').map f) x =
  (CommRingCat.KaehlerDifferential.map ⋯) x

full_name: PresheafOfModules.DifferentialsConstruction.relativeDifferentials'_map_d
code: lemma relativeDifferentials'_map_d {X Y : Dᵒᵖ} (f : X ⟶ Y)
    (x : R.obj X) :
    (relativeDifferentials' φ').map f (CommRingCat.KaehlerDifferential.d x) =
      CommRingCat.KaehlerDifferential.d (R.map f x) 
goal: ((PresheafOfModules.DifferentialsConstruction.relativeDifferentials' φ').map f) (CommRingCat.KaehlerDifferential.d x) =
  CommRingCat.KaehlerDifferential.d ((R.map f) x)

full_name: PresheafOfModules.DifferentialsConstruction.derivation'
code: /-- The universal derivation. -/
noncomputable def derivation' : (relativeDifferentials' φ').Derivation' φ' 
goal: (PresheafOfModules.DifferentialsConstruction.relativeDifferentials' φ').Derivation' φ'

full_name: PresheafOfModules.DifferentialsConstruction.isUniversal'
code: /-- The derivation `derivation' φ'` is universal. -/
noncomputable def isUniversal' : (derivation' φ').Universal 
goal: PresheafOfModules.Derivation.Universal (PresheafOfModules.DifferentialsConstruction.derivation' φ')

full_name: PresheafOfModules.DifferentialsConstruction.instHasDifferentials
code: instance : HasDifferentials (F := 𝟭 D) φ' 
goal: PresheafOfModules.HasDifferentials φ'