l3lab/ntp-mathlib huggingface dataset:
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
  · intro H U g hg V
    

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
H : sourceAffineLocally P f
U : Scheme
g : U ⟶ X
hg : IsOpenImmersion g
V : ↑(Scheme.affineOpens U)
⊢ P (Scheme.Γ.map (Scheme.ofRestrict U (_ : OpenEmbedding ⇑(Opens.inclusion ↑V)) ≫ g ≫ f).op)

Next tactic:
skip
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    

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
H : sourceAffineLocally P f
U : Scheme
g : U ⟶ X
hg : IsOpenImmersion g
V : ↑(Scheme.affineOpens U)
⊢ P (Scheme.Γ.map (Scheme.ofRestrict U (_ : OpenEmbedding ⇑(Opens.inclusion ↑V)) ≫ g ≫ f).op)

Next tactic:
have := (hP.affine_openCover_TFAE f).out 0 3
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    

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
H : sourceAffineLocally P f
U : Scheme
g : U ⟶ X
hg : IsOpenImmersion g
V : ↑(Scheme.affineOpens U)
this :
  sourceAffineLocally P f ↔
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
⊢ P (Scheme.Γ.map (Scheme.ofRestrict U (_ : OpenEmbedding ⇑(Opens.inclusion ↑V)) ≫ g ≫ f).op)

Next tactic:
rw [this] at H
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    

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
H : ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
U : Scheme
g : U ⟶ X
hg : IsOpenImmersion g
V : ↑(Scheme.affineOpens U)
this :
  sourceAffineLocally P f ↔
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
⊢ P (Scheme.Γ.map (Scheme.ofRestrict U (_ : OpenEmbedding ⇑(Opens.inclusion ↑V)) ≫ g ≫ f).op)

Next tactic:
haveI : IsAffine _ := V.2
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    

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
H : ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
U : Scheme
g : U ⟶ X
hg : IsOpenImmersion g
V : ↑(Scheme.affineOpens U)
this✝ :
  sourceAffineLocally P f ↔
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
this : IsAffine (Scheme.restrict U (_ : OpenEmbedding ⇑(Opens.inclusion ↑V)))
⊢ P (Scheme.Γ.map (Scheme.ofRestrict U (_ : OpenEmbedding ⇑(Opens.inclusion ↑V)) ≫ g ≫ f).op)

Next tactic:
rw [← Category.assoc]
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    rw [← Category.assoc]
    -- Porting note: Lean could find this previously
    

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
H : ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
U : Scheme
g : U ⟶ X
hg : IsOpenImmersion g
V : ↑(Scheme.affineOpens U)
this✝ :
  sourceAffineLocally P f ↔
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
this : IsAffine (Scheme.restrict U (_ : OpenEmbedding ⇑(Opens.inclusion ↑V)))
⊢ P (Scheme.Γ.map ((Scheme.ofRestrict U (_ : OpenEmbedding ⇑(Opens.inclusion ↑V)) ≫ g) ≫ f).op)

Next tactic:
have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g :=
      LocallyRingedSpace.IsOpenImmersion.comp _ _
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    rw [← Category.assoc]
    -- Porting note: Lean could find this previously
    have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g :=
      LocallyRingedSpace.IsOpenImmersion.comp _ _
    

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
H : ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
U : Scheme
g : U ⟶ X
hg : IsOpenImmersion g
V : ↑(Scheme.affineOpens U)
this✝¹ :
  sourceAffineLocally P f ↔
    ∀ {U : Scheme} (g : U ⟶ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Γ.map (g ≫ f).op)
this✝ : IsAffine (Scheme.restrict U (_ : OpenEmbedding ⇑(Opens.inclusion ↑V)))
this : IsOpenImmersion (Scheme.ofRestrict U (_ : OpenEmbedding ⇑(Opens.inclusion ↑V)) ≫ g)
⊢ P (Scheme.Γ.map ((Scheme.ofRestrict U (_ : OpenEmbedding ⇑(Opens.inclusion ↑V)) ≫ g) ≫ f).op)

Next tactic:
apply H
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    rw [← Category.assoc]
    -- Porting note: Lean could find this previously
    have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g :=
      LocallyRingedSpace.IsOpenImmersion.comp _ _
    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 : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)
⊢ 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 4 → 3
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    rw [← Category.assoc]
    -- Porting note: Lean could find this previously
    have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g :=
      LocallyRingedSpace.IsOpenImmersion.comp _ _
    apply 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 : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)
⊢ (∀ {U : Scheme} (g : U ⟶ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) →
    ∀ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)

Next tactic:
intro H 𝒰 _ i
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    rw [← Category.assoc]
    -- Porting note: Lean could find this previously
    have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g :=
      LocallyRingedSpace.IsOpenImmersion.comp _ _
    apply 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 : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)
H : ∀ {U : Scheme} (g : U ⟶ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)
𝒰 : Scheme.OpenCover X
i✝ : 𝒰.J
i : ↑(Scheme.affineOpens (Scheme.OpenCover.obj 𝒰 i✝))
⊢ P
    (Scheme.Γ.map
      (Scheme.ofRestrict (Scheme.OpenCover.obj 𝒰 i✝) (_ : OpenEmbedding ⇑(Opens.inclusion ↑i)) ≫
          Scheme.OpenCover.map 𝒰 i✝ ≫ f).op)

Next tactic:
skip
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    rw [← Category.assoc]
    -- Porting note: Lean could find this previously
    have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g :=
      LocallyRingedSpace.IsOpenImmersion.comp _ _
    apply 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 : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)
H : ∀ {U : Scheme} (g : U ⟶ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)
𝒰 : Scheme.OpenCover X
i✝ : 𝒰.J
i : ↑(Scheme.affineOpens (Scheme.OpenCover.obj 𝒰 i✝))
⊢ P
    (Scheme.Γ.map
      (Scheme.ofRestrict (Scheme.OpenCover.obj 𝒰 i✝) (_ : OpenEmbedding ⇑(Opens.inclusion ↑i)) ≫
          Scheme.OpenCover.map 𝒰 i✝ ≫ f).op)

Next tactic:
apply H
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    rw [← Category.assoc]
    -- Porting note: Lean could find this previously
    have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g :=
      LocallyRingedSpace.IsOpenImmersion.comp _ _
    apply 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 : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) →
    ∀ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)
⊢ 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 3 → 2
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    rw [← Category.assoc]
    -- Porting note: Lean could find this previously
    have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g :=
      LocallyRingedSpace.IsOpenImmersion.comp _ _
    apply 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 : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) →
    ∀ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)
⊢ (∀ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) →
    ∃ 𝒰, ∀ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)

Next tactic:
intro H
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    rw [← Category.assoc]
    -- Porting note: Lean could find this previously
    have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g :=
      LocallyRingedSpace.IsOpenImmersion.comp _ _
    apply 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 : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) →
    ∀ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)
H : ∀ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)
⊢ ∃ 𝒰, ∀ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)

Next tactic:
refine' ⟨X.affineCover, H _⟩
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    rw [← Category.assoc]
    -- Porting note: Lean could find this previously
    have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g :=
      LocallyRingedSpace.IsOpenImmersion.comp _ _
    apply H
  tfae_have 4 → 3
  · intro H 𝒰 _ i; skip; apply H
  tfae_have 3 → 2
  · intro H; refine' ⟨X.affineCover, 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 : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) →
    ∀ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)
tfae_3_to_2 :
  (∀ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) →
    ∃ 𝒰, ∀ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)
⊢ 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 2 → 1
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
  · intro H U g hg V
    skip
    -- Porting note: this has metavariable if I put it directly into rw
    have := (hP.affine_openCover_TFAE f).out 0 3
    rw [this] at H
    haveI : IsAffine _ := V.2
    rw [← Category.assoc]
    -- Porting note: Lean could find this previously
    have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g :=
      LocallyRingedSpace.IsOpenImmersion.comp _ _
    apply H
  tfae_have 4 → 3
  · intro H 𝒰 _ i; skip; apply H
  tfae_have 3 → 2
  · intro H; refine' ⟨X.affineCover, 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 : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) →
    ∀ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)
tfae_3_to_2 :
  (∀ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) →
    ∃ 𝒰, ∀ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)
⊢ (∃ 𝒰, ∀ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) → sourceAffineLocally P f

Next tactic:
rintro ⟨𝒰, h𝒰⟩