Theorem: AlgebraicGeometry.HasRingHomProperty.of_source_openCover
File: Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean

Proof steps:
state_before: P : MorphismProperty Scheme
Q : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
inst✝² : HasRingHomProperty P Q
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
inst✝¹ : IsAffine Y
𝒰 : X.OpenCover
inst✝ : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
H : ∀ (i : 𝒰.J), Q (Scheme.Hom.app (𝒰.map i ≫ f) ⊤)
⊢ P f
state_after: P : MorphismProperty Scheme
Q : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
inst✝² : HasRingHomProperty P Q
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
inst✝¹ : IsAffine Y
𝒰 : X.OpenCover
inst✝ : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
H : ∀ (i : 𝒰.J), Q (Scheme.Hom.app (𝒰.map i ≫ f) ⊤)
⊢ sourceAffineLocally (fun {R S} [CommRing R] [CommRing S] => Q) f
tactic: rw [HasAffineProperty.iff_of_isAffine (P := P)]
state_before: P : MorphismProperty Scheme
Q : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
inst✝² : HasRingHomProperty P Q
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
inst✝¹ : IsAffine Y
𝒰 : X.OpenCover
inst✝ : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
H : ∀ (i : 𝒰.J), Q (Scheme.Hom.app (𝒰.map i ≫ f) ⊤)
⊢ sourceAffineLocally (fun {R S} [CommRing R] [CommRing S] => Q) f
state_after: P : MorphismProperty Scheme
Q : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
inst✝² : HasRingHomProperty P Q
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
inst✝¹ : IsAffine Y
𝒰 : X.OpenCover
inst✝ : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
H : ∀ (i : 𝒰.J), Q (Scheme.Hom.app (𝒰.map i ≫ f) ⊤)
U : ↑X.affineOpens
⊢ Q (Scheme.Hom.appLE f ⊤ ↑U ⋯)
tactic: intro U
state_before: P : MorphismProperty Scheme
Q : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
inst✝² : HasRingHomProperty P Q
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
inst✝¹ : IsAffine Y
𝒰 : X.OpenCover
inst✝ : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
H : ∀ (i : 𝒰.J), Q (Scheme.Hom.app (𝒰.map i ≫ f) ⊤)
U : ↑X.affineOpens
⊢ Q (Scheme.Hom.appLE f ⊤ ↑U ⋯)
state_after: P : MorphismProperty Scheme
Q : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
inst✝² : HasRingHomProperty P Q
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
inst✝¹ : IsAffine Y
𝒰 : X.OpenCover
inst✝ : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
H : ∀ (i : 𝒰.J), Q (Scheme.Hom.app (𝒰.map i ≫ f) ⊤)
U : ↑X.affineOpens
S : 𝒰.J → ↑X.affineOpens := fun i => ⟨Scheme.Hom.opensRange (𝒰.map i), ⋯⟩
⊢ Q (Scheme.Hom.appLE f ⊤ ↑U ⋯)
tactic: let S i : X.affineOpens := ⟨_, isAffineOpen_opensRange (𝒰.map i)⟩
state_before: P : MorphismProperty Scheme
Q : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
inst✝² : HasRingHomProperty P Q
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
inst✝¹ : IsAffine Y
𝒰 : X.OpenCover
inst✝ : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
H : ∀ (i : 𝒰.J), Q (Scheme.Hom.app (𝒰.map i ≫ f) ⊤)
U : ↑X.affineOpens
S : 𝒰.J → ↑X.affineOpens := fun i => ⟨Scheme.Hom.opensRange (𝒰.map i), ⋯⟩
⊢ Q (Scheme.Hom.appLE f ⊤ ↑U ⋯)
state_after: no goals
tactic: induction U using of_affine_open_cover S 𝒰.iSup_opensRange with
  | basicOpen U r H =>
    simp_rw [Scheme.affineBasicOpen_coe,
      ← f.appLE_map (U := ⊤) le_top (homOfLE (X.basicOpen_le r)).op]
    apply (isLocal_ringHomProperty P).StableUnderComposition _ _ H
    have := U.2.isLocalization_basicOpen r
    apply (isLocal_ringHomProperty P).HoldsForLocalizationAway _ r
  | openCover U s hs H =>
    apply (isLocal_ringHomProperty P).OfLocalizationSpanTarget.ofIsLocalization
      (isLocal_ringHomProperty P).respectsIso _ _ hs
    rintro r
    refine ⟨_, _, _, IsAffineOpen.isLocalization_basicOpen U.2 r, ?_⟩
    rw [RingHom.algebraMap_toAlgebra, ← CommRingCat.comp_eq_ring_hom_comp, Scheme.Hom.appLE_map]
    exact H r
  | hU i =>
    specialize H i
    rw [← (isLocal_ringHomProperty P).respectsIso.cancel_right_isIso _
      ((IsOpenImmersion.isoOfRangeEq (𝒰.map i) (S i).1.ι
      Subtype.range_coe.symm).inv.app _), ← Scheme.comp_app,
      IsOpenImmersion.isoOfRangeEq_inv_fac_assoc, Scheme.comp_app,
      Scheme.Opens.ι_app, Scheme.Hom.app_eq_appLE, Scheme.Hom.appLE_map] at H
    exact (f.appLE_congr _ rfl (by simp) Q).mp H