l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem iSupLift_mk {i : ι} (x : K i) (hx : (x : A) ∈ T) :
    iSupLift K dir f hf T hT ⟨x, hx⟩ = f i x := by
  subst hT
  dsimp [iSupLift]
  

Proof state:
F : Type v'
R' : Type u'
R : Type u
A : Type v
B : Type w
C : Type w'
inst✝¹⁴ : CommSemiring R
inst✝¹³ : StarRing R
inst✝¹² : NonUnitalSemiring A
inst✝¹¹ : StarRing A
inst✝¹⁰ : Module R A
inst✝⁹ : IsScalarTower R A A
inst✝⁸ : SMulCommClass R A A
inst✝⁷ : StarModule R A
inst✝⁶ : NonUnitalSemiring B
inst✝⁵ : StarRing B
inst✝⁴ : Module R B
inst✝³ : IsScalarTower R B B
inst✝² : SMulCommClass R B B
inst✝¹ : StarModule R B
hF : NonUnitalStarAlgHomClass F R A B
S : NonUnitalStarSubalgebra R A
ι : Type u_1
inst✝ : Nonempty ι
K : ι → NonUnitalStarSubalgebra R A
dir : Directed (fun x x_1 => x ≤ x_1) K
f : (i : ι) → ↥(K i) →⋆ₙₐ[R] B
hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalStarAlgHom.comp (f j) (inclusion h)
i : ι
x : ↥(K i)
hx : ↑x ∈ iSup K
⊢ Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
      (_ :
        ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
          (fun i x => (f i) x) i { val := x, property := hxi } = (fun i x => (f i) x) j { val := x, property := hxj })
      ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) { val := ↑x, property := hx } =
    (f i) x

Next tactic:
apply Set.iUnionLift_mk
theorem iSupLift_of_mem {i : ι} (x : T) (hx : (x : A) ∈ K i) :
    iSupLift K dir f hf T hT x = f i ⟨x, hx⟩ := by
  

Proof state:
F : Type v'
R' : Type u'
R : Type u
A : Type v
B : Type w
C : Type w'
inst✝¹⁴ : CommSemiring R
inst✝¹³ : StarRing R
inst✝¹² : NonUnitalSemiring A
inst✝¹¹ : StarRing A
inst✝¹⁰ : Module R A
inst✝⁹ : IsScalarTower R A A
inst✝⁸ : SMulCommClass R A A
inst✝⁷ : StarModule R A
inst✝⁶ : NonUnitalSemiring B
inst✝⁵ : StarRing B
inst✝⁴ : Module R B
inst✝³ : IsScalarTower R B B
inst✝² : SMulCommClass R B B
inst✝¹ : StarModule R B
hF : NonUnitalStarAlgHomClass F R A B
S : NonUnitalStarSubalgebra R A
ι : Type u_1
inst✝ : Nonempty ι
K : ι → NonUnitalStarSubalgebra R A
dir : Directed (fun x x_1 => x ≤ x_1) K
f : (i : ι) → ↥(K i) →⋆ₙₐ[R] B
hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalStarAlgHom.comp (f j) (inclusion h)
T : NonUnitalStarSubalgebra R A
hT : T = iSup K
i : ι
x : ↥T
hx : ↑x ∈ K i
⊢ (iSupLift K dir f hf T hT) x = (f i) { val := ↑x, property := hx }

Next tactic:
subst hT
theorem iSupLift_of_mem {i : ι} (x : T) (hx : (x : A) ∈ K i) :
    iSupLift K dir f hf T hT x = f i ⟨x, hx⟩ := by
  subst hT
  

Proof state:
F : Type v'
R' : Type u'
R : Type u
A : Type v
B : Type w
C : Type w'
inst✝¹⁴ : CommSemiring R
inst✝¹³ : StarRing R
inst✝¹² : NonUnitalSemiring A
inst✝¹¹ : StarRing A
inst✝¹⁰ : Module R A
inst✝⁹ : IsScalarTower R A A
inst✝⁸ : SMulCommClass R A A
inst✝⁷ : StarModule R A
inst✝⁶ : NonUnitalSemiring B
inst✝⁵ : StarRing B
inst✝⁴ : Module R B
inst✝³ : IsScalarTower R B B
inst✝² : SMulCommClass R B B
inst✝¹ : StarModule R B
hF : NonUnitalStarAlgHomClass F R A B
S : NonUnitalStarSubalgebra R A
ι : Type u_1
inst✝ : Nonempty ι
K : ι → NonUnitalStarSubalgebra R A
dir : Directed (fun x x_1 => x ≤ x_1) K
f : (i : ι) → ↥(K i) →⋆ₙₐ[R] B
hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalStarAlgHom.comp (f j) (inclusion h)
i : ι
x : ↥(iSup K)
hx : ↑x ∈ K i
⊢ (iSupLift K dir f hf (iSup K) (_ : iSup K = iSup K)) x = (f i) { val := ↑x, property := hx }

Next tactic:
dsimp [iSupLift]
theorem iSupLift_of_mem {i : ι} (x : T) (hx : (x : A) ∈ K i) :
    iSupLift K dir f hf T hT x = f i ⟨x, hx⟩ := by
  subst hT
  dsimp [iSupLift]
  

Proof state:
F : Type v'
R' : Type u'
R : Type u
A : Type v
B : Type w
C : Type w'
inst✝¹⁴ : CommSemiring R
inst✝¹³ : StarRing R
inst✝¹² : NonUnitalSemiring A
inst✝¹¹ : StarRing A
inst✝¹⁰ : Module R A
inst✝⁹ : IsScalarTower R A A
inst✝⁸ : SMulCommClass R A A
inst✝⁷ : StarModule R A
inst✝⁶ : NonUnitalSemiring B
inst✝⁵ : StarRing B
inst✝⁴ : Module R B
inst✝³ : IsScalarTower R B B
inst✝² : SMulCommClass R B B
inst✝¹ : StarModule R B
hF : NonUnitalStarAlgHomClass F R A B
S : NonUnitalStarSubalgebra R A
ι : Type u_1
inst✝ : Nonempty ι
K : ι → NonUnitalStarSubalgebra R A
dir : Directed (fun x x_1 => x ≤ x_1) K
f : (i : ι) → ↥(K i) →⋆ₙₐ[R] B
hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalStarAlgHom.comp (f j) (inclusion h)
i : ι
x : ↥(iSup K)
hx : ↑x ∈ K i
⊢ Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
      (_ :
        ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
          (fun i x => (f i) x) i { val := x, property := hxi } = (fun i x => (f i) x) j { val := x, property := hxj })
      ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) x =
    (f i) { val := ↑x, property := hx }

Next tactic:
apply Set.iUnionLift_of_mem
theorem mem_centralizer_iff {s : Set A} {z : A} :
    z ∈ centralizer R s ↔ ∀ g ∈ s, g * z = z * g ∧ star g * z = z * star g := by
  

Proof state:
F : Type v'
R' : Type u'
R : Type u
A : Type v
B : Type w
C : Type w'
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : NonUnitalSemiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Module R A
inst✝⁸ : IsScalarTower R A A
inst✝⁷ : SMulCommClass R A A
inst✝⁶ : StarModule R A
inst✝⁵ : NonUnitalSemiring B
inst✝⁴ : StarRing B
inst✝³ : Module R B
inst✝² : IsScalarTower R B B
inst✝¹ : SMulCommClass R B B
inst✝ : StarModule R B
hF : NonUnitalStarAlgHomClass F R A B
S : NonUnitalStarSubalgebra R A
s : Set A
z : A
⊢ z ∈ centralizer R s ↔ ∀ g ∈ s, g * z = z * g ∧ star g * z = z * star g

Next tactic:
show (∀ g ∈ s ∪ star s, g * z = z * g) ↔ ∀ g ∈ s, g * z = z * g ∧ star g * z = z * star g
theorem mem_centralizer_iff {s : Set A} {z : A} :
    z ∈ centralizer R s ↔ ∀ g ∈ s, g * z = z * g ∧ star g * z = z * star g := by
  show (∀ g ∈ s ∪ star s, g * z = z * g) ↔ ∀ g ∈ s, g * z = z * g ∧ star g * z = z * star g
  

Proof state:
F : Type v'
R' : Type u'
R : Type u
A : Type v
B : Type w
C : Type w'
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : NonUnitalSemiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Module R A
inst✝⁸ : IsScalarTower R A A
inst✝⁷ : SMulCommClass R A A
inst✝⁶ : StarModule R A
inst✝⁵ : NonUnitalSemiring B
inst✝⁴ : StarRing B
inst✝³ : Module R B
inst✝² : IsScalarTower R B B
inst✝¹ : SMulCommClass R B B
inst✝ : StarModule R B
hF : NonUnitalStarAlgHomClass F R A B
S : NonUnitalStarSubalgebra R A
s : Set A
z : A
⊢ (∀ g ∈ s ∪ star s, g * z = z * g) ↔ ∀ g ∈ s, g * z = z * g ∧ star g * z = z * star g

Next tactic:
simp only [Set.mem_union, or_imp, forall_and, and_congr_right_iff]
theorem mem_centralizer_iff {s : Set A} {z : A} :
    z ∈ centralizer R s ↔ ∀ g ∈ s, g * z = z * g ∧ star g * z = z * star g := by
  show (∀ g ∈ s ∪ star s, g * z = z * g) ↔ ∀ g ∈ s, g * z = z * g ∧ star g * z = z * star g
  simp only [Set.mem_union, or_imp, forall_and, and_congr_right_iff]
  

Proof state:
F : Type v'
R' : Type u'
R : Type u
A : Type v
B : Type w
C : Type w'
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : NonUnitalSemiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Module R A
inst✝⁸ : IsScalarTower R A A
inst✝⁷ : SMulCommClass R A A
inst✝⁶ : StarModule R A
inst✝⁵ : NonUnitalSemiring B
inst✝⁴ : StarRing B
inst✝³ : Module R B
inst✝² : IsScalarTower R B B
inst✝¹ : SMulCommClass R B B
inst✝ : StarModule R B
hF : NonUnitalStarAlgHomClass F R A B
S : NonUnitalStarSubalgebra R A
s : Set A
z : A
⊢ (∀ x ∈ s, x * z = z * x) → ((∀ x ∈ star s, x * z = z * x) ↔ ∀ x ∈ s, star x * z = z * star x)

Next tactic:
exact fun _ =>
    ⟨fun hz a ha => hz _ (Set.star_mem_star.mpr ha), fun hz a ha => star_star a ▸ hz _ ha⟩
@[simp]
theorem centralizer_univ : centralizer R Set.univ = center R A :=
  SetLike.ext' <| by 

Proof state:
F : Type v'
R' : Type u'
R : Type u
A : Type v
B : Type w
C : Type w'
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : NonUnitalSemiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Module R A
inst✝⁸ : IsScalarTower R A A
inst✝⁷ : SMulCommClass R A A
inst✝⁶ : StarModule R A
inst✝⁵ : NonUnitalSemiring B
inst✝⁴ : StarRing B
inst✝³ : Module R B
inst✝² : IsScalarTower R B B
inst✝¹ : SMulCommClass R B B
inst✝ : StarModule R B
hF : NonUnitalStarAlgHomClass F R A B
S : NonUnitalStarSubalgebra R A
⊢ ↑(centralizer R Set.univ) = ↑(center R A)

Next tactic:
rw [coe_centralizer, Set.univ_union, coe_center, Set.centralizer_univ]
@[simp]
theorem map_id (P : PresheafOfModules R) (X : Cᵒᵖ) :
    P.map (𝟙 X) = LinearMap.id' := by
  

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P : PresheafOfModules R
X : Cᵒᵖ
⊢ map P (𝟙 X) = id'

Next tactic:
ext
@[simp]
theorem map_id (P : PresheafOfModules R) (X : Cᵒᵖ) :
    P.map (𝟙 X) = LinearMap.id' := by
  ext
  

Proof state:
case h
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P : PresheafOfModules R
X : Cᵒᵖ
x✝ : ↑(obj P X)
⊢ (map P (𝟙 X)) x✝ = id' x✝

Next tactic:
simp
@[simp]
theorem map_comp (P : PresheafOfModules R) {X Y Z : Cᵒᵖ} (f : X ⟶ Y) (g : Y ⟶ Z) :
    P.map (f ≫ g) = (P.map g).comp (P.map f) := by
  

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P : PresheafOfModules R
X Y Z : Cᵒᵖ
f : X ⟶ Y
g : Y ⟶ Z
⊢ map P (f ≫ g) = comp (map P g) (map P f)

Next tactic:
ext
@[simp]
theorem map_comp (P : PresheafOfModules R) {X Y Z : Cᵒᵖ} (f : X ⟶ Y) (g : Y ⟶ Z) :
    P.map (f ≫ g) = (P.map g).comp (P.map f) := by
  ext
  

Proof state:
case h
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P : PresheafOfModules R
X Y Z : Cᵒᵖ
f : X ⟶ Y
g : Y ⟶ Z
x✝ : ↑(obj P X)
⊢ (map P (f ≫ g)) x✝ = (comp (map P g) (map P f)) x✝

Next tactic:
simp
/-- Composition of morphisms of presheaves of modules. -/
def comp {P Q R : PresheafOfModules R} (f : Hom P Q) (g : Hom Q R) : Hom P R where
  hom := f.hom ≫ g.hom
  map_smul _ _ _ := by 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R✝ : Cᵒᵖ ⥤ RingCat
P Q R : PresheafOfModules R✝
f : Hom P Q
g : Hom Q R
x✝² : Cᵒᵖ
x✝¹ : ↑(R✝.obj x✝²)
x✝ : ↑(P.presheaf.obj x✝²)
⊢ ((f.hom ≫ g.hom).app x✝²) (x✝¹ • x✝) = x✝¹ • ((f.hom ≫ g.hom).app x✝²) x✝

Next tactic:
simp [Hom.map_smul]
@[ext]
theorem ext {f g : P ⟶ Q} (w : ∀ X, f.app X = g.app X) : f = g := by
  

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
f g : P ⟶ Q
w : ∀ (X : Cᵒᵖ), app f X = app g X
⊢ f = g

Next tactic:
cases f
@[ext]
theorem ext {f g : P ⟶ Q} (w : ∀ X, f.app X = g.app X) : f = g := by
  cases f; 

Proof state:
case mk
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
g : P ⟶ Q
hom✝ : P.presheaf ⟶ Q.presheaf
map_smul✝ : ∀ (X : Cᵒᵖ) (r : ↑(R.obj X)) (x : ↑(P.presheaf.obj X)), (hom✝.app X) (r • x) = r • (hom✝.app X) x
w : ∀ (X : Cᵒᵖ), app { hom := hom✝, map_smul := map_smul✝ } X = app g X
⊢ { hom := hom✝, map_smul := map_smul✝ } = g

Next tactic:
cases g
@[ext]
theorem ext {f g : P ⟶ Q} (w : ∀ X, f.app X = g.app X) : f = g := by
  cases f; cases g
  

Proof state:
case mk.mk
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
hom✝¹ : P.presheaf ⟶ Q.presheaf
map_smul✝¹ : ∀ (X : Cᵒᵖ) (r : ↑(R.obj X)) (x : ↑(P.presheaf.obj X)), (hom✝¹.app X) (r • x) = r • (hom✝¹.app X) x
hom✝ : P.presheaf ⟶ Q.presheaf
map_smul✝ : ∀ (X : Cᵒᵖ) (r : ↑(R.obj X)) (x : ↑(P.presheaf.obj X)), (hom✝.app X) (r • x) = r • (hom✝.app X) x
w : ∀ (X : Cᵒᵖ), app { hom := hom✝¹, map_smul := map_smul✝¹ } X = app { hom := hom✝, map_smul := map_smul✝ } X
⊢ { hom := hom✝¹, map_smul := map_smul✝¹ } = { hom := hom✝, map_smul := map_smul✝ }

Next tactic:
congr
@[ext]
theorem ext {f g : P ⟶ Q} (w : ∀ X, f.app X = g.app X) : f = g := by
  cases f; cases g
  congr
  

Proof state:
case mk.mk.e_hom
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
hom✝¹ : P.presheaf ⟶ Q.presheaf
map_smul✝¹ : ∀ (X : Cᵒᵖ) (r : ↑(R.obj X)) (x : ↑(P.presheaf.obj X)), (hom✝¹.app X) (r • x) = r • (hom✝¹.app X) x
hom✝ : P.presheaf ⟶ Q.presheaf
map_smul✝ : ∀ (X : Cᵒᵖ) (r : ↑(R.obj X)) (x : ↑(P.presheaf.obj X)), (hom✝.app X) (r • x) = r • (hom✝.app X) x
w : ∀ (X : Cᵒᵖ), app { hom := hom✝¹, map_smul := map_smul✝¹ } X = app { hom := hom✝, map_smul := map_smul✝ } X
⊢ hom✝¹ = hom✝

Next tactic:
ext X x
@[ext]
theorem ext {f g : P ⟶ Q} (w : ∀ X, f.app X = g.app X) : f = g := by
  cases f; cases g
  congr
  ext X x
  

Proof state:
case mk.mk.e_hom.w.h.w
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
hom✝¹ : P.presheaf ⟶ Q.presheaf
map_smul✝¹ : ∀ (X : Cᵒᵖ) (r : ↑(R.obj X)) (x : ↑(P.presheaf.obj X)), (hom✝¹.app X) (r • x) = r • (hom✝¹.app X) x
hom✝ : P.presheaf ⟶ Q.presheaf
map_smul✝ : ∀ (X : Cᵒᵖ) (r : ↑(R.obj X)) (x : ↑(P.presheaf.obj X)), (hom✝.app X) (r • x) = r • (hom✝.app X) x
w : ∀ (X : Cᵒᵖ), app { hom := hom✝¹, map_smul := map_smul✝¹ } X = app { hom := hom✝, map_smul := map_smul✝ } X
X : Cᵒᵖ
x : ↑(P.presheaf.obj X)
⊢ (hom✝¹.app X) x = (hom✝.app X) x

Next tactic:
exact LinearMap.congr_fun (w X) x
instance : Zero (P ⟶ Q) := ⟨mk 0 (by
  

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
⊢ ∀ (X : Cᵒᵖ) (r : ↑(R.obj X)) (x : ↑(P.presheaf.obj X)), (0.app X) (r • x) = r • (0.app X) x

Next tactic:
intros
instance : Zero (P ⟶ Q) := ⟨mk 0 (by
  intros
  

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
X✝ : Cᵒᵖ
r✝ : ↑(R.obj X✝)
x✝ : ↑(P.presheaf.obj X✝)
⊢ (0.app X✝) (r✝ • x✝) = r✝ • (0.app X✝) x✝

Next tactic:
simp only [Limits.zero_app, AddMonoidHom.zero_apply, smul_zero]
instance : Add (P ⟶ Q) := ⟨fun f g => mk (f.hom + g.hom) (by
  

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
f g : P ⟶ Q
⊢ ∀ (X : Cᵒᵖ) (r : ↑(R.obj X)) (x : ↑(P.presheaf.obj X)),
    ((f.hom + g.hom).app X) (r • x) = r • ((f.hom + g.hom).app X) x

Next tactic:
intros
instance : Add (P ⟶ Q) := ⟨fun f g => mk (f.hom + g.hom) (by
  intros
  

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
f g : P ⟶ Q
X✝ : Cᵒᵖ
r✝ : ↑(R.obj X✝)
x✝ : ↑(P.presheaf.obj X✝)
⊢ ((f.hom + g.hom).app X✝) (r✝ • x✝) = r✝ • ((f.hom + g.hom).app X✝) x✝

Next tactic:
simp only [NatTrans.app_add, AddCommGroupCat.hom_add_apply, map_smul, smul_add]
instance : Sub (P ⟶ Q) := ⟨fun f g => mk (f.hom - g.hom) (by
  

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
f g : P ⟶ Q
⊢ ∀ (X : Cᵒᵖ) (r : ↑(R.obj X)) (x : ↑(P.presheaf.obj X)),
    ((f.hom - g.hom).app X) (r • x) = r • ((f.hom - g.hom).app X) x

Next tactic:
intros
instance : Sub (P ⟶ Q) := ⟨fun f g => mk (f.hom - g.hom) (by
  intros
  

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
f g : P ⟶ Q
X✝ : Cᵒᵖ
r✝ : ↑(R.obj X✝)
x✝ : ↑(P.presheaf.obj X✝)
⊢ ((f.hom - g.hom).app X✝) (r✝ • x✝) = r✝ • ((f.hom - g.hom).app X✝) x✝

Next tactic:
rw [NatTrans.app_sub, AddMonoidHom.sub_apply, AddMonoidHom.sub_apply,
    smul_sub, map_smul, map_smul]
instance : Neg (P ⟶ Q) := ⟨fun f => mk (-f.hom) (by
  

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
f : P ⟶ Q
⊢ ∀ (X : Cᵒᵖ) (r : ↑(R.obj X)) (x : ↑(P.presheaf.obj X)), ((-f.hom).app X) (r • x) = r • ((-f.hom).app X) x

Next tactic:
intros
instance : Neg (P ⟶ Q) := ⟨fun f => mk (-f.hom) (by
  intros
  

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
f : P ⟶ Q
X✝ : Cᵒᵖ
r✝ : ↑(R.obj X✝)
x✝ : ↑(P.presheaf.obj X✝)
⊢ ((-f.hom).app X✝) (r✝ • x✝) = r✝ • ((-f.hom).app X✝) x✝

Next tactic:
rw [NatTrans.app_neg, AddMonoidHom.neg_apply, AddMonoidHom.neg_apply,
    map_smul, smul_neg]
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
⊢ ∀ (a b c : P ⟶ Q), a + b + c = a + (b + c)

Next tactic:
intros
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ b✝ c✝ : P ⟶ Q
⊢ a✝ + b✝ + c✝ = a✝ + (b✝ + c✝)

Next tactic:
ext1
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; 

Proof state:
case w
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ b✝ c✝ : P ⟶ Q
X✝ : Cᵒᵖ
⊢ app (a✝ + b✝ + c✝) X✝ = app (a✝ + (b✝ + c✝)) X✝

Next tactic:
simp only [add_app, add_assoc]
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
⊢ ∀ (a : P ⟶ Q), 0 + a = a

Next tactic:
intros
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ : P ⟶ Q
⊢ 0 + a✝ = a✝

Next tactic:
ext1
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; 

Proof state:
case w
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ : P ⟶ Q
X✝ : Cᵒᵖ
⊢ app (0 + a✝) X✝ = app a✝ X✝

Next tactic:
simp only [add_app, zero_app, zero_add]
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; ext1; simp only [add_app, neg_app, add_left_neg, zero_app]
  add_zero := by 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
⊢ ∀ (a : P ⟶ Q), a + 0 = a

Next tactic:
intros
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; ext1; simp only [add_app, neg_app, add_left_neg, zero_app]
  add_zero := by intros; 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ : P ⟶ Q
⊢ a✝ + 0 = a✝

Next tactic:
ext1
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; ext1; simp only [add_app, neg_app, add_left_neg, zero_app]
  add_zero := by intros; ext1; 

Proof state:
case w
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ : P ⟶ Q
X✝ : Cᵒᵖ
⊢ app (a✝ + 0) X✝ = app a✝ X✝

Next tactic:
simp only [add_app, zero_app, add_zero]
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; ext1; simp only [add_app, neg_app, add_left_neg, zero_app]
  add_zero := by intros; ext1; simp only [add_app, zero_app, add_zero]
  add_comm := by intros; ext1; simp only [add_app]; apply add_comm
  sub_eq_add_neg := by 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
⊢ ∀ (a b : P ⟶ Q), a - b = a + -b

Next tactic:
intros
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; ext1; simp only [add_app, neg_app, add_left_neg, zero_app]
  add_zero := by intros; ext1; simp only [add_app, zero_app, add_zero]
  add_comm := by intros; ext1; simp only [add_app]; apply add_comm
  sub_eq_add_neg := by intros; 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ b✝ : P ⟶ Q
⊢ a✝ - b✝ = a✝ + -b✝

Next tactic:
ext1
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; ext1; simp only [add_app, neg_app, add_left_neg, zero_app]
  add_zero := by intros; ext1; simp only [add_app, zero_app, add_zero]
  add_comm := by intros; ext1; simp only [add_app]; apply add_comm
  sub_eq_add_neg := by intros; ext1; 

Proof state:
case w
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ b✝ : P ⟶ Q
X✝ : Cᵒᵖ
⊢ app (a✝ - b✝) X✝ = app (a✝ + -b✝) X✝

Next tactic:
simp only [add_app, sub_app, neg_app, sub_eq_add_neg]
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
⊢ ∀ (a : P ⟶ Q), -a + a = 0

Next tactic:
intros
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ : P ⟶ Q
⊢ -a✝ + a✝ = 0

Next tactic:
ext1
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; ext1; 

Proof state:
case w
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ : P ⟶ Q
X✝ : Cᵒᵖ
⊢ app (-a✝ + a✝) X✝ = app 0 X✝

Next tactic:
simp only [add_app, neg_app, add_left_neg, zero_app]
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; ext1; simp only [add_app, neg_app, add_left_neg, zero_app]
  add_zero := by intros; ext1; simp only [add_app, zero_app, add_zero]
  add_comm := by 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
⊢ ∀ (a b : P ⟶ Q), a + b = b + a

Next tactic:
intros
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; ext1; simp only [add_app, neg_app, add_left_neg, zero_app]
  add_zero := by intros; ext1; simp only [add_app, zero_app, add_zero]
  add_comm := by intros; 

Proof state:
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ b✝ : P ⟶ Q
⊢ a✝ + b✝ = b✝ + a✝

Next tactic:
ext1
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; ext1; simp only [add_app, neg_app, add_left_neg, zero_app]
  add_zero := by intros; ext1; simp only [add_app, zero_app, add_zero]
  add_comm := by intros; ext1; 

Proof state:
case w
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ b✝ : P ⟶ Q
X✝ : Cᵒᵖ
⊢ app (a✝ + b✝) X✝ = app (b✝ + a✝) X✝

Next tactic:
simp only [add_app]
instance : AddCommGroup (P ⟶ Q) where
  add_assoc := by intros; ext1; simp only [add_app, add_assoc]
  zero_add := by intros; ext1; simp only [add_app, zero_app, zero_add]
  add_left_neg := by intros; ext1; simp only [add_app, neg_app, add_left_neg, zero_app]
  add_zero := by intros; ext1; simp only [add_app, zero_app, add_zero]
  add_comm := by intros; ext1; simp only [add_app]; 

Proof state:
case w
C : Type u₁
inst✝ : Category.{v₁, u₁} C
R : Cᵒᵖ ⥤ RingCat
P Q : PresheafOfModules R
T : PresheafOfModules R
a✝ b✝ : P ⟶ Q
X✝ : Cᵒᵖ
⊢ app a✝ X✝ + app b✝ X✝ = app b✝ X✝ + app a✝ X✝

Next tactic:
apply add_comm