l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem subgraphOfAdj_connected {v w : V} (hvw : G.Adj v w) : (G.subgraphOfAdj hvw).Connected := by
  refine ⟨⟨?_⟩⟩
  rintro ⟨a, ha⟩ ⟨b, hb⟩
  simp only [subgraphOfAdj_verts, Set.mem_insert_iff, Set.mem_singleton_iff] at ha hb
  obtain rfl | rfl := ha <;> obtain rfl | rfl := hb <;>
    first | rfl | (apply Adj.reachable; 

Proof state:
case mk.mk.inl.inr.h
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
a b : V
hvw : SimpleGraph.Adj G a b
ha : a ∈ (subgraphOfAdj G hvw).verts
hb : b ∈ (subgraphOfAdj G hvw).verts
⊢ SimpleGraph.Adj (Subgraph.coe (subgraphOfAdj G hvw)) { val := a, property := ha } { val := b, property := hb }

Next tactic:
simp
@[simp]
theorem subgraphOfAdj_connected {v w : V} (hvw : G.Adj v w) : (G.subgraphOfAdj hvw).Connected := by
  refine ⟨⟨?_⟩⟩
  rintro ⟨a, ha⟩ ⟨b, hb⟩
  simp only [subgraphOfAdj_verts, Set.mem_insert_iff, Set.mem_singleton_iff] at ha hb
  obtain rfl | rfl := ha <;> obtain rfl | rfl := hb <;>
    

Proof state:
case mk.mk.inr.inl
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
a b : V
hvw : SimpleGraph.Adj G b a
ha : a ∈ (subgraphOfAdj G hvw).verts
hb : b ∈ (subgraphOfAdj G hvw).verts
⊢ Reachable (Subgraph.coe (subgraphOfAdj G hvw)) { val := a, property := ha } { val := b, property := hb }

Next tactic:
first | rfl | (apply Adj.reachable; simp)
@[simp]
theorem subgraphOfAdj_connected {v w : V} (hvw : G.Adj v w) : (G.subgraphOfAdj hvw).Connected := by
  refine ⟨⟨?_⟩⟩
  rintro ⟨a, ha⟩ ⟨b, hb⟩
  simp only [subgraphOfAdj_verts, Set.mem_insert_iff, Set.mem_singleton_iff] at ha hb
  obtain rfl | rfl := ha <;> obtain rfl | rfl := hb <;>
    first | 

Proof state:
case mk.mk.inr.inl
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
a b : V
hvw : SimpleGraph.Adj G b a
ha : a ∈ (subgraphOfAdj G hvw).verts
hb : b ∈ (subgraphOfAdj G hvw).verts
⊢ Reachable (Subgraph.coe (subgraphOfAdj G hvw)) { val := a, property := ha } { val := b, property := hb }

Next tactic:
rfl
@[simp]
theorem subgraphOfAdj_connected {v w : V} (hvw : G.Adj v w) : (G.subgraphOfAdj hvw).Connected := by
  refine ⟨⟨?_⟩⟩
  rintro ⟨a, ha⟩ ⟨b, hb⟩
  simp only [subgraphOfAdj_verts, Set.mem_insert_iff, Set.mem_singleton_iff] at ha hb
  obtain rfl | rfl := ha <;> obtain rfl | rfl := hb <;>
    first | rfl | (

Proof state:
case mk.mk.inr.inl
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
a b : V
hvw : SimpleGraph.Adj G b a
ha : a ∈ (subgraphOfAdj G hvw).verts
hb : b ∈ (subgraphOfAdj G hvw).verts
⊢ Reachable (Subgraph.coe (subgraphOfAdj G hvw)) { val := a, property := ha } { val := b, property := hb }

Next tactic:
apply Adj.reachable
@[simp]
theorem subgraphOfAdj_connected {v w : V} (hvw : G.Adj v w) : (G.subgraphOfAdj hvw).Connected := by
  refine ⟨⟨?_⟩⟩
  rintro ⟨a, ha⟩ ⟨b, hb⟩
  simp only [subgraphOfAdj_verts, Set.mem_insert_iff, Set.mem_singleton_iff] at ha hb
  obtain rfl | rfl := ha <;> obtain rfl | rfl := hb <;>
    first | rfl | (apply Adj.reachable; 

Proof state:
case mk.mk.inr.inl.h
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
a b : V
hvw : SimpleGraph.Adj G b a
ha : a ∈ (subgraphOfAdj G hvw).verts
hb : b ∈ (subgraphOfAdj G hvw).verts
⊢ SimpleGraph.Adj (Subgraph.coe (subgraphOfAdj G hvw)) { val := a, property := ha } { val := b, property := hb }

Next tactic:
simp
@[simp]
theorem subgraphOfAdj_connected {v w : V} (hvw : G.Adj v w) : (G.subgraphOfAdj hvw).Connected := by
  refine ⟨⟨?_⟩⟩
  rintro ⟨a, ha⟩ ⟨b, hb⟩
  simp only [subgraphOfAdj_verts, Set.mem_insert_iff, Set.mem_singleton_iff] at ha hb
  obtain rfl | rfl := ha <;> obtain rfl | rfl := hb <;>
    

Proof state:
case mk.mk.inr.inr
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
v b : V
hvw : SimpleGraph.Adj G v b
ha hb : b ∈ (subgraphOfAdj G hvw).verts
⊢ Reachable (Subgraph.coe (subgraphOfAdj G hvw)) { val := b, property := ha } { val := b, property := hb }

Next tactic:
first | rfl | (apply Adj.reachable; simp)
@[simp]
theorem subgraphOfAdj_connected {v w : V} (hvw : G.Adj v w) : (G.subgraphOfAdj hvw).Connected := by
  refine ⟨⟨?_⟩⟩
  rintro ⟨a, ha⟩ ⟨b, hb⟩
  simp only [subgraphOfAdj_verts, Set.mem_insert_iff, Set.mem_singleton_iff] at ha hb
  obtain rfl | rfl := ha <;> obtain rfl | rfl := hb <;>
    first | 

Proof state:
case mk.mk.inr.inr
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
v b : V
hvw : SimpleGraph.Adj G v b
ha hb : b ∈ (subgraphOfAdj G hvw).verts
⊢ Reachable (Subgraph.coe (subgraphOfAdj G hvw)) { val := b, property := ha } { val := b, property := hb }

Next tactic:
rfl
lemma top_induce_pair_connected_of_adj {u v : V} (huv : G.Adj u v) :
    ((⊤ : G.Subgraph).induce {u, v}).Connected := by
  

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

Next tactic:
rw [← subgraphOfAdj_eq_induce huv]
lemma top_induce_pair_connected_of_adj {u v : V} (huv : G.Adj u v) :
    ((⊤ : G.Subgraph).induce {u, v}).Connected := by
  rw [← subgraphOfAdj_eq_induce huv]
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
u v : V
huv : SimpleGraph.Adj G u v
⊢ Subgraph.Connected (subgraphOfAdj G huv)

Next tactic:
exact subgraphOfAdj_connected huv
@[mono]
protected lemma Connected.mono {H H' : G.Subgraph} (hle : H ≤ H') (hv : H.verts = H'.verts)
    (h : H.Connected) : H'.Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H H' : Subgraph G
hle : H ≤ H'
hv : H.verts = H'.verts
h : Subgraph.Connected H
⊢ Subgraph.Connected H'

Next tactic:
rw [← Subgraph.copy_eq H' H.verts hv H'.Adj rfl]
@[mono]
protected lemma Connected.mono {H H' : G.Subgraph} (hle : H ≤ H') (hv : H.verts = H'.verts)
    (h : H.Connected) : H'.Connected := by
  rw [← Subgraph.copy_eq H' H.verts hv H'.Adj rfl]
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H H' : Subgraph G
hle : H ≤ H'
hv : H.verts = H'.verts
h : Subgraph.Connected H
⊢ Subgraph.Connected (copy H' H.verts hv H'.Adj (_ : H'.Adj = H'.Adj))

Next tactic:
refine ⟨h.coe.mono ?_⟩
@[mono]
protected lemma Connected.mono {H H' : G.Subgraph} (hle : H ≤ H') (hv : H.verts = H'.verts)
    (h : H.Connected) : H'.Connected := by
  rw [← Subgraph.copy_eq H' H.verts hv H'.Adj rfl]
  refine ⟨h.coe.mono ?_⟩
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H H' : Subgraph G
hle : H ≤ H'
hv : H.verts = H'.verts
h : Subgraph.Connected H
⊢ Subgraph.coe H ≤ Subgraph.coe (copy H' H.verts hv H'.Adj (_ : H'.Adj = H'.Adj))

Next tactic:
rintro ⟨v, hv⟩ ⟨w, hw⟩ hvw
@[mono]
protected lemma Connected.mono {H H' : G.Subgraph} (hle : H ≤ H') (hv : H.verts = H'.verts)
    (h : H.Connected) : H'.Connected := by
  rw [← Subgraph.copy_eq H' H.verts hv H'.Adj rfl]
  refine ⟨h.coe.mono ?_⟩
  rintro ⟨v, hv⟩ ⟨w, hw⟩ hvw
  

Proof state:
case mk.mk
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H H' : Subgraph G
hle : H ≤ H'
hv✝ : H.verts = H'.verts
h : Subgraph.Connected H
v : V
hv : v ∈ H.verts
w : V
hw : w ∈ H.verts
hvw : SimpleGraph.Adj (Subgraph.coe H) { val := v, property := hv } { val := w, property := hw }
⊢ SimpleGraph.Adj (Subgraph.coe (copy H' H.verts hv✝ H'.Adj (_ : H'.Adj = H'.Adj))) { val := v, property := hv }
    { val := w, property := hw }

Next tactic:
exact hle.2 hvw
protected lemma Connected.mono' {H H' : G.Subgraph}
    (hle : ∀ v w, H.Adj v w → H'.Adj v w) (hv : H.verts = H'.verts)
    (h : H.Connected) : H'.Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H H' : Subgraph G
hle : ∀ (v w : V), Adj H v w → Adj H' v w
hv : H.verts = H'.verts
h : Subgraph.Connected H
⊢ Subgraph.Connected H'

Next tactic:
exact h.mono ⟨hv.le, hle⟩ hv
protected lemma Connected.sup {H K : G.Subgraph}
    (hH : H.Connected) (hK : K.Connected) (hn : (H ⊓ K).verts.Nonempty) :
    (H ⊔ K).Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H K : Subgraph G
hH : Subgraph.Connected H
hK : Subgraph.Connected K
hn : Set.Nonempty (H ⊓ K).verts
⊢ Subgraph.Connected (H ⊔ K)

Next tactic:
rw [Subgraph.connected_iff', connected_iff_exists_forall_reachable]
protected lemma Connected.sup {H K : G.Subgraph}
    (hH : H.Connected) (hK : K.Connected) (hn : (H ⊓ K).verts.Nonempty) :
    (H ⊔ K).Connected := by
  rw [Subgraph.connected_iff', connected_iff_exists_forall_reachable]
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H K : Subgraph G
hH : Subgraph.Connected H
hK : Subgraph.Connected K
hn : Set.Nonempty (H ⊓ K).verts
⊢ ∃ v, ∀ (w : ↑(H ⊔ K).verts), Reachable (Subgraph.coe (H ⊔ K)) v w

Next tactic:
obtain ⟨u, hu, hu'⟩ := hn
protected lemma Connected.sup {H K : G.Subgraph}
    (hH : H.Connected) (hK : K.Connected) (hn : (H ⊓ K).verts.Nonempty) :
    (H ⊔ K).Connected := by
  rw [Subgraph.connected_iff', connected_iff_exists_forall_reachable]
  obtain ⟨u, hu, hu'⟩ := hn
  

Proof state:
case intro.intro
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H K : Subgraph G
hH : Subgraph.Connected H
hK : Subgraph.Connected K
u : V
hu : u ∈ H.verts
hu' : u ∈ K.verts
⊢ ∃ v, ∀ (w : ↑(H ⊔ K).verts), Reachable (Subgraph.coe (H ⊔ K)) v w

Next tactic:
exists ⟨u, Or.inl hu⟩
protected lemma Connected.sup {H K : G.Subgraph}
    (hH : H.Connected) (hK : K.Connected) (hn : (H ⊓ K).verts.Nonempty) :
    (H ⊔ K).Connected := by
  rw [Subgraph.connected_iff', connected_iff_exists_forall_reachable]
  obtain ⟨u, hu, hu'⟩ := hn
  exists ⟨u, Or.inl hu⟩
  

Proof state:
case intro.intro
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H K : Subgraph G
hH : Subgraph.Connected H
hK : Subgraph.Connected K
u : V
hu : u ∈ H.verts
hu' : u ∈ K.verts
⊢ ∀ (w : ↑(H ⊔ K).verts), Reachable (Subgraph.coe (H ⊔ K)) { val := u, property := (_ : u ∈ H.verts ∨ u ∈ K.verts) } w

Next tactic:
rintro ⟨v, (hv|hv)⟩
protected lemma Connected.sup {H K : G.Subgraph}
    (hH : H.Connected) (hK : K.Connected) (hn : (H ⊓ K).verts.Nonempty) :
    (H ⊔ K).Connected := by
  rw [Subgraph.connected_iff', connected_iff_exists_forall_reachable]
  obtain ⟨u, hu, hu'⟩ := hn
  exists ⟨u, Or.inl hu⟩
  rintro ⟨v, (hv|hv)⟩
  · 

Proof state:
case intro.intro.mk.inl
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H K : Subgraph G
hH : Subgraph.Connected H
hK : Subgraph.Connected K
u : V
hu : u ∈ H.verts
hu' : u ∈ K.verts
v : V
hv : v ∈ H.verts
⊢ Reachable (Subgraph.coe (H ⊔ K)) { val := u, property := (_ : u ∈ H.verts ∨ u ∈ K.verts) }
    { val := v, property := (_ : v ∈ H.verts ∨ v ∈ K.verts) }

Next tactic:
exact Reachable.map (Subgraph.inclusion (le_sup_left : H ≤ H ⊔ K)) (hH ⟨u, hu⟩ ⟨v, hv⟩)
protected lemma Connected.sup {H K : G.Subgraph}
    (hH : H.Connected) (hK : K.Connected) (hn : (H ⊓ K).verts.Nonempty) :
    (H ⊔ K).Connected := by
  rw [Subgraph.connected_iff', connected_iff_exists_forall_reachable]
  obtain ⟨u, hu, hu'⟩ := hn
  exists ⟨u, Or.inl hu⟩
  rintro ⟨v, (hv|hv)⟩
  · exact Reachable.map (Subgraph.inclusion (le_sup_left : H ≤ H ⊔ K)) (hH ⟨u, hu⟩ ⟨v, hv⟩)
  · 

Proof state:
case intro.intro.mk.inr
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H K : Subgraph G
hH : Subgraph.Connected H
hK : Subgraph.Connected K
u : V
hu : u ∈ H.verts
hu' : u ∈ K.verts
v : V
hv : v ∈ K.verts
⊢ Reachable (Subgraph.coe (H ⊔ K)) { val := u, property := (_ : u ∈ H.verts ∨ u ∈ K.verts) }
    { val := v, property := (_ : v ∈ H.verts ∨ v ∈ K.verts) }

Next tactic:
exact Reachable.map (Subgraph.inclusion (le_sup_right : K ≤ H ⊔ K)) (hK ⟨u, hu'⟩ ⟨v, hv⟩)
lemma _root_.SimpleGraph.Walk.toSubgraph_connected {u v : V} (p : G.Walk u v) :
    p.toSubgraph.Connected := by
  

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

Next tactic:
induction p with
  | nil => apply singletonSubgraph_connected
  | @cons _ w _ h p ih =>
    apply (subgraphOfAdj_connected h).sup ih
    exists w
    simp
lemma _root_.SimpleGraph.Walk.toSubgraph_connected {u v : V} (p : G.Walk u v) :
    p.toSubgraph.Connected := by
  induction p with
  

Proof state:
case nil
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
u v u✝ : V
⊢ Subgraph.Connected (Walk.toSubgraph Walk.nil)

Next tactic:
| nil => apply singletonSubgraph_connected
lemma _root_.SimpleGraph.Walk.toSubgraph_connected {u v : V} (p : G.Walk u v) :
    p.toSubgraph.Connected := by
  induction p with
  | nil => 

Proof state:
case nil
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
u v u✝ : V
⊢ Subgraph.Connected (Walk.toSubgraph Walk.nil)

Next tactic:
apply singletonSubgraph_connected
lemma _root_.SimpleGraph.Walk.toSubgraph_connected {u v : V} (p : G.Walk u v) :
    p.toSubgraph.Connected := by
  induction p with
  | nil => apply singletonSubgraph_connected
  

Proof state:
case cons
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
u v u✝ w w✝ : V
h : SimpleGraph.Adj G u✝ w
p : Walk G w w✝
ih : Subgraph.Connected (Walk.toSubgraph p)
⊢ Subgraph.Connected (Walk.toSubgraph (Walk.cons h p))

Next tactic:
| @cons _ w _ h p ih =>
    apply (subgraphOfAdj_connected h).sup ih
    exists w
    simp
lemma _root_.SimpleGraph.Walk.toSubgraph_connected {u v : V} (p : G.Walk u v) :
    p.toSubgraph.Connected := by
  induction p with
  | nil => apply singletonSubgraph_connected
  | @cons _ w _ h p ih =>
    

Proof state:
case cons
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
u v u✝ w w✝ : V
h : SimpleGraph.Adj G u✝ w
p : Walk G w w✝
ih : Subgraph.Connected (Walk.toSubgraph p)
⊢ Subgraph.Connected (Walk.toSubgraph (Walk.cons h p))

Next tactic:
apply (subgraphOfAdj_connected h).sup ih
lemma _root_.SimpleGraph.Walk.toSubgraph_connected {u v : V} (p : G.Walk u v) :
    p.toSubgraph.Connected := by
  induction p with
  | nil => apply singletonSubgraph_connected
  | @cons _ w _ h p ih =>
    apply (subgraphOfAdj_connected h).sup ih
    

Proof state:
case cons
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
u v u✝ w w✝ : V
h : SimpleGraph.Adj G u✝ w
p : Walk G w w✝
ih : Subgraph.Connected (Walk.toSubgraph p)
⊢ Set.Nonempty (subgraphOfAdj G h ⊓ Walk.toSubgraph p).verts

Next tactic:
exists w
lemma _root_.SimpleGraph.Walk.toSubgraph_connected {u v : V} (p : G.Walk u v) :
    p.toSubgraph.Connected := by
  induction p with
  | nil => apply singletonSubgraph_connected
  | @cons _ w _ h p ih =>
    apply (subgraphOfAdj_connected h).sup ih
    exists w
    

Proof state:
case cons
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
u v u✝ w w✝ : V
h : SimpleGraph.Adj G u✝ w
p : Walk G w w✝
ih : Subgraph.Connected (Walk.toSubgraph p)
⊢ w ∈ (subgraphOfAdj G h ⊓ Walk.toSubgraph p).verts

Next tactic:
simp
lemma induce_union_connected {H : G.Subgraph} {s t : Set V}
    (sconn : (H.induce s).Connected) (tconn : (H.induce t).Connected)
    (sintert : (s ⊓ t).Nonempty) :
    (H.induce (s ∪ t)).Connected := by
  

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

Next tactic:
refine (sconn.sup tconn sintert).mono ?_ ?_
lemma induce_union_connected {H : G.Subgraph} {s t : Set V}
    (sconn : (H.induce s).Connected) (tconn : (H.induce t).Connected)
    (sintert : (s ⊓ t).Nonempty) :
    (H.induce (s ∪ t)).Connected := by
  refine (sconn.sup tconn sintert).mono ?_ ?_
  · 

Proof state:
case refine_1
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
s t : Set V
sconn : Subgraph.Connected (induce H s)
tconn : Subgraph.Connected (induce H t)
sintert : Set.Nonempty (s ⊓ t)
⊢ induce H s ⊔ induce H t ≤ induce H (s ∪ t)

Next tactic:
apply le_induce_union
lemma induce_union_connected {H : G.Subgraph} {s t : Set V}
    (sconn : (H.induce s).Connected) (tconn : (H.induce t).Connected)
    (sintert : (s ⊓ t).Nonempty) :
    (H.induce (s ∪ t)).Connected := by
  refine (sconn.sup tconn sintert).mono ?_ ?_
  · apply le_induce_union
  · 

Proof state:
case refine_2
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
s t : Set V
sconn : Subgraph.Connected (induce H s)
tconn : Subgraph.Connected (induce H t)
sintert : Set.Nonempty (s ⊓ t)
⊢ (induce H s ⊔ induce H t).verts = (induce H (s ∪ t)).verts

Next tactic:
simp
lemma Connected.adj_union {H K : G.Subgraph}
    (Hconn : H.Connected) (Kconn : K.Connected) {u v : V} (uH : u ∈ H.verts) (vK : v ∈ K.verts)
    (huv : G.Adj u v) :
    ((⊤ : G.Subgraph).induce {u, v} ⊔ H ⊔ K).Connected := by
  

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H K : Subgraph G
Hconn : Subgraph.Connected H
Kconn : Subgraph.Connected K
u v : V
uH : u ∈ H.verts
vK : v ∈ K.verts
huv : SimpleGraph.Adj G u v
⊢ Subgraph.Connected (induce ⊤ {u, v} ⊔ H ⊔ K)

Next tactic:
refine ((top_induce_pair_connected_of_adj huv).sup Hconn ?_).sup Kconn ?_
lemma Connected.adj_union {H K : G.Subgraph}
    (Hconn : H.Connected) (Kconn : K.Connected) {u v : V} (uH : u ∈ H.verts) (vK : v ∈ K.verts)
    (huv : G.Adj u v) :
    ((⊤ : G.Subgraph).induce {u, v} ⊔ H ⊔ K).Connected := by
  refine ((top_induce_pair_connected_of_adj huv).sup Hconn ?_).sup Kconn ?_
  · 

Proof state:
case refine_1
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H K : Subgraph G
Hconn : Subgraph.Connected H
Kconn : Subgraph.Connected K
u v : V
uH : u ∈ H.verts
vK : v ∈ K.verts
huv : SimpleGraph.Adj G u v
⊢ Set.Nonempty (induce ⊤ {u, v} ⊓ H).verts

Next tactic:
exact ⟨u, by simp [uH]⟩
lemma Connected.adj_union {H K : G.Subgraph}
    (Hconn : H.Connected) (Kconn : K.Connected) {u v : V} (uH : u ∈ H.verts) (vK : v ∈ K.verts)
    (huv : G.Adj u v) :
    ((⊤ : G.Subgraph).induce {u, v} ⊔ H ⊔ K).Connected := by
  refine ((top_induce_pair_connected_of_adj huv).sup Hconn ?_).sup Kconn ?_
  · exact ⟨u, by 

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H K : Subgraph G
Hconn : Subgraph.Connected H
Kconn : Subgraph.Connected K
u v : V
uH : u ∈ H.verts
vK : v ∈ K.verts
huv : SimpleGraph.Adj G u v
⊢ u ∈ (induce ⊤ {u, v} ⊓ H).verts

Next tactic:
simp [uH]
lemma Connected.adj_union {H K : G.Subgraph}
    (Hconn : H.Connected) (Kconn : K.Connected) {u v : V} (uH : u ∈ H.verts) (vK : v ∈ K.verts)
    (huv : G.Adj u v) :
    ((⊤ : G.Subgraph).induce {u, v} ⊔ H ⊔ K).Connected := by
  refine ((top_induce_pair_connected_of_adj huv).sup Hconn ?_).sup Kconn ?_
  · exact ⟨u, by simp [uH]⟩
  · 

Proof state:
case refine_2
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H K : Subgraph G
Hconn : Subgraph.Connected H
Kconn : Subgraph.Connected K
u v : V
uH : u ∈ H.verts
vK : v ∈ K.verts
huv : SimpleGraph.Adj G u v
⊢ Set.Nonempty ((induce ⊤ {u, v} ⊔ H) ⊓ K).verts

Next tactic:
exact ⟨v, by simp [vK]⟩
lemma Connected.adj_union {H K : G.Subgraph}
    (Hconn : H.Connected) (Kconn : K.Connected) {u v : V} (uH : u ∈ H.verts) (vK : v ∈ K.verts)
    (huv : G.Adj u v) :
    ((⊤ : G.Subgraph).induce {u, v} ⊔ H ⊔ K).Connected := by
  refine ((top_induce_pair_connected_of_adj huv).sup Hconn ?_).sup Kconn ?_
  · exact ⟨u, by simp [uH]⟩
  · exact ⟨v, by 

Proof state:
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H K : Subgraph G
Hconn : Subgraph.Connected H
Kconn : Subgraph.Connected K
u v : V
uH : u ∈ H.verts
vK : v ∈ K.verts
huv : SimpleGraph.Adj G u v
⊢ v ∈ ((induce ⊤ {u, v} ⊔ H) ⊓ K).verts

Next tactic:
simp [vK]
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
  

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

Next tactic:
constructor
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
  · 

Proof state:
case mp
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
⊢ Subgraph.Preconnected H → ∀ {u v : V}, u ∈ H.verts → v ∈ H.verts → ∃ p, Walk.toSubgraph p ≤ H

Next tactic:
intro hc u v hu hv
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
    

Proof state:
case mp
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
hc : Subgraph.Preconnected H
u v : V
hu : u ∈ H.verts
hv : v ∈ H.verts
⊢ ∃ p, Walk.toSubgraph p ≤ H

Next tactic:
refine (hc ⟨_, hu⟩ ⟨_, hv⟩).elim fun p => ?_
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 => ?_
    

Proof state:
case mp
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
hc : Subgraph.Preconnected H
u v : V
hu : u ∈ H.verts
hv : v ∈ H.verts
p : Walk (Subgraph.coe H) { val := u, property := hu } { val := v, property := hv }
⊢ ∃ p, Walk.toSubgraph p ≤ H

Next tactic:
exists p.map (Subgraph.hom _)
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 _)
    

Proof state:
case mp
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
hc : Subgraph.Preconnected H
u v : V
hu : u ∈ H.verts
hv : v ∈ H.verts
p : Walk (Subgraph.coe H) { val := u, property := hu } { val := v, property := hv }
⊢ Walk.toSubgraph (Walk.map (Subgraph.hom H) p) ≤ H

Next tactic:
simp [coeSubgraph_le]
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]
  · 

Proof state:
case mpr
V : Type u
V' : Type v
G : SimpleGraph V
G' : SimpleGraph V'
H : Subgraph G
⊢ (∀ {u v : V}, u ∈ H.verts → v ∈ H.verts → ∃ p, Walk.toSubgraph p ≤ H) → Subgraph.Preconnected H

Next tactic:
intro hw
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
    

Proof state:
case mpr
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
⊢ Subgraph.Preconnected H

Next tactic:
rw [Subgraph.preconnected_iff]
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]
    

Proof state:
case mpr
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
⊢ Preconnected (Subgraph.coe H)

Next tactic:
rintro ⟨u, hu⟩ ⟨v, hv⟩
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⟩
    

Proof state:
case mpr.mk.mk
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
⊢ Reachable (Subgraph.coe H) { val := u, property := hu } { val := v, property := hv }

Next tactic:
obtain ⟨p, h⟩ := hw hu hv