l3lab/ntp-mathlib huggingface dataset:
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
    Cone (widePullbackDiagramOfDiagramOver B F) where
  pt := c.pt.left
  π :=
    { app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
      -- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
      naturality := fun X Y f => by
        dsimp; cases X <;> cases Y <;> cases f
        · rw [Category.id_comp, Category.comp_id]
        · rw [Over.w, Category.id_comp]
        · 

Proof state:
case some.some.id
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
val✝ : J
⊢ 𝟙 c.pt.left ≫ Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) (some val✝) =
    Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) (some val✝) ≫
      WidePullbackShape.Hom.rec (motive := fun a a_1 t =>
        some val✝ = a →
          some val✝ = a_1 →
            HEq (WidePullbackShape.Hom.id (some val✝)) t →
              (Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
                Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
        (fun X h =>
          Eq.rec (motive := fun x x_1 =>
            some val✝ = x →
              HEq (WidePullbackShape.Hom.id (some val✝)) (𝟙 x) →
                (Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
                  Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
            (fun h =>
              Eq.rec (motive := fun x x_1 =>
                (f : some val✝ ⟶ x) →
                  HEq f (𝟙 (some val✝)) →
                    (Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
                      Option.rec B (fun val => (F.obj { as := val }).left) x))
                (fun f h => 𝟙 (Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
                (_ : some val✝ = some val✝) (WidePullbackShape.Hom.id (some val✝)))
            h)
        (fun j h =>
          Eq.rec (motive := fun x x_1 =>
            (f : x ⟶ some val✝) →
              some val✝ = none →
                HEq f (WidePullbackShape.Hom.term j) →
                  (Option.rec B (fun val => (F.obj { as := val }).left) x ⟶
                    Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
            (fun f h =>
              Eq.rec (motive := fun x x_1 =>
                (f : some j ⟶ x) →
                  HEq f (WidePullbackShape.Hom.term j) →
                    ((F.obj { as := j }).left ⟶ Option.rec B (fun val => (F.obj { as := val }).left) x))
                (fun f h => (F.obj { as := j }).hom) (_ : none = some val✝) f)
            (_ : some j = some val✝) (WidePullbackShape.Hom.id (some val✝)))
        (WidePullbackShape.Hom.id (some val✝)) (_ : some val✝ = some val✝) (_ : some val✝ = some val✝)
        (_ : HEq (WidePullbackShape.Hom.id (some val✝)) (WidePullbackShape.Hom.id (some val✝)))

Next tactic:
rw [Category.id_comp, Category.comp_id]
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
    Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
  obj := conesEquivInverseObj B F
  map f :=
    { hom := f.hom.left
      w := fun j => by
        

Proof state:
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
X✝ Y✝ : Cone F
f : X✝ ⟶ Y✝
j : WidePullbackShape J
⊢ f.hom.left ≫ (conesEquivInverseObj B F Y✝).π.app j = (conesEquivInverseObj B F X✝).π.app j

Next tactic:
cases' j with j
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
    Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
  obj := conesEquivInverseObj B F
  map f :=
    { hom := f.hom.left
      w := fun j => by
        cases' j with j
        · 

Proof state:
case none
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
X✝ Y✝ : Cone F
f : X✝ ⟶ Y✝
⊢ f.hom.left ≫ (conesEquivInverseObj B F Y✝).π.app none = (conesEquivInverseObj B F X✝).π.app none

Next tactic:
simp
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
    Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
  obj := conesEquivInverseObj B F
  map f :=
    { hom := f.hom.left
      w := fun j => by
        cases' j with j
        · simp
        · 

Proof state:
case some
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
X✝ Y✝ : Cone F
f : X✝ ⟶ Y✝
j : J
⊢ f.hom.left ≫ (conesEquivInverseObj B F Y✝).π.app (some j) = (conesEquivInverseObj B F X✝).π.app (some j)

Next tactic:
dsimp
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
    Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
  obj := conesEquivInverseObj B F
  map f :=
    { hom := f.hom.left
      w := fun j => by
        cases' j with j
        · simp
        · dsimp
          

Proof state:
case some
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
X✝ Y✝ : Cone F
f : X✝ ⟶ Y✝
j : J
⊢ f.hom.left ≫ (Y✝.π.app { as := j }).left = (X✝.π.app { as := j }).left

Next tactic:
rw [← f.w ⟨j⟩]
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
    Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
  obj := conesEquivInverseObj B F
  map f :=
    { hom := f.hom.left
      w := fun j => by
        cases' j with j
        · simp
        · dsimp
          rw [← f.w ⟨j⟩]
          

Proof state:
case some
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
X✝ Y✝ : Cone F
f : X✝ ⟶ Y✝
j : J
⊢ f.hom.left ≫ (Y✝.π.app { as := j }).left = (f.hom ≫ Y✝.π.app { as := j }).left

Next tactic:
rfl
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
    Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
  obj c :=
    { pt := Over.mk (c.π.app none)
      π :=
        { app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
          -- Porting note: Added a proof for `naturality`
          naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by 

Proof state:
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X✝ B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone (widePullbackDiagramOfDiagramOver B F)
x✝² x✝¹ : Discrete J
X Y : J
x✝ : { as := X } ⟶ { as := Y }
f : { as := X }.as = { as := Y }.as
⊢ ((Functor.const (Discrete J)).obj (mk (c.π.app none))).map { down := { down := f } } ≫
      (fun x =>
          match x with
          | { as := j } => homMk (c.π.app (some j)))
        { as := Y } =
    (fun x =>
          match x with
          | { as := j } => homMk (c.π.app (some j)))
        { as := X } ≫
      F.map { down := { down := f } }

Next tactic:
dsimp at f ⊢
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
    Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
  obj c :=
    { pt := Over.mk (c.π.app none)
      π :=
        { app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
          -- Porting note: Added a proof for `naturality`
          naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢; 

Proof state:
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X✝ B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone (widePullbackDiagramOfDiagramOver B F)
x✝² x✝¹ : Discrete J
X Y : J
x✝ : { as := X } ⟶ { as := Y }
f : X = Y
⊢ 𝟙 (mk (c.π.app none)) ≫ homMk (c.π.app (some Y)) = homMk (c.π.app (some X)) ≫ F.map { down := { down := f } }

Next tactic:
aesop_cat
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
    𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
      conesEquivFunctor B F ⋙ conesEquivInverse B F :=
  NatIso.ofComponents fun _ => Cones.ext
    { hom := 𝟙 _
      inv := 𝟙 _ }
    (by 

Proof state:
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete J ⥤ Over B
x✝ : Cone (widePullbackDiagramOfDiagramOver B F)
⊢ ∀ (j : WidePullbackShape J),
    ((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).π.app j =
      (Iso.mk (𝟙 ((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).pt)
            (𝟙 ((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).pt)).hom ≫
        ((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).π.app j

Next tactic:
rintro (j | j)
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
    𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
      conesEquivFunctor B F ⋙ conesEquivInverse B F :=
  NatIso.ofComponents fun _ => Cones.ext
    { hom := 𝟙 _
      inv := 𝟙 _ }
    (by rintro (j | j) <;> 

Proof state:
case none
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete J ⥤ Over B
x✝ : Cone (widePullbackDiagramOfDiagramOver B F)
⊢ ((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).π.app none =
    (Iso.mk (𝟙 ((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).pt)
          (𝟙 ((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).pt)).hom ≫
      ((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).π.app none

Next tactic:
aesop_cat
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
    𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
      conesEquivFunctor B F ⋙ conesEquivInverse B F :=
  NatIso.ofComponents fun _ => Cones.ext
    { hom := 𝟙 _
      inv := 𝟙 _ }
    (by rintro (j | j) <;> 

Proof state:
case some
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete J ⥤ Over B
x✝ : Cone (widePullbackDiagramOfDiagramOver B F)
j : J
⊢ ((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).π.app (some j) =
    (Iso.mk (𝟙 ((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).pt)
          (𝟙 ((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).pt)).hom ≫
      ((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).π.app (some j)

Next tactic:
aesop_cat
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
  has_limit F := HasLimit.mk
    { cone :=
        { pt := Over.mk (𝟙 _)
          π :=
            { app := fun p => p.as.elim } }
      isLimit :=
        { lift := fun s => Over.homMk _
          fac := fun _ j => j.as.elim
          uniq := fun s m _ => by
            

Proof state:
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
⊢ m = (fun s => homMk s.pt.hom) s

Next tactic:
simp only
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
  has_limit F := HasLimit.mk
    { cone :=
        { pt := Over.mk (𝟙 _)
          π :=
            { app := fun p => p.as.elim } }
      isLimit :=
        { lift := fun s => Over.homMk _
          fac := fun _ j => j.as.elim
          uniq := fun s m _ => by
            simp only
            

Proof state:
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
⊢ m = homMk s.pt.hom

Next tactic:
ext
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
  has_limit F := HasLimit.mk
    { cone :=
        { pt := Over.mk (𝟙 _)
          π :=
            { app := fun p => p.as.elim } }
      isLimit :=
        { lift := fun s => Over.homMk _
          fac := fun _ j => j.as.elim
          uniq := fun s m _ => by
            simp only
            ext
            

Proof state:
case h
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
⊢ m.left = (homMk s.pt.hom).left

Next tactic:
rw [Over.homMk_left _]
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
  has_limit F := HasLimit.mk
    { cone :=
        { pt := Over.mk (𝟙 _)
          π :=
            { app := fun p => p.as.elim } }
      isLimit :=
        { lift := fun s => Over.homMk _
          fac := fun _ j => j.as.elim
          uniq := fun s m _ => by
            simp only
            ext
            rw [Over.homMk_left _]
            

Proof state:
case h
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
⊢ m.left = s.pt.hom

Next tactic:
have := m.w
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
  has_limit F := HasLimit.mk
    { cone :=
        { pt := Over.mk (𝟙 _)
          π :=
            { app := fun p => p.as.elim } }
      isLimit :=
        { lift := fun s => Over.homMk _
          fac := fun _ j => j.as.elim
          uniq := fun s m _ => by
            simp only
            ext
            rw [Over.homMk_left _]
            have := m.w
            

Proof state:
case h
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
this :
  (𝟭 C).map m.left ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt.hom =
    s.pt.hom ≫ (Functor.fromPUnit B).map m.right
⊢ m.left = s.pt.hom

Next tactic:
dsimp at this
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
  has_limit F := HasLimit.mk
    { cone :=
        { pt := Over.mk (𝟙 _)
          π :=
            { app := fun p => p.as.elim } }
      isLimit :=
        { lift := fun s => Over.homMk _
          fac := fun _ j => j.as.elim
          uniq := fun s m _ => by
            simp only
            ext
            rw [Over.homMk_left _]
            have := m.w
            dsimp at this
            

Proof state:
case h
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
this : m.left ≫ 𝟙 B = s.pt.hom ≫ 𝟙 B
⊢ m.left = s.pt.hom

Next tactic:
rwa [Category.comp_id, Category.comp_id] at this
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
  obj U := CommRingCat.of <| Localization (G.obj U)
  map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
  map_id U := by
    

Proof state:
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U : (Opens ↑X)ᵒᵖ
⊢ { obj := fun U => CommRingCat.of (Localization (obj G U)),
          map := fun {U V} i =>
            CommRingCat.ofHom
              (IsLocalization.map (Localization (obj G V)) (F.map i)
                (_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
      (𝟙 U) =
    𝟙
      ({ obj := fun U => CommRingCat.of (Localization (obj G U)),
            map := fun {U V} i =>
              CommRingCat.ofHom
                (IsLocalization.map (Localization (obj G V)) (F.map i)
                  (_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.obj
        U)

Next tactic:
simp_rw [F.map_id]
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
  obj U := CommRingCat.of <| Localization (G.obj U)
  map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
  map_id U := by
    simp_rw [F.map_id]
    

Proof state:
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U : (Opens ↑X)ᵒᵖ
⊢ CommRingCat.ofHom
      (IsLocalization.map (Localization (obj G U)) (𝟙 (F.obj U))
        (_ : obj G U ≤ Submonoid.comap (𝟙 (F.obj U)) (obj G U))) =
    𝟙 (CommRingCat.of (Localization (obj G U)))

Next tactic:
ext x
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
  obj U := CommRingCat.of <| Localization (G.obj U)
  map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
  map_id U := by
    simp_rw [F.map_id]
    ext x
    -- Porting note : `M` and `S` needs to be specified manually
    

Proof state:
case w
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U : (Opens ↑X)ᵒᵖ
x : (forget CommRingCat).obj (CommRingCat.of (Localization (obj G U)))
⊢ (CommRingCat.ofHom
        (IsLocalization.map (Localization (obj G U)) (𝟙 (F.obj U))
          (_ : obj G U ≤ Submonoid.comap (𝟙 (F.obj U)) (obj G U))))
      x =
    (𝟙 (CommRingCat.of (Localization (obj G U)))) x

Next tactic:
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
  obj U := CommRingCat.of <| Localization (G.obj U)
  map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
  map_id U := by
    simp_rw [F.map_id]
    ext x
    -- Porting note : `M` and `S` needs to be specified manually
    exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
  map_comp {U V W} i j := by
    

Proof state:
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U V W : (Opens ↑X)ᵒᵖ
i : U ⟶ V
j : V ⟶ W
⊢ { obj := fun U => CommRingCat.of (Localization (obj G U)),
          map := fun {U V} i =>
            CommRingCat.ofHom
              (IsLocalization.map (Localization (obj G V)) (F.map i)
                (_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
      (i ≫ j) =
    { obj := fun U => CommRingCat.of (Localization (obj G U)),
            map := fun {U V} i =>
              CommRingCat.ofHom
                (IsLocalization.map (Localization (obj G V)) (F.map i)
                  (_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
        i ≫
      { obj := fun U => CommRingCat.of (Localization (obj G U)),
            map := fun {U V} i =>
              CommRingCat.ofHom
                (IsLocalization.map (Localization (obj G V)) (F.map i)
                  (_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
        j

Next tactic:
delta CommRingCat.ofHom CommRingCat.of Bundled.of
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
  obj U := CommRingCat.of <| Localization (G.obj U)
  map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
  map_id U := by
    simp_rw [F.map_id]
    ext x
    -- Porting note : `M` and `S` needs to be specified manually
    exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
  map_comp {U V W} i j := by
    delta CommRingCat.ofHom CommRingCat.of Bundled.of
    

Proof state:
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U V W : (Opens ↑X)ᵒᵖ
i : U ⟶ V
j : V ⟶ W
⊢ { obj := fun U => Bundled.mk (Localization (obj G U)),
          map := fun {U V} i =>
            IsLocalization.map (Localization (obj G V)) (F.map i)
              (_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)) }.map
      (i ≫ j) =
    { obj := fun U => Bundled.mk (Localization (obj G U)),
            map := fun {U V} i =>
              IsLocalization.map (Localization (obj G V)) (F.map i)
                (_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)) }.map
        i ≫
      { obj := fun U => Bundled.mk (Localization (obj G U)),
            map := fun {U V} i =>
              IsLocalization.map (Localization (obj G V)) (F.map i)
                (_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)) }.map
        j

Next tactic:
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
  obj U := CommRingCat.of <| Localization (G.obj U)
  map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
  map_id U := by
    simp_rw [F.map_id]
    ext x
    -- Porting note : `M` and `S` needs to be specified manually
    exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
  map_comp {U V W} i j := by
    delta CommRingCat.ofHom CommRingCat.of Bundled.of
    simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
    

Proof state:
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U V W : (Opens ↑X)ᵒᵖ
i : U ⟶ V
j : V ⟶ W
⊢ IsLocalization.map (Localization (obj G W)) (RingHom.comp (F.map j) (F.map i))
      (_ : obj G U ≤ Submonoid.comap (RingHom.comp (F.map j) (F.map i)) (obj G W)) =
    RingHom.comp
      (IsLocalization.map (Localization (obj G W)) (F.map j) (_ : obj G V ≤ Submonoid.comap (F.map j) (obj G W)))
      (IsLocalization.map (Localization (obj G V)) (F.map i) (_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)))

Next tactic:
rw [IsLocalization.map_comp_map]