-- Mathlib/AlgebraicGeometry/Morphisms/Constructors.lean
/-- If `P` respects isos, then `stalkwise P` is local at the target. -/
lemma stalkwiseIsLocalAtTarget_of_respectsIso (hP : RingHom.RespectsIso P) :
    IsLocalAtTarget (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
hP' : (RingHom.toMorphismProperty fun {R S} [CommRing R] [CommRing S] => P).RespectsIso
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
⊢ ∀ {X Y : Scheme} (f : X ⟶ Y) {ι : Type u} (U : ι → Y.Opens),
    iSup U = ⊤ →
      (∀ (i : ι), stalkwise (fun {R S} [CommRing R] [CommRing S] => P) (f ∣_ U i)) →
        stalkwise (fun {R S} [CommRing R] [CommRing S] => P) f

Tactic:
intro X Y f ι U hU hf x

Result:
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
hP' : (RingHom.toMorphismProperty fun {R S} [CommRing R] [CommRing S] => P).RespectsIso
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
X Y : Scheme
f : X ⟶ Y
ι : Type u
U : ι → Y.Opens
hU : iSup U = ⊤
hf : ∀ (i : ι), stalkwise (fun {R S} [CommRing R] [CommRing S] => P) (f ∣_ U i)
x : ↑↑X.toPresheafedSpace
⊢ 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
hP' : (RingHom.toMorphismProperty fun {R S} [CommRing R] [CommRing S] => P).RespectsIso
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
⊢ ∀ {X Y : Scheme} (f : X ⟶ Y) (U : Y.Opens),
    stalkwise (fun {R S} [CommRing R] [CommRing S] => P) f →
      stalkwise (fun {R S} [CommRing R] [CommRing S] => P) (f ∣_ U)

Tactic:
intro X Y f U hf x

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
hP' : (RingHom.toMorphismProperty fun {R S} [CommRing R] [CommRing S] => P).RespectsIso
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
X Y : Scheme
f : X ⟶ Y
U : Y.Opens
hf : stalkwise (fun {R S} [CommRing R] [CommRing S] => P) f
x : ↑↑(↑(f ⁻¹ᵁ U)).toPresheafedSpace
⊢ P (CommRingCat.Hom.hom (Scheme.Hom.stalkMap (f ∣_ U) x))

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
hP' : (RingHom.toMorphismProperty fun {R S} [CommRing R] [CommRing S] => P).RespectsIso
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
X Y : Scheme
f : X ⟶ Y
ι : Type u
U : ι → Y.Opens
hU : iSup U = ⊤
hf : ∀ (i : ι), stalkwise (fun {R S} [CommRing R] [CommRing S] => P) (f ∣_ U i)
x : ↑↑X.toPresheafedSpace
hy : (ConcreteCategory.hom f.base) 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
hP' : (RingHom.toMorphismProperty fun {R S} [CommRing R] [CommRing S] => P).RespectsIso
this : (stalkwise fun {R S} [CommRing R] [CommRing S] => P).RespectsIso := stalkwise_respectsIso hP
X Y : Scheme
f : X ⟶ Y
ι : Type u
U : ι → Y.Opens
hU : iSup U = ⊤
hf : ∀ (i : ι), stalkwise (fun {R S} [CommRing R] [CommRing S] => P) (f ∣_ U i)
x : ↑↑X.toPresheafedSpace
hy : (ConcreteCategory.hom f.base) x ∈ iSup U
i : ι
hi : (ConcreteCategory.hom f.base) x ∈ U i
⊢ P (CommRingCat.Hom.hom (Scheme.Hom.stalkMap f x))

Proof state:
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
⊢ IsLocalAtTarget (stalkwise fun {R S} [CommRing R] [CommRing S] => P)

Tactic:
have hP' : (RingHom.toMorphismProperty P).RespectsIso :=
  RingHom.toMorphismProperty_respectsIso_iff.mp hP

Result:
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
hP' : (RingHom.toMorphismProperty fun {R S} [CommRing R] [CommRing S] => P).RespectsIso
⊢ IsLocalAtTarget (stalkwise fun {R S} [CommRing R] [CommRing S] => P)