Theorem: isConnected_iff_sUnion_disjoint_open
File: Mathlib/Topology/Connected.lean

tactic: rw [IsConnected, isPreconnected_iff_subset_of_disjoint]
state_before: α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u v s : Set α
⊢ IsConnected s ↔
    ∀ (U : Finset (Set α)),
      (∀ (u v : Set α), u ∈ U → v ∈ U → Set.Nonempty (s ∩ (u ∩ v)) → u = v) →
        (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u

tactic: refine ⟨fun ⟨hne, h⟩ U hU hUo hsU => ?_, fun h => ⟨?_, fun u v hu hv hs hsuv => ?_⟩⟩
state_before: α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u v s : Set α
⊢ (Set.Nonempty s ∧ ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v) ↔
    ∀ (U : Finset (Set α)),
      (∀ (u v : Set α), u ∈ U → v ∈ U → Set.Nonempty (s ∩ (u ∩ v)) → u = v) →
        (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u

tactic: induction U using Finset.induction_on
state_before: case refine_1
α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u v s : Set α
x✝ : Set.Nonempty s ∧ ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
U : Finset (Set α)
hU : ∀ (u v : Set α), u ∈ U → v ∈ U → Set.Nonempty (s ∩ (u ∩ v)) → u = v
hUo : ∀ (u : Set α), u ∈ U → IsOpen u
hsU : s ⊆ ⋃₀ ↑U
hne : Set.Nonempty s
h : ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
⊢ ∃ u, u ∈ U ∧ s ⊆ u

tactic: case empty => exact absurd (by simpa using hsU) hne.not_subset_empty
state_before: case refine_1.empty
α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u v s : Set α
x✝ : Set.Nonempty s ∧ ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
hne : Set.Nonempty s
h : ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
hU : ∀ (u v : Set α), u ∈ ∅ → v ∈ ∅ → Set.Nonempty (s ∩ (u ∩ v)) → u = v
hUo : ∀ (u : Set α), u ∈ ∅ → IsOpen u
hsU : s ⊆ ⋃₀ ↑∅
⊢ ∃ u, u ∈ ∅ ∧ s ⊆ u

case refine_1.insert
α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝¹ t u v s : Set α
x✝ : Set.Nonempty s ∧ ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
hne : Set.Nonempty s
h : ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
a✝² : Set α
s✝ : Finset (Set α)
a✝¹ : ¬a✝² ∈ s✝
a✝ :
  (∀ (u v : Set α), u ∈ s✝ → v ∈ s✝ → Set.Nonempty (s ∩ (u ∩ v)) → u = v) →
    (∀ (u : Set α), u ∈ s✝ → IsOpen u) → s ⊆ ⋃₀ ↑s✝ → ∃ u, u ∈ s✝ ∧ s ⊆ u
hU : ∀ (u v : Set α), u ∈ insert a✝² s✝ → v ∈ insert a✝² s✝ → Set.Nonempty (s ∩ (u ∩ v)) → u = v
hUo : ∀ (u : Set α), u ∈ insert a✝² s✝ → IsOpen u
hsU : s ⊆ ⋃₀ ↑(insert a✝² s✝)
⊢ ∃ u, u ∈ insert a✝² s✝ ∧ s ⊆ u

tactic: exact absurd (by simpa using hsU) hne.not_subset_empty
state_before: α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u v s : Set α
x✝ : Set.Nonempty s ∧ ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
hne : Set.Nonempty s
h : ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
hU : ∀ (u v : Set α), u ∈ ∅ → v ∈ ∅ → Set.Nonempty (s ∩ (u ∩ v)) → u = v
hUo : ∀ (u : Set α), u ∈ ∅ → IsOpen u
hsU : s ⊆ ⋃₀ ↑∅
⊢ ∃ u, u ∈ ∅ ∧ s ⊆ u

tactic: simpa using hsU
state_before: α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u v s : Set α
x✝ : Set.Nonempty s ∧ ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
hne : Set.Nonempty s
h : ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
hU : ∀ (u v : Set α), u ∈ ∅ → v ∈ ∅ → Set.Nonempty (s ∩ (u ∩ v)) → u = v
hUo : ∀ (u : Set α), u ∈ ∅ → IsOpen u
hsU : s ⊆ ⋃₀ ↑∅
⊢ s ⊆ ∅

tactic: simp only [← ball_cond_comm, Finset.forall_mem_insert, Finset.exists_mem_insert,
  Finset.coe_insert, sUnion_insert, implies_true, true_and] at *
state_before: α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u✝ v s : Set α
x✝ : Set.Nonempty s ∧ ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
hne : Set.Nonempty s
h : ∀ (u v : Set α), IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
u : Set α
U : Finset (Set α)
uU : ¬u ∈ U
IH :
  (∀ (u v : Set α), u ∈ U → v ∈ U → Set.Nonempty (s ∩ (u ∩ v)) → u = v) →
    (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u
hU : ∀ (u_1 v : Set α), u_1 ∈ insert u U → v ∈ insert u U → Set.Nonempty (s ∩ (u_1 ∩ v)) → u_1 = v
hUo : ∀ (u_1 : Set α), u_1 ∈ insert u U → IsOpen u_1
hsU : s ⊆ ⋃₀ ↑(insert u U)
⊢ ∃ u_1, u_1 ∈ insert u U ∧ s ⊆ u_1

tactic: refine (h _ hUo.1 (⋃₀ ↑U) (isOpen_sUnion hUo.2) hsU ?_).imp_right ?_
state_before: α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u✝ v s : Set α
hne : Set.Nonempty s
u : Set α
U : Finset (Set α)
uU : ¬u ∈ U
x✝ : Set.Nonempty s ∧ ∀ (a : Set α), IsOpen a → ∀ (b : Set α), IsOpen b → s ⊆ a ∪ b → s ∩ (a ∩ b) = ∅ → s ⊆ a ∨ s ⊆ b
h : ∀ (a : Set α), IsOpen a → ∀ (b : Set α), IsOpen b → s ⊆ a ∪ b → s ∩ (a ∩ b) = ∅ → s ⊆ a ∨ s ⊆ b
IH :
  (∀ (a : Set α), a ∈ U → ∀ (b : Set α), b ∈ U → Set.Nonempty (s ∩ (a ∩ b)) → a = b) →
    (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u
hU :
  (∀ (x : Set α), x ∈ U → Set.Nonempty (s ∩ (u ∩ x)) → u = x) ∧
    ∀ (x : Set α),
      x ∈ U → (Set.Nonempty (s ∩ (x ∩ u)) → x = u) ∧ ∀ (x_1 : Set α), x_1 ∈ U → Set.Nonempty (s ∩ (x ∩ x_1)) → x = x_1
hUo : IsOpen u ∧ ∀ (x : Set α), x ∈ U → IsOpen x
hsU : s ⊆ u ∪ ⋃₀ ↑U
⊢ s ⊆ u ∨ ∃ x, x ∈ U ∧ s ⊆ x

tactic: refine subset_empty_iff.1 fun x ⟨hxs, hxu, v, hvU, hxv⟩ => ?_
state_before: case refine_1
α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u✝ v s : Set α
hne : Set.Nonempty s
u : Set α
U : Finset (Set α)
uU : ¬u ∈ U
x✝ : Set.Nonempty s ∧ ∀ (a : Set α), IsOpen a → ∀ (b : Set α), IsOpen b → s ⊆ a ∪ b → s ∩ (a ∩ b) = ∅ → s ⊆ a ∨ s ⊆ b
h : ∀ (a : Set α), IsOpen a → ∀ (b : Set α), IsOpen b → s ⊆ a ∪ b → s ∩ (a ∩ b) = ∅ → s ⊆ a ∨ s ⊆ b
IH :
  (∀ (a : Set α), a ∈ U → ∀ (b : Set α), b ∈ U → Set.Nonempty (s ∩ (a ∩ b)) → a = b) →
    (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u
hU :
  (∀ (x : Set α), x ∈ U → Set.Nonempty (s ∩ (u ∩ x)) → u = x) ∧
    ∀ (x : Set α),
      x ∈ U → (Set.Nonempty (s ∩ (x ∩ u)) → x = u) ∧ ∀ (x_1 : Set α), x_1 ∈ U → Set.Nonempty (s ∩ (x ∩ x_1)) → x = x_1
hUo : IsOpen u ∧ ∀ (x : Set α), x ∈ U → IsOpen x
hsU : s ⊆ u ∪ ⋃₀ ↑U
⊢ s ∩ (u ∩ ⋃₀ ↑U) = ∅

tactic: exact ne_of_mem_of_not_mem hvU uU (hU.1 v hvU ⟨x, hxs, hxu, hxv⟩).symm
state_before: case refine_1
α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u✝ v✝ s : Set α
hne : Set.Nonempty s
u : Set α
U : Finset (Set α)
uU : ¬u ∈ U
x✝¹ : Set.Nonempty s ∧ ∀ (a : Set α), IsOpen a → ∀ (b : Set α), IsOpen b → s ⊆ a ∪ b → s ∩ (a ∩ b) = ∅ → s ⊆ a ∨ s ⊆ b
h : ∀ (a : Set α), IsOpen a → ∀ (b : Set α), IsOpen b → s ⊆ a ∪ b → s ∩ (a ∩ b) = ∅ → s ⊆ a ∨ s ⊆ b
IH :
  (∀ (a : Set α), a ∈ U → ∀ (b : Set α), b ∈ U → Set.Nonempty (s ∩ (a ∩ b)) → a = b) →
    (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u
hU :
  (∀ (x : Set α), x ∈ U → Set.Nonempty (s ∩ (u ∩ x)) → u = x) ∧
    ∀ (x : Set α),
      x ∈ U → (Set.Nonempty (s ∩ (x ∩ u)) → x = u) ∧ ∀ (x_1 : Set α), x_1 ∈ U → Set.Nonempty (s ∩ (x ∩ x_1)) → x = x_1
hUo : IsOpen u ∧ ∀ (x : Set α), x ∈ U → IsOpen x
hsU : s ⊆ u ∪ ⋃₀ ↑U
x : α
x✝ : x ∈ s ∩ (u ∩ ⋃₀ ↑U)
hxs : x ∈ s
hxu : x ∈ u
v : Set α
hvU : v ∈ ↑U
hxv : x ∈ v
⊢ x ∈ ∅

tactic: exact IH (fun u hu => (hU.2 u hu).2) hUo.2
state_before: case refine_2
α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u✝ v s : Set α
hne : Set.Nonempty s
u : Set α
U : Finset (Set α)
uU : ¬u ∈ U
x✝ : Set.Nonempty s ∧ ∀ (a : Set α), IsOpen a → ∀ (b : Set α), IsOpen b → s ⊆ a ∪ b → s ∩ (a ∩ b) = ∅ → s ⊆ a ∨ s ⊆ b
h : ∀ (a : Set α), IsOpen a → ∀ (b : Set α), IsOpen b → s ⊆ a ∪ b → s ∩ (a ∩ b) = ∅ → s ⊆ a ∨ s ⊆ b
IH :
  (∀ (a : Set α), a ∈ U → ∀ (b : Set α), b ∈ U → Set.Nonempty (s ∩ (a ∩ b)) → a = b) →
    (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u
hU :
  (∀ (x : Set α), x ∈ U → Set.Nonempty (s ∩ (u ∩ x)) → u = x) ∧
    ∀ (x : Set α),
      x ∈ U → (Set.Nonempty (s ∩ (x ∩ u)) → x = u) ∧ ∀ (x_1 : Set α), x_1 ∈ U → Set.Nonempty (s ∩ (x ∩ x_1)) → x = x_1
hUo : IsOpen u ∧ ∀ (x : Set α), x ∈ U → IsOpen x
hsU : s ⊆ u ∪ ⋃₀ ↑U
⊢ s ⊆ ⋃₀ ↑U → ∃ x, x ∈ U ∧ s ⊆ x

tactic: simpa [subset_empty_iff, nonempty_iff_ne_empty] using h ∅
state_before: case refine_2
α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u v s : Set α
h :
  ∀ (U : Finset (Set α)),
    (∀ (u v : Set α), u ∈ U → v ∈ U → Set.Nonempty (s ∩ (u ∩ v)) → u = v) →
      (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u
⊢ Set.Nonempty s

tactic: rw [← not_nonempty_iff_eq_empty] at hsuv
state_before: case refine_3
α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u✝ v✝ s : Set α
h :
  ∀ (U : Finset (Set α)),
    (∀ (u v : Set α), u ∈ U → v ∈ U → Set.Nonempty (s ∩ (u ∩ v)) → u = v) →
      (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u
u v : Set α
hu : IsOpen u
hv : IsOpen v
hs : s ⊆ u ∪ v
hsuv : s ∩ (u ∩ v) = ∅
⊢ s ⊆ u ∨ s ⊆ v

tactic: have := hsuv
state_before: case refine_3
α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u✝ v✝ s : Set α
h :
  ∀ (U : Finset (Set α)),
    (∀ (u v : Set α), u ∈ U → v ∈ U → Set.Nonempty (s ∩ (u ∩ v)) → u = v) →
      (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u
u v : Set α
hu : IsOpen u
hv : IsOpen v
hs : s ⊆ u ∪ v
hsuv : ¬Set.Nonempty (s ∩ (u ∩ v))
⊢ s ⊆ u ∨ s ⊆ v

tactic: rw [inter_comm u] at this
state_before: case refine_3
α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u✝ v✝ s : Set α
h :
  ∀ (U : Finset (Set α)),
    (∀ (u v : Set α), u ∈ U → v ∈ U → Set.Nonempty (s ∩ (u ∩ v)) → u = v) →
      (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u
u v : Set α
hu : IsOpen u
hv : IsOpen v
hs : s ⊆ u ∪ v
hsuv this : ¬Set.Nonempty (s ∩ (u ∩ v))
⊢ s ⊆ u ∨ s ⊆ v

tactic: simpa [*, or_imp, forall_and] using h {u, v}
state_before: case refine_3
α : Type u
β : Type v
ι : Type ?u.76010
π : ι → Type ?u.76015
inst✝ : TopologicalSpace α
s✝ t u✝ v✝ s : Set α
h :
  ∀ (U : Finset (Set α)),
    (∀ (u v : Set α), u ∈ U → v ∈ U → Set.Nonempty (s ∩ (u ∩ v)) → u = v) →
      (∀ (u : Set α), u ∈ U → IsOpen u) → s ⊆ ⋃₀ ↑U → ∃ u, u ∈ U ∧ s ⊆ u
u v : Set α
hu : IsOpen u
hv : IsOpen v
hs : s ⊆ u ∪ v
hsuv : ¬Set.Nonempty (s ∩ (u ∩ v))
this : ¬Set.Nonempty (s ∩ (v ∩ u))
⊢ s ⊆ u ∨ s ⊆ v