l3lab/ntp-mathlib huggingface dataset:
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; 

Proof state:
case refine'_1.refine'_1
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
h : P f
this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ⇑(Opens.inclusion (Y.basicOpen r))))
i : (Scheme.openCoverOfIsIso (𝟙 Y)).J
⊢ IsAffine (Scheme.OpenCover.obj (Scheme.openCoverOfIsIso (𝟙 Y)) i)

Next tactic:
dsimp
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; 

Proof state:
case refine'_1.refine'_1
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
h : P f
this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ⇑(Opens.inclusion (Y.basicOpen r))))
i : (Scheme.openCoverOfIsIso (𝟙 Y)).J
⊢ IsAffine Y

Next tactic:
infer_instance
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · 

Proof state:
case refine'_1.refine'_2
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
h : P f
this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ⇑(Opens.inclusion (Y.basicOpen r))))
⊢ ∀ (i : (Scheme.openCoverOfIsIso (𝟙 Y)).J), P pullback.snd

Next tactic:
intro i
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · intro i; 

Proof state:
case refine'_1.refine'_2
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
h : P f
this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ⇑(Opens.inclusion (Y.basicOpen r))))
i : (Scheme.openCoverOfIsIso (𝟙 Y)).J
⊢ P pullback.snd

Next tactic:
dsimp
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · intro i; dsimp
      

Proof state:
case refine'_1.refine'_2
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
h : P f
this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ⇑(Opens.inclusion (Y.basicOpen r))))
i : (Scheme.openCoverOfIsIso (𝟙 Y)).J
⊢ P pullback.snd

Next tactic:
rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · intro i; dsimp
      rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
  · 

Proof state:
case refine'_2
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
⊢ ∀ {X Y : Scheme} [inst : IsAffine Y] (f : X ⟶ Y) (s : Finset ↑(Y.presheaf.obj (op ⊤))),
    Ideal.span ↑s = ⊤ → (∀ (r : { x // x ∈ s }), P (f ∣_ Y.basicOpen ↑r)) → P f

Next tactic:
introv hs hs'
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · intro i; dsimp
      rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
  · introv hs hs'
    

Proof state:
case refine'_2
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
s : Finset ↑(Y.presheaf.obj (op ⊤))
hs : Ideal.span ↑s = ⊤
hs' : ∀ (r : { x // x ∈ s }), P (f ∣_ Y.basicOpen ↑r)
⊢ P f

Next tactic:
replace hs := ((topIsAffineOpen Y).basicOpen_union_eq_self_iff _).mpr hs
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · intro i; dsimp
      rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
  · introv hs hs'
    replace hs := ((topIsAffineOpen Y).basicOpen_union_eq_self_iff _).mpr hs
    

Proof state:
case refine'_2
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
s : Finset ↑(Y.presheaf.obj (op ⊤))
hs' : ∀ (r : { x // x ∈ s }), P (f ∣_ Y.basicOpen ↑r)
hs : ⨆ f, Y.basicOpen ↑f = ⊤
⊢ P f

Next tactic:
have := H f ⟨Y.openCoverOfSuprEqTop _ hs, ?_, ?_⟩ (𝟙 _)
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · intro i; dsimp
      rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
  · introv hs hs'
    replace hs := ((topIsAffineOpen Y).basicOpen_union_eq_self_iff _).mpr hs
    have := H f ⟨Y.openCoverOfSuprEqTop _ hs, ?_, ?_⟩ (𝟙 _)
    

Proof state:
case refine'_2.refine_3
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
s : Finset ↑(Y.presheaf.obj (op ⊤))
hs' : ∀ (r : { x // x ∈ s }), P (f ∣_ Y.basicOpen ↑r)
hs : ⨆ f, Y.basicOpen ↑f = ⊤
this : P pullback.snd
⊢ P f
case refine'_2.refine_1
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
s : Finset ↑(Y.presheaf.obj (op ⊤))
hs' : ∀ (r : { x // x ∈ s }), P (f ∣_ Y.basicOpen ↑r)
hs : ⨆ f, Y.basicOpen ↑f = ⊤
⊢ ∀ (i : (Scheme.openCoverOfSuprEqTop Y (fun i => Y.basicOpen ↑i) hs).J),
    IsAffine (Scheme.OpenCover.obj (Scheme.openCoverOfSuprEqTop Y (fun i => Y.basicOpen ↑i) hs) i)
case refine'_2.refine_2
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
s : Finset ↑(Y.presheaf.obj (op ⊤))
hs' : ∀ (r : { x // x ∈ s }), P (f ∣_ Y.basicOpen ↑r)
hs : ⨆ f, Y.basicOpen ↑f = ⊤
⊢ ∀ (i : (Scheme.openCoverOfSuprEqTop Y (fun i => Y.basicOpen ↑i) hs).J), P pullback.snd

Next tactic:
rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
      at this
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · intro i; dsimp
      rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
  · introv hs hs'
    replace hs := ((topIsAffineOpen Y).basicOpen_union_eq_self_iff _).mpr hs
    have := H f ⟨Y.openCoverOfSuprEqTop _ hs, ?_, ?_⟩ (𝟙 _)
    rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
      at this
    · 

Proof state:
case refine'_2.refine_1
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
s : Finset ↑(Y.presheaf.obj (op ⊤))
hs' : ∀ (r : { x // x ∈ s }), P (f ∣_ Y.basicOpen ↑r)
hs : ⨆ f, Y.basicOpen ↑f = ⊤
⊢ ∀ (i : (Scheme.openCoverOfSuprEqTop Y (fun i => Y.basicOpen ↑i) hs).J),
    IsAffine (Scheme.OpenCover.obj (Scheme.openCoverOfSuprEqTop Y (fun i => Y.basicOpen ↑i) hs) i)

Next tactic:
intro i
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · intro i; dsimp
      rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
  · introv hs hs'
    replace hs := ((topIsAffineOpen Y).basicOpen_union_eq_self_iff _).mpr hs
    have := H f ⟨Y.openCoverOfSuprEqTop _ hs, ?_, ?_⟩ (𝟙 _)
    rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
      at this
    · intro i; 

Proof state:
case refine'_2.refine_1
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
s : Finset ↑(Y.presheaf.obj (op ⊤))
hs' : ∀ (r : { x // x ∈ s }), P (f ∣_ Y.basicOpen ↑r)
hs : ⨆ f, Y.basicOpen ↑f = ⊤
i : (Scheme.openCoverOfSuprEqTop Y (fun i => Y.basicOpen ↑i) hs).J
⊢ IsAffine (Scheme.OpenCover.obj (Scheme.openCoverOfSuprEqTop Y (fun i => Y.basicOpen ↑i) hs) i)

Next tactic:
exact (topIsAffineOpen Y).basicOpenIsAffine _
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · intro i; dsimp
      rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
  · introv hs hs'
    replace hs := ((topIsAffineOpen Y).basicOpen_union_eq_self_iff _).mpr hs
    have := H f ⟨Y.openCoverOfSuprEqTop _ hs, ?_, ?_⟩ (𝟙 _)
    rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
      at this
    · intro i; exact (topIsAffineOpen Y).basicOpenIsAffine _
    · 

Proof state:
case refine'_2.refine_2
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
s : Finset ↑(Y.presheaf.obj (op ⊤))
hs' : ∀ (r : { x // x ∈ s }), P (f ∣_ Y.basicOpen ↑r)
hs : ⨆ f, Y.basicOpen ↑f = ⊤
⊢ ∀ (i : (Scheme.openCoverOfSuprEqTop Y (fun i => Y.basicOpen ↑i) hs).J), P pullback.snd

Next tactic:
rintro (i : s)
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · intro i; dsimp
      rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
  · introv hs hs'
    replace hs := ((topIsAffineOpen Y).basicOpen_union_eq_self_iff _).mpr hs
    have := H f ⟨Y.openCoverOfSuprEqTop _ hs, ?_, ?_⟩ (𝟙 _)
    rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
      at this
    · intro i; exact (topIsAffineOpen Y).basicOpenIsAffine _
    · rintro (i : s)
      

Proof state:
case refine'_2.refine_2
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
s : Finset ↑(Y.presheaf.obj (op ⊤))
hs' : ∀ (r : { x // x ∈ s }), P (f ∣_ Y.basicOpen ↑r)
hs : ⨆ f, Y.basicOpen ↑f = ⊤
i : { x // x ∈ s }
⊢ P pullback.snd

Next tactic:
specialize hs' i
theorem AffineTargetMorphismProperty.isLocalOfOpenCoverImply (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso)
    (H : ∀ {X Y : Scheme.{u}} (f : X ⟶ Y),
      (∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
        ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i)) →
        ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g],
          P (pullback.snd : pullback f g ⟶ U)) :
    P.IsLocal := by
  refine' ⟨hP, _, _⟩
  · introv h
    haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine r
    delta morphismRestrict
    rw [affine_cancel_left_isIso hP]
    refine' @H _ _ f ⟨Scheme.openCoverOfIsIso (𝟙 Y), _, _⟩ _ (Y.ofRestrict _) _ _
    · intro i; dsimp; infer_instance
    · intro i; dsimp
      rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
  · introv hs hs'
    replace hs := ((topIsAffineOpen Y).basicOpen_union_eq_self_iff _).mpr hs
    have := H f ⟨Y.openCoverOfSuprEqTop _ hs, ?_, ?_⟩ (𝟙 _)
    rwa [← Category.comp_id pullback.snd, ← pullback.condition, affine_cancel_left_isIso hP]
      at this
    · intro i; exact (topIsAffineOpen Y).basicOpenIsAffine _
    · rintro (i : s)
      specialize hs' i
      

Proof state:
case refine'_2.refine_2
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
H :
  ∀ {X Y : Scheme} (f : X ⟶ Y),
    (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) →
      ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
s : Finset ↑(Y.presheaf.obj (op ⊤))
hs : ⨆ f, Y.basicOpen ↑f = ⊤
i : { x // x ∈ s }
hs' : P (f ∣_ Y.basicOpen ↑i)
⊢ P pullback.snd

Next tactic:
haveI : IsAffine _ := (topIsAffineOpen Y).basicOpenIsAffine i.1