l3lab/ntp-mathlib huggingface dataset:
theorem affine_openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ (𝒰 : Scheme.OpenCover.{u} X) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J),
          P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ {U : Scheme} (g : U ⟶ X) [IsAffine U] [IsOpenImmersion g],
          P (Scheme.Γ.map (g ≫ f).op)] := by
  tfae_have 1 → 4
  · intro H U g _ hg
    skip
    specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩
    rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Γ.map (IsOpenImmersion.isoOfRangeEq g
      (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩))
      Subtype.range_coe.symm).hom.op),
      ← Scheme.Γ.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom_fac_assoc] at H
    exact H
  

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
tfae_1_to_4 :
  sourceAffineLocally P f →
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
⊢ List.TFAE
    [sourceAffineLocally P f,
      ∃ 𝒰,
        ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
          ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op),
      ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
        P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op),
      ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)]

Next tactic:
tfae_have 4 → 3
theorem affine_openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ (𝒰 : Scheme.OpenCover.{u} X) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J),
          P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ {U : Scheme} (g : U ⟶ X) [IsAffine U] [IsOpenImmersion g],
          P (Scheme.Γ.map (g ≫ f).op)] := by
  tfae_have 1 → 4
  · intro H U g _ hg
    skip
    specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩
    rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Γ.map (IsOpenImmersion.isoOfRangeEq g
      (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩))
      Subtype.range_coe.symm).hom.op),
      ← Scheme.Γ.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom_fac_assoc] at H
    exact H
  tfae_have 4 → 3
  · 

Proof state:
case tfae_4_to_3
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
tfae_1_to_4 :
  sourceAffineLocally P f →
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
⊢ (∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)) →
    ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)

Next tactic:
intro H 𝒰 _ i
theorem affine_openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ (𝒰 : Scheme.OpenCover.{u} X) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J),
          P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ {U : Scheme} (g : U ⟶ X) [IsAffine U] [IsOpenImmersion g],
          P (Scheme.Γ.map (g ≫ f).op)] := by
  tfae_have 1 → 4
  · intro H U g _ hg
    skip
    specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩
    rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Γ.map (IsOpenImmersion.isoOfRangeEq g
      (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩))
      Subtype.range_coe.symm).hom.op),
      ← Scheme.Γ.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom_fac_assoc] at H
    exact H
  tfae_have 4 → 3
  · intro H 𝒰 _ i; 

Proof state:
case tfae_4_to_3
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝¹ : IsAffine Y
f : X ⟶ Y
tfae_1_to_4 :
  sourceAffineLocally P f →
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
H : ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
𝒰 : Scheme.OpenCover X
inst✝ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)
i : 𝒰.J
⊢ P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)

Next tactic:
skip
theorem affine_openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ (𝒰 : Scheme.OpenCover.{u} X) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J),
          P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ {U : Scheme} (g : U ⟶ X) [IsAffine U] [IsOpenImmersion g],
          P (Scheme.Γ.map (g ≫ f).op)] := by
  tfae_have 1 → 4
  · intro H U g _ hg
    skip
    specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩
    rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Γ.map (IsOpenImmersion.isoOfRangeEq g
      (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩))
      Subtype.range_coe.symm).hom.op),
      ← Scheme.Γ.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom_fac_assoc] at H
    exact H
  tfae_have 4 → 3
  · intro H 𝒰 _ i; skip; 

Proof state:
case tfae_4_to_3
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝¹ : IsAffine Y
f : X ⟶ Y
tfae_1_to_4 :
  sourceAffineLocally P f →
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
H : ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
𝒰 : Scheme.OpenCover X
inst✝ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)
i : 𝒰.J
⊢ P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)

Next tactic:
apply H
theorem affine_openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ (𝒰 : Scheme.OpenCover.{u} X) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J),
          P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ {U : Scheme} (g : U ⟶ X) [IsAffine U] [IsOpenImmersion g],
          P (Scheme.Γ.map (g ≫ f).op)] := by
  tfae_have 1 → 4
  · intro H U g _ hg
    skip
    specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩
    rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Γ.map (IsOpenImmersion.isoOfRangeEq g
      (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩))
      Subtype.range_coe.symm).hom.op),
      ← Scheme.Γ.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom_fac_assoc] at H
    exact H
  tfae_have 4 → 3
  · intro H 𝒰 _ i; skip; apply H
  

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
tfae_1_to_4 :
  sourceAffineLocally P f →
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)) →
    ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
⊢ List.TFAE
    [sourceAffineLocally P f,
      ∃ 𝒰,
        ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
          ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op),
      ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
        P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op),
      ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)]

Next tactic:
tfae_have 3 → 2
theorem affine_openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ (𝒰 : Scheme.OpenCover.{u} X) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J),
          P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ {U : Scheme} (g : U ⟶ X) [IsAffine U] [IsOpenImmersion g],
          P (Scheme.Γ.map (g ≫ f).op)] := by
  tfae_have 1 → 4
  · intro H U g _ hg
    skip
    specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩
    rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Γ.map (IsOpenImmersion.isoOfRangeEq g
      (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩))
      Subtype.range_coe.symm).hom.op),
      ← Scheme.Γ.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom_fac_assoc] at H
    exact H
  tfae_have 4 → 3
  · intro H 𝒰 _ i; skip; apply H
  tfae_have 3 → 2
  · 

Proof state:
case tfae_3_to_2
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
tfae_1_to_4 :
  sourceAffineLocally P f →
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)) →
    ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
⊢ (∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) →
    ∃ 𝒰,
      ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
        ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)

Next tactic:
intro H
theorem affine_openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ (𝒰 : Scheme.OpenCover.{u} X) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J),
          P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ {U : Scheme} (g : U ⟶ X) [IsAffine U] [IsOpenImmersion g],
          P (Scheme.Γ.map (g ≫ f).op)] := by
  tfae_have 1 → 4
  · intro H U g _ hg
    skip
    specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩
    rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Γ.map (IsOpenImmersion.isoOfRangeEq g
      (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩))
      Subtype.range_coe.symm).hom.op),
      ← Scheme.Γ.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom_fac_assoc] at H
    exact H
  tfae_have 4 → 3
  · intro H 𝒰 _ i; skip; apply H
  tfae_have 3 → 2
  · intro H; 

Proof state:
case tfae_3_to_2
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
tfae_1_to_4 :
  sourceAffineLocally P f →
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)) →
    ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
H :
  ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
    P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
⊢ ∃ 𝒰,
    ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
      ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)

Next tactic:
refine' ⟨X.affineCover, inferInstance, H _⟩
theorem affine_openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ (𝒰 : Scheme.OpenCover.{u} X) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J),
          P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ {U : Scheme} (g : U ⟶ X) [IsAffine U] [IsOpenImmersion g],
          P (Scheme.Γ.map (g ≫ f).op)] := by
  tfae_have 1 → 4
  · intro H U g _ hg
    skip
    specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩
    rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Γ.map (IsOpenImmersion.isoOfRangeEq g
      (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩))
      Subtype.range_coe.symm).hom.op),
      ← Scheme.Γ.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom_fac_assoc] at H
    exact H
  tfae_have 4 → 3
  · intro H 𝒰 _ i; skip; apply H
  tfae_have 3 → 2
  · intro H; refine' ⟨X.affineCover, inferInstance, H _⟩
  

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
tfae_1_to_4 :
  sourceAffineLocally P f →
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)) →
    ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
tfae_3_to_2 :
  (∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) →
    ∃ 𝒰,
      ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
        ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
⊢ List.TFAE
    [sourceAffineLocally P f,
      ∃ 𝒰,
        ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
          ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op),
      ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
        P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op),
      ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)]

Next tactic:
tfae_have 2 → 1
theorem affine_openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ (𝒰 : Scheme.OpenCover.{u} X) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J),
          P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ {U : Scheme} (g : U ⟶ X) [IsAffine U] [IsOpenImmersion g],
          P (Scheme.Γ.map (g ≫ f).op)] := by
  tfae_have 1 → 4
  · intro H U g _ hg
    skip
    specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩
    rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Γ.map (IsOpenImmersion.isoOfRangeEq g
      (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩))
      Subtype.range_coe.symm).hom.op),
      ← Scheme.Γ.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom_fac_assoc] at H
    exact H
  tfae_have 4 → 3
  · intro H 𝒰 _ i; skip; apply H
  tfae_have 3 → 2
  · intro H; refine' ⟨X.affineCover, inferInstance, H _⟩
  tfae_have 2 → 1
  · 

Proof state:
case tfae_2_to_1
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
tfae_1_to_4 :
  sourceAffineLocally P f →
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)) →
    ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
tfae_3_to_2 :
  (∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) →
    ∃ 𝒰,
      ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
        ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
⊢ (∃ 𝒰,
      ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
        ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) →
    sourceAffineLocally P f

Next tactic:
rintro ⟨𝒰, _, h𝒰⟩
theorem affine_openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ (𝒰 : Scheme.OpenCover.{u} X) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J),
          P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ {U : Scheme} (g : U ⟶ X) [IsAffine U] [IsOpenImmersion g],
          P (Scheme.Γ.map (g ≫ f).op)] := by
  tfae_have 1 → 4
  · intro H U g _ hg
    skip
    specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩
    rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Γ.map (IsOpenImmersion.isoOfRangeEq g
      (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩))
      Subtype.range_coe.symm).hom.op),
      ← Scheme.Γ.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom_fac_assoc] at H
    exact H
  tfae_have 4 → 3
  · intro H 𝒰 _ i; skip; apply H
  tfae_have 3 → 2
  · intro H; refine' ⟨X.affineCover, inferInstance, H _⟩
  tfae_have 2 → 1
  · rintro ⟨𝒰, _, h𝒰⟩
    

Proof state:
case tfae_2_to_1.intro.intro
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
tfae_1_to_4 :
  sourceAffineLocally P f →
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)) →
    ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
tfae_3_to_2 :
  (∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) →
    ∃ 𝒰,
      ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
        ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
𝒰 : Scheme.OpenCover X
w✝ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)
h𝒰 : ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
⊢ sourceAffineLocally P f

Next tactic:
exact sourceAffineLocally_of_source_openCover hP f 𝒰 h𝒰
theorem affine_openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ (𝒰 : Scheme.OpenCover.{u} X) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J),
          P (Scheme.Γ.map (𝒰.map i ≫ f).op),
        ∀ {U : Scheme} (g : U ⟶ X) [IsAffine U] [IsOpenImmersion g],
          P (Scheme.Γ.map (g ≫ f).op)] := by
  tfae_have 1 → 4
  · intro H U g _ hg
    skip
    specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩
    rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Γ.map (IsOpenImmersion.isoOfRangeEq g
      (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩))
      Subtype.range_coe.symm).hom.op),
      ← Scheme.Γ.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom_fac_assoc] at H
    exact H
  tfae_have 4 → 3
  · intro H 𝒰 _ i; skip; apply H
  tfae_have 3 → 2
  · intro H; refine' ⟨X.affineCover, inferInstance, H _⟩
  tfae_have 2 → 1
  · rintro ⟨𝒰, _, h𝒰⟩
    exact sourceAffineLocally_of_source_openCover hP f 𝒰 h𝒰
  

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
tfae_1_to_4 :
  sourceAffineLocally P f →
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)) →
    ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
tfae_3_to_2 :
  (∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) →
    ∃ 𝒰,
      ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
        ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)
tfae_2_to_1 :
  (∃ 𝒰,
      ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
        ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) →
    sourceAffineLocally P f
⊢ List.TFAE
    [sourceAffineLocally P f,
      ∃ 𝒰,
        ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
          ∀ (i : 𝒰.J), P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op),
      ∀ (𝒰 : Scheme.OpenCover X) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
        P (Scheme.Γ.map (Scheme.OpenCover.map 𝒰 i ≫ f).op),
      ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)]

Next tactic:
tfae_finish
theorem openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ 𝒰 : Scheme.OpenCover.{u} X, ∀ i : 𝒰.J, sourceAffineLocally (@P) (𝒰.map i ≫ f),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) (i : 𝒰.J), sourceAffineLocally (@P) (𝒰.map i ≫ f),
        ∀ {U : Scheme} (g : U ⟶ X) [IsOpenImmersion g], sourceAffineLocally (@P) (g ≫ f)] := by
  

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
⊢ List.TFAE
    [sourceAffineLocally P f, ∃ 𝒰, ∀ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f),
      ∀ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f),
      ∀ {U : Scheme} (g : U ⟶ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)]

Next tactic:
tfae_have 1 → 4
theorem openCover_TFAE {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) :
    List.TFAE
      [sourceAffineLocally (@P) f,
        ∃ 𝒰 : Scheme.OpenCover.{u} X, ∀ i : 𝒰.J, sourceAffineLocally (@P) (𝒰.map i ≫ f),
        ∀ (𝒰 : Scheme.OpenCover.{u} X) (i : 𝒰.J), sourceAffineLocally (@P) (𝒰.map i ≫ f),
        ∀ {U : Scheme} (g : U ⟶ X) [IsOpenImmersion g], sourceAffineLocally (@P) (g ≫ f)] := by
  tfae_have 1 → 4
  · 

Proof state:
case tfae_1_to_4
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : PropertyIsLocal P
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
⊢ sourceAffineLocally P f → ∀ {U : Scheme} (g : U ⟶ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)

Next tactic:
intro H U g hg V