l3lab/ntp-mathlib huggingface dataset:
instance quasiSeparatedSpace_of_isAffine (X : Scheme) [IsAffine X] :
    QuasiSeparatedSpace X.carrier := by
  constructor
  intro U V hU hU' hV hV'
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hU', hU⟩
  obtain ⟨s', hs', e'⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hV', hV⟩
  rw [e, e', Set.iUnion₂_inter]
  simp_rw [Set.inter_iUnion₂]
  

Proof state:
case inter_isCompact.intro.intro.intro.intro
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
inst✝ : IsAffine X
U V : Set ↑↑X.toPresheafedSpace
hU : IsOpen U
hU' : IsCompact U
hV : IsOpen V
hV' : IsCompact V
s : Set ↑(X.presheaf.obj (op ⊤))
hs : Set.Finite s
e : U = ⋃ i ∈ s, ↑(X.basicOpen i)
s' : Set ↑(X.presheaf.obj (op ⊤))
hs' : Set.Finite s'
e' : V = ⋃ i ∈ s', ↑(X.basicOpen i)
⊢ IsCompact (⋃ i ∈ s, ⋃ i_1 ∈ s', ↑(X.basicOpen i) ∩ ↑(X.basicOpen i_1))

Next tactic:
apply hs.isCompact_biUnion
instance quasiSeparatedSpace_of_isAffine (X : Scheme) [IsAffine X] :
    QuasiSeparatedSpace X.carrier := by
  constructor
  intro U V hU hU' hV hV'
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hU', hU⟩
  obtain ⟨s', hs', e'⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hV', hV⟩
  rw [e, e', Set.iUnion₂_inter]
  simp_rw [Set.inter_iUnion₂]
  apply hs.isCompact_biUnion
  · 

Proof state:
case inter_isCompact.intro.intro.intro.intro
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
inst✝ : IsAffine X
U V : Set ↑↑X.toPresheafedSpace
hU : IsOpen U
hU' : IsCompact U
hV : IsOpen V
hV' : IsCompact V
s : Set ↑(X.presheaf.obj (op ⊤))
hs : Set.Finite s
e : U = ⋃ i ∈ s, ↑(X.basicOpen i)
s' : Set ↑(X.presheaf.obj (op ⊤))
hs' : Set.Finite s'
e' : V = ⋃ i ∈ s', ↑(X.basicOpen i)
⊢ ∀ i ∈ s, IsCompact (⋃ i_1 ∈ s', ↑(X.basicOpen i) ∩ ↑(X.basicOpen i_1))

Next tactic:
intro i _
instance quasiSeparatedSpace_of_isAffine (X : Scheme) [IsAffine X] :
    QuasiSeparatedSpace X.carrier := by
  constructor
  intro U V hU hU' hV hV'
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hU', hU⟩
  obtain ⟨s', hs', e'⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hV', hV⟩
  rw [e, e', Set.iUnion₂_inter]
  simp_rw [Set.inter_iUnion₂]
  apply hs.isCompact_biUnion
  · intro i _
    

Proof state:
case inter_isCompact.intro.intro.intro.intro
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
inst✝ : IsAffine X
U V : Set ↑↑X.toPresheafedSpace
hU : IsOpen U
hU' : IsCompact U
hV : IsOpen V
hV' : IsCompact V
s : Set ↑(X.presheaf.obj (op ⊤))
hs : Set.Finite s
e : U = ⋃ i ∈ s, ↑(X.basicOpen i)
s' : Set ↑(X.presheaf.obj (op ⊤))
hs' : Set.Finite s'
e' : V = ⋃ i ∈ s', ↑(X.basicOpen i)
i : ↑(X.presheaf.obj (op ⊤))
a✝ : i ∈ s
⊢ IsCompact (⋃ i_1 ∈ s', ↑(X.basicOpen i) ∩ ↑(X.basicOpen i_1))

Next tactic:
apply hs'.isCompact_biUnion
instance quasiSeparatedSpace_of_isAffine (X : Scheme) [IsAffine X] :
    QuasiSeparatedSpace X.carrier := by
  constructor
  intro U V hU hU' hV hV'
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hU', hU⟩
  obtain ⟨s', hs', e'⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hV', hV⟩
  rw [e, e', Set.iUnion₂_inter]
  simp_rw [Set.inter_iUnion₂]
  apply hs.isCompact_biUnion
  · intro i _
    apply hs'.isCompact_biUnion
    

Proof state:
case inter_isCompact.intro.intro.intro.intro
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
inst✝ : IsAffine X
U V : Set ↑↑X.toPresheafedSpace
hU : IsOpen U
hU' : IsCompact U
hV : IsOpen V
hV' : IsCompact V
s : Set ↑(X.presheaf.obj (op ⊤))
hs : Set.Finite s
e : U = ⋃ i ∈ s, ↑(X.basicOpen i)
s' : Set ↑(X.presheaf.obj (op ⊤))
hs' : Set.Finite s'
e' : V = ⋃ i ∈ s', ↑(X.basicOpen i)
i : ↑(X.presheaf.obj (op ⊤))
a✝ : i ∈ s
⊢ ∀ i_1 ∈ s', IsCompact (↑(X.basicOpen i) ∩ ↑(X.basicOpen i_1))

Next tactic:
intro i' _
instance quasiSeparatedSpace_of_isAffine (X : Scheme) [IsAffine X] :
    QuasiSeparatedSpace X.carrier := by
  constructor
  intro U V hU hU' hV hV'
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hU', hU⟩
  obtain ⟨s', hs', e'⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hV', hV⟩
  rw [e, e', Set.iUnion₂_inter]
  simp_rw [Set.inter_iUnion₂]
  apply hs.isCompact_biUnion
  · intro i _
    apply hs'.isCompact_biUnion
    intro i' _
    

Proof state:
case inter_isCompact.intro.intro.intro.intro
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
inst✝ : IsAffine X
U V : Set ↑↑X.toPresheafedSpace
hU : IsOpen U
hU' : IsCompact U
hV : IsOpen V
hV' : IsCompact V
s : Set ↑(X.presheaf.obj (op ⊤))
hs : Set.Finite s
e : U = ⋃ i ∈ s, ↑(X.basicOpen i)
s' : Set ↑(X.presheaf.obj (op ⊤))
hs' : Set.Finite s'
e' : V = ⋃ i ∈ s', ↑(X.basicOpen i)
i : ↑(X.presheaf.obj (op ⊤))
a✝¹ : i ∈ s
i' : ↑(X.presheaf.obj (op ⊤))
a✝ : i' ∈ s'
⊢ IsCompact (↑(X.basicOpen i) ∩ ↑(X.basicOpen i'))

Next tactic:
change IsCompact (X.basicOpen i ⊓ X.basicOpen i').1
instance quasiSeparatedSpace_of_isAffine (X : Scheme) [IsAffine X] :
    QuasiSeparatedSpace X.carrier := by
  constructor
  intro U V hU hU' hV hV'
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hU', hU⟩
  obtain ⟨s', hs', e'⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hV', hV⟩
  rw [e, e', Set.iUnion₂_inter]
  simp_rw [Set.inter_iUnion₂]
  apply hs.isCompact_biUnion
  · intro i _
    apply hs'.isCompact_biUnion
    intro i' _
    change IsCompact (X.basicOpen i ⊓ X.basicOpen i').1
    

Proof state:
case inter_isCompact.intro.intro.intro.intro
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
inst✝ : IsAffine X
U V : Set ↑↑X.toPresheafedSpace
hU : IsOpen U
hU' : IsCompact U
hV : IsOpen V
hV' : IsCompact V
s : Set ↑(X.presheaf.obj (op ⊤))
hs : Set.Finite s
e : U = ⋃ i ∈ s, ↑(X.basicOpen i)
s' : Set ↑(X.presheaf.obj (op ⊤))
hs' : Set.Finite s'
e' : V = ⋃ i ∈ s', ↑(X.basicOpen i)
i : ↑(X.presheaf.obj (op ⊤))
a✝¹ : i ∈ s
i' : ↑(X.presheaf.obj (op ⊤))
a✝ : i' ∈ s'
⊢ IsCompact (X.basicOpen i ⊓ X.basicOpen i').carrier

Next tactic:
rw [← Scheme.basicOpen_mul]
instance quasiSeparatedSpace_of_isAffine (X : Scheme) [IsAffine X] :
    QuasiSeparatedSpace X.carrier := by
  constructor
  intro U V hU hU' hV hV'
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hU', hU⟩
  obtain ⟨s', hs', e'⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hV', hV⟩
  rw [e, e', Set.iUnion₂_inter]
  simp_rw [Set.inter_iUnion₂]
  apply hs.isCompact_biUnion
  · intro i _
    apply hs'.isCompact_biUnion
    intro i' _
    change IsCompact (X.basicOpen i ⊓ X.basicOpen i').1
    rw [← Scheme.basicOpen_mul]
    

Proof state:
case inter_isCompact.intro.intro.intro.intro
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
inst✝ : IsAffine X
U V : Set ↑↑X.toPresheafedSpace
hU : IsOpen U
hU' : IsCompact U
hV : IsOpen V
hV' : IsCompact V
s : Set ↑(X.presheaf.obj (op ⊤))
hs : Set.Finite s
e : U = ⋃ i ∈ s, ↑(X.basicOpen i)
s' : Set ↑(X.presheaf.obj (op ⊤))
hs' : Set.Finite s'
e' : V = ⋃ i ∈ s', ↑(X.basicOpen i)
i : ↑(X.presheaf.obj (op ⊤))
a✝¹ : i ∈ s
i' : ↑(X.presheaf.obj (op ⊤))
a✝ : i' ∈ s'
⊢ IsCompact (X.basicOpen (i * i')).carrier

Next tactic:
exact ((topIsAffineOpen _).basicOpenIsAffine _).isCompact
theorem IsAffineOpen.isQuasiSeparated {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
    IsQuasiSeparated (U : Set X.carrier) := by
  

Proof state:
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ IsQuasiSeparated ↑U

Next tactic:
rw [isQuasiSeparated_iff_quasiSeparatedSpace]
theorem IsAffineOpen.isQuasiSeparated {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
    IsQuasiSeparated (U : Set X.carrier) := by
  rw [isQuasiSeparated_iff_quasiSeparatedSpace]
  

Proof state:
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ QuasiSeparatedSpace ↑↑U
case hs X✝ Y : Scheme f : X✝ ⟶ Y X : Scheme U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U ⊢ IsOpen ↑U

Next tactic:
exacts [@AlgebraicGeometry.quasiSeparatedSpace_of_isAffine _ hU, U.isOpen]
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  

Proof state:
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H : QuasiSeparated (f ≫ g)
⊢ QuasiSeparated f

Next tactic:
have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  

Proof state:
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H : QuasiSeparated (f ≫ g)
h01 :
  QuasiSeparated f ↔
    ∃ 𝒰,
      ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
        ∀ (i : 𝒰.J),
          QuasiSeparatedSpace
            ↑↑(pullback f (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ QuasiSeparated f

Next tactic:
rw [h01]
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  rw [h01]; 

Proof state:
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H : QuasiSeparated (f ≫ g)
h01 :
  QuasiSeparated f ↔
    ∃ 𝒰,
      ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
        ∀ (i : 𝒰.J),
          QuasiSeparatedSpace
            ↑↑(pullback f (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ ∃ 𝒰,
    ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
      ∀ (i : 𝒰.J),
        QuasiSeparatedSpace
          ↑↑(pullback f (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace

Next tactic:
clear h01
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  rw [h01]; clear h01
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE ...).out 0 2` directly fails, but
  -- give it a name works
  

Proof state:
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H : QuasiSeparated (f ≫ g)
⊢ ∃ 𝒰,
    ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
      ∀ (i : 𝒰.J),
        QuasiSeparatedSpace
          ↑↑(pullback f (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace

Next tactic:
have h02 := (QuasiSeparated.affine_openCover_TFAE (f ≫ g)).out 0 2
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  rw [h01]; clear h01
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE ...).out 0 2` directly fails, but
  -- give it a name works
  have h02 := (QuasiSeparated.affine_openCover_TFAE (f ≫ g)).out 0 2
  

Proof state:
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H : QuasiSeparated (f ≫ g)
h02 :
  QuasiSeparated (f ≫ g) ↔
    ∀ (𝒰 : Scheme.OpenCover Z) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      QuasiSeparatedSpace
        ↑↑(pullback (f ≫ g) (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ ∃ 𝒰,
    ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
      ∀ (i : 𝒰.J),
        QuasiSeparatedSpace
          ↑↑(pullback f (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace

Next tactic:
rw [h02] at H
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  rw [h01]; clear h01
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE ...).out 0 2` directly fails, but
  -- give it a name works
  have h02 := (QuasiSeparated.affine_openCover_TFAE (f ≫ g)).out 0 2
  rw [h02] at H; 

Proof state:
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H :
  ∀ (𝒰 : Scheme.OpenCover Z) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
    QuasiSeparatedSpace
      ↑↑(pullback (f ≫ g) (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
h02 :
  QuasiSeparated (f ≫ g) ↔
    ∀ (𝒰 : Scheme.OpenCover Z) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
      QuasiSeparatedSpace
        ↑↑(pullback (f ≫ g) (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ ∃ 𝒰,
    ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
      ∀ (i : 𝒰.J),
        QuasiSeparatedSpace
          ↑↑(pullback f (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace

Next tactic:
clear h02
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  rw [h01]; clear h01
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE ...).out 0 2` directly fails, but
  -- give it a name works
  have h02 := (QuasiSeparated.affine_openCover_TFAE (f ≫ g)).out 0 2
  rw [h02] at H; clear h02
  

Proof state:
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H :
  ∀ (𝒰 : Scheme.OpenCover Z) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
    QuasiSeparatedSpace
      ↑↑(pullback (f ≫ g) (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ ∃ 𝒰,
    ∃ (_ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)),
      ∀ (i : 𝒰.J),
        QuasiSeparatedSpace
          ↑↑(pullback f (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace

Next tactic:
refine ⟨(Z.affineCover.pullbackCover g).bind fun x => Scheme.affineCover _, ?_, ?_⟩
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  rw [h01]; clear h01
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE ...).out 0 2` directly fails, but
  -- give it a name works
  have h02 := (QuasiSeparated.affine_openCover_TFAE (f ≫ g)).out 0 2
  rw [h02] at H; clear h02
  refine ⟨(Z.affineCover.pullbackCover g).bind fun x => Scheme.affineCover _, ?_, ?_⟩
  -- constructor
  · 

Proof state:
case refine_1
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H :
  ∀ (𝒰 : Scheme.OpenCover Z) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
    QuasiSeparatedSpace
      ↑↑(pullback (f ≫ g) (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ ∀
    (i :
      (Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun x =>
          Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) x)).J),
    IsAffine
      (Scheme.OpenCover.obj
        (Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun x =>
          Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) x))
        i)

Next tactic:
intro i
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  rw [h01]; clear h01
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE ...).out 0 2` directly fails, but
  -- give it a name works
  have h02 := (QuasiSeparated.affine_openCover_TFAE (f ≫ g)).out 0 2
  rw [h02] at H; clear h02
  refine ⟨(Z.affineCover.pullbackCover g).bind fun x => Scheme.affineCover _, ?_, ?_⟩
  -- constructor
  · intro i; 

Proof state:
case refine_1
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H :
  ∀ (𝒰 : Scheme.OpenCover Z) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
    QuasiSeparatedSpace
      ↑↑(pullback (f ≫ g) (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
i :
  (Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun x =>
      Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) x)).J
⊢ IsAffine
    (Scheme.OpenCover.obj
      (Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun x =>
        Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) x))
      i)

Next tactic:
dsimp
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  rw [h01]; clear h01
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE ...).out 0 2` directly fails, but
  -- give it a name works
  have h02 := (QuasiSeparated.affine_openCover_TFAE (f ≫ g)).out 0 2
  rw [h02] at H; clear h02
  refine ⟨(Z.affineCover.pullbackCover g).bind fun x => Scheme.affineCover _, ?_, ?_⟩
  -- constructor
  · intro i; dsimp; 

Proof state:
case refine_1
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H :
  ∀ (𝒰 : Scheme.OpenCover Z) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
    QuasiSeparatedSpace
      ↑↑(pullback (f ≫ g) (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
i :
  (Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun x =>
      Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) x)).J
⊢ IsAffine
    (Scheme.OpenCover.obj (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i.fst))) i.snd)

Next tactic:
infer_instance
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  rw [h01]; clear h01
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE ...).out 0 2` directly fails, but
  -- give it a name works
  have h02 := (QuasiSeparated.affine_openCover_TFAE (f ≫ g)).out 0 2
  rw [h02] at H; clear h02
  refine ⟨(Z.affineCover.pullbackCover g).bind fun x => Scheme.affineCover _, ?_, ?_⟩
  -- constructor
  · intro i; dsimp; infer_instance
  

Proof state:
case refine_2
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H :
  ∀ (𝒰 : Scheme.OpenCover Z) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
    QuasiSeparatedSpace
      ↑↑(pullback (f ≫ g) (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ ∀
    (i :
      (Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun x =>
          Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) x)).J),
    QuasiSeparatedSpace
      ↑↑(pullback f
                  (Scheme.OpenCover.map
                    (Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun x =>
                      Scheme.affineCover
                        (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) x))
                    i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace

Next tactic:
rintro ⟨i, j⟩
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  rw [h01]; clear h01
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE ...).out 0 2` directly fails, but
  -- give it a name works
  have h02 := (QuasiSeparated.affine_openCover_TFAE (f ≫ g)).out 0 2
  rw [h02] at H; clear h02
  refine ⟨(Z.affineCover.pullbackCover g).bind fun x => Scheme.affineCover _, ?_, ?_⟩
  -- constructor
  · intro i; dsimp; infer_instance
  rintro ⟨i, j⟩; 

Proof state:
case refine_2.mk
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H :
  ∀ (𝒰 : Scheme.OpenCover Z) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
    QuasiSeparatedSpace
      ↑↑(pullback (f ≫ g) (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g).J
j :
  ((fun x => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) x)) i).J
⊢ QuasiSeparatedSpace
    ↑↑(pullback f
                (Scheme.OpenCover.map
                  (Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun x =>
                    Scheme.affineCover
                      (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) x))
                  { fst := i, snd := j })).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace

Next tactic:
dsimp at i j
theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] :
    QuasiSeparated f := by
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but
  -- give it a name works
  have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1
  rw [h01]; clear h01
  -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE ...).out 0 2` directly fails, but
  -- give it a name works
  have h02 := (QuasiSeparated.affine_openCover_TFAE (f ≫ g)).out 0 2
  rw [h02] at H; clear h02
  refine ⟨(Z.affineCover.pullbackCover g).bind fun x => Scheme.affineCover _, ?_, ?_⟩
  -- constructor
  · intro i; dsimp; infer_instance
  rintro ⟨i, j⟩; dsimp at i j
  -- replace H := H (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i
  

Proof state:
case refine_2.mk
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y Z : Scheme
f : X ⟶ Y
g : Y ⟶ Z
H :
  ∀ (𝒰 : Scheme.OpenCover Z) [inst : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J),
    QuasiSeparatedSpace
      ↑↑(pullback (f ≫ g) (Scheme.OpenCover.map 𝒰 i)).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
i : (Scheme.affineCover Z).J
j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))).J
⊢ QuasiSeparatedSpace
    ↑↑(pullback f
                (Scheme.OpenCover.map
                  (Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun x =>
                    Scheme.affineCover
                      (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) x))
                  { fst := i, snd := j })).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace

Next tactic:
specialize H _ i