l3lab/ntp-mathlib huggingface dataset:
open List in
theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_TFAE
    {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) :
    TFAE
      [targetAffineLocally P f,
        ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i),
        ∀ (𝒰 : 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),
        ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤) (hU' : ∀ i, IsAffineOpen (U i)),
          ∀ i, @P _ _ (f ∣_ U i) (hU' i)] := by
  tfae_have 1 → 4
  · intro H U g h₁ h₂
    -- Porting note : I need to add `i1` manually, so to save some typing, named this variable
    set U' : Opens _ := ⟨_, h₂.base_open.open_range⟩
    replace H := H ⟨U', rangeIsAffineOpenOfOpenImmersion g⟩
    haveI i1 : IsAffine (Y.restrict U'.openEmbedding) := rangeIsAffineOpenOfOpenImmersion g
    rw [← P.toProperty_apply] at H ⊢
    

Proof state:
case tfae_1_to_4
P : AffineTargetMorphismProperty
hP : IsLocal P
X Y : Scheme
f : X ⟶ Y
U : Scheme
g : U ⟶ Y
h₁ : IsAffine U
h₂ : IsOpenImmersion g
U' : Opens ((forget TopCat).obj ↑Y.toPresheafedSpace) :=
  { carrier := Set.range ⇑g.val.base, is_open' := (_ : IsOpen (Set.range ⇑g.val.base)) }
H : toProperty P (f ∣_ ↑{ val := U', property := (_ : IsAffineOpen (Scheme.Hom.opensRange g)) })
i1 : IsAffine (Y ∣_ᵤ U')
⊢ toProperty P pullback.snd

Next tactic:
rwa [← hP.1.arrow_mk_iso_iff (morphismRestrictOpensRange f _)]
open List in
theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_TFAE
    {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) :
    TFAE
      [targetAffineLocally P f,
        ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i),
        ∀ (𝒰 : 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),
        ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤) (hU' : ∀ i, IsAffineOpen (U i)),
          ∀ i, @P _ _ (f ∣_ U i) (hU' i)] := by
  tfae_have 1 → 4
  · intro H U g h₁ h₂
    -- Porting note : I need to add `i1` manually, so to save some typing, named this variable
    set U' : Opens _ := ⟨_, h₂.base_open.open_range⟩
    replace H := H ⟨U', rangeIsAffineOpenOfOpenImmersion g⟩
    haveI i1 : IsAffine (Y.restrict U'.openEmbedding) := rangeIsAffineOpenOfOpenImmersion g
    rw [← P.toProperty_apply] at H ⊢
    rwa [← hP.1.arrow_mk_iso_iff (morphismRestrictOpensRange f _)]
  

Proof state:
P : AffineTargetMorphismProperty
hP : IsLocal P
X Y : Scheme
f : X ⟶ Y
tfae_1_to_4 :
  targetAffineLocally P f → ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
⊢ TFAE
    [targetAffineLocally P f,
      ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd,
      ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (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,
      ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)]

Next tactic:
tfae_have 4 → 3
open List in
theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_TFAE
    {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) :
    TFAE
      [targetAffineLocally P f,
        ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i),
        ∀ (𝒰 : 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),
        ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤) (hU' : ∀ i, IsAffineOpen (U i)),
          ∀ i, @P _ _ (f ∣_ U i) (hU' i)] := by
  tfae_have 1 → 4
  · intro H U g h₁ h₂
    -- Porting note : I need to add `i1` manually, so to save some typing, named this variable
    set U' : Opens _ := ⟨_, h₂.base_open.open_range⟩
    replace H := H ⟨U', rangeIsAffineOpenOfOpenImmersion g⟩
    haveI i1 : IsAffine (Y.restrict U'.openEmbedding) := rangeIsAffineOpenOfOpenImmersion g
    rw [← P.toProperty_apply] at H ⊢
    rwa [← hP.1.arrow_mk_iso_iff (morphismRestrictOpensRange f _)]
  tfae_have 4 → 3
  · 

Proof state:
case tfae_4_to_3
P : AffineTargetMorphismProperty
hP : IsLocal P
X Y : Scheme
f : X ⟶ Y
tfae_1_to_4 :
  targetAffineLocally P f → ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
⊢ (∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd) →
    ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd

Next tactic:
intro H 𝒰 h𝒰 i
open List in
theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_TFAE
    {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) :
    TFAE
      [targetAffineLocally P f,
        ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i),
        ∀ (𝒰 : 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),
        ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤) (hU' : ∀ i, IsAffineOpen (U i)),
          ∀ i, @P _ _ (f ∣_ U i) (hU' i)] := by
  tfae_have 1 → 4
  · intro H U g h₁ h₂
    -- Porting note : I need to add `i1` manually, so to save some typing, named this variable
    set U' : Opens _ := ⟨_, h₂.base_open.open_range⟩
    replace H := H ⟨U', rangeIsAffineOpenOfOpenImmersion g⟩
    haveI i1 : IsAffine (Y.restrict U'.openEmbedding) := rangeIsAffineOpenOfOpenImmersion g
    rw [← P.toProperty_apply] at H ⊢
    rwa [← hP.1.arrow_mk_iso_iff (morphismRestrictOpensRange f _)]
  tfae_have 4 → 3
  · intro H 𝒰 h𝒰 i
    

Proof state:
case tfae_4_to_3
P : AffineTargetMorphismProperty
hP : IsLocal P
X Y : Scheme
f : X ⟶ Y
tfae_1_to_4 :
  targetAffineLocally P f → ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
H : ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
𝒰 : Scheme.OpenCover Y
h𝒰 : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)
i : 𝒰.J
⊢ P pullback.snd

Next tactic:
apply H
open List in
theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_TFAE
    {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) :
    TFAE
      [targetAffineLocally P f,
        ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i),
        ∀ (𝒰 : 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),
        ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤) (hU' : ∀ i, IsAffineOpen (U i)),
          ∀ i, @P _ _ (f ∣_ U i) (hU' i)] := by
  tfae_have 1 → 4
  · intro H U g h₁ h₂
    -- Porting note : I need to add `i1` manually, so to save some typing, named this variable
    set U' : Opens _ := ⟨_, h₂.base_open.open_range⟩
    replace H := H ⟨U', rangeIsAffineOpenOfOpenImmersion g⟩
    haveI i1 : IsAffine (Y.restrict U'.openEmbedding) := rangeIsAffineOpenOfOpenImmersion g
    rw [← P.toProperty_apply] at H ⊢
    rwa [← hP.1.arrow_mk_iso_iff (morphismRestrictOpensRange f _)]
  tfae_have 4 → 3
  · intro H 𝒰 h𝒰 i
    apply H
  

Proof state:
P : AffineTargetMorphismProperty
hP : IsLocal P
X Y : Scheme
f : X ⟶ Y
tfae_1_to_4 :
  targetAffineLocally P f → ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd) →
    ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd
⊢ TFAE
    [targetAffineLocally P f,
      ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd,
      ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (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,
      ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)]

Next tactic:
tfae_have 3 → 2
open List in
theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_TFAE
    {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) :
    TFAE
      [targetAffineLocally P f,
        ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i),
        ∀ (𝒰 : 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),
        ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤) (hU' : ∀ i, IsAffineOpen (U i)),
          ∀ i, @P _ _ (f ∣_ U i) (hU' i)] := by
  tfae_have 1 → 4
  · intro H U g h₁ h₂
    -- Porting note : I need to add `i1` manually, so to save some typing, named this variable
    set U' : Opens _ := ⟨_, h₂.base_open.open_range⟩
    replace H := H ⟨U', rangeIsAffineOpenOfOpenImmersion g⟩
    haveI i1 : IsAffine (Y.restrict U'.openEmbedding) := rangeIsAffineOpenOfOpenImmersion g
    rw [← P.toProperty_apply] at H ⊢
    rwa [← hP.1.arrow_mk_iso_iff (morphismRestrictOpensRange f _)]
  tfae_have 4 → 3
  · intro H 𝒰 h𝒰 i
    apply H
  tfae_have 3 → 2
  · 

Proof state:
case tfae_3_to_2
P : AffineTargetMorphismProperty
hP : IsLocal P
X Y : Scheme
f : X ⟶ Y
tfae_1_to_4 :
  targetAffineLocally P f → ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd) →
    ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd
⊢ (∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd) →
    ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd

Next tactic:
exact fun H => ⟨Y.affineCover, inferInstance, H Y.affineCover⟩
open List in
theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_TFAE
    {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) :
    TFAE
      [targetAffineLocally P f,
        ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i),
        ∀ (𝒰 : 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),
        ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤) (hU' : ∀ i, IsAffineOpen (U i)),
          ∀ i, @P _ _ (f ∣_ U i) (hU' i)] := by
  tfae_have 1 → 4
  · intro H U g h₁ h₂
    -- Porting note : I need to add `i1` manually, so to save some typing, named this variable
    set U' : Opens _ := ⟨_, h₂.base_open.open_range⟩
    replace H := H ⟨U', rangeIsAffineOpenOfOpenImmersion g⟩
    haveI i1 : IsAffine (Y.restrict U'.openEmbedding) := rangeIsAffineOpenOfOpenImmersion g
    rw [← P.toProperty_apply] at H ⊢
    rwa [← hP.1.arrow_mk_iso_iff (morphismRestrictOpensRange f _)]
  tfae_have 4 → 3
  · intro H 𝒰 h𝒰 i
    apply H
  tfae_have 3 → 2
  · exact fun H => ⟨Y.affineCover, inferInstance, H Y.affineCover⟩
  

Proof state:
P : AffineTargetMorphismProperty
hP : IsLocal P
X Y : Scheme
f : X ⟶ Y
tfae_1_to_4 :
  targetAffineLocally P f → ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd) →
    ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd
tfae_3_to_2 :
  (∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd) →
    ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd
⊢ TFAE
    [targetAffineLocally P f,
      ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd,
      ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (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,
      ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)]

Next tactic:
tfae_have 2 → 1
open List in
theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_TFAE
    {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) :
    TFAE
      [targetAffineLocally P f,
        ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i),
        ∀ (𝒰 : 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),
        ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤) (hU' : ∀ i, IsAffineOpen (U i)),
          ∀ i, @P _ _ (f ∣_ U i) (hU' i)] := by
  tfae_have 1 → 4
  · intro H U g h₁ h₂
    -- Porting note : I need to add `i1` manually, so to save some typing, named this variable
    set U' : Opens _ := ⟨_, h₂.base_open.open_range⟩
    replace H := H ⟨U', rangeIsAffineOpenOfOpenImmersion g⟩
    haveI i1 : IsAffine (Y.restrict U'.openEmbedding) := rangeIsAffineOpenOfOpenImmersion g
    rw [← P.toProperty_apply] at H ⊢
    rwa [← hP.1.arrow_mk_iso_iff (morphismRestrictOpensRange f _)]
  tfae_have 4 → 3
  · intro H 𝒰 h𝒰 i
    apply H
  tfae_have 3 → 2
  · exact fun H => ⟨Y.affineCover, inferInstance, H Y.affineCover⟩
  tfae_have 2 → 1
  · 

Proof state:
case tfae_2_to_1
P : AffineTargetMorphismProperty
hP : IsLocal P
X Y : Scheme
f : X ⟶ Y
tfae_1_to_4 :
  targetAffineLocally P f → ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd) →
    ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd
tfae_3_to_2 :
  (∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd) →
    ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd
⊢ (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) → targetAffineLocally P f

Next tactic:
rintro ⟨𝒰, h𝒰, H⟩
open List in
theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_TFAE
    {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) :
    TFAE
      [targetAffineLocally P f,
        ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i),
        ∀ (𝒰 : 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),
        ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤) (hU' : ∀ i, IsAffineOpen (U i)),
          ∀ i, @P _ _ (f ∣_ U i) (hU' i)] := by
  tfae_have 1 → 4
  · intro H U g h₁ h₂
    -- Porting note : I need to add `i1` manually, so to save some typing, named this variable
    set U' : Opens _ := ⟨_, h₂.base_open.open_range⟩
    replace H := H ⟨U', rangeIsAffineOpenOfOpenImmersion g⟩
    haveI i1 : IsAffine (Y.restrict U'.openEmbedding) := rangeIsAffineOpenOfOpenImmersion g
    rw [← P.toProperty_apply] at H ⊢
    rwa [← hP.1.arrow_mk_iso_iff (morphismRestrictOpensRange f _)]
  tfae_have 4 → 3
  · intro H 𝒰 h𝒰 i
    apply H
  tfae_have 3 → 2
  · exact fun H => ⟨Y.affineCover, inferInstance, H Y.affineCover⟩
  tfae_have 2 → 1
  · rintro ⟨𝒰, h𝒰, H⟩; 

Proof state:
case tfae_2_to_1.intro.intro
P : AffineTargetMorphismProperty
hP : IsLocal P
X Y : Scheme
f : X ⟶ Y
tfae_1_to_4 :
  targetAffineLocally P f → ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd) →
    ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd
tfae_3_to_2 :
  (∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd) →
    ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd
𝒰 : Scheme.OpenCover Y
h𝒰 : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)
H : ∀ (i : 𝒰.J), P pullback.snd
⊢ targetAffineLocally P f

Next tactic:
exact targetAffineLocallyOfOpenCover hP f 𝒰 H
open List in
theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_TFAE
    {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) :
    TFAE
      [targetAffineLocally P f,
        ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i),
        ∀ (𝒰 : 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),
        ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤) (hU' : ∀ i, IsAffineOpen (U i)),
          ∀ i, @P _ _ (f ∣_ U i) (hU' i)] := by
  tfae_have 1 → 4
  · intro H U g h₁ h₂
    -- Porting note : I need to add `i1` manually, so to save some typing, named this variable
    set U' : Opens _ := ⟨_, h₂.base_open.open_range⟩
    replace H := H ⟨U', rangeIsAffineOpenOfOpenImmersion g⟩
    haveI i1 : IsAffine (Y.restrict U'.openEmbedding) := rangeIsAffineOpenOfOpenImmersion g
    rw [← P.toProperty_apply] at H ⊢
    rwa [← hP.1.arrow_mk_iso_iff (morphismRestrictOpensRange f _)]
  tfae_have 4 → 3
  · intro H 𝒰 h𝒰 i
    apply H
  tfae_have 3 → 2
  · exact fun H => ⟨Y.affineCover, inferInstance, H Y.affineCover⟩
  tfae_have 2 → 1
  · rintro ⟨𝒰, h𝒰, H⟩; exact targetAffineLocallyOfOpenCover hP f 𝒰 H
  

Proof state:
P : AffineTargetMorphismProperty
hP : IsLocal P
X Y : Scheme
f : X ⟶ Y
tfae_1_to_4 :
  targetAffineLocally P f → ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd) →
    ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd
tfae_3_to_2 :
  (∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd) →
    ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd
tfae_2_to_1 :
  (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) → targetAffineLocally P f
⊢ TFAE
    [targetAffineLocally P f,
      ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd,
      ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (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,
      ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)]

Next tactic:
tfae_have 5 → 2
open List in
theorem AffineTargetMorphismProperty.IsLocal.affine_openCover_TFAE
    {P : AffineTargetMorphismProperty} (hP : P.IsLocal) {X Y : Scheme.{u}} (f : X ⟶ Y) :
    TFAE
      [targetAffineLocally P f,
        ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)),
          ∀ i : 𝒰.J, P (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i),
        ∀ (𝒰 : 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),
        ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤) (hU' : ∀ i, IsAffineOpen (U i)),
          ∀ i, @P _ _ (f ∣_ U i) (hU' i)] := by
  tfae_have 1 → 4
  · intro H U g h₁ h₂
    -- Porting note : I need to add `i1` manually, so to save some typing, named this variable
    set U' : Opens _ := ⟨_, h₂.base_open.open_range⟩
    replace H := H ⟨U', rangeIsAffineOpenOfOpenImmersion g⟩
    haveI i1 : IsAffine (Y.restrict U'.openEmbedding) := rangeIsAffineOpenOfOpenImmersion g
    rw [← P.toProperty_apply] at H ⊢
    rwa [← hP.1.arrow_mk_iso_iff (morphismRestrictOpensRange f _)]
  tfae_have 4 → 3
  · intro H 𝒰 h𝒰 i
    apply H
  tfae_have 3 → 2
  · exact fun H => ⟨Y.affineCover, inferInstance, H Y.affineCover⟩
  tfae_have 2 → 1
  · rintro ⟨𝒰, h𝒰, H⟩; exact targetAffineLocallyOfOpenCover hP f 𝒰 H
  tfae_have 5 → 2
  · 

Proof state:
case tfae_5_to_2
P : AffineTargetMorphismProperty
hP : IsLocal P
X Y : Scheme
f : X ⟶ Y
tfae_1_to_4 :
  targetAffineLocally P f → ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd
tfae_4_to_3 :
  (∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd) →
    ∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd
tfae_3_to_2 :
  (∀ (𝒰 : Scheme.OpenCover Y) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P pullback.snd) →
    ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd
tfae_2_to_1 :
  (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd) → targetAffineLocally P f
⊢ (∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)) →
    ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)), ∀ (i : 𝒰.J), P pullback.snd

Next tactic:
rintro ⟨ι, U, hU, hU', H⟩