l3lab/ntp-mathlib huggingface dataset:
theorem IsMatching.toEdge_eq_toEdge_of_adj {M : Subgraph G} {v w : V} (h : M.IsMatching)
    (hv : v ∈ M.verts) (hw : w ∈ M.verts) (ha : M.Adj v w) :
    h.toEdge ⟨v, hv⟩ = h.toEdge ⟨w, hw⟩ := by
  

Proof state:
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
v w : V
h : IsMatching M
hv : v ∈ M.verts
hw : w ∈ M.verts
ha : Adj M v w
⊢ toEdge h { val := v, property := hv } = toEdge h { val := w, property := hw }

Next tactic:
rw [h.toEdge_eq_of_adj hv ha, h.toEdge_eq_of_adj hw (M.symm ha), Subtype.mk_eq_mk, Sym2.eq_swap]
theorem IsMatching.support_eq_verts {M : Subgraph G} (h : M.IsMatching) : M.support = M.verts := by
  

Proof state:
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
h : IsMatching M
⊢ support M = M.verts

Next tactic:
refine M.support_subset_verts.antisymm fun v hv => ?_
theorem IsMatching.support_eq_verts {M : Subgraph G} (h : M.IsMatching) : M.support = M.verts := by
  refine M.support_subset_verts.antisymm fun v hv => ?_
  

Proof state:
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
h : IsMatching M
v : V
hv : v ∈ M.verts
⊢ v ∈ support M

Next tactic:
obtain ⟨w, hvw, -⟩ := h hv
theorem IsMatching.support_eq_verts {M : Subgraph G} (h : M.IsMatching) : M.support = M.verts := by
  refine M.support_subset_verts.antisymm fun v hv => ?_
  obtain ⟨w, hvw, -⟩ := h hv
  

Proof state:
case intro.intro
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
h : IsMatching M
v : V
hv : v ∈ M.verts
w : V
hvw : Adj M v w
⊢ v ∈ support M

Next tactic:
exact ⟨_, hvw⟩
theorem isMatching_iff_forall_degree {M : Subgraph G} [∀ v : V, Fintype (M.neighborSet v)] :
    M.IsMatching ↔ ∀ v : V, v ∈ M.verts → M.degree v = 1 := by
  

Proof state:
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
inst✝ : (v : V) → Fintype ↑(neighborSet M v)
⊢ IsMatching M ↔ ∀ v ∈ M.verts, degree M v = 1

Next tactic:
simp only [degree_eq_one_iff_unique_adj, IsMatching]
theorem IsMatching.even_card {M : Subgraph G} [Fintype M.verts] (h : M.IsMatching) :
    Even M.verts.toFinset.card := by
  

Proof state:
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
inst✝ : Fintype ↑M.verts
h : IsMatching M
⊢ Even (Finset.card (Set.toFinset M.verts))

Next tactic:
classical
  rw [isMatching_iff_forall_degree] at h
  use M.coe.edgeFinset.card
  rw [← two_mul, ← M.coe.sum_degrees_eq_twice_card_edges]
  -- Porting note: `SimpleGraph.Subgraph.coe_degree` does not trigger because it uses
  -- instance arguments instead of implicit arguments for the first `Fintype` argument.
  -- Using a `convert_to` to swap out the `Fintype` instance to the "right" one.
  convert_to _ = Finset.sum Finset.univ fun v => SimpleGraph.degree (Subgraph.coe M) v using 3
  simp [h, Finset.card_univ]
theorem IsMatching.even_card {M : Subgraph G} [Fintype M.verts] (h : M.IsMatching) :
    Even M.verts.toFinset.card := by
  classical
  

Proof state:
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
inst✝ : Fintype ↑M.verts
h : IsMatching M
⊢ Even (Finset.card (Set.toFinset M.verts))

Next tactic:
rw [isMatching_iff_forall_degree] at h
theorem IsMatching.even_card {M : Subgraph G} [Fintype M.verts] (h : M.IsMatching) :
    Even M.verts.toFinset.card := by
  classical
  rw [isMatching_iff_forall_degree] at h
  

Proof state:
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
inst✝ : Fintype ↑M.verts
h : ∀ v ∈ M.verts, degree M v = 1
⊢ Even (Finset.card (Set.toFinset M.verts))

Next tactic:
use M.coe.edgeFinset.card
theorem IsMatching.even_card {M : Subgraph G} [Fintype M.verts] (h : M.IsMatching) :
    Even M.verts.toFinset.card := by
  classical
  rw [isMatching_iff_forall_degree] at h
  use M.coe.edgeFinset.card
  

Proof state:
case h
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
inst✝ : Fintype ↑M.verts
h : ∀ v ∈ M.verts, degree M v = 1
⊢ Finset.card (Set.toFinset M.verts) =
    Finset.card (edgeFinset (Subgraph.coe M)) + Finset.card (edgeFinset (Subgraph.coe M))

Next tactic:
rw [← two_mul, ← M.coe.sum_degrees_eq_twice_card_edges]
theorem IsMatching.even_card {M : Subgraph G} [Fintype M.verts] (h : M.IsMatching) :
    Even M.verts.toFinset.card := by
  classical
  rw [isMatching_iff_forall_degree] at h
  use M.coe.edgeFinset.card
  rw [← two_mul, ← M.coe.sum_degrees_eq_twice_card_edges]
  -- Porting note: `SimpleGraph.Subgraph.coe_degree` does not trigger because it uses
  -- instance arguments instead of implicit arguments for the first `Fintype` argument.
  -- Using a `convert_to` to swap out the `Fintype` instance to the "right" one.
  

Proof state:
case h
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
inst✝ : Fintype ↑M.verts
h : ∀ v ∈ M.verts, degree M v = 1
⊢ Finset.card (Set.toFinset M.verts) = Finset.sum Finset.univ fun v => SimpleGraph.degree (Subgraph.coe M) v

Next tactic:
convert_to _ = Finset.sum Finset.univ fun v => SimpleGraph.degree (Subgraph.coe M) v using 3
theorem IsMatching.even_card {M : Subgraph G} [Fintype M.verts] (h : M.IsMatching) :
    Even M.verts.toFinset.card := by
  classical
  rw [isMatching_iff_forall_degree] at h
  use M.coe.edgeFinset.card
  rw [← two_mul, ← M.coe.sum_degrees_eq_twice_card_edges]
  -- Porting note: `SimpleGraph.Subgraph.coe_degree` does not trigger because it uses
  -- instance arguments instead of implicit arguments for the first `Fintype` argument.
  -- Using a `convert_to` to swap out the `Fintype` instance to the "right" one.
  convert_to _ = Finset.sum Finset.univ fun v => SimpleGraph.degree (Subgraph.coe M) v using 3
  

Proof state:
case h.convert_2
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
inst✝ : Fintype ↑M.verts
h : ∀ v ∈ M.verts, degree M v = 1
⊢ Finset.card (Set.toFinset M.verts) = Finset.sum Finset.univ fun v => SimpleGraph.degree (Subgraph.coe M) v

Next tactic:
simp [h, Finset.card_univ]
theorem isPerfectMatching_iff : M.IsPerfectMatching ↔ ∀ v, ∃! w, M.Adj v w := by
  

Proof state:
V : Type u
G : SimpleGraph V
M : Subgraph G
⊢ IsPerfectMatching M ↔ ∀ (v : V), ∃! w, Adj M v w

Next tactic:
refine' ⟨_, fun hm => ⟨fun v _ => hm v, fun v => _⟩⟩
theorem isPerfectMatching_iff : M.IsPerfectMatching ↔ ∀ v, ∃! w, M.Adj v w := by
  refine' ⟨_, fun hm => ⟨fun v _ => hm v, fun v => _⟩⟩
  · 

Proof state:
case refine'_1
V : Type u
G : SimpleGraph V
M : Subgraph G
⊢ IsPerfectMatching M → ∀ (v : V), ∃! w, Adj M v w

Next tactic:
rintro ⟨hm, hs⟩ v
theorem isPerfectMatching_iff : M.IsPerfectMatching ↔ ∀ v, ∃! w, M.Adj v w := by
  refine' ⟨_, fun hm => ⟨fun v _ => hm v, fun v => _⟩⟩
  · rintro ⟨hm, hs⟩ v
    

Proof state:
case refine'_1.intro
V : Type u
G : SimpleGraph V
M : Subgraph G
hm : IsMatching M
hs : IsSpanning M
v : V
⊢ ∃! w, Adj M v w

Next tactic:
exact hm (hs v)
theorem isPerfectMatching_iff : M.IsPerfectMatching ↔ ∀ v, ∃! w, M.Adj v w := by
  refine' ⟨_, fun hm => ⟨fun v _ => hm v, fun v => _⟩⟩
  · rintro ⟨hm, hs⟩ v
    exact hm (hs v)
  · 

Proof state:
case refine'_2
V : Type u
G : SimpleGraph V
M : Subgraph G
hm : ∀ (v : V), ∃! w, Adj M v w
v : V
⊢ v ∈ M.verts

Next tactic:
obtain ⟨w, hw, -⟩ := hm v
theorem isPerfectMatching_iff : M.IsPerfectMatching ↔ ∀ v, ∃! w, M.Adj v w := by
  refine' ⟨_, fun hm => ⟨fun v _ => hm v, fun v => _⟩⟩
  · rintro ⟨hm, hs⟩ v
    exact hm (hs v)
  · obtain ⟨w, hw, -⟩ := hm v
    

Proof state:
case refine'_2.intro.intro
V : Type u
G : SimpleGraph V
M : Subgraph G
hm : ∀ (v : V), ∃! w, Adj M v w
v w : V
hw : Adj M v w
⊢ v ∈ M.verts

Next tactic:
exact M.edge_vert hw
theorem isPerfectMatching_iff_forall_degree {M : Subgraph G} [∀ v, Fintype (M.neighborSet v)] :
    M.IsPerfectMatching ↔ ∀ v, M.degree v = 1 := by
  

Proof state:
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
inst✝ : (v : V) → Fintype ↑(neighborSet M v)
⊢ IsPerfectMatching M ↔ ∀ (v : V), degree M v = 1

Next tactic:
simp [degree_eq_one_iff_unique_adj, isPerfectMatching_iff]
theorem IsPerfectMatching.even_card {M : Subgraph G} [Fintype V] (h : M.IsPerfectMatching) :
    Even (Fintype.card V) := by
  

Proof state:
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
inst✝ : Fintype V
h : IsPerfectMatching M
⊢ Even (Fintype.card V)

Next tactic:
classical
  simpa only [h.2.card_verts] using IsMatching.even_card h.1
theorem IsPerfectMatching.even_card {M : Subgraph G} [Fintype V] (h : M.IsPerfectMatching) :
    Even (Fintype.card V) := by
  classical
  

Proof state:
V : Type u
G : SimpleGraph V
M✝ M : Subgraph G
inst✝ : Fintype V
h : IsPerfectMatching M
⊢ Even (Fintype.card V)

Next tactic:
simpa only [h.2.card_verts] using IsMatching.even_card h.1
/-- A nontrivial subsingleton filter is equal to `pure a` for some `a`. -/
theorem Subsingleton.exists_eq_pure [l.NeBot] (hl : l.Subsingleton) : ∃ a, l = pure a := by
  

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
inst✝ : NeBot l
hl : Filter.Subsingleton l
⊢ ∃ a, l = pure a

Next tactic:
rcases hl with ⟨s, hsl, hs⟩
/-- A nontrivial subsingleton filter is equal to `pure a` for some `a`. -/
theorem Subsingleton.exists_eq_pure [l.NeBot] (hl : l.Subsingleton) : ∃ a, l = pure a := by
  rcases hl with ⟨s, hsl, hs⟩
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
l : Filter α
inst✝ : NeBot l
s : Set α
hsl : s ∈ l
hs : Set.Subsingleton s
⊢ ∃ a, l = pure a

Next tactic:
rcases exists_eq_singleton_iff_nonempty_subsingleton.2 ⟨nonempty_of_mem hsl, hs⟩ with ⟨a, rfl⟩
/-- A nontrivial subsingleton filter is equal to `pure a` for some `a`. -/
theorem Subsingleton.exists_eq_pure [l.NeBot] (hl : l.Subsingleton) : ∃ a, l = pure a := by
  rcases hl with ⟨s, hsl, hs⟩
  rcases exists_eq_singleton_iff_nonempty_subsingleton.2 ⟨nonempty_of_mem hsl, hs⟩ with ⟨a, rfl⟩
  

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
l : Filter α
inst✝ : NeBot l
a : α
hsl : {a} ∈ l
hs : Set.Subsingleton {a}
⊢ ∃ a, l = pure a

Next tactic:
refine ⟨a, (NeBot.le_pure_iff ‹_›).1 ?_⟩
/-- A nontrivial subsingleton filter is equal to `pure a` for some `a`. -/
theorem Subsingleton.exists_eq_pure [l.NeBot] (hl : l.Subsingleton) : ∃ a, l = pure a := by
  rcases hl with ⟨s, hsl, hs⟩
  rcases exists_eq_singleton_iff_nonempty_subsingleton.2 ⟨nonempty_of_mem hsl, hs⟩ with ⟨a, rfl⟩
  refine ⟨a, (NeBot.le_pure_iff ‹_›).1 ?_⟩
  

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
l : Filter α
inst✝ : NeBot l
a : α
hsl : {a} ∈ l
hs : Set.Subsingleton {a}
⊢ l ≤ pure a

Next tactic:
rwa [le_pure_iff]
/-- A filter is a subsingleton iff it is equal to `⊥` or to `pure a` for some `a`. -/
theorem subsingleton_iff_bot_or_pure : l.Subsingleton ↔ l = ⊥ ∨ ∃ a, l = pure a := by
  

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
⊢ Filter.Subsingleton l ↔ l = ⊥ ∨ ∃ a, l = pure a

Next tactic:
refine ⟨fun hl ↦ ?_, ?_⟩
/-- A filter is a subsingleton iff it is equal to `⊥` or to `pure a` for some `a`. -/
theorem subsingleton_iff_bot_or_pure : l.Subsingleton ↔ l = ⊥ ∨ ∃ a, l = pure a := by
  refine ⟨fun hl ↦ ?_, ?_⟩
  · 

Proof state:
case refine_1
α : Type u_1
β : Type u_2
l : Filter α
hl : Filter.Subsingleton l
⊢ l = ⊥ ∨ ∃ a, l = pure a

Next tactic:
exact (eq_or_neBot l).imp_right (@Subsingleton.exists_eq_pure _ _ · hl)
/-- A filter is a subsingleton iff it is equal to `⊥` or to `pure a` for some `a`. -/
theorem subsingleton_iff_bot_or_pure : l.Subsingleton ↔ l = ⊥ ∨ ∃ a, l = pure a := by
  refine ⟨fun hl ↦ ?_, ?_⟩
  · exact (eq_or_neBot l).imp_right (@Subsingleton.exists_eq_pure _ _ · hl)
  · 

Proof state:
case refine_2
α : Type u_1
β : Type u_2
l : Filter α
⊢ (l = ⊥ ∨ ∃ a, l = pure a) → Filter.Subsingleton l

Next tactic:
rintro (rfl | ⟨a, rfl⟩)
/-- A filter is a subsingleton iff it is equal to `⊥` or to `pure a` for some `a`. -/
theorem subsingleton_iff_bot_or_pure : l.Subsingleton ↔ l = ⊥ ∨ ∃ a, l = pure a := by
  refine ⟨fun hl ↦ ?_, ?_⟩
  · exact (eq_or_neBot l).imp_right (@Subsingleton.exists_eq_pure _ _ · hl)
  · rintro (rfl | ⟨a, rfl⟩) <;> 

Proof state:
case refine_2.inl
α : Type u_1
β : Type u_2
⊢ Filter.Subsingleton ⊥

Next tactic:
simp
/-- A filter is a subsingleton iff it is equal to `⊥` or to `pure a` for some `a`. -/
theorem subsingleton_iff_bot_or_pure : l.Subsingleton ↔ l = ⊥ ∨ ∃ a, l = pure a := by
  refine ⟨fun hl ↦ ?_, ?_⟩
  · exact (eq_or_neBot l).imp_right (@Subsingleton.exists_eq_pure _ _ · hl)
  · rintro (rfl | ⟨a, rfl⟩) <;> 

Proof state:
case refine_2.inr.intro
α : Type u_1
β : Type u_2
a : α
⊢ Filter.Subsingleton (pure a)

Next tactic:
simp
/-- In a nonempty type, a filter is a subsingleton iff
it is less than or equal to a pure filter. -/
theorem subsingleton_iff_exists_le_pure [Nonempty α] : l.Subsingleton ↔ ∃ a, l ≤ pure a := by
  

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
inst✝ : Nonempty α
⊢ Filter.Subsingleton l ↔ ∃ a, l ≤ pure a

Next tactic:
rcases eq_or_neBot l with rfl | hbot
/-- In a nonempty type, a filter is a subsingleton iff
it is less than or equal to a pure filter. -/
theorem subsingleton_iff_exists_le_pure [Nonempty α] : l.Subsingleton ↔ ∃ a, l ≤ pure a := by
  rcases eq_or_neBot l with rfl | hbot
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝ : Nonempty α
⊢ Filter.Subsingleton ⊥ ↔ ∃ a, ⊥ ≤ pure a

Next tactic:
simp
/-- In a nonempty type, a filter is a subsingleton iff
it is less than or equal to a pure filter. -/
theorem subsingleton_iff_exists_le_pure [Nonempty α] : l.Subsingleton ↔ ∃ a, l ≤ pure a := by
  rcases eq_or_neBot l with rfl | hbot
  · simp
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
l : Filter α
inst✝ : Nonempty α
hbot : NeBot l
⊢ Filter.Subsingleton l ↔ ∃ a, l ≤ pure a

Next tactic:
simp [subsingleton_iff_bot_or_pure, ← hbot.le_pure_iff, hbot.ne]
theorem subsingleton_iff_exists_singleton_mem [Nonempty α] : l.Subsingleton ↔ ∃ a, {a} ∈ l := by
  

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
inst✝ : Nonempty α
⊢ Filter.Subsingleton l ↔ ∃ a, {a} ∈ l

Next tactic:
simp only [subsingleton_iff_exists_le_pure, le_pure_iff]
lemma Subsingleton.isCountablyGenerated (hl : l.Subsingleton) : IsCountablyGenerated l := by
  

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
hl : Filter.Subsingleton l
⊢ IsCountablyGenerated l

Next tactic:
rcases subsingleton_iff_bot_or_pure.1 hl with rfl|⟨x, rfl⟩
lemma Subsingleton.isCountablyGenerated (hl : l.Subsingleton) : IsCountablyGenerated l := by
  rcases subsingleton_iff_bot_or_pure.1 hl with rfl|⟨x, rfl⟩
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
hl : Filter.Subsingleton ⊥
⊢ IsCountablyGenerated ⊥

Next tactic:
exact isCountablyGenerated_bot
lemma Subsingleton.isCountablyGenerated (hl : l.Subsingleton) : IsCountablyGenerated l := by
  rcases subsingleton_iff_bot_or_pure.1 hl with rfl|⟨x, rfl⟩
  · exact isCountablyGenerated_bot
  · 

Proof state:
case inr.intro
α : Type u_1
β : Type u_2
x : α
hl : Filter.Subsingleton (pure x)
⊢ IsCountablyGenerated (pure x)

Next tactic:
exact isCountablyGenerated_pure x
nonrec theorem FarFromTriangleFree.mono (hε : G.FarFromTriangleFree ε) (h : δ ≤ ε) :
    G.FarFromTriangleFree δ := hε.mono <| by 

Proof state:
α : Type u_1
𝕜 : Type u_2
inst✝¹ : Fintype α
inst✝ : LinearOrderedField 𝕜
G H : SimpleGraph α
ε δ : 𝕜
n : ℕ
s : Finset α
hε : FarFromTriangleFree G ε
h : δ ≤ ε
⊢ δ * ↑(Fintype.card α ^ 2) ≤ ε * ↑(Fintype.card α ^ 2)

Next tactic:
gcongr
theorem FarFromTriangleFree.nonpos (h₀ : G.FarFromTriangleFree ε) (h₁ : G.CliqueFree 3) :
    ε ≤ 0 := by
  

Proof state:
α : Type u_1
𝕜 : Type u_2
inst✝² : Fintype α
inst✝¹ : LinearOrderedField 𝕜
G H : SimpleGraph α
ε δ : 𝕜
n : ℕ
s : Finset α
inst✝ : Nonempty α
h₀ : FarFromTriangleFree G ε
h₁ : CliqueFree G 3
⊢ ε ≤ 0

Next tactic:
have := h₀ (empty_subset _)
theorem FarFromTriangleFree.nonpos (h₀ : G.FarFromTriangleFree ε) (h₁ : G.CliqueFree 3) :
    ε ≤ 0 := by
  have := h₀ (empty_subset _)
  

Proof state:
α : Type u_1
𝕜 : Type u_2
inst✝² : Fintype α
inst✝¹ : LinearOrderedField 𝕜
G H : SimpleGraph α
ε δ : 𝕜
n : ℕ
s : Finset α
inst✝ : Nonempty α
h₀ : FarFromTriangleFree G ε
h₁ : CliqueFree G 3
this : (fun H => CliqueFree H 3) (deleteEdges G ↑∅) → ε * ↑(Fintype.card α ^ 2) ≤ ↑(Finset.card ∅)
⊢ ε ≤ 0

Next tactic:
rw [coe_empty, Finset.card_empty, cast_zero, deleteEdges_empty_eq] at this
theorem FarFromTriangleFree.nonpos (h₀ : G.FarFromTriangleFree ε) (h₁ : G.CliqueFree 3) :
    ε ≤ 0 := by
  have := h₀ (empty_subset _)
  rw [coe_empty, Finset.card_empty, cast_zero, deleteEdges_empty_eq] at this
  

Proof state:
α : Type u_1
𝕜 : Type u_2
inst✝² : Fintype α
inst✝¹ : LinearOrderedField 𝕜
G H : SimpleGraph α
ε δ : 𝕜
n : ℕ
s : Finset α
inst✝ : Nonempty α
h₀ : FarFromTriangleFree G ε
h₁ : CliqueFree G 3
this : (fun H => CliqueFree H 3) G → ε * ↑(Fintype.card α ^ 2) ≤ 0
⊢ ε ≤ 0

Next tactic:
exact nonpos_of_mul_nonpos_left (this h₁) (cast_pos.2 <| sq_pos_of_pos Fintype.card_pos)
instance [TopologicalSpace β] [TotallyDisconnectedSpace α] [TotallyDisconnectedSpace β] :
    TotallyDisconnectedSpace (Sum α β) := by
  

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝³ : TopologicalSpace α
s t u v : Set α
inst✝² : TopologicalSpace β
inst✝¹ : TotallyDisconnectedSpace α
inst✝ : TotallyDisconnectedSpace β
⊢ TotallyDisconnectedSpace (α ⊕ β)

Next tactic:
refine' ⟨fun s _ hs => _⟩
instance [TopologicalSpace β] [TotallyDisconnectedSpace α] [TotallyDisconnectedSpace β] :
    TotallyDisconnectedSpace (Sum α β) := by
  refine' ⟨fun s _ hs => _⟩
  

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝³ : TopologicalSpace α
s✝ t u v : Set α
inst✝² : TopologicalSpace β
inst✝¹ : TotallyDisconnectedSpace α
inst✝ : TotallyDisconnectedSpace β
s : Set (α ⊕ β)
x✝ : s ⊆ univ
hs : IsPreconnected s
⊢ Set.Subsingleton s

Next tactic:
obtain ⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩ := Sum.isPreconnected_iff.1 hs
instance [TopologicalSpace β] [TotallyDisconnectedSpace α] [TotallyDisconnectedSpace β] :
    TotallyDisconnectedSpace (Sum α β) := by
  refine' ⟨fun s _ hs => _⟩
  obtain ⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩ := Sum.isPreconnected_iff.1 hs
  · 

Proof state:
case inl.intro.intro
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝³ : TopologicalSpace α
s t✝ u v : Set α
inst✝² : TopologicalSpace β
inst✝¹ : TotallyDisconnectedSpace α
inst✝ : TotallyDisconnectedSpace β
t : Set α
ht : IsPreconnected t
x✝ : Sum.inl '' t ⊆ univ
hs : IsPreconnected (Sum.inl '' t)
⊢ Set.Subsingleton (Sum.inl '' t)

Next tactic:
exact ht.subsingleton.image _
instance [TopologicalSpace β] [TotallyDisconnectedSpace α] [TotallyDisconnectedSpace β] :
    TotallyDisconnectedSpace (Sum α β) := by
  refine' ⟨fun s _ hs => _⟩
  obtain ⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩ := Sum.isPreconnected_iff.1 hs
  · exact ht.subsingleton.image _
  · 

Proof state:
case inr.intro.intro
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝³ : TopologicalSpace α
s t✝ u v : Set α
inst✝² : TopologicalSpace β
inst✝¹ : TotallyDisconnectedSpace α
inst✝ : TotallyDisconnectedSpace β
t : Set β
ht : IsPreconnected t
x✝ : Sum.inr '' t ⊆ univ
hs : IsPreconnected (Sum.inr '' t)
⊢ Set.Subsingleton (Sum.inr '' t)

Next tactic:
exact ht.subsingleton.image _
instance [∀ i, TopologicalSpace (π i)] [∀ i, TotallyDisconnectedSpace (π i)] :
    TotallyDisconnectedSpace (Σi, π i) := by
  

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝² : TopologicalSpace α
s t u v : Set α
inst✝¹ : (i : ι) → TopologicalSpace (π i)
inst✝ : ∀ (i : ι), TotallyDisconnectedSpace (π i)
⊢ TotallyDisconnectedSpace ((i : ι) × π i)

Next tactic:
refine' ⟨fun s _ hs => _⟩
instance [∀ i, TopologicalSpace (π i)] [∀ i, TotallyDisconnectedSpace (π i)] :
    TotallyDisconnectedSpace (Σi, π i) := by
  refine' ⟨fun s _ hs => _⟩
  

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝² : TopologicalSpace α
s✝ t u v : Set α
inst✝¹ : (i : ι) → TopologicalSpace (π i)
inst✝ : ∀ (i : ι), TotallyDisconnectedSpace (π i)
s : Set ((i : ι) × π i)
x✝ : s ⊆ univ
hs : IsPreconnected s
⊢ Set.Subsingleton s

Next tactic:
obtain rfl | h := s.eq_empty_or_nonempty
instance [∀ i, TopologicalSpace (π i)] [∀ i, TotallyDisconnectedSpace (π i)] :
    TotallyDisconnectedSpace (Σi, π i) := by
  refine' ⟨fun s _ hs => _⟩
  obtain rfl | h := s.eq_empty_or_nonempty
  · 

Proof state:
case inl
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝² : TopologicalSpace α
s t u v : Set α
inst✝¹ : (i : ι) → TopologicalSpace (π i)
inst✝ : ∀ (i : ι), TotallyDisconnectedSpace (π i)
x✝ : ∅ ⊆ univ
hs : IsPreconnected ∅
⊢ Set.Subsingleton ∅

Next tactic:
exact subsingleton_empty
instance [∀ i, TopologicalSpace (π i)] [∀ i, TotallyDisconnectedSpace (π i)] :
    TotallyDisconnectedSpace (Σi, π i) := by
  refine' ⟨fun s _ hs => _⟩
  obtain rfl | h := s.eq_empty_or_nonempty
  · exact subsingleton_empty
  · 

Proof state:
case inr
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝² : TopologicalSpace α
s✝ t u v : Set α
inst✝¹ : (i : ι) → TopologicalSpace (π i)
inst✝ : ∀ (i : ι), TotallyDisconnectedSpace (π i)
s : Set ((i : ι) × π i)
x✝ : s ⊆ univ
hs : IsPreconnected s
h : Set.Nonempty s
⊢ Set.Subsingleton s

Next tactic:
obtain ⟨a, t, ht, rfl⟩ := Sigma.isConnected_iff.1 ⟨h, hs⟩
instance [∀ i, TopologicalSpace (π i)] [∀ i, TotallyDisconnectedSpace (π i)] :
    TotallyDisconnectedSpace (Σi, π i) := by
  refine' ⟨fun s _ hs => _⟩
  obtain rfl | h := s.eq_empty_or_nonempty
  · exact subsingleton_empty
  · obtain ⟨a, t, ht, rfl⟩ := Sigma.isConnected_iff.1 ⟨h, hs⟩
    

Proof state:
case inr.intro.intro.intro
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝² : TopologicalSpace α
s t✝ u v : Set α
inst✝¹ : (i : ι) → TopologicalSpace (π i)
inst✝ : ∀ (i : ι), TotallyDisconnectedSpace (π i)
a : ι
t : Set (π a)
ht : IsConnected t
x✝ : Sigma.mk a '' t ⊆ univ
hs : IsPreconnected (Sigma.mk a '' t)
h : Set.Nonempty (Sigma.mk a '' t)
⊢ Set.Subsingleton (Sigma.mk a '' t)

Next tactic:
exact ht.isPreconnected.subsingleton.image _
/-- Let `X` be a topological space, and suppose that for all distinct `x,y ∈ X`, there
  is some clopen set `U` such that `x ∈ U` and `y ∉ U`. Then `X` is totally disconnected. -/
theorem isTotallyDisconnected_of_isClopen_set {X : Type*} [TopologicalSpace X]
    (hX : Pairwise fun x y => ∃ (U : Set X), IsClopen U ∧ x ∈ U ∧ y ∉ U) :
    IsTotallyDisconnected (Set.univ : Set X) := by
  

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s t u v : Set α
X : Type u_3
inst✝ : TopologicalSpace X
hX : Pairwise fun x y => ∃ U, IsClopen U ∧ x ∈ U ∧ y ∉ U
⊢ IsTotallyDisconnected univ

Next tactic:
rintro S - hS
/-- Let `X` be a topological space, and suppose that for all distinct `x,y ∈ X`, there
  is some clopen set `U` such that `x ∈ U` and `y ∉ U`. Then `X` is totally disconnected. -/
theorem isTotallyDisconnected_of_isClopen_set {X : Type*} [TopologicalSpace X]
    (hX : Pairwise fun x y => ∃ (U : Set X), IsClopen U ∧ x ∈ U ∧ y ∉ U) :
    IsTotallyDisconnected (Set.univ : Set X) := by
  rintro S - hS
  

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s t u v : Set α
X : Type u_3
inst✝ : TopologicalSpace X
hX : Pairwise fun x y => ∃ U, IsClopen U ∧ x ∈ U ∧ y ∉ U
S : Set X
hS : IsPreconnected S
⊢ Set.Subsingleton S

Next tactic:
unfold Set.Subsingleton
/-- Let `X` be a topological space, and suppose that for all distinct `x,y ∈ X`, there
  is some clopen set `U` such that `x ∈ U` and `y ∉ U`. Then `X` is totally disconnected. -/
theorem isTotallyDisconnected_of_isClopen_set {X : Type*} [TopologicalSpace X]
    (hX : Pairwise fun x y => ∃ (U : Set X), IsClopen U ∧ x ∈ U ∧ y ∉ U) :
    IsTotallyDisconnected (Set.univ : Set X) := by
  rintro S - hS
  unfold Set.Subsingleton
  

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s t u v : Set α
X : Type u_3
inst✝ : TopologicalSpace X
hX : Pairwise fun x y => ∃ U, IsClopen U ∧ x ∈ U ∧ y ∉ U
S : Set X
hS : IsPreconnected S
⊢ ∀ ⦃x : X⦄, x ∈ S → ∀ ⦃y : X⦄, y ∈ S → x = y

Next tactic:
by_contra! h_contra
/-- Let `X` be a topological space, and suppose that for all distinct `x,y ∈ X`, there
  is some clopen set `U` such that `x ∈ U` and `y ∉ U`. Then `X` is totally disconnected. -/
theorem isTotallyDisconnected_of_isClopen_set {X : Type*} [TopologicalSpace X]
    (hX : Pairwise fun x y => ∃ (U : Set X), IsClopen U ∧ x ∈ U ∧ y ∉ U) :
    IsTotallyDisconnected (Set.univ : Set X) := by
  rintro S - hS
  unfold Set.Subsingleton
  by_contra! h_contra
  

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s t u v : Set α
X : Type u_3
inst✝ : TopologicalSpace X
hX : Pairwise fun x y => ∃ U, IsClopen U ∧ x ∈ U ∧ y ∉ U
S : Set X
hS : IsPreconnected S
h_contra : ∃ x ∈ S, ∃ y ∈ S, x ≠ y
⊢ False

Next tactic:
rcases h_contra with ⟨x, hx, y, hy, hxy⟩