l3lab/ntp-mathlib huggingface dataset:
private def f (n : ℕ) : WType' β (n + 1) → Σa : α, β a → WType' β n
  | ⟨t, h⟩ => by
    

Proof state:
α : Type u_1
β : α → Type u_2
inst✝¹ : (a : α) → Fintype (β a)
inst✝ : (a : α) → Encodable (β a)
n : ℕ
t : WType β
h : depth t ≤ n + 1
⊢ (a : α) × (β a → WType.WType' β n)

Next tactic:
cases' t with a f
private def f (n : ℕ) : WType' β (n + 1) → Σa : α, β a → WType' β n
  | ⟨t, h⟩ => by
    cases' t with a f
    

Proof state:
case mk
α : Type u_1
β : α → Type u_2
inst✝¹ : (a : α) → Fintype (β a)
inst✝ : (a : α) → Encodable (β a)
n : ℕ
a : α
f : β a → WType β
h : depth (mk a f) ≤ n + 1
⊢ (a : α) × (β a → WType.WType' β n)

Next tactic:
have h₀ : ∀ i : β a, WType.depth (f i) ≤ n := fun i =>
      Nat.le_of_lt_succ (lt_of_lt_of_le (WType.depth_lt_depth_mk a f i) h)
private def f (n : ℕ) : WType' β (n + 1) → Σa : α, β a → WType' β n
  | ⟨t, h⟩ => by
    cases' t with a f
    have h₀ : ∀ i : β a, WType.depth (f i) ≤ n := fun i =>
      Nat.le_of_lt_succ (lt_of_lt_of_le (WType.depth_lt_depth_mk a f i) h)
    

Proof state:
case mk
α : Type u_1
β : α → Type u_2
inst✝¹ : (a : α) → Fintype (β a)
inst✝ : (a : α) → Encodable (β a)
n : ℕ
a : α
f : β a → WType β
h : depth (mk a f) ≤ n + 1
h₀ : ∀ (i : β a), depth (f i) ≤ n
⊢ (a : α) × (β a → WType.WType' β n)

Next tactic:
exact ⟨a, fun i : β a => ⟨f i, h₀ i⟩⟩
private def encodable_succ (n : Nat) (h : Encodable (WType' β n)) : Encodable (WType' β (n + 1)) :=
  Encodable.ofLeftInverse (f n) (finv n)
    (by
      

Proof state:
α : Type u_1
β : α → Type u_2
inst✝² : (a : α) → Fintype (β a)
inst✝¹ : (a : α) → Encodable (β a)
inst✝ : Encodable α
n : ℕ
h : Encodable (WType.WType' β n)
⊢ ∀ (b : WType.WType' β (n + 1)), WType.finv n (WType.f n b) = b

Next tactic:
rintro ⟨⟨_, _⟩, _⟩
private def encodable_succ (n : Nat) (h : Encodable (WType' β n)) : Encodable (WType' β (n + 1)) :=
  Encodable.ofLeftInverse (f n) (finv n)
    (by
      rintro ⟨⟨_, _⟩, _⟩
      

Proof state:
case mk.mk
α : Type u_1
β : α → Type u_2
inst✝² : (a : α) → Fintype (β a)
inst✝¹ : (a : α) → Encodable (β a)
inst✝ : Encodable α
n : ℕ
h : Encodable (WType.WType' β n)
a✝ : α
f✝ : β a✝ → WType β
property✝ : depth (mk a✝ f✝) ≤ n + 1
⊢ WType.finv n (WType.f n { val := mk a✝ f✝, property := property✝ }) = { val := mk a✝ f✝, property := property✝ }

Next tactic:
rfl
/-- `WType` is encodable when `α` is an encodable fintype and for every `a : α`, `β a` is
encodable. -/
instance : Encodable (WType β) := by
  

Proof state:
α : Type u_1
β : α → Type u_2
inst✝² : (a : α) → Fintype (β a)
inst✝¹ : (a : α) → Encodable (β a)
inst✝ : Encodable α
⊢ Encodable (WType β)

Next tactic:
haveI h' : ∀ n, Encodable (WType' β n) := fun n => Nat.rec encodable_zero encodable_succ n
/-- `WType` is encodable when `α` is an encodable fintype and for every `a : α`, `β a` is
encodable. -/
instance : Encodable (WType β) := by
  haveI h' : ∀ n, Encodable (WType' β n) := fun n => Nat.rec encodable_zero encodable_succ n
  

Proof state:
α : Type u_1
β : α → Type u_2
inst✝² : (a : α) → Fintype (β a)
inst✝¹ : (a : α) → Encodable (β a)
inst✝ : Encodable α
h' : (n : ℕ) → Encodable (WType.WType' β n)
⊢ Encodable (WType β)

Next tactic:
let f : WType β → Σn, WType' β n := fun t => ⟨t.depth, ⟨t, le_rfl⟩⟩
/-- `WType` is encodable when `α` is an encodable fintype and for every `a : α`, `β a` is
encodable. -/
instance : Encodable (WType β) := by
  haveI h' : ∀ n, Encodable (WType' β n) := fun n => Nat.rec encodable_zero encodable_succ n
  let f : WType β → Σn, WType' β n := fun t => ⟨t.depth, ⟨t, le_rfl⟩⟩
  

Proof state:
α : Type u_1
β : α → Type u_2
inst✝² : (a : α) → Fintype (β a)
inst✝¹ : (a : α) → Encodable (β a)
inst✝ : Encodable α
h' : (n : ℕ) → Encodable (WType.WType' β n)
f : WType β → (n : ℕ) × WType.WType' β n :=
  fun t => { fst := depth t, snd := { val := t, property := (_ : depth t ≤ depth t) } }
⊢ Encodable (WType β)

Next tactic:
let finv : (Σn, WType' β n) → WType β := fun p => p.2.1
/-- `WType` is encodable when `α` is an encodable fintype and for every `a : α`, `β a` is
encodable. -/
instance : Encodable (WType β) := by
  haveI h' : ∀ n, Encodable (WType' β n) := fun n => Nat.rec encodable_zero encodable_succ n
  let f : WType β → Σn, WType' β n := fun t => ⟨t.depth, ⟨t, le_rfl⟩⟩
  let finv : (Σn, WType' β n) → WType β := fun p => p.2.1
  

Proof state:
α : Type u_1
β : α → Type u_2
inst✝² : (a : α) → Fintype (β a)
inst✝¹ : (a : α) → Encodable (β a)
inst✝ : Encodable α
h' : (n : ℕ) → Encodable (WType.WType' β n)
f : WType β → (n : ℕ) × WType.WType' β n :=
  fun t => { fst := depth t, snd := { val := t, property := (_ : depth t ≤ depth t) } }
finv : (n : ℕ) × WType.WType' β n → WType β := fun p => ↑p.snd
⊢ Encodable (WType β)

Next tactic:
have : ∀ t, finv (f t) = t := fun t => rfl
/-- `WType` is encodable when `α` is an encodable fintype and for every `a : α`, `β a` is
encodable. -/
instance : Encodable (WType β) := by
  haveI h' : ∀ n, Encodable (WType' β n) := fun n => Nat.rec encodable_zero encodable_succ n
  let f : WType β → Σn, WType' β n := fun t => ⟨t.depth, ⟨t, le_rfl⟩⟩
  let finv : (Σn, WType' β n) → WType β := fun p => p.2.1
  have : ∀ t, finv (f t) = t := fun t => rfl
  

Proof state:
α : Type u_1
β : α → Type u_2
inst✝² : (a : α) → Fintype (β a)
inst✝¹ : (a : α) → Encodable (β a)
inst✝ : Encodable α
h' : (n : ℕ) → Encodable (WType.WType' β n)
f : WType β → (n : ℕ) × WType.WType' β n :=
  fun t => { fst := depth t, snd := { val := t, property := (_ : depth t ≤ depth t) } }
finv : (n : ℕ) × WType.WType' β n → WType β := fun p => ↑p.snd
this : ∀ (t : WType β), finv (f t) = t
⊢ Encodable (WType β)

Next tactic:
exact Encodable.ofLeftInverse f finv this
theorem separatedNhds_iff_disjoint {s t : Set X} : SeparatedNhds s t ↔ Disjoint (𝓝ˢ s) (𝓝ˢ t) := by
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
s t : Set X
⊢ SeparatedNhds s t ↔ Disjoint (𝓝ˢ s) (𝓝ˢ t)

Next tactic:
simp only [(hasBasis_nhdsSet s).disjoint_iff (hasBasis_nhdsSet t), SeparatedNhds, exists_prop, ←
    exists_and_left, and_assoc, and_comm, and_left_comm]
theorem union_left : SeparatedNhds s u → SeparatedNhds t u → SeparatedNhds (s ∪ t) u := by
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
s s₁ s₂ t t₁ t₂ u : Set X
⊢ SeparatedNhds s u → SeparatedNhds t u → SeparatedNhds (s ∪ t) u

Next tactic:
simpa only [separatedNhds_iff_disjoint, nhdsSet_union, disjoint_sup_left] using And.intro
theorem t0Space_iff_not_inseparable (X : Type u) [TopologicalSpace X] :
    T0Space X ↔ ∀ x y : X, x ≠ y → ¬Inseparable x y := by
  

Proof state:
X✝ : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X✝
X : Type u
inst✝ : TopologicalSpace X
⊢ T0Space X ↔ ∀ (x y : X), x ≠ y → ¬Inseparable x y

Next tactic:
simp only [t0Space_iff_inseparable, Ne.def, not_imp_not]
theorem TopologicalSpace.IsTopologicalBasis.inseparable_iff {b : Set (Set X)}
    (hb : IsTopologicalBasis b) {x y : X} : Inseparable x y ↔ ∀ s ∈ b, (x ∈ s ↔ y ∈ s) :=
  ⟨fun h s hs ↦ inseparable_iff_forall_open.1 h _ (hb.isOpen hs),
    fun h ↦ hb.nhds_hasBasis.eq_of_same_basis $ by
      

Proof state:
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
b : Set (Set X)
hb : IsTopologicalBasis b
x y : X
h : ∀ s ∈ b, x ∈ s ↔ y ∈ s
⊢ HasBasis (𝓝 y) (fun t => t ∈ b ∧ x ∈ t) fun t => t

Next tactic:
convert hb.nhds_hasBasis using 2
theorem TopologicalSpace.IsTopologicalBasis.inseparable_iff {b : Set (Set X)}
    (hb : IsTopologicalBasis b) {x y : X} : Inseparable x y ↔ ∀ s ∈ b, (x ∈ s ↔ y ∈ s) :=
  ⟨fun h s hs ↦ inseparable_iff_forall_open.1 h _ (hb.isOpen hs),
    fun h ↦ hb.nhds_hasBasis.eq_of_same_basis $ by
      convert hb.nhds_hasBasis using 2
      

Proof state:
case h.e'_4.h.a
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
b : Set (Set X)
hb : IsTopologicalBasis b
x y : X
h : ∀ s ∈ b, x ∈ s ↔ y ∈ s
x✝ : Set X
⊢ x✝ ∈ b ∧ x ∈ x✝ ↔ x✝ ∈ b ∧ y ∈ x✝

Next tactic:
exact and_congr_right (h _)
theorem t0Space_iff_exists_isOpen_xor'_mem (X : Type u) [TopologicalSpace X] :
    T0Space X ↔ ∀ x y, x ≠ y → ∃ U : Set X, IsOpen U ∧ Xor' (x ∈ U) (y ∈ U) := by
  

Proof state:
X✝ : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X✝
X : Type u
inst✝ : TopologicalSpace X
⊢ T0Space X ↔ ∀ (x y : X), x ≠ y → ∃ U, IsOpen U ∧ Xor' (x ∈ U) (y ∈ U)

Next tactic:
simp only [t0Space_iff_not_inseparable, xor_iff_not_iff, not_forall, exists_prop,
    inseparable_iff_forall_open]
theorem minimal_nonempty_closed_subsingleton [T0Space X] {s : Set X} (hs : IsClosed s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsClosed t → t = s) : s.Subsingleton := by
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsClosed s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsClosed t → t = s
⊢ Set.Subsingleton s

Next tactic:
clear Y
theorem minimal_nonempty_closed_subsingleton [T0Space X] {s : Set X} (hs : IsClosed s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsClosed t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  

Proof state:
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsClosed s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsClosed t → t = s
⊢ Set.Subsingleton s

Next tactic:
refine' fun x hx y hy => of_not_not fun hxy => _
theorem minimal_nonempty_closed_subsingleton [T0Space X] {s : Set X} (hs : IsClosed s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsClosed t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  

Proof state:
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsClosed s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsClosed t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
⊢ False

Next tactic:
rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
theorem minimal_nonempty_closed_subsingleton [T0Space X] {s : Set X} (hs : IsClosed s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsClosed t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
  

Proof state:
case intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsClosed s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsClosed t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
U : Set X
hUo : IsOpen U
hU : Xor' (x ∈ U) (y ∈ U)
⊢ False

Next tactic:
wlog h : x ∈ U ∧ y ∉ U
theorem minimal_nonempty_closed_subsingleton [T0Space X] {s : Set X} (hs : IsClosed s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsClosed t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
  wlog h : x ∈ U ∧ y ∉ U
  · 

Proof state:
case intro.intro.inr
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsClosed s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsClosed t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
U : Set X
hUo : IsOpen U
hU : Xor' (x ∈ U) (y ∈ U)
this :
  ∀ {X : Type u_1} [inst : TopologicalSpace X] [inst_1 : T0Space X] {s : Set X},
    IsClosed s →
      (∀ t ⊆ s, Set.Nonempty t → IsClosed t → t = s) →
        ∀ x ∈ s, ∀ y ∈ s, ¬x = y → ∀ (U : Set X), IsOpen U → Xor' (x ∈ U) (y ∈ U) → x ∈ U ∧ y ∉ U → False
h : ¬(x ∈ U ∧ y ∉ U)
⊢ False

Next tactic:
refine this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h)
theorem minimal_nonempty_closed_subsingleton [T0Space X] {s : Set X} (hs : IsClosed s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsClosed t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
  wlog h : x ∈ U ∧ y ∉ U
  · refine this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h)
  

Proof state:
X✝ : Type u_1
inst✝² : TopologicalSpace X✝
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsClosed s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsClosed t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
U : Set X
hUo : IsOpen U
hU : Xor' (x ∈ U) (y ∈ U)
h : x ∈ U ∧ y ∉ U
⊢ False

Next tactic:
cases' h with hxU hyU
theorem minimal_nonempty_closed_subsingleton [T0Space X] {s : Set X} (hs : IsClosed s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsClosed t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
  wlog h : x ∈ U ∧ y ∉ U
  · refine this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h)
  cases' h with hxU hyU
  

Proof state:
case intro
X✝ : Type u_1
inst✝² : TopologicalSpace X✝
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsClosed s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsClosed t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
U : Set X
hUo : IsOpen U
hU : Xor' (x ∈ U) (y ∈ U)
hxU : x ∈ U
hyU : y ∉ U
⊢ False

Next tactic:
have : s \ U = s := hmin (s \ U) (diff_subset _ _) ⟨y, hy, hyU⟩ (hs.sdiff hUo)
theorem minimal_nonempty_closed_subsingleton [T0Space X] {s : Set X} (hs : IsClosed s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsClosed t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
  wlog h : x ∈ U ∧ y ∉ U
  · refine this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h)
  cases' h with hxU hyU
  have : s \ U = s := hmin (s \ U) (diff_subset _ _) ⟨y, hy, hyU⟩ (hs.sdiff hUo)
  

Proof state:
case intro
X✝ : Type u_1
inst✝² : TopologicalSpace X✝
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsClosed s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsClosed t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
U : Set X
hUo : IsOpen U
hU : Xor' (x ∈ U) (y ∈ U)
hxU : x ∈ U
hyU : y ∉ U
this : s \ U = s
⊢ False

Next tactic:
exact (this.symm.subset hx).2 hxU
/-- Given a closed set `S` in a compact T₀ space, there is some `x ∈ S` such that `{x}` is
closed. -/
theorem IsClosed.exists_closed_singleton [T0Space X] [CompactSpace X] {S : Set X}
    (hS : IsClosed S) (hne : S.Nonempty) : ∃ x : X, x ∈ S ∧ IsClosed ({x} : Set X) := by
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : T0Space X
inst✝ : CompactSpace X
S : Set X
hS : IsClosed S
hne : Set.Nonempty S
⊢ ∃ x ∈ S, IsClosed {x}

Next tactic:
obtain ⟨V, Vsub, Vne, Vcls, hV⟩ := hS.exists_minimal_nonempty_closed_subset hne
/-- Given a closed set `S` in a compact T₀ space, there is some `x ∈ S` such that `{x}` is
closed. -/
theorem IsClosed.exists_closed_singleton [T0Space X] [CompactSpace X] {S : Set X}
    (hS : IsClosed S) (hne : S.Nonempty) : ∃ x : X, x ∈ S ∧ IsClosed ({x} : Set X) := by
  obtain ⟨V, Vsub, Vne, Vcls, hV⟩ := hS.exists_minimal_nonempty_closed_subset hne
  

Proof state:
case intro.intro.intro.intro
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : T0Space X
inst✝ : CompactSpace X
S : Set X
hS : IsClosed S
hne : Set.Nonempty S
V : Set X
Vsub : V ⊆ S
Vne : Set.Nonempty V
Vcls : IsClosed V
hV : ∀ V' ⊆ V, Set.Nonempty V' → IsClosed V' → V' = V
⊢ ∃ x ∈ S, IsClosed {x}

Next tactic:
rcases minimal_nonempty_closed_eq_singleton Vcls Vne hV with ⟨x, rfl⟩
/-- Given a closed set `S` in a compact T₀ space, there is some `x ∈ S` such that `{x}` is
closed. -/
theorem IsClosed.exists_closed_singleton [T0Space X] [CompactSpace X] {S : Set X}
    (hS : IsClosed S) (hne : S.Nonempty) : ∃ x : X, x ∈ S ∧ IsClosed ({x} : Set X) := by
  obtain ⟨V, Vsub, Vne, Vcls, hV⟩ := hS.exists_minimal_nonempty_closed_subset hne
  rcases minimal_nonempty_closed_eq_singleton Vcls Vne hV with ⟨x, rfl⟩
  

Proof state:
case intro.intro.intro.intro.intro
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : T0Space X
inst✝ : CompactSpace X
S : Set X
hS : IsClosed S
hne : Set.Nonempty S
x : X
Vsub : {x} ⊆ S
Vne : Set.Nonempty {x}
Vcls : IsClosed {x}
hV : ∀ V' ⊆ {x}, Set.Nonempty V' → IsClosed V' → V' = {x}
⊢ ∃ x ∈ S, IsClosed {x}

Next tactic:
exact ⟨x, Vsub (mem_singleton x), Vcls⟩
theorem minimal_nonempty_open_subsingleton [T0Space X] {s : Set X} (hs : IsOpen s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsOpen t → t = s) : s.Subsingleton := by
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsOpen s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsOpen t → t = s
⊢ Set.Subsingleton s

Next tactic:
clear Y
theorem minimal_nonempty_open_subsingleton [T0Space X] {s : Set X} (hs : IsOpen s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsOpen t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  

Proof state:
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsOpen s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsOpen t → t = s
⊢ Set.Subsingleton s

Next tactic:
refine' fun x hx y hy => of_not_not fun hxy => _
theorem minimal_nonempty_open_subsingleton [T0Space X] {s : Set X} (hs : IsOpen s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsOpen t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  

Proof state:
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsOpen s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsOpen t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
⊢ False

Next tactic:
rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
theorem minimal_nonempty_open_subsingleton [T0Space X] {s : Set X} (hs : IsOpen s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsOpen t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
  

Proof state:
case intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsOpen s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsOpen t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
U : Set X
hUo : IsOpen U
hU : Xor' (x ∈ U) (y ∈ U)
⊢ False

Next tactic:
wlog h : x ∈ U ∧ y ∉ U
theorem minimal_nonempty_open_subsingleton [T0Space X] {s : Set X} (hs : IsOpen s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsOpen t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
  wlog h : x ∈ U ∧ y ∉ U
  · 

Proof state:
case intro.intro.inr
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsOpen s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsOpen t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
U : Set X
hUo : IsOpen U
hU : Xor' (x ∈ U) (y ∈ U)
this :
  ∀ {X : Type u_1} [inst : TopologicalSpace X] [inst_1 : T0Space X] {s : Set X},
    IsOpen s →
      (∀ t ⊆ s, Set.Nonempty t → IsOpen t → t = s) →
        ∀ x ∈ s, ∀ y ∈ s, ¬x = y → ∀ (U : Set X), IsOpen U → Xor' (x ∈ U) (y ∈ U) → x ∈ U ∧ y ∉ U → False
h : ¬(x ∈ U ∧ y ∉ U)
⊢ False

Next tactic:
exact this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h)
theorem minimal_nonempty_open_subsingleton [T0Space X] {s : Set X} (hs : IsOpen s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsOpen t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
  wlog h : x ∈ U ∧ y ∉ U
  · exact this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h)
  

Proof state:
X✝ : Type u_1
inst✝² : TopologicalSpace X✝
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsOpen s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsOpen t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
U : Set X
hUo : IsOpen U
hU : Xor' (x ∈ U) (y ∈ U)
h : x ∈ U ∧ y ∉ U
⊢ False

Next tactic:
cases' h with hxU hyU
theorem minimal_nonempty_open_subsingleton [T0Space X] {s : Set X} (hs : IsOpen s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsOpen t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
  wlog h : x ∈ U ∧ y ∉ U
  · exact this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h)
  cases' h with hxU hyU
  

Proof state:
case intro
X✝ : Type u_1
inst✝² : TopologicalSpace X✝
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsOpen s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsOpen t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
U : Set X
hUo : IsOpen U
hU : Xor' (x ∈ U) (y ∈ U)
hxU : x ∈ U
hyU : y ∉ U
⊢ False

Next tactic:
have : s ∩ U = s := hmin (s ∩ U) (inter_subset_left _ _) ⟨x, hx, hxU⟩ (hs.inter hUo)
theorem minimal_nonempty_open_subsingleton [T0Space X] {s : Set X} (hs : IsOpen s)
    (hmin : ∀ t, t ⊆ s → t.Nonempty → IsOpen t → t = s) : s.Subsingleton := by
  clear Y -- Porting note: added
  refine' fun x hx y hy => of_not_not fun hxy => _
  rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩
  wlog h : x ∈ U ∧ y ∉ U
  · exact this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h)
  cases' h with hxU hyU
  have : s ∩ U = s := hmin (s ∩ U) (inter_subset_left _ _) ⟨x, hx, hxU⟩ (hs.inter hUo)
  

Proof state:
case intro
X✝ : Type u_1
inst✝² : TopologicalSpace X✝
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hs : IsOpen s
hmin : ∀ t ⊆ s, Set.Nonempty t → IsOpen t → t = s
x : X
hx : x ∈ s
y : X
hy : y ∈ s
hxy : ¬x = y
U : Set X
hUo : IsOpen U
hU : Xor' (x ∈ U) (y ∈ U)
hxU : x ∈ U
hyU : y ∉ U
this : s ∩ U = s
⊢ False

Next tactic:
exact hyU (this.symm.subset hy).2
/-- Given an open finite set `S` in a T₀ space, there is some `x ∈ S` such that `{x}` is open. -/
theorem exists_isOpen_singleton_of_isOpen_finite [T0Space X] {s : Set X} (hfin : s.Finite)
    (hne : s.Nonempty) (ho : IsOpen s) : ∃ x ∈ s, IsOpen ({x} : Set X) := by
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Set X
hfin : Set.Finite s
hne : Set.Nonempty s
ho : IsOpen s
⊢ ∃ x ∈ s, IsOpen {x}

Next tactic:
lift s to Finset X using hfin
/-- Given an open finite set `S` in a T₀ space, there is some `x ∈ S` such that `{x}` is open. -/
theorem exists_isOpen_singleton_of_isOpen_finite [T0Space X] {s : Set X} (hfin : s.Finite)
    (hne : s.Nonempty) (ho : IsOpen s) : ∃ x ∈ s, IsOpen ({x} : Set X) := by
  lift s to Finset X using hfin
  

Proof state:
case intro
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Finset X
hne : Set.Nonempty ↑s
ho : IsOpen ↑s
⊢ ∃ x ∈ ↑s, IsOpen {x}

Next tactic:
induction' s using Finset.strongInductionOn with s ihs
/-- Given an open finite set `S` in a T₀ space, there is some `x ∈ S` such that `{x}` is open. -/
theorem exists_isOpen_singleton_of_isOpen_finite [T0Space X] {s : Set X} (hfin : s.Finite)
    (hne : s.Nonempty) (ho : IsOpen s) : ∃ x ∈ s, IsOpen ({x} : Set X) := by
  lift s to Finset X using hfin
  induction' s using Finset.strongInductionOn with s ihs
  

Proof state:
case intro.a
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Finset X
ihs : ∀ t ⊂ s, Set.Nonempty ↑t → IsOpen ↑t → ∃ x ∈ ↑t, IsOpen {x}
hne : Set.Nonempty ↑s
ho : IsOpen ↑s
⊢ ∃ x ∈ ↑s, IsOpen {x}

Next tactic:
rcases em (∃ t, t ⊂ s ∧ t.Nonempty ∧ IsOpen (t : Set X)) with (⟨t, hts, htne, hto⟩ | ht)
/-- Given an open finite set `S` in a T₀ space, there is some `x ∈ S` such that `{x}` is open. -/
theorem exists_isOpen_singleton_of_isOpen_finite [T0Space X] {s : Set X} (hfin : s.Finite)
    (hne : s.Nonempty) (ho : IsOpen s) : ∃ x ∈ s, IsOpen ({x} : Set X) := by
  lift s to Finset X using hfin
  induction' s using Finset.strongInductionOn with s ihs
  rcases em (∃ t, t ⊂ s ∧ t.Nonempty ∧ IsOpen (t : Set X)) with (⟨t, hts, htne, hto⟩ | ht)
  · 

Proof state:
case intro.a.inl.intro.intro.intro
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T0Space X
s : Finset X
ihs : ∀ t ⊂ s, Set.Nonempty ↑t → IsOpen ↑t → ∃ x ∈ ↑t, IsOpen {x}
hne : Set.Nonempty ↑s
ho : IsOpen ↑s
t : Finset X
hts : t ⊂ s
htne : Finset.Nonempty t
hto : IsOpen ↑t
⊢ ∃ x ∈ ↑s, IsOpen {x}

Next tactic:
rcases ihs t hts htne hto with ⟨x, hxt, hxo⟩