-- Mathlib/AlgebraicGeometry/Morphisms/Constructors.lean
/-- If `P` respects isos, then `stalkwise P` is local at the source. -/
lemma stalkwise_isLocalAtSource_of_respectsIso (hP : RingHom.RespectsIso P) :
    IsLocalAtSource (stalkwise P)

Proof state:
case of_sSup_eq_top
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : RingHom.RespectsIso fun {R S} [CommRing R] [CommRing S] => P
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
X Y : Scheme
f : X ⟶ Y
ι : Type u
U : ι → X.Opens
hU : iSup U = ⊤
hf : ∀ (i : ι), stalkwise (fun {R S} [CommRing R] [CommRing S] => P) ((U i).ι ≫ f)
x : ↑↑X.toPresheafedSpace
hy : x ∈ iSup U
⊢ P (CommRingCat.Hom.hom (Scheme.Hom.stalkMap f x))

Tactic:
obtain ⟨i, hi⟩ := Opens.mem_iSup.mp hy

Result:
case of_sSup_eq_top.intro
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : RingHom.RespectsIso fun {R S} [CommRing R] [CommRing S] => P
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
X Y : Scheme
f : X ⟶ Y
ι : Type u
U : ι → X.Opens
hU : iSup U = ⊤
hf : ∀ (i : ι), stalkwise (fun {R S} [CommRing R] [CommRing S] => P) ((U i).ι ≫ f)
x : ↑↑X.toPresheafedSpace
hy : x ∈ iSup U
i : ι
hi : x ∈ U i
⊢ P (CommRingCat.Hom.hom (Scheme.Hom.stalkMap f x))

Proof state:
case restrict
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : RingHom.RespectsIso fun {R S} [CommRing R] [CommRing S] => P
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
X Y : Scheme
f : X ⟶ Y
U : X.Opens
hf : stalkwise (fun {R S} [CommRing R] [CommRing S] => P) f
x : ↑↑(↑U).toPresheafedSpace
⊢ P (CommRingCat.Hom.hom (Scheme.Hom.stalkMap f ((ConcreteCategory.hom U.ι.base) x)))

Tactic:
exact hf _

Result:
no goals

Proof state:
case of_sSup_eq_top.intro
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : RingHom.RespectsIso fun {R S} [CommRing R] [CommRing S] => P
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
X Y : Scheme
f : X ⟶ Y
ι : Type u
U : ι → X.Opens
hU : iSup U = ⊤
hf : ∀ (i : ι), stalkwise (fun {R S} [CommRing R] [CommRing S] => P) ((U i).ι ≫ f)
x : ↑↑X.toPresheafedSpace
hy : x ∈ iSup U
i : ι
hi : x ∈ U i
⊢ P (CommRingCat.Hom.hom (Scheme.Hom.stalkMap f x))

Tactic:
rw [← hP.cancel_right_isIso _ ((U i).ι.stalkMap ⟨x, hi⟩)]

Result:
case of_sSup_eq_top.intro
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : RingHom.RespectsIso fun {R S} [CommRing R] [CommRing S] => P
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
X Y : Scheme
f : X ⟶ Y
ι : Type u
U : ι → X.Opens
hU : iSup U = ⊤
hf : ∀ (i : ι), stalkwise (fun {R S} [CommRing R] [CommRing S] => P) ((U i).ι ≫ f)
x : ↑↑X.toPresheafedSpace
hy : x ∈ iSup U
i : ι
hi : x ∈ U i
⊢ P ((CommRingCat.Hom.hom (Scheme.Hom.stalkMap (U i).ι ⟨x, hi⟩)).comp (CommRingCat.Hom.hom (Scheme.Hom.stalkMap f x)))

Proof state:
case restrict
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : RingHom.RespectsIso fun {R S} [CommRing R] [CommRing S] => P
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
X Y : Scheme
f : X ⟶ Y
U : X.Opens
hf : stalkwise (fun {R S} [CommRing R] [CommRing S] => P) f
x : ↑↑(↑U).toPresheafedSpace
⊢ P (CommRingCat.Hom.hom (Scheme.Hom.stalkMap (U.ι ≫ f) x))

Tactic:
rw [Scheme.stalkMap_comp, CommRingCat.hom_comp, hP.cancel_right_isIso]

Result:
case restrict
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : RingHom.RespectsIso fun {R S} [CommRing R] [CommRing S] => P
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
X Y : Scheme
f : X ⟶ Y
U : X.Opens
hf : stalkwise (fun {R S} [CommRing R] [CommRing S] => P) f
x : ↑↑(↑U).toPresheafedSpace
⊢ P (CommRingCat.Hom.hom (Scheme.Hom.stalkMap f ((ConcreteCategory.hom U.ι.base) x)))