l3lab/ntp-mathlib huggingface dataset:
/-- For functors out of a discrete category,
a natural isomorphism is just a collection of isomorphisms,
as the naturality squares are trivial.
-/
@[simps!]
def natIso {I : Type u₁} {F G : Discrete I ⥤ C} (f : ∀ i : Discrete I, F.obj i ≅ G.obj i) :
    F ≅ G :=
  NatIso.ofComponents f fun ⟨⟨g⟩⟩ => by
    discrete_cases
    rcases g
    

Proof state:
case mk.mk.up.up.refl
α : Type u₁
C : Type u₂
inst✝ : Category.{v₂, u₂} C
I : Type u₁
F G : Discrete I ⥤ C
f : (i : Discrete I) → F.obj i ≅ G.obj i
as✝ : I
down✝ : { as := as✝ }.as = { as := as✝ }.as
⊢ F.map { down := { down := (_ : { as := as✝ }.as = { as := as✝ }.as) } } ≫ (f { as := as✝ }).hom =
    (f { as := as✝ }).hom ≫ G.map { down := { down := (_ : { as := as✝ }.as = { as := as✝ }.as) } }

Next tactic:
change F.map (𝟙 _) ≫ _ = _ ≫ G.map (𝟙 _)
/-- For functors out of a discrete category,
a natural isomorphism is just a collection of isomorphisms,
as the naturality squares are trivial.
-/
@[simps!]
def natIso {I : Type u₁} {F G : Discrete I ⥤ C} (f : ∀ i : Discrete I, F.obj i ≅ G.obj i) :
    F ≅ G :=
  NatIso.ofComponents f fun ⟨⟨g⟩⟩ => by
    discrete_cases
    rcases g
    change F.map (𝟙 _) ≫ _ = _ ≫ G.map (𝟙 _)
    

Proof state:
case mk.mk.up.up.refl
α : Type u₁
C : Type u₂
inst✝ : Category.{v₂, u₂} C
I : Type u₁
F G : Discrete I ⥤ C
f : (i : Discrete I) → F.obj i ≅ G.obj i
as✝ : I
down✝ : { as := as✝ }.as = { as := as✝ }.as
⊢ F.map (𝟙 { as := as✝ }) ≫ (f { as := as✝ }).hom = (f { as := as✝ }).hom ≫ G.map (𝟙 { as := as✝ })

Next tactic:
simp
@[simp]
theorem natIso_app {I : Type u₁} {F G : Discrete I ⥤ C} (f : ∀ i : Discrete I, F.obj i ≅ G.obj i)
    (i : Discrete I) : (Discrete.natIso f).app i = f i := by 

Proof state:
α : Type u₁
C : Type u₂
inst✝ : Category.{v₂, u₂} C
I : Type u₁
F G : Discrete I ⥤ C
f : (i : Discrete I) → F.obj i ≅ G.obj i
i : Discrete I
⊢ (natIso f).app i = f i

Next tactic:
aesop_cat
/-- We can promote a type-level `Equiv` to
an equivalence between the corresponding `discrete` categories.
-/
@[simps]
def equivalence {I : Type u₁} {J : Type u₂} (e : I ≃ J) : Discrete I ≌ Discrete J where
  functor := Discrete.functor (Discrete.mk ∘ (e : I → J))
  inverse := Discrete.functor (Discrete.mk ∘ (e.symm : J → I))
  unitIso :=
    Discrete.natIso fun i => eqToIso (by 

Proof state:
α : Type u₁
C : Type u₂
inst✝ : Category.{v₂, u₂} C
I : Type u₁
J : Type u₂
e : I ≃ J
i : Discrete I
⊢ (𝟭 (Discrete I)).obj i = (functor (mk ∘ ⇑e) ⋙ functor (mk ∘ ⇑e.symm)).obj i

Next tactic:
aesop_cat
/-- We can promote a type-level `Equiv` to
an equivalence between the corresponding `discrete` categories.
-/
@[simps]
def equivalence {I : Type u₁} {J : Type u₂} (e : I ≃ J) : Discrete I ≌ Discrete J where
  functor := Discrete.functor (Discrete.mk ∘ (e : I → J))
  inverse := Discrete.functor (Discrete.mk ∘ (e.symm : J → I))
  unitIso :=
    Discrete.natIso fun i => eqToIso (by aesop_cat)
  counitIso :=
    Discrete.natIso fun j => eqToIso (by 

Proof state:
α : Type u₁
C : Type u₂
inst✝ : Category.{v₂, u₂} C
I : Type u₁
J : Type u₂
e : I ≃ J
j : Discrete J
⊢ (functor (mk ∘ ⇑e.symm) ⋙ functor (mk ∘ ⇑e)).obj j = (𝟭 (Discrete J)).obj j

Next tactic:
aesop_cat
/-- We can convert an equivalence of `discrete` categories to a type-level `Equiv`. -/
@[simps]
def equivOfEquivalence {α : Type u₁} {β : Type u₂} (h : Discrete α ≌ Discrete β) : α ≃ β where
  toFun := Discrete.as ∘ h.functor.obj ∘ Discrete.mk
  invFun := Discrete.as ∘ h.inverse.obj ∘ Discrete.mk
  left_inv a := by 

Proof state:
α✝ : Type u₁
C : Type u₂
inst✝ : Category.{v₂, u₂} C
α : Type u₁
β : Type u₂
h : Discrete α ≌ Discrete β
a : α
⊢ (as ∘ h.inverse.obj ∘ mk) ((as ∘ h.functor.obj ∘ mk) a) = a

Next tactic:
simpa using eq_of_hom (h.unitIso.app (Discrete.mk a)).2
/-- We can convert an equivalence of `discrete` categories to a type-level `Equiv`. -/
@[simps]
def equivOfEquivalence {α : Type u₁} {β : Type u₂} (h : Discrete α ≌ Discrete β) : α ≃ β where
  toFun := Discrete.as ∘ h.functor.obj ∘ Discrete.mk
  invFun := Discrete.as ∘ h.inverse.obj ∘ Discrete.mk
  left_inv a := by simpa using eq_of_hom (h.unitIso.app (Discrete.mk a)).2
  right_inv a := by 

Proof state:
α✝ : Type u₁
C : Type u₂
inst✝ : Category.{v₂, u₂} C
α : Type u₁
β : Type u₂
h : Discrete α ≌ Discrete β
a : β
⊢ (as ∘ h.functor.obj ∘ mk) ((as ∘ h.inverse.obj ∘ mk) a) = a

Next tactic:
simpa using eq_of_hom (h.counitIso.app (Discrete.mk a)).1
@[simp]
theorem functor_map_id (F : Discrete J ⥤ C) {j : Discrete J} (f : j ⟶ j) :
    F.map f = 𝟙 (F.obj j) := by
  

Proof state:
J : Type v₁
C : Type u₂
inst✝ : Category.{v₂, u₂} C
F : Discrete J ⥤ C
j : Discrete J
f : j ⟶ j
⊢ F.map f = 𝟙 (F.obj j)

Next tactic:
have h : f = 𝟙 j := by aesop_cat
@[simp]
theorem functor_map_id (F : Discrete J ⥤ C) {j : Discrete J} (f : j ⟶ j) :
    F.map f = 𝟙 (F.obj j) := by
  have h : f = 𝟙 j := by 

Proof state:
J : Type v₁
C : Type u₂
inst✝ : Category.{v₂, u₂} C
F : Discrete J ⥤ C
j : Discrete J
f : j ⟶ j
⊢ f = 𝟙 j

Next tactic:
aesop_cat
@[simp]
theorem functor_map_id (F : Discrete J ⥤ C) {j : Discrete J} (f : j ⟶ j) :
    F.map f = 𝟙 (F.obj j) := by
  have h : f = 𝟙 j := by aesop_cat
  

Proof state:
J : Type v₁
C : Type u₂
inst✝ : Category.{v₂, u₂} C
F : Discrete J ⥤ C
j : Discrete J
f : j ⟶ j
h : f = 𝟙 j
⊢ F.map f = 𝟙 (F.obj j)

Next tactic:
rw [h]
@[simp]
theorem functor_map_id (F : Discrete J ⥤ C) {j : Discrete J} (f : j ⟶ j) :
    F.map f = 𝟙 (F.obj j) := by
  have h : f = 𝟙 j := by aesop_cat
  rw [h]
  

Proof state:
J : Type v₁
C : Type u₂
inst✝ : Category.{v₂, u₂} C
F : Discrete J ⥤ C
j : Discrete J
f : j ⟶ j
h : f = 𝟙 j
⊢ F.map (𝟙 j) = 𝟙 (F.obj j)

Next tactic:
simp
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  

Proof state:
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
⊢ QuasiSeparatedSpace ↑↑X.toPresheafedSpace ↔ ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)

Next tactic:
rw [QuasiSeparatedSpace_iff]
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  

Proof state:
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
⊢ (∀ (U V : Set ↑↑X.toPresheafedSpace), IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V)) ↔
    ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)

Next tactic:
constructor
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · 

Proof state:
case mp
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
⊢ (∀ (U V : Set ↑↑X.toPresheafedSpace), IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V)) →
    ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)

Next tactic:
intro H U V
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; 

Proof state:
case mp
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : Set ↑↑X.toPresheafedSpace), IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V)
U V : ↑(Scheme.affineOpens X)
⊢ IsCompact (↑↑U ∩ ↑↑V)

Next tactic:
exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · 

Proof state:
case mpr
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
⊢ (∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)) →
    ∀ (U V : Set ↑↑X.toPresheafedSpace), IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V)

Next tactic:
intro H
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    

Proof state:
case mpr
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
⊢ ∀ (U V : Set ↑↑X.toPresheafedSpace), IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V)

Next tactic:
suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by 

Proof state:
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
this :
  ∀ (U : Opens ↑↑X.toPresheafedSpace),
    IsCompact U.carrier → ∀ (V : Opens ↑↑X.toPresheafedSpace), IsCompact V.carrier → IsCompact (U ⊓ V).carrier
⊢ ∀ (U V : Set ↑↑X.toPresheafedSpace), IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V)

Next tactic:
intro U V hU hU' hV hV'
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; 

Proof state:
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
this :
  ∀ (U : Opens ↑↑X.toPresheafedSpace),
    IsCompact U.carrier → ∀ (V : Opens ↑↑X.toPresheafedSpace), IsCompact V.carrier → IsCompact (U ⊓ V).carrier
U V : Set ↑↑X.toPresheafedSpace
hU : IsOpen U
hU' : IsCompact U
hV : IsOpen V
hV' : IsCompact V
⊢ IsCompact (U ∩ V)

Next tactic:
exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
    

Proof state:
case mpr
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
⊢ ∀ (U : Opens ↑↑X.toPresheafedSpace),
    IsCompact U.carrier → ∀ (V : Opens ↑↑X.toPresheafedSpace), IsCompact V.carrier → IsCompact (U ⊓ V).carrier

Next tactic:
intro U hU V hV
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
    intro U hU V hV
    -- Porting note: it complains "unable to find motive", but telling Lean that motive is
    -- underscore is actually sufficient, weird
    

Proof state:
case mpr
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
V : Opens ↑↑X.toPresheafedSpace
hV : IsCompact V.carrier
⊢ IsCompact (U ⊓ V).carrier

Next tactic:
apply compact_open_induction_on (P := _) V hV
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
    intro U hU V hV
    -- Porting note: it complains "unable to find motive", but telling Lean that motive is
    -- underscore is actually sufficient, weird
    apply compact_open_induction_on (P := _) V hV
    · 

Proof state:
case mpr.h₁
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
V : Opens ↑↑X.toPresheafedSpace
hV : IsCompact V.carrier
⊢ IsCompact (U ⊓ ⊥).carrier

Next tactic:
simp
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
    intro U hU V hV
    -- Porting note: it complains "unable to find motive", but telling Lean that motive is
    -- underscore is actually sufficient, weird
    apply compact_open_induction_on (P := _) V hV
    · simp
    · 

Proof state:
case mpr.h₂
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
V : Opens ↑↑X.toPresheafedSpace
hV : IsCompact V.carrier
⊢ ∀ (S : Opens ↑↑X.toPresheafedSpace),
    IsCompact S.carrier →
      ∀ (U_1 : ↑(Scheme.affineOpens X)), IsCompact (U ⊓ S).carrier → IsCompact (U ⊓ (S ⊔ ↑U_1)).carrier

Next tactic:
intro S _ V hV
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
    intro U hU V hV
    -- Porting note: it complains "unable to find motive", but telling Lean that motive is
    -- underscore is actually sufficient, weird
    apply compact_open_induction_on (P := _) V hV
    · simp
    · intro S _ V hV
      

Proof state:
case mpr.h₂
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
V✝ : Opens ↑↑X.toPresheafedSpace
hV✝ : IsCompact V✝.carrier
S : Opens ↑↑X.toPresheafedSpace
x✝ : IsCompact S.carrier
V : ↑(Scheme.affineOpens X)
hV : IsCompact (U ⊓ S).carrier
⊢ IsCompact (U ⊓ (S ⊔ ↑V)).carrier

Next tactic:
change IsCompact (U.1 ∩ (S.1 ∪ V.1))
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
    intro U hU V hV
    -- Porting note: it complains "unable to find motive", but telling Lean that motive is
    -- underscore is actually sufficient, weird
    apply compact_open_induction_on (P := _) V hV
    · simp
    · intro S _ V hV
      change IsCompact (U.1 ∩ (S.1 ∪ V.1))
      

Proof state:
case mpr.h₂
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
V✝ : Opens ↑↑X.toPresheafedSpace
hV✝ : IsCompact V✝.carrier
S : Opens ↑↑X.toPresheafedSpace
x✝ : IsCompact S.carrier
V : ↑(Scheme.affineOpens X)
hV : IsCompact (U ⊓ S).carrier
⊢ IsCompact (U.carrier ∩ (S.carrier ∪ ↑↑V))

Next tactic:
rw [Set.inter_union_distrib_left]
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
    intro U hU V hV
    -- Porting note: it complains "unable to find motive", but telling Lean that motive is
    -- underscore is actually sufficient, weird
    apply compact_open_induction_on (P := _) V hV
    · simp
    · intro S _ V hV
      change IsCompact (U.1 ∩ (S.1 ∪ V.1))
      rw [Set.inter_union_distrib_left]
      

Proof state:
case mpr.h₂
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
V✝ : Opens ↑↑X.toPresheafedSpace
hV✝ : IsCompact V✝.carrier
S : Opens ↑↑X.toPresheafedSpace
x✝ : IsCompact S.carrier
V : ↑(Scheme.affineOpens X)
hV : IsCompact (U ⊓ S).carrier
⊢ IsCompact (U.carrier ∩ S.carrier ∪ U.carrier ∩ ↑↑V)

Next tactic:
apply hV.union
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
    intro U hU V hV
    -- Porting note: it complains "unable to find motive", but telling Lean that motive is
    -- underscore is actually sufficient, weird
    apply compact_open_induction_on (P := _) V hV
    · simp
    · intro S _ V hV
      change IsCompact (U.1 ∩ (S.1 ∪ V.1))
      rw [Set.inter_union_distrib_left]
      apply hV.union
      

Proof state:
case mpr.h₂
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
V✝ : Opens ↑↑X.toPresheafedSpace
hV✝ : IsCompact V✝.carrier
S : Opens ↑↑X.toPresheafedSpace
x✝ : IsCompact S.carrier
V : ↑(Scheme.affineOpens X)
hV : IsCompact (U ⊓ S).carrier
⊢ IsCompact (U.carrier ∩ ↑↑V)

Next tactic:
clear hV
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
    intro U hU V hV
    -- Porting note: it complains "unable to find motive", but telling Lean that motive is
    -- underscore is actually sufficient, weird
    apply compact_open_induction_on (P := _) V hV
    · simp
    · intro S _ V hV
      change IsCompact (U.1 ∩ (S.1 ∪ V.1))
      rw [Set.inter_union_distrib_left]
      apply hV.union
      clear hV
      

Proof state:
case mpr.h₂
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
V✝ : Opens ↑↑X.toPresheafedSpace
hV : IsCompact V✝.carrier
S : Opens ↑↑X.toPresheafedSpace
x✝ : IsCompact S.carrier
V : ↑(Scheme.affineOpens X)
⊢ IsCompact (U.carrier ∩ ↑↑V)

Next tactic:
apply compact_open_induction_on (P := _) U hU
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
    intro U hU V hV
    -- Porting note: it complains "unable to find motive", but telling Lean that motive is
    -- underscore is actually sufficient, weird
    apply compact_open_induction_on (P := _) V hV
    · simp
    · intro S _ V hV
      change IsCompact (U.1 ∩ (S.1 ∪ V.1))
      rw [Set.inter_union_distrib_left]
      apply hV.union
      clear hV
      apply compact_open_induction_on (P := _) U hU
      · 

Proof state:
case mpr.h₂.h₁
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
V✝ : Opens ↑↑X.toPresheafedSpace
hV : IsCompact V✝.carrier
S : Opens ↑↑X.toPresheafedSpace
x✝ : IsCompact S.carrier
V : ↑(Scheme.affineOpens X)
⊢ IsCompact (⊥.carrier ∩ ↑↑V)

Next tactic:
simp
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
    QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
  rw [QuasiSeparatedSpace_iff]
  constructor
  · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
  · intro H
    suffices
      ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
        IsCompact (U ⊓ V).1
      by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
    intro U hU V hV
    -- Porting note: it complains "unable to find motive", but telling Lean that motive is
    -- underscore is actually sufficient, weird
    apply compact_open_induction_on (P := _) V hV
    · simp
    · intro S _ V hV
      change IsCompact (U.1 ∩ (S.1 ∪ V.1))
      rw [Set.inter_union_distrib_left]
      apply hV.union
      clear hV
      apply compact_open_induction_on (P := _) U hU
      · simp
      · 

Proof state:
case mpr.h₂.h₂
X✝ Y : Scheme
f : X✝ ⟶ Y
X : Scheme
H : ∀ (U V : ↑(Scheme.affineOpens X)), IsCompact (↑↑U ∩ ↑↑V)
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
V✝ : Opens ↑↑X.toPresheafedSpace
hV : IsCompact V✝.carrier
S : Opens ↑↑X.toPresheafedSpace
x✝ : IsCompact S.carrier
V : ↑(Scheme.affineOpens X)
⊢ ∀ (S : Opens ↑↑X.toPresheafedSpace),
    IsCompact S.carrier →
      ∀ (U : ↑(Scheme.affineOpens X)), IsCompact (S.carrier ∩ ↑↑V) → IsCompact ((S ⊔ ↑U).carrier ∩ ↑↑V)

Next tactic:
intro S _ W hW