l3lab/ntp-mathlib huggingface dataset:
theorem isCompact_basicOpen (X : Scheme) {U : Opens X.carrier} (hU : IsCompact (U : Set X.carrier))
    (f : X.presheaf.obj (op U)) : IsCompact (X.basicOpen f : Set X.carrier) := by
  classical
  refine' ((isCompact_open_iff_eq_finset_affine_union _).mpr _).1
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union _).mp ⟨hU, U.isOpen⟩
  let g : s → X.affineOpens := by
    intro V
    use V.1 ⊓ X.basicOpen f
    have : V.1.1 ⟶ U := by
      apply homOfLE; change _ ⊆ (U : Set X.carrier); rw [e]
      convert @Set.subset_iUnion₂ _ _ _
        (fun (U : X.affineOpens) (_ : U ∈ s) => ↑U) V V.prop using 1
    erw [← X.toLocallyRingedSpace.toRingedSpace.basicOpen_res this.op]
    exact IsAffineOpen.basicOpenIsAffine V.1.prop _
  haveI : Finite s := hs.to_subtype
  refine' ⟨Set.range g, Set.finite_range g, _⟩
  refine' (Set.inter_eq_right.mpr
            (SetLike.coe_subset_coe.2 <| RingedSpace.basicOpen_le _ _)).symm.trans _
  rw [e, Set.iUnion₂_inter]
  apply le_antisymm <;> apply Set.iUnion₂_subset
  · intro i hi
    -- porting note: had to make explicit the first given parameter to `Set.subset_iUnion₂`
    exact Set.Subset.trans (Set.Subset.rfl : _ ≤ g ⟨i, hi⟩)
      (@Set.subset_iUnion₂ _ _ _
        (fun (i : Scheme.affineOpens X) (_ : i ∈ Set.range g) => (i : Set X.toPresheafedSpace)) _
        (Set.mem_range_self ⟨i, hi⟩))
  · 

Proof state:
case intro.intro.a.h
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact ↑U
f : ↑(X.presheaf.obj (op U))
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : ↑U = ⋃ i ∈ s, ↑↑i
g : ↑s → ↑(Scheme.affineOpens X) :=
  fun V => { val := ↑↑V ⊓ X.basicOpen f, property := (_ : ↑↑V ⊓ X.basicOpen f ∈ Scheme.affineOpens X) }
this : Finite ↑s
⊢ ∀ i ∈ Set.range g,
    ↑↑i ⊆ ⋃ i ∈ s, ↑↑i ∩ ↑(RingedSpace.basicOpen (LocallyRingedSpace.toRingedSpace X.toLocallyRingedSpace) f)

Next tactic:
rintro ⟨i, hi⟩ ⟨⟨j, hj⟩, hj'⟩
theorem isCompact_basicOpen (X : Scheme) {U : Opens X.carrier} (hU : IsCompact (U : Set X.carrier))
    (f : X.presheaf.obj (op U)) : IsCompact (X.basicOpen f : Set X.carrier) := by
  classical
  refine' ((isCompact_open_iff_eq_finset_affine_union _).mpr _).1
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union _).mp ⟨hU, U.isOpen⟩
  let g : s → X.affineOpens := by
    intro V
    use V.1 ⊓ X.basicOpen f
    have : V.1.1 ⟶ U := by
      apply homOfLE; change _ ⊆ (U : Set X.carrier); rw [e]
      convert @Set.subset_iUnion₂ _ _ _
        (fun (U : X.affineOpens) (_ : U ∈ s) => ↑U) V V.prop using 1
    erw [← X.toLocallyRingedSpace.toRingedSpace.basicOpen_res this.op]
    exact IsAffineOpen.basicOpenIsAffine V.1.prop _
  haveI : Finite s := hs.to_subtype
  refine' ⟨Set.range g, Set.finite_range g, _⟩
  refine' (Set.inter_eq_right.mpr
            (SetLike.coe_subset_coe.2 <| RingedSpace.basicOpen_le _ _)).symm.trans _
  rw [e, Set.iUnion₂_inter]
  apply le_antisymm <;> apply Set.iUnion₂_subset
  · intro i hi
    -- porting note: had to make explicit the first given parameter to `Set.subset_iUnion₂`
    exact Set.Subset.trans (Set.Subset.rfl : _ ≤ g ⟨i, hi⟩)
      (@Set.subset_iUnion₂ _ _ _
        (fun (i : Scheme.affineOpens X) (_ : i ∈ Set.range g) => (i : Set X.toPresheafedSpace)) _
        (Set.mem_range_self ⟨i, hi⟩))
  · rintro ⟨i, hi⟩ ⟨⟨j, hj⟩, hj'⟩
    

Proof state:
case intro.intro.a.h.mk.intro.mk
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact ↑U
f : ↑(X.presheaf.obj (op U))
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : ↑U = ⋃ i ∈ s, ↑↑i
g : ↑s → ↑(Scheme.affineOpens X) :=
  fun V => { val := ↑↑V ⊓ X.basicOpen f, property := (_ : ↑↑V ⊓ X.basicOpen f ∈ Scheme.affineOpens X) }
this : Finite ↑s
i : Opens ↑↑X.toPresheafedSpace
hi : i ∈ Scheme.affineOpens X
j : ↑(Scheme.affineOpens X)
hj : j ∈ s
hj' : g { val := j, property := hj } = { val := i, property := hi }
⊢ ↑↑{ val := i, property := hi } ⊆
    ⋃ i ∈ s, ↑↑i ∩ ↑(RingedSpace.basicOpen (LocallyRingedSpace.toRingedSpace X.toLocallyRingedSpace) f)

Next tactic:
rw [← hj']
theorem isCompact_basicOpen (X : Scheme) {U : Opens X.carrier} (hU : IsCompact (U : Set X.carrier))
    (f : X.presheaf.obj (op U)) : IsCompact (X.basicOpen f : Set X.carrier) := by
  classical
  refine' ((isCompact_open_iff_eq_finset_affine_union _).mpr _).1
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union _).mp ⟨hU, U.isOpen⟩
  let g : s → X.affineOpens := by
    intro V
    use V.1 ⊓ X.basicOpen f
    have : V.1.1 ⟶ U := by
      apply homOfLE; change _ ⊆ (U : Set X.carrier); rw [e]
      convert @Set.subset_iUnion₂ _ _ _
        (fun (U : X.affineOpens) (_ : U ∈ s) => ↑U) V V.prop using 1
    erw [← X.toLocallyRingedSpace.toRingedSpace.basicOpen_res this.op]
    exact IsAffineOpen.basicOpenIsAffine V.1.prop _
  haveI : Finite s := hs.to_subtype
  refine' ⟨Set.range g, Set.finite_range g, _⟩
  refine' (Set.inter_eq_right.mpr
            (SetLike.coe_subset_coe.2 <| RingedSpace.basicOpen_le _ _)).symm.trans _
  rw [e, Set.iUnion₂_inter]
  apply le_antisymm <;> apply Set.iUnion₂_subset
  · intro i hi
    -- porting note: had to make explicit the first given parameter to `Set.subset_iUnion₂`
    exact Set.Subset.trans (Set.Subset.rfl : _ ≤ g ⟨i, hi⟩)
      (@Set.subset_iUnion₂ _ _ _
        (fun (i : Scheme.affineOpens X) (_ : i ∈ Set.range g) => (i : Set X.toPresheafedSpace)) _
        (Set.mem_range_self ⟨i, hi⟩))
  · rintro ⟨i, hi⟩ ⟨⟨j, hj⟩, hj'⟩
    rw [← hj']
    

Proof state:
case intro.intro.a.h.mk.intro.mk
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact ↑U
f : ↑(X.presheaf.obj (op U))
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : ↑U = ⋃ i ∈ s, ↑↑i
g : ↑s → ↑(Scheme.affineOpens X) :=
  fun V => { val := ↑↑V ⊓ X.basicOpen f, property := (_ : ↑↑V ⊓ X.basicOpen f ∈ Scheme.affineOpens X) }
this : Finite ↑s
i : Opens ↑↑X.toPresheafedSpace
hi : i ∈ Scheme.affineOpens X
j : ↑(Scheme.affineOpens X)
hj : j ∈ s
hj' : g { val := j, property := hj } = { val := i, property := hi }
⊢ ↑↑(g { val := j, property := hj }) ⊆
    ⋃ i ∈ s, ↑↑i ∩ ↑(RingedSpace.basicOpen (LocallyRingedSpace.toRingedSpace X.toLocallyRingedSpace) f)

Next tactic:
refine' Set.Subset.trans _ (Set.subset_iUnion₂ j hj)
theorem isCompact_basicOpen (X : Scheme) {U : Opens X.carrier} (hU : IsCompact (U : Set X.carrier))
    (f : X.presheaf.obj (op U)) : IsCompact (X.basicOpen f : Set X.carrier) := by
  classical
  refine' ((isCompact_open_iff_eq_finset_affine_union _).mpr _).1
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union _).mp ⟨hU, U.isOpen⟩
  let g : s → X.affineOpens := by
    intro V
    use V.1 ⊓ X.basicOpen f
    have : V.1.1 ⟶ U := by
      apply homOfLE; change _ ⊆ (U : Set X.carrier); rw [e]
      convert @Set.subset_iUnion₂ _ _ _
        (fun (U : X.affineOpens) (_ : U ∈ s) => ↑U) V V.prop using 1
    erw [← X.toLocallyRingedSpace.toRingedSpace.basicOpen_res this.op]
    exact IsAffineOpen.basicOpenIsAffine V.1.prop _
  haveI : Finite s := hs.to_subtype
  refine' ⟨Set.range g, Set.finite_range g, _⟩
  refine' (Set.inter_eq_right.mpr
            (SetLike.coe_subset_coe.2 <| RingedSpace.basicOpen_le _ _)).symm.trans _
  rw [e, Set.iUnion₂_inter]
  apply le_antisymm <;> apply Set.iUnion₂_subset
  · intro i hi
    -- porting note: had to make explicit the first given parameter to `Set.subset_iUnion₂`
    exact Set.Subset.trans (Set.Subset.rfl : _ ≤ g ⟨i, hi⟩)
      (@Set.subset_iUnion₂ _ _ _
        (fun (i : Scheme.affineOpens X) (_ : i ∈ Set.range g) => (i : Set X.toPresheafedSpace)) _
        (Set.mem_range_self ⟨i, hi⟩))
  · rintro ⟨i, hi⟩ ⟨⟨j, hj⟩, hj'⟩
    rw [← hj']
    refine' Set.Subset.trans _ (Set.subset_iUnion₂ j hj)
    

Proof state:
case intro.intro.a.h.mk.intro.mk
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact ↑U
f : ↑(X.presheaf.obj (op U))
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : ↑U = ⋃ i ∈ s, ↑↑i
g : ↑s → ↑(Scheme.affineOpens X) :=
  fun V => { val := ↑↑V ⊓ X.basicOpen f, property := (_ : ↑↑V ⊓ X.basicOpen f ∈ Scheme.affineOpens X) }
this : Finite ↑s
i : Opens ↑↑X.toPresheafedSpace
hi : i ∈ Scheme.affineOpens X
j : ↑(Scheme.affineOpens X)
hj : j ∈ s
hj' : g { val := j, property := hj } = { val := i, property := hi }
⊢ ↑↑(g { val := j, property := hj }) ⊆
    ↑↑j ∩ ↑(RingedSpace.basicOpen (LocallyRingedSpace.toRingedSpace X.toLocallyRingedSpace) f)

Next tactic:
exact Set.Subset.rfl
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  

Proof state:
X Y : Scheme
f : X ⟶ Y
⊢ AffineTargetMorphismProperty.IsLocal affineProperty

Next tactic:
constructor
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · 

Proof state:
case RespectsIso
X Y : Scheme
f : X ⟶ Y
⊢ MorphismProperty.RespectsIso (AffineTargetMorphismProperty.toProperty affineProperty)

Next tactic:
apply AffineTargetMorphismProperty.respectsIso_mk
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> 

Proof state:
case RespectsIso.h₁
X Y : Scheme
f : X ⟶ Y
⊢ ∀ {X Y Z : Scheme} (e : X ≅ Y) (f : Y ⟶ Z) [inst : IsAffine Z], affineProperty f → affineProperty (e.hom ≫ f)

Next tactic:
rintro X Y Z e _ _ H
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> 

Proof state:
case RespectsIso.h₂
X Y : Scheme
f : X ⟶ Y
⊢ ∀ {X Y Z : Scheme} (e : Y ≅ Z) (f : X ⟶ Y) [h : IsAffine Y], affineProperty f → affineProperty (f ≫ e.hom)

Next tactic:
rintro X Y Z e _ _ H
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    

Proof state:
case RespectsIso.h₁
X✝ Y✝ : Scheme
f : X✝ ⟶ Y✝
X Y Z : Scheme
e : X ≅ Y
f✝ : Y ⟶ Z
inst✝ : IsAffine Z
H : affineProperty f✝
⊢ affineProperty (e.hom ≫ f✝)
case RespectsIso.h₂
X✝ Y✝ : Scheme
f : X✝ ⟶ Y✝
X Y Z : Scheme
e : Y ≅ Z
f✝ : X ⟶ Y
h✝ : IsAffine Y
H : affineProperty f✝
⊢ affineProperty (f✝ ≫ e.hom)

Next tactic:
exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · 

Proof state:
case toBasicOpen
X Y : Scheme
f : X ⟶ Y
⊢ ∀ {X Y : Scheme} [inst : IsAffine Y] (f : X ⟶ Y) (r : ↑(Y.presheaf.obj (op ⊤))),
    affineProperty f → affineProperty (f ∣_ Y.basicOpen r)

Next tactic:
introv H
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    

Proof state:
case toBasicOpen
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
H : affineProperty f
⊢ affineProperty (f ∣_ Y.basicOpen r)

Next tactic:
dsimp [affineProperty] at H ⊢
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    

Proof state:
case toBasicOpen
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
H : CompactSpace ↑↑X.toPresheafedSpace
⊢ CompactSpace ↑↑(X ∣_ᵤ f⁻¹ᵁ Y.basicOpen r).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace

Next tactic:
change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    

Proof state:
case toBasicOpen
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
H : CompactSpace ↑↑X.toPresheafedSpace
⊢ CompactSpace ↥(f⁻¹ᵁ Y.basicOpen r)

Next tactic:
rw [Scheme.preimage_basicOpen f r]
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    rw [Scheme.preimage_basicOpen f r]
    

Proof state:
case toBasicOpen
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
H : CompactSpace ↑↑X.toPresheafedSpace
⊢ CompactSpace ↥(X.basicOpen ((f.val.c.app (op ⊤)) r))

Next tactic:
erw [← isCompact_iff_compactSpace]
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    rw [Scheme.preimage_basicOpen f r]
    erw [← isCompact_iff_compactSpace]
    

Proof state:
case toBasicOpen
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
H : CompactSpace ↑↑X.toPresheafedSpace
⊢ IsCompact ↑(X.basicOpen ((f.val.c.app (op ⊤)) r))

Next tactic:
rw [← isCompact_univ_iff] at H
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    rw [Scheme.preimage_basicOpen f r]
    erw [← isCompact_iff_compactSpace]
    rw [← isCompact_univ_iff] at H
    

Proof state:
case toBasicOpen
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
H : IsCompact Set.univ
⊢ IsCompact ↑(X.basicOpen ((f.val.c.app (op ⊤)) r))

Next tactic:
apply isCompact_basicOpen
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    rw [Scheme.preimage_basicOpen f r]
    erw [← isCompact_iff_compactSpace]
    rw [← isCompact_univ_iff] at H
    apply isCompact_basicOpen
    

Proof state:
case toBasicOpen.hU
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
inst✝ : IsAffine Y
f : X ⟶ Y
r : ↑(Y.presheaf.obj (op ⊤))
H : IsCompact Set.univ
⊢ IsCompact ↑(f⁻¹ᵁ ⊤)

Next tactic:
exact H
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    rw [Scheme.preimage_basicOpen f r]
    erw [← isCompact_iff_compactSpace]
    rw [← isCompact_univ_iff] at H
    apply isCompact_basicOpen
    exact H
  · 

Proof state:
case ofBasicOpenCover
X Y : Scheme
f : X ⟶ Y
⊢ ∀ {X Y : Scheme} [inst : IsAffine Y] (f : X ⟶ Y) (s : Finset ↑(Y.presheaf.obj (op ⊤))),
    Ideal.span ↑s = ⊤ → (∀ (r : { x // x ∈ s }), affineProperty (f ∣_ Y.basicOpen ↑r)) → affineProperty f

Next tactic:
rintro X Y H f S hS hS'
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    rw [Scheme.preimage_basicOpen f r]
    erw [← isCompact_iff_compactSpace]
    rw [← isCompact_univ_iff] at H
    apply isCompact_basicOpen
    exact H
  · rintro X Y H f S hS hS'
    

Proof state:
case ofBasicOpenCover
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
H : IsAffine Y
f : X ⟶ Y
S : Finset ↑(Y.presheaf.obj (op ⊤))
hS : Ideal.span ↑S = ⊤
hS' : ∀ (r : { x // x ∈ S }), affineProperty (f ∣_ Y.basicOpen ↑r)
⊢ affineProperty f

Next tactic:
rw [← IsAffineOpen.basicOpen_union_eq_self_iff] at hS
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    rw [Scheme.preimage_basicOpen f r]
    erw [← isCompact_iff_compactSpace]
    rw [← isCompact_univ_iff] at H
    apply isCompact_basicOpen
    exact H
  · rintro X Y H f S hS hS'
    rw [← IsAffineOpen.basicOpen_union_eq_self_iff] at hS
    

Proof state:
case ofBasicOpenCover
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
H : IsAffine Y
f : X ⟶ Y
S : Finset ↑(Y.presheaf.obj (op ⊤))
hS : ⨆ f, Y.basicOpen ↑f = ⊤
hS' : ∀ (r : { x // x ∈ S }), affineProperty (f ∣_ Y.basicOpen ↑r)
⊢ affineProperty f
case ofBasicOpenCover.hU
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
H : IsAffine Y
f : X ⟶ Y
S : Finset ↑(Y.presheaf.obj (op ⊤))
hS : Ideal.span ↑S = ⊤
hS' : ∀ (r : { x // x ∈ S }), affineProperty (f ∣_ Y.basicOpen ↑r)
⊢ IsAffineOpen ⊤

Next tactic:
delta QuasiCompact.affineProperty
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    rw [Scheme.preimage_basicOpen f r]
    erw [← isCompact_iff_compactSpace]
    rw [← isCompact_univ_iff] at H
    apply isCompact_basicOpen
    exact H
  · rintro X Y H f S hS hS'
    rw [← IsAffineOpen.basicOpen_union_eq_self_iff] at hS
    delta QuasiCompact.affineProperty
    

Proof state:
case ofBasicOpenCover
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
H : IsAffine Y
f : X ⟶ Y
S : Finset ↑(Y.presheaf.obj (op ⊤))
hS : ⨆ f, Y.basicOpen ↑f = ⊤
hS' : ∀ (r : { x // x ∈ S }), affineProperty (f ∣_ Y.basicOpen ↑r)
⊢ CompactSpace ↑↑X.toPresheafedSpace
case ofBasicOpenCover.hU
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
H : IsAffine Y
f : X ⟶ Y
S : Finset ↑(Y.presheaf.obj (op ⊤))
hS : Ideal.span ↑S = ⊤
hS' : ∀ (r : { x // x ∈ S }), affineProperty (f ∣_ Y.basicOpen ↑r)
⊢ IsAffineOpen ⊤

Next tactic:
rw [← isCompact_univ_iff]
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    rw [Scheme.preimage_basicOpen f r]
    erw [← isCompact_iff_compactSpace]
    rw [← isCompact_univ_iff] at H
    apply isCompact_basicOpen
    exact H
  · rintro X Y H f S hS hS'
    rw [← IsAffineOpen.basicOpen_union_eq_self_iff] at hS
    delta QuasiCompact.affineProperty
    rw [← isCompact_univ_iff]
    

Proof state:
case ofBasicOpenCover
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
H : IsAffine Y
f : X ⟶ Y
S : Finset ↑(Y.presheaf.obj (op ⊤))
hS : ⨆ f, Y.basicOpen ↑f = ⊤
hS' : ∀ (r : { x // x ∈ S }), affineProperty (f ∣_ Y.basicOpen ↑r)
⊢ IsCompact Set.univ
case ofBasicOpenCover.hU
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
H : IsAffine Y
f : X ⟶ Y
S : Finset ↑(Y.presheaf.obj (op ⊤))
hS : Ideal.span ↑S = ⊤
hS' : ∀ (r : { x // x ∈ S }), affineProperty (f ∣_ Y.basicOpen ↑r)
⊢ IsAffineOpen ⊤

Next tactic:
change IsCompact ((Opens.map f.val.base).obj ⊤).1
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    rw [Scheme.preimage_basicOpen f r]
    erw [← isCompact_iff_compactSpace]
    rw [← isCompact_univ_iff] at H
    apply isCompact_basicOpen
    exact H
  · rintro X Y H f S hS hS'
    rw [← IsAffineOpen.basicOpen_union_eq_self_iff] at hS
    delta QuasiCompact.affineProperty
    rw [← isCompact_univ_iff]
    change IsCompact ((Opens.map f.val.base).obj ⊤).1
    

Proof state:
case ofBasicOpenCover
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
H : IsAffine Y
f : X ⟶ Y
S : Finset ↑(Y.presheaf.obj (op ⊤))
hS : ⨆ f, Y.basicOpen ↑f = ⊤
hS' : ∀ (r : { x // x ∈ S }), affineProperty (f ∣_ Y.basicOpen ↑r)
⊢ IsCompact (f⁻¹ᵁ ⊤).carrier
case ofBasicOpenCover.hU
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
H : IsAffine Y
f : X ⟶ Y
S : Finset ↑(Y.presheaf.obj (op ⊤))
hS : Ideal.span ↑S = ⊤
hS' : ∀ (r : { x // x ∈ S }), affineProperty (f ∣_ Y.basicOpen ↑r)
⊢ IsAffineOpen ⊤

Next tactic:
rw [← hS]
theorem QuasiCompact.affineProperty_isLocal : (QuasiCompact.affineProperty : _).IsLocal := by
  constructor
  · apply AffineTargetMorphismProperty.respectsIso_mk <;> rintro X Y Z e _ _ H
    exacts [@Homeomorph.compactSpace _ _ _ _ H (TopCat.homeoOfIso (asIso e.inv.1.base)), H]
  · introv H
    dsimp [affineProperty] at H ⊢
    change CompactSpace ((Opens.map f.val.base).obj (Y.basicOpen r))
    rw [Scheme.preimage_basicOpen f r]
    erw [← isCompact_iff_compactSpace]
    rw [← isCompact_univ_iff] at H
    apply isCompact_basicOpen
    exact H
  · rintro X Y H f S hS hS'
    rw [← IsAffineOpen.basicOpen_union_eq_self_iff] at hS
    delta QuasiCompact.affineProperty
    rw [← isCompact_univ_iff]
    change IsCompact ((Opens.map f.val.base).obj ⊤).1
    rw [← hS]
    

Proof state:
case ofBasicOpenCover
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
H : IsAffine Y
f : X ⟶ Y
S : Finset ↑(Y.presheaf.obj (op ⊤))
hS : ⨆ f, Y.basicOpen ↑f = ⊤
hS' : ∀ (r : { x // x ∈ S }), affineProperty (f ∣_ Y.basicOpen ↑r)
⊢ IsCompact (f⁻¹ᵁ ⨆ f, Y.basicOpen ↑f).carrier
case ofBasicOpenCover.hU
X✝ Y✝ : Scheme
f✝ : X✝ ⟶ Y✝
X Y : Scheme
H : IsAffine Y
f : X ⟶ Y
S : Finset ↑(Y.presheaf.obj (op ⊤))
hS : Ideal.span ↑S = ⊤
hS' : ∀ (r : { x // x ∈ S }), affineProperty (f ∣_ Y.basicOpen ↑r)
⊢ IsAffineOpen ⊤

Next tactic:
dsimp [Opens.map]