l3lab/ntp-mathlib huggingface dataset:
lemma preconnected_iff_forall_exists_walk_subgraph (H : G.Subgraph) :
    H.Preconnected ↔ ∀ {u v}, u ∈ H.verts → v ∈ H.verts → ∃ p : G.Walk u v, p.toSubgraph ≤ H := by
  constructor
  · intro hc u v hu hv
    refine (hc ⟨_, hu⟩ ⟨_, hv⟩).elim fun p => ?_
    exists p.map (Subgraph.hom _)
    simp [coeSubgraph_le]
  · intro hw
    rw [Subgraph.preconnected_iff]
    rintro ⟨u, hu⟩ ⟨v, hv⟩
    obtain ⟨p, h⟩ := hw hu hv
    

Proof state:
case mpr.mk.mk.intro
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
hw : ∀ {u v : V}, u ∈ H.verts → v ∈ H.verts → ∃ p, Walk.toSubgraph p ≤ H
u : V
hu : u ∈ H.verts
v : V
hv : v ∈ H.verts
p : Walk G u v
h : Walk.toSubgraph p ≤ H
⊢ Reachable (Subgraph.coe H) { val := u, property := hu } { val := v, property := hv }

Next tactic:
exact Reachable.map (Subgraph.inclusion h)
      (p.toSubgraph_connected ⟨_, p.start_mem_verts_toSubgraph⟩ ⟨_, p.end_mem_verts_toSubgraph⟩)
lemma connected_iff_forall_exists_walk_subgraph (H : G.Subgraph) :
    H.Connected ↔
      H.verts.Nonempty ∧
        ∀ {u v}, u ∈ H.verts → v ∈ H.verts → ∃ p : G.Walk u v, p.toSubgraph ≤ H := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
⊢ Subgraph.Connected H ↔ Set.Nonempty H.verts ∧ ∀ {u v : V}, u ∈ H.verts → v ∈ H.verts → ∃ p, Walk.toSubgraph p ≤ H

Next tactic:
rw [H.connected_iff, preconnected_iff_forall_exists_walk_subgraph, and_comm]
lemma connected_induce_iff : (G.induce s).Connected ↔ ((⊤ : G.Subgraph).induce s).Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
s : Set V
⊢ Connected (induce s G) ↔ Subgraph.Connected (Subgraph.induce ⊤ s)

Next tactic:
rw [induce_eq_coe_induce_top, ← Subgraph.connected_iff']
lemma induce_union_connected {s t : Set V}
    (sconn : (G.induce s).Connected) (tconn : (G.induce t).Connected)
    (sintert : (s ∩ t).Nonempty) :
    (G.induce (s ∪ t)).Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
s t : Set V
sconn : Connected (induce s G)
tconn : Connected (induce t G)
sintert : Set.Nonempty (s ∩ t)
⊢ Connected (induce (s ∪ t) G)

Next tactic:
rw [connected_induce_iff] at sconn tconn ⊢
lemma induce_union_connected {s t : Set V}
    (sconn : (G.induce s).Connected) (tconn : (G.induce t).Connected)
    (sintert : (s ∩ t).Nonempty) :
    (G.induce (s ∪ t)).Connected := by
  rw [connected_induce_iff] at sconn tconn ⊢
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
s t : Set V
sconn : Subgraph.Connected (Subgraph.induce ⊤ s)
tconn : Subgraph.Connected (Subgraph.induce ⊤ t)
sintert : Set.Nonempty (s ∩ t)
⊢ Subgraph.Connected (Subgraph.induce ⊤ (s ∪ t))

Next tactic:
exact Subgraph.induce_union_connected sconn tconn sintert
lemma induce_pair_connected_of_adj {u v : V} (huv : G.Adj u v) :
    (G.induce {u, v}).Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
u v : V
huv : Adj G u v
⊢ Connected (induce {u, v} G)

Next tactic:
rw [connected_induce_iff]
lemma induce_pair_connected_of_adj {u v : V} (huv : G.Adj u v) :
    (G.induce {u, v}).Connected := by
  rw [connected_induce_iff]
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
u v : V
huv : Adj G u v
⊢ Subgraph.Connected (Subgraph.induce ⊤ {u, v})

Next tactic:
exact Subgraph.top_induce_pair_connected_of_adj huv
lemma Subgraph.Connected.induce_verts {H : G.Subgraph} (h : H.Connected) :
    (G.induce H.verts).Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
h : Subgraph.Connected H
⊢ Connected (SimpleGraph.induce H.verts G)

Next tactic:
rw [connected_induce_iff]
lemma Subgraph.Connected.induce_verts {H : G.Subgraph} (h : H.Connected) :
    (G.induce H.verts).Connected := by
  rw [connected_induce_iff]
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
h : Subgraph.Connected H
⊢ Subgraph.Connected (induce ⊤ H.verts)

Next tactic:
exact h.mono le_induce_top_verts (by exact rfl)
lemma Subgraph.Connected.induce_verts {H : G.Subgraph} (h : H.Connected) :
    (G.induce H.verts).Connected := by
  rw [connected_induce_iff]
  exact h.mono le_induce_top_verts (by 

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
h : Subgraph.Connected H
⊢ H.verts = (induce ⊤ H.verts).verts

Next tactic:
exact rfl
lemma Walk.connected_induce_support {u v : V} (p : G.Walk u v) :
    (G.induce {v | v ∈ p.support}).Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
u v : V
p : Walk G u v
⊢ Connected (induce {v_1 | v_1 ∈ support p} G)

Next tactic:
rw [← p.verts_toSubgraph]
lemma Walk.connected_induce_support {u v : V} (p : G.Walk u v) :
    (G.induce {v | v ∈ p.support}).Connected := by
  rw [← p.verts_toSubgraph]
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
u v : V
p : Walk G u v
⊢ Connected (induce (Walk.toSubgraph p).verts G)

Next tactic:
exact p.toSubgraph_connected.induce_verts
lemma induce_connected_adj_union {s t : Set V}
    (sconn : (G.induce s).Connected) (tconn : (G.induce t).Connected)
    (hv : v ∈ s) (hw : w ∈ t) (ha : G.Adj v w) :
    (G.induce (s ∪ t)).Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
v w : V
s t : Set V
sconn : Connected (induce s G)
tconn : Connected (induce t G)
hv : v ∈ s
hw : w ∈ t
ha : Adj G v w
⊢ Connected (induce (s ∪ t) G)

Next tactic:
rw [connected_induce_iff] at sconn tconn ⊢
lemma induce_connected_adj_union {s t : Set V}
    (sconn : (G.induce s).Connected) (tconn : (G.induce t).Connected)
    (hv : v ∈ s) (hw : w ∈ t) (ha : G.Adj v w) :
    (G.induce (s ∪ t)).Connected := by
  rw [connected_induce_iff] at sconn tconn ⊢
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
v w : V
s t : Set V
sconn : Subgraph.Connected (Subgraph.induce ⊤ s)
tconn : Subgraph.Connected (Subgraph.induce ⊤ t)
hv : v ∈ s
hw : w ∈ t
ha : Adj G v w
⊢ Subgraph.Connected (Subgraph.induce ⊤ (s ∪ t))

Next tactic:
apply (sconn.adj_union tconn hv hw ha).mono
lemma induce_connected_adj_union {s t : Set V}
    (sconn : (G.induce s).Connected) (tconn : (G.induce t).Connected)
    (hv : v ∈ s) (hw : w ∈ t) (ha : G.Adj v w) :
    (G.induce (s ∪ t)).Connected := by
  rw [connected_induce_iff] at sconn tconn ⊢
  apply (sconn.adj_union tconn hv hw ha).mono
  · 

Proof state:
case hle
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
v w : V
s t : Set V
sconn : Subgraph.Connected (Subgraph.induce ⊤ s)
tconn : Subgraph.Connected (Subgraph.induce ⊤ t)
hv : v ∈ s
hw : w ∈ t
ha : Adj G v w
⊢ Subgraph.induce ⊤ {v, w} ⊔ Subgraph.induce ⊤ s ⊔ Subgraph.induce ⊤ t ≤ Subgraph.induce ⊤ (s ∪ t)

Next tactic:
simp only [Set.mem_singleton_iff, sup_le_iff, Subgraph.le_induce_union_left,
      Subgraph.le_induce_union_right, and_true, ← Subgraph.subgraphOfAdj_eq_induce ha]
lemma induce_connected_adj_union {s t : Set V}
    (sconn : (G.induce s).Connected) (tconn : (G.induce t).Connected)
    (hv : v ∈ s) (hw : w ∈ t) (ha : G.Adj v w) :
    (G.induce (s ∪ t)).Connected := by
  rw [connected_induce_iff] at sconn tconn ⊢
  apply (sconn.adj_union tconn hv hw ha).mono
  · simp only [Set.mem_singleton_iff, sup_le_iff, Subgraph.le_induce_union_left,
      Subgraph.le_induce_union_right, and_true, ← Subgraph.subgraphOfAdj_eq_induce ha]
    

Proof state:
case hle
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
v w : V
s t : Set V
sconn : Subgraph.Connected (Subgraph.induce ⊤ s)
tconn : Subgraph.Connected (Subgraph.induce ⊤ t)
hv : v ∈ s
hw : w ∈ t
ha : Adj G v w
⊢ subgraphOfAdj G ha ≤ Subgraph.induce ⊤ (s ∪ t)

Next tactic:
apply subgraphOfAdj_le_of_adj
lemma induce_connected_adj_union {s t : Set V}
    (sconn : (G.induce s).Connected) (tconn : (G.induce t).Connected)
    (hv : v ∈ s) (hw : w ∈ t) (ha : G.Adj v w) :
    (G.induce (s ∪ t)).Connected := by
  rw [connected_induce_iff] at sconn tconn ⊢
  apply (sconn.adj_union tconn hv hw ha).mono
  · simp only [Set.mem_singleton_iff, sup_le_iff, Subgraph.le_induce_union_left,
      Subgraph.le_induce_union_right, and_true, ← Subgraph.subgraphOfAdj_eq_induce ha]
    apply subgraphOfAdj_le_of_adj
    

Proof state:
case hle.h
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
v w : V
s t : Set V
sconn : Subgraph.Connected (Subgraph.induce ⊤ s)
tconn : Subgraph.Connected (Subgraph.induce ⊤ t)
hv : v ∈ s
hw : w ∈ t
ha : Adj G v w
⊢ Subgraph.Adj (Subgraph.induce ⊤ (s ∪ t)) v w

Next tactic:
simp [hv, hw, ha]
lemma induce_connected_adj_union {s t : Set V}
    (sconn : (G.induce s).Connected) (tconn : (G.induce t).Connected)
    (hv : v ∈ s) (hw : w ∈ t) (ha : G.Adj v w) :
    (G.induce (s ∪ t)).Connected := by
  rw [connected_induce_iff] at sconn tconn ⊢
  apply (sconn.adj_union tconn hv hw ha).mono
  · simp only [Set.mem_singleton_iff, sup_le_iff, Subgraph.le_induce_union_left,
      Subgraph.le_induce_union_right, and_true, ← Subgraph.subgraphOfAdj_eq_induce ha]
    apply subgraphOfAdj_le_of_adj
    simp [hv, hw, ha]
  · 

Proof state:
case hv
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
v w : V
s t : Set V
sconn : Subgraph.Connected (Subgraph.induce ⊤ s)
tconn : Subgraph.Connected (Subgraph.induce ⊤ t)
hv : v ∈ s
hw : w ∈ t
ha : Adj G v w
⊢ (Subgraph.induce ⊤ {v, w} ⊔ Subgraph.induce ⊤ s ⊔ Subgraph.induce ⊤ t).verts = (Subgraph.induce ⊤ (s ∪ t)).verts

Next tactic:
simp only [Set.mem_singleton_iff, sup_le_iff, Subgraph.verts_sup, Subgraph.induce_verts]
lemma induce_connected_adj_union {s t : Set V}
    (sconn : (G.induce s).Connected) (tconn : (G.induce t).Connected)
    (hv : v ∈ s) (hw : w ∈ t) (ha : G.Adj v w) :
    (G.induce (s ∪ t)).Connected := by
  rw [connected_induce_iff] at sconn tconn ⊢
  apply (sconn.adj_union tconn hv hw ha).mono
  · simp only [Set.mem_singleton_iff, sup_le_iff, Subgraph.le_induce_union_left,
      Subgraph.le_induce_union_right, and_true, ← Subgraph.subgraphOfAdj_eq_induce ha]
    apply subgraphOfAdj_le_of_adj
    simp [hv, hw, ha]
  · simp only [Set.mem_singleton_iff, sup_le_iff, Subgraph.verts_sup, Subgraph.induce_verts]
    

Proof state:
case hv
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
v w : V
s t : Set V
sconn : Subgraph.Connected (Subgraph.induce ⊤ s)
tconn : Subgraph.Connected (Subgraph.induce ⊤ t)
hv : v ∈ s
hw : w ∈ t
ha : Adj G v w
⊢ {v, w} ∪ s ∪ t = s ∪ t

Next tactic:
rw [Set.union_assoc]
lemma induce_connected_adj_union {s t : Set V}
    (sconn : (G.induce s).Connected) (tconn : (G.induce t).Connected)
    (hv : v ∈ s) (hw : w ∈ t) (ha : G.Adj v w) :
    (G.induce (s ∪ t)).Connected := by
  rw [connected_induce_iff] at sconn tconn ⊢
  apply (sconn.adj_union tconn hv hw ha).mono
  · simp only [Set.mem_singleton_iff, sup_le_iff, Subgraph.le_induce_union_left,
      Subgraph.le_induce_union_right, and_true, ← Subgraph.subgraphOfAdj_eq_induce ha]
    apply subgraphOfAdj_le_of_adj
    simp [hv, hw, ha]
  · simp only [Set.mem_singleton_iff, sup_le_iff, Subgraph.verts_sup, Subgraph.induce_verts]
    rw [Set.union_assoc]
    

Proof state:
case hv
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
v w : V
s t : Set V
sconn : Subgraph.Connected (Subgraph.induce ⊤ s)
tconn : Subgraph.Connected (Subgraph.induce ⊤ t)
hv : v ∈ s
hw : w ∈ t
ha : Adj G v w
⊢ {v, w} ∪ (s ∪ t) = s ∪ t

Next tactic:
simp [Set.insert_subset_iff, Set.singleton_subset_iff, hv, hw]
lemma induce_connected_of_patches {s : Set V} (u : V) (hu : u ∈ s)
    (patches : ∀ {v} (_ : v ∈ s), ∃ (s' : Set V) (_ : s' ⊆ s) (hu' : u ∈ s') (hv' : v ∈ s'),
                  (G.induce s').Reachable ⟨u, hu'⟩ ⟨v, hv'⟩) : (G.induce s).Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
s : Set V
u : V
hu : u ∈ s
patches :
  ∀ {v : V},
    v ∈ s →
      ∃ s',
        ∃ (_ : s' ⊆ s) (hu' : u ∈ s') (hv' : v ∈ s'),
          Reachable (induce s' G) { val := u, property := hu' } { val := v, property := hv' }
⊢ Connected (induce s G)

Next tactic:
rw [connected_iff_exists_forall_reachable]
lemma induce_connected_of_patches {s : Set V} (u : V) (hu : u ∈ s)
    (patches : ∀ {v} (_ : v ∈ s), ∃ (s' : Set V) (_ : s' ⊆ s) (hu' : u ∈ s') (hv' : v ∈ s'),
                  (G.induce s').Reachable ⟨u, hu'⟩ ⟨v, hv'⟩) : (G.induce s).Connected := by
  rw [connected_iff_exists_forall_reachable]
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
s : Set V
u : V
hu : u ∈ s
patches :
  ∀ {v : V},
    v ∈ s →
      ∃ s',
        ∃ (_ : s' ⊆ s) (hu' : u ∈ s') (hv' : v ∈ s'),
          Reachable (induce s' G) { val := u, property := hu' } { val := v, property := hv' }
⊢ ∃ v, ∀ (w : ↑s), Reachable (induce s G) v w

Next tactic:
refine ⟨⟨u, hu⟩, ?_⟩
lemma induce_connected_of_patches {s : Set V} (u : V) (hu : u ∈ s)
    (patches : ∀ {v} (_ : v ∈ s), ∃ (s' : Set V) (_ : s' ⊆ s) (hu' : u ∈ s') (hv' : v ∈ s'),
                  (G.induce s').Reachable ⟨u, hu'⟩ ⟨v, hv'⟩) : (G.induce s).Connected := by
  rw [connected_iff_exists_forall_reachable]
  refine ⟨⟨u, hu⟩, ?_⟩
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
s : Set V
u : V
hu : u ∈ s
patches :
  ∀ {v : V},
    v ∈ s →
      ∃ s',
        ∃ (_ : s' ⊆ s) (hu' : u ∈ s') (hv' : v ∈ s'),
          Reachable (induce s' G) { val := u, property := hu' } { val := v, property := hv' }
⊢ ∀ (w : ↑s), Reachable (induce s G) { val := u, property := hu } w

Next tactic:
rintro ⟨v, hv⟩
lemma induce_connected_of_patches {s : Set V} (u : V) (hu : u ∈ s)
    (patches : ∀ {v} (_ : v ∈ s), ∃ (s' : Set V) (_ : s' ⊆ s) (hu' : u ∈ s') (hv' : v ∈ s'),
                  (G.induce s').Reachable ⟨u, hu'⟩ ⟨v, hv'⟩) : (G.induce s).Connected := by
  rw [connected_iff_exists_forall_reachable]
  refine ⟨⟨u, hu⟩, ?_⟩
  rintro ⟨v, hv⟩
  

Proof state:
case mk
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
s : Set V
u : V
hu : u ∈ s
patches :
  ∀ {v : V},
    v ∈ s →
      ∃ s',
        ∃ (_ : s' ⊆ s) (hu' : u ∈ s') (hv' : v ∈ s'),
          Reachable (induce s' G) { val := u, property := hu' } { val := v, property := hv' }
v : V
hv : v ∈ s
⊢ Reachable (induce s G) { val := u, property := hu } { val := v, property := hv }

Next tactic:
obtain ⟨sv, svs, hu', hv', uv⟩ := patches hv
lemma induce_connected_of_patches {s : Set V} (u : V) (hu : u ∈ s)
    (patches : ∀ {v} (_ : v ∈ s), ∃ (s' : Set V) (_ : s' ⊆ s) (hu' : u ∈ s') (hv' : v ∈ s'),
                  (G.induce s').Reachable ⟨u, hu'⟩ ⟨v, hv'⟩) : (G.induce s).Connected := by
  rw [connected_iff_exists_forall_reachable]
  refine ⟨⟨u, hu⟩, ?_⟩
  rintro ⟨v, hv⟩
  obtain ⟨sv, svs, hu', hv', uv⟩ := patches hv
  

Proof state:
case mk.intro.intro.intro.intro
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
s : Set V
u : V
hu : u ∈ s
patches :
  ∀ {v : V},
    v ∈ s →
      ∃ s',
        ∃ (_ : s' ⊆ s) (hu' : u ∈ s') (hv' : v ∈ s'),
          Reachable (induce s' G) { val := u, property := hu' } { val := v, property := hv' }
v : V
hv : v ∈ s
sv : Set V
svs : sv ⊆ s
hu' : u ∈ sv
hv' : v ∈ sv
uv : Reachable (induce sv G) { val := u, property := hu' } { val := v, property := hv' }
⊢ Reachable (induce s G) { val := u, property := hu } { val := v, property := hv }

Next tactic:
exact uv.map (induceHomOfLE _ svs).toHom
lemma induce_sUnion_connected_of_pairwise_not_disjoint {S : Set (Set V)} (Sn : S.Nonempty)
    (Snd : ∀ {s t}, s ∈ S → t ∈ S → (s ∩ t).Nonempty)
    (Sc : ∀ {s}, s ∈ S → (G.induce s).Connected) :
    (G.induce (⋃₀ S)).Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
S : Set (Set V)
Sn : Set.Nonempty S
Snd : ∀ {s t : Set V}, s ∈ S → t ∈ S → Set.Nonempty (s ∩ t)
Sc : ∀ {s : Set V}, s ∈ S → Connected (induce s G)
⊢ Connected (induce (⋃₀ S) G)

Next tactic:
obtain ⟨s, sS⟩ := Sn
lemma induce_sUnion_connected_of_pairwise_not_disjoint {S : Set (Set V)} (Sn : S.Nonempty)
    (Snd : ∀ {s t}, s ∈ S → t ∈ S → (s ∩ t).Nonempty)
    (Sc : ∀ {s}, s ∈ S → (G.induce s).Connected) :
    (G.induce (⋃₀ S)).Connected := by
  obtain ⟨s, sS⟩ := Sn
  

Proof state:
case intro
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
S : Set (Set V)
Snd : ∀ {s t : Set V}, s ∈ S → t ∈ S → Set.Nonempty (s ∩ t)
Sc : ∀ {s : Set V}, s ∈ S → Connected (induce s G)
s : Set V
sS : s ∈ S
⊢ Connected (induce (⋃₀ S) G)

Next tactic:
obtain ⟨v, vs⟩ := (Sc sS).nonempty
lemma induce_sUnion_connected_of_pairwise_not_disjoint {S : Set (Set V)} (Sn : S.Nonempty)
    (Snd : ∀ {s t}, s ∈ S → t ∈ S → (s ∩ t).Nonempty)
    (Sc : ∀ {s}, s ∈ S → (G.induce s).Connected) :
    (G.induce (⋃₀ S)).Connected := by
  obtain ⟨s, sS⟩ := Sn
  obtain ⟨v, vs⟩ := (Sc sS).nonempty
  

Proof state:
case intro.intro.mk
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
S : Set (Set V)
Snd : ∀ {s t : Set V}, s ∈ S → t ∈ S → Set.Nonempty (s ∩ t)
Sc : ∀ {s : Set V}, s ∈ S → Connected (induce s G)
s : Set V
sS : s ∈ S
v : V
vs : v ∈ s
⊢ Connected (induce (⋃₀ S) G)

Next tactic:
apply G.induce_connected_of_patches _ (Set.subset_sUnion_of_mem sS vs)
lemma induce_sUnion_connected_of_pairwise_not_disjoint {S : Set (Set V)} (Sn : S.Nonempty)
    (Snd : ∀ {s t}, s ∈ S → t ∈ S → (s ∩ t).Nonempty)
    (Sc : ∀ {s}, s ∈ S → (G.induce s).Connected) :
    (G.induce (⋃₀ S)).Connected := by
  obtain ⟨s, sS⟩ := Sn
  obtain ⟨v, vs⟩ := (Sc sS).nonempty
  apply G.induce_connected_of_patches _ (Set.subset_sUnion_of_mem sS vs)
  

Proof state:
case intro.intro.mk
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
S : Set (Set V)
Snd : ∀ {s t : Set V}, s ∈ S → t ∈ S → Set.Nonempty (s ∩ t)
Sc : ∀ {s : Set V}, s ∈ S → Connected (induce s G)
s : Set V
sS : s ∈ S
v : V
vs : v ∈ s
⊢ ∀ {v_1 : V},
    v_1 ∈ ⋃₀ S →
      ∃ s',
        ∃ (_ : s' ⊆ ⋃₀ S) (hu' : v ∈ s') (hv' : v_1 ∈ s'),
          Reachable (induce s' G) { val := v, property := hu' } { val := v_1, property := hv' }

Next tactic:
rintro w hw
lemma induce_sUnion_connected_of_pairwise_not_disjoint {S : Set (Set V)} (Sn : S.Nonempty)
    (Snd : ∀ {s t}, s ∈ S → t ∈ S → (s ∩ t).Nonempty)
    (Sc : ∀ {s}, s ∈ S → (G.induce s).Connected) :
    (G.induce (⋃₀ S)).Connected := by
  obtain ⟨s, sS⟩ := Sn
  obtain ⟨v, vs⟩ := (Sc sS).nonempty
  apply G.induce_connected_of_patches _ (Set.subset_sUnion_of_mem sS vs)
  rintro w hw
  

Proof state:
case intro.intro.mk
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
S : Set (Set V)
Snd : ∀ {s t : Set V}, s ∈ S → t ∈ S → Set.Nonempty (s ∩ t)
Sc : ∀ {s : Set V}, s ∈ S → Connected (induce s G)
s : Set V
sS : s ∈ S
v : V
vs : v ∈ s
w : V
hw : w ∈ ⋃₀ S
⊢ ∃ s',
    ∃ (_ : s' ⊆ ⋃₀ S) (hu' : v ∈ s') (hv' : w ∈ s'),
      Reachable (induce s' G) { val := v, property := hu' } { val := w, property := hv' }

Next tactic:
simp only [Set.mem_sUnion, exists_prop] at hw
lemma induce_sUnion_connected_of_pairwise_not_disjoint {S : Set (Set V)} (Sn : S.Nonempty)
    (Snd : ∀ {s t}, s ∈ S → t ∈ S → (s ∩ t).Nonempty)
    (Sc : ∀ {s}, s ∈ S → (G.induce s).Connected) :
    (G.induce (⋃₀ S)).Connected := by
  obtain ⟨s, sS⟩ := Sn
  obtain ⟨v, vs⟩ := (Sc sS).nonempty
  apply G.induce_connected_of_patches _ (Set.subset_sUnion_of_mem sS vs)
  rintro w hw
  simp only [Set.mem_sUnion, exists_prop] at hw
  

Proof state:
case intro.intro.mk
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
S : Set (Set V)
Snd : ∀ {s t : Set V}, s ∈ S → t ∈ S → Set.Nonempty (s ∩ t)
Sc : ∀ {s : Set V}, s ∈ S → Connected (induce s G)
s : Set V
sS : s ∈ S
v : V
vs : v ∈ s
w : V
hw : ∃ t ∈ S, w ∈ t
⊢ ∃ s',
    ∃ (_ : s' ⊆ ⋃₀ S) (hu' : v ∈ s') (hv' : w ∈ s'),
      Reachable (induce s' G) { val := v, property := hu' } { val := w, property := hv' }

Next tactic:
obtain ⟨t, tS, wt⟩ := hw
lemma induce_sUnion_connected_of_pairwise_not_disjoint {S : Set (Set V)} (Sn : S.Nonempty)
    (Snd : ∀ {s t}, s ∈ S → t ∈ S → (s ∩ t).Nonempty)
    (Sc : ∀ {s}, s ∈ S → (G.induce s).Connected) :
    (G.induce (⋃₀ S)).Connected := by
  obtain ⟨s, sS⟩ := Sn
  obtain ⟨v, vs⟩ := (Sc sS).nonempty
  apply G.induce_connected_of_patches _ (Set.subset_sUnion_of_mem sS vs)
  rintro w hw
  simp only [Set.mem_sUnion, exists_prop] at hw
  obtain ⟨t, tS, wt⟩ := hw
  

Proof state:
case intro.intro.mk.intro.intro
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
S : Set (Set V)
Snd : ∀ {s t : Set V}, s ∈ S → t ∈ S → Set.Nonempty (s ∩ t)
Sc : ∀ {s : Set V}, s ∈ S → Connected (induce s G)
s : Set V
sS : s ∈ S
v : V
vs : v ∈ s
w : V
t : Set V
tS : t ∈ S
wt : w ∈ t
⊢ ∃ s',
    ∃ (_ : s' ⊆ ⋃₀ S) (hu' : v ∈ s') (hv' : w ∈ s'),
      Reachable (induce s' G) { val := v, property := hu' } { val := w, property := hv' }

Next tactic:
refine ⟨s ∪ t, Set.union_subset (Set.subset_sUnion_of_mem sS) (Set.subset_sUnion_of_mem tS),
          Or.inl vs, Or.inr wt, induce_union_connected (Sc sS) (Sc tS) (Snd sS tS) _ _⟩
lemma extend_finset_to_connected (Gpc : G.Preconnected) {t : Finset V} (tn : t.Nonempty) :
    ∃ (t' : Finset V), t ⊆ t' ∧ (G.induce (t' : Set V)).Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
Gpc : Preconnected G
t : Finset V
tn : Finset.Nonempty t
⊢ ∃ t', t ⊆ t' ∧ Connected (induce (↑t') G)

Next tactic:
classical
  obtain ⟨u, ut⟩ := tn
  refine ⟨t.biUnion (fun v => (Gpc u v).some.support.toFinset), fun v vt => ?_, ?_⟩
  · simp only [Finset.mem_biUnion, List.mem_toFinset, exists_prop]
    refine ⟨v, vt, Walk.end_mem_support _⟩
  · apply G.induce_connected_of_patches u
    · simp only [Finset.coe_biUnion, Finset.mem_coe, List.coe_toFinset, Set.mem_iUnion,
                 Set.mem_setOf_eq, Walk.start_mem_support, exists_prop, and_true]
      exact ⟨u, ut⟩
    intros v hv
    simp only [Finset.mem_coe, Finset.mem_biUnion, List.mem_toFinset, exists_prop] at hv
    obtain ⟨w, wt, hw⟩ := hv
    refine ⟨{x | x ∈ (Gpc u w).some.support}, ?_, ?_⟩
    · simp only [Finset.coe_biUnion, Finset.mem_coe, List.coe_toFinset]
      exact fun x xw => Set.mem_iUnion₂.mpr ⟨w,wt,xw⟩
    · simp only [Set.mem_setOf_eq, Walk.start_mem_support, exists_true_left]
      refine ⟨hw, Walk.connected_induce_support _ _ _⟩
lemma extend_finset_to_connected (Gpc : G.Preconnected) {t : Finset V} (tn : t.Nonempty) :
    ∃ (t' : Finset V), t ⊆ t' ∧ (G.induce (t' : Set V)).Connected := by
  classical
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
Gpc : Preconnected G
t : Finset V
tn : Finset.Nonempty t
⊢ ∃ t', t ⊆ t' ∧ Connected (induce (↑t') G)

Next tactic:
obtain ⟨u, ut⟩ := tn
lemma extend_finset_to_connected (Gpc : G.Preconnected) {t : Finset V} (tn : t.Nonempty) :
    ∃ (t' : Finset V), t ⊆ t' ∧ (G.induce (t' : Set V)).Connected := by
  classical
  obtain ⟨u, ut⟩ := tn
  

Proof state:
case intro
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
Gpc : Preconnected G
t : Finset V
u : V
ut : u ∈ t
⊢ ∃ t', t ⊆ t' ∧ Connected (induce (↑t') G)

Next tactic:
refine ⟨t.biUnion (fun v => (Gpc u v).some.support.toFinset), fun v vt => ?_, ?_⟩
lemma extend_finset_to_connected (Gpc : G.Preconnected) {t : Finset V} (tn : t.Nonempty) :
    ∃ (t' : Finset V), t ⊆ t' ∧ (G.induce (t' : Set V)).Connected := by
  classical
  obtain ⟨u, ut⟩ := tn
  refine ⟨t.biUnion (fun v => (Gpc u v).some.support.toFinset), fun v vt => ?_, ?_⟩
  · 

Proof state:
case intro.refine_1
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
Gpc : Preconnected G
t : Finset V
u : V
ut : u ∈ t
v : V
vt : v ∈ t
⊢ v ∈ Finset.biUnion t fun v => List.toFinset (Walk.support (Nonempty.some (_ : Reachable G u v)))

Next tactic:
simp only [Finset.mem_biUnion, List.mem_toFinset, exists_prop]
lemma extend_finset_to_connected (Gpc : G.Preconnected) {t : Finset V} (tn : t.Nonempty) :
    ∃ (t' : Finset V), t ⊆ t' ∧ (G.induce (t' : Set V)).Connected := by
  classical
  obtain ⟨u, ut⟩ := tn
  refine ⟨t.biUnion (fun v => (Gpc u v).some.support.toFinset), fun v vt => ?_, ?_⟩
  · simp only [Finset.mem_biUnion, List.mem_toFinset, exists_prop]
    

Proof state:
case intro.refine_1
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
Gpc : Preconnected G
t : Finset V
u : V
ut : u ∈ t
v : V
vt : v ∈ t
⊢ ∃ a ∈ t, v ∈ Walk.support (Nonempty.some (_ : Reachable G u a))

Next tactic:
refine ⟨v, vt, Walk.end_mem_support _⟩