l3lab/ntp-mathlib huggingface dataset:
/-- Given a walk that avoids a set of edges, produce a walk in the graph
with those edges deleted. -/
@[reducible]
def toDeleteEdges (s : Set (Sym2 V)) {v w : V} (p : G.Walk v w) (hp : ∀ e, e ∈ p.edges → ¬e ∈ s) :
    (G.deleteEdges s).Walk v w :=
  p.transfer _ <| by
    

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
s : Set (Sym2 V)
v w : V
p : Walk G v w
hp : ∀ e ∈ edges p, e ∉ s
⊢ ∀ e ∈ edges p, e ∈ edgeSet (deleteEdges G s)

Next tactic:
simp only [edgeSet_deleteEdges, Set.mem_diff]
/-- Given a walk that avoids a set of edges, produce a walk in the graph
with those edges deleted. -/
@[reducible]
def toDeleteEdges (s : Set (Sym2 V)) {v w : V} (p : G.Walk v w) (hp : ∀ e, e ∈ p.edges → ¬e ∈ s) :
    (G.deleteEdges s).Walk v w :=
  p.transfer _ <| by
    simp only [edgeSet_deleteEdges, Set.mem_diff]
    

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
s : Set (Sym2 V)
v w : V
p : Walk G v w
hp : ∀ e ∈ edges p, e ∉ s
⊢ ∀ e ∈ edges p, e ∈ edgeSet G ∧ e ∉ s

Next tactic:
exact fun e ep => ⟨edges_subset_edgeSet p ep, hp e ep⟩
/-- Given a walk that avoids an edge, create a walk in the subgraph with that edge deleted.
This is an abbreviation for `SimpleGraph.Walk.toDeleteEdges`. -/
abbrev toDeleteEdge (e : Sym2 V) (p : G.Walk v w) (hp : e ∉ p.edges) :
    (G.deleteEdges {e}).Walk v w :=
  p.toDeleteEdges {e} (fun e' => by 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
e : Sym2 V
p : Walk G v w
hp : e ∉ edges p
e' : Sym2 V
⊢ e' ∈ edges p → e' ∉ {e}

Next tactic:
contrapose!
/-- Given a walk that avoids an edge, create a walk in the subgraph with that edge deleted.
This is an abbreviation for `SimpleGraph.Walk.toDeleteEdges`. -/
abbrev toDeleteEdge (e : Sym2 V) (p : G.Walk v w) (hp : e ∉ p.edges) :
    (G.deleteEdges {e}).Walk v w :=
  p.toDeleteEdges {e} (fun e' => by contrapose!; 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
e : Sym2 V
p : Walk G v w
hp : e ∉ edges p
e' : Sym2 V
⊢ e' ∈ {e} → e' ∉ edges p

Next tactic:
simp (config := { contextual := true }) [hp]
@[simp]
theorem map_toDeleteEdges_eq (s : Set (Sym2 V)) {p : G.Walk v w} (hp) :
    Walk.map (Hom.mapSpanningSubgraphs (G.deleteEdges_le s)) (p.toDeleteEdges s hp) = p := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
s : Set (Sym2 V)
p : Walk G v w
hp : ∀ e ∈ edges p, e ∉ s
⊢ Walk.map (Hom.mapSpanningSubgraphs (_ : deleteEdges G s ≤ G)) (toDeleteEdges s p hp) = p

Next tactic:
rw [← transfer_eq_map_of_le, transfer_transfer, transfer_self]
@[simp]
theorem map_toDeleteEdges_eq (s : Set (Sym2 V)) {p : G.Walk v w} (hp) :
    Walk.map (Hom.mapSpanningSubgraphs (G.deleteEdges_le s)) (p.toDeleteEdges s hp) = p := by
  rw [← transfer_eq_map_of_le, transfer_transfer, transfer_self]
  · 

Proof state:
case hp'
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
s : Set (Sym2 V)
p : Walk G v w
hp : ∀ e ∈ edges p, e ∉ s
⊢ ∀ e ∈ edges (Walk.transfer p (deleteEdges G s) (_ : ∀ e ∈ edges p, e ∈ edgeSet (deleteEdges G s))), e ∈ edgeSet G

Next tactic:
intros e
@[simp]
theorem map_toDeleteEdges_eq (s : Set (Sym2 V)) {p : G.Walk v w} (hp) :
    Walk.map (Hom.mapSpanningSubgraphs (G.deleteEdges_le s)) (p.toDeleteEdges s hp) = p := by
  rw [← transfer_eq_map_of_le, transfer_transfer, transfer_self]
  · intros e
    

Proof state:
case hp'
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
s : Set (Sym2 V)
p : Walk G v w
hp : ∀ e ∈ edges p, e ∉ s
e : Sym2 V
⊢ e ∈ edges (Walk.transfer p (deleteEdges G s) (_ : ∀ e ∈ edges p, e ∈ edgeSet (deleteEdges G s))) → e ∈ edgeSet G

Next tactic:
rw [edges_transfer]
@[simp]
theorem map_toDeleteEdges_eq (s : Set (Sym2 V)) {p : G.Walk v w} (hp) :
    Walk.map (Hom.mapSpanningSubgraphs (G.deleteEdges_le s)) (p.toDeleteEdges s hp) = p := by
  rw [← transfer_eq_map_of_le, transfer_transfer, transfer_self]
  · intros e
    rw [edges_transfer]
    

Proof state:
case hp'
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
s : Set (Sym2 V)
p : Walk G v w
hp : ∀ e ∈ edges p, e ∉ s
e : Sym2 V
⊢ e ∈ edges p → e ∈ edgeSet G

Next tactic:
apply edges_subset_edgeSet p
@[simp]
theorem toDeleteEdges_copy (s : Set (Sym2 V))
    (p : G.Walk u v) (hu : u = u') (hv : v = v') (h) :
    (p.copy hu hv).toDeleteEdges s h =
      (p.toDeleteEdges s (by 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v u' v' : V
s : Set (Sym2 V)
p : Walk G u v
hu : u = u'
hv : v = v'
h : ∀ e ∈ edges (Walk.copy p hu hv), e ∉ s
⊢ ∀ e ∈ edges p, e ∉ s

Next tactic:
subst_vars
@[simp]
theorem toDeleteEdges_copy (s : Set (Sym2 V))
    (p : G.Walk u v) (hu : u = u') (hv : v = v') (h) :
    (p.copy hu hv).toDeleteEdges s h =
      (p.toDeleteEdges s (by subst_vars; 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u' v' : V
s : Set (Sym2 V)
p : Walk G u' v'
h : ∀ e ∈ edges (Walk.copy p (_ : u' = u') (_ : v' = v')), e ∉ s
⊢ ∀ e ∈ edges p, e ∉ s

Next tactic:
exact h
@[simp]
theorem toDeleteEdges_copy (s : Set (Sym2 V))
    (p : G.Walk u v) (hu : u = u') (hv : v = v') (h) :
    (p.copy hu hv).toDeleteEdges s h =
      (p.toDeleteEdges s (by subst_vars; exact h)).copy hu hv := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v u' v' : V
s : Set (Sym2 V)
p : Walk G u v
hu : u = u'
hv : v = v'
h : ∀ e ∈ edges (Walk.copy p hu hv), e ∉ s
⊢ toDeleteEdges s (Walk.copy p hu hv) h = Walk.copy (toDeleteEdges s p (_ : ∀ e ∈ edges p, e ∉ s)) hu hv

Next tactic:
subst_vars
@[simp]
theorem toDeleteEdges_copy (s : Set (Sym2 V))
    (p : G.Walk u v) (hu : u = u') (hv : v = v') (h) :
    (p.copy hu hv).toDeleteEdges s h =
      (p.toDeleteEdges s (by subst_vars; exact h)).copy hu hv := by
  subst_vars
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u' v' : V
s : Set (Sym2 V)
p : Walk G u' v'
h : ∀ e ∈ edges (Walk.copy p (_ : u' = u') (_ : v' = v')), e ∉ s
⊢ toDeleteEdges s (Walk.copy p (_ : u' = u') (_ : v' = v')) h =
    Walk.copy (toDeleteEdges s p (_ : ∀ e ∈ edges p, e ∉ s)) (_ : u' = u') (_ : v' = v')

Next tactic:
rfl
protected theorem Reachable.elim_path {p : Prop} {u v : V} (h : G.Reachable u v)
    (hp : G.Path u v → p) : p := by 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
p : Prop
u v : V
h : Reachable G u v
hp : Path G u v → p
⊢ p

Next tactic:
classical exact h.elim fun q => hp q.toPath
protected theorem Reachable.elim_path {p : Prop} {u v : V} (h : G.Reachable u v)
    (hp : G.Path u v → p) : p := by classical 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
p : Prop
u v : V
h : Reachable G u v
hp : Path G u v → p
⊢ p

Next tactic:
exact h.elim fun q => hp q.toPath
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
⊢ Reachable G u v ↔ Relation.ReflTransGen G.Adj u v

Next tactic:
constructor
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · 

Proof state:
case mp
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
⊢ Reachable G u v → Relation.ReflTransGen G.Adj u v

Next tactic:
rintro ⟨h⟩
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · rintro ⟨h⟩
    

Proof state:
case mp.intro
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
h : Walk G u v
⊢ Relation.ReflTransGen G.Adj u v

Next tactic:
induction h with
    | nil => rfl
    | cons h' _ ih => exact (Relation.ReflTransGen.single h').trans ih
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · rintro ⟨h⟩
    induction h with
    

Proof state:
case mp.intro.nil
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v u✝ : V
⊢ Relation.ReflTransGen G.Adj u✝ u✝

Next tactic:
| nil => rfl
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · rintro ⟨h⟩
    induction h with
    | nil => 

Proof state:
case mp.intro.nil
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v u✝ : V
⊢ Relation.ReflTransGen G.Adj u✝ u✝

Next tactic:
rfl
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · rintro ⟨h⟩
    induction h with
    | nil => rfl
    

Proof state:
case mp.intro.cons
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v u✝ v✝ w✝ : V
h' : Adj G u✝ v✝
p✝ : Walk G v✝ w✝
ih : Relation.ReflTransGen G.Adj v✝ w✝
⊢ Relation.ReflTransGen G.Adj u✝ w✝

Next tactic:
| cons h' _ ih => exact (Relation.ReflTransGen.single h').trans ih
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · rintro ⟨h⟩
    induction h with
    | nil => rfl
    | cons h' _ ih => 

Proof state:
case mp.intro.cons
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v u✝ v✝ w✝ : V
h' : Adj G u✝ v✝
p✝ : Walk G v✝ w✝
ih : Relation.ReflTransGen G.Adj v✝ w✝
⊢ Relation.ReflTransGen G.Adj u✝ w✝

Next tactic:
exact (Relation.ReflTransGen.single h').trans ih
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · rintro ⟨h⟩
    induction h with
    | nil => rfl
    | cons h' _ ih => exact (Relation.ReflTransGen.single h').trans ih
  · 

Proof state:
case mpr
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
⊢ Relation.ReflTransGen G.Adj u v → Reachable G u v

Next tactic:
intro h
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · rintro ⟨h⟩
    induction h with
    | nil => rfl
    | cons h' _ ih => exact (Relation.ReflTransGen.single h').trans ih
  · intro h
    

Proof state:
case mpr
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
h : Relation.ReflTransGen G.Adj u v
⊢ Reachable G u v

Next tactic:
induction h with
    | refl => rfl
    | tail _ ha hr => exact Reachable.trans hr ⟨Walk.cons ha Walk.nil⟩
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · rintro ⟨h⟩
    induction h with
    | nil => rfl
    | cons h' _ ih => exact (Relation.ReflTransGen.single h').trans ih
  · intro h
    induction h with
    

Proof state:
case mpr.refl
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
⊢ Reachable G u u

Next tactic:
| refl => rfl
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · rintro ⟨h⟩
    induction h with
    | nil => rfl
    | cons h' _ ih => exact (Relation.ReflTransGen.single h').trans ih
  · intro h
    induction h with
    | refl => 

Proof state:
case mpr.refl
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
⊢ Reachable G u u

Next tactic:
rfl
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · rintro ⟨h⟩
    induction h with
    | nil => rfl
    | cons h' _ ih => exact (Relation.ReflTransGen.single h').trans ih
  · intro h
    induction h with
    | refl => rfl
    

Proof state:
case mpr.tail
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v b✝ c✝ : V
a✝ : Relation.ReflTransGen G.Adj u b✝
ha : Adj G b✝ c✝
hr : Reachable G u b✝
⊢ Reachable G u c✝

Next tactic:
| tail _ ha hr => exact Reachable.trans hr ⟨Walk.cons ha Walk.nil⟩
theorem reachable_iff_reflTransGen (u v : V) :
    G.Reachable u v ↔ Relation.ReflTransGen G.Adj u v := by
  constructor
  · rintro ⟨h⟩
    induction h with
    | nil => rfl
    | cons h' _ ih => exact (Relation.ReflTransGen.single h').trans ih
  · intro h
    induction h with
    | refl => rfl
    | tail _ ha hr => 

Proof state:
case mpr.tail
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v b✝ c✝ : V
a✝ : Relation.ReflTransGen G.Adj u b✝
ha : Adj G b✝ c✝
hr : Reachable G u b✝
⊢ Reachable G u c✝

Next tactic:
exact Reachable.trans hr ⟨Walk.cons ha Walk.nil⟩
theorem Iso.symm_apply_reachable {G : SimpleGraph V} {G' : SimpleGraph V'} {φ : G ≃g G'} {u : V}
    {v : V'} : G.Reachable (φ.symm v) u ↔ G'.Reachable v (φ u) := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G✝ : SimpleGraph V
G'✝ : SimpleGraph V'
G'' : SimpleGraph V''
G : SimpleGraph V
G' : SimpleGraph V'
φ : G ≃g G'
u : V
v : V'
⊢ Reachable G ((symm φ) v) u ↔ Reachable G' v (φ u)

Next tactic:
rw [← Iso.reachable_iff, RelIso.apply_symm_apply]
lemma top_preconnected : (⊤ : SimpleGraph V).Preconnected := fun x y => by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
x y : V
⊢ Reachable ⊤ x y

Next tactic:
if h : x = y then rw [h] else exact Adj.reachable h
lemma top_preconnected : (⊤ : SimpleGraph V).Preconnected := fun x y => by
  if h : x = y then 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
x y : V
h : x = y
⊢ Reachable ⊤ x y

Next tactic:
rw [h]
lemma top_preconnected : (⊤ : SimpleGraph V).Preconnected := fun x y => by
  if h : x = y then rw [h] else 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
x y : V
h : ¬x = y
⊢ Reachable ⊤ x y

Next tactic:
exact Adj.reachable h
lemma connected_iff_exists_forall_reachable : G.Connected ↔ ∃ v, ∀ w, G.Reachable v w := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
⊢ Connected G ↔ ∃ v, ∀ (w : V), Reachable G v w

Next tactic:
rw [connected_iff]
lemma connected_iff_exists_forall_reachable : G.Connected ↔ ∃ v, ∀ w, G.Reachable v w := by
  rw [connected_iff]
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
⊢ Preconnected G ∧ Nonempty V ↔ ∃ v, ∀ (w : V), Reachable G v w

Next tactic:
constructor
lemma connected_iff_exists_forall_reachable : G.Connected ↔ ∃ v, ∀ w, G.Reachable v w := by
  rw [connected_iff]
  constructor
  · 

Proof state:
case mp
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
⊢ Preconnected G ∧ Nonempty V → ∃ v, ∀ (w : V), Reachable G v w

Next tactic:
rintro ⟨hp, ⟨v⟩⟩
lemma connected_iff_exists_forall_reachable : G.Connected ↔ ∃ v, ∀ w, G.Reachable v w := by
  rw [connected_iff]
  constructor
  · rintro ⟨hp, ⟨v⟩⟩
    

Proof state:
case mp.intro.intro
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
hp : Preconnected G
v : V
⊢ ∃ v, ∀ (w : V), Reachable G v w

Next tactic:
exact ⟨v, fun w => hp v w⟩
lemma connected_iff_exists_forall_reachable : G.Connected ↔ ∃ v, ∀ w, G.Reachable v w := by
  rw [connected_iff]
  constructor
  · rintro ⟨hp, ⟨v⟩⟩
    exact ⟨v, fun w => hp v w⟩
  · 

Proof state:
case mpr
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
⊢ (∃ v, ∀ (w : V), Reachable G v w) → Preconnected G ∧ Nonempty V

Next tactic:
rintro ⟨v, h⟩
lemma connected_iff_exists_forall_reachable : G.Connected ↔ ∃ v, ∀ w, G.Reachable v w := by
  rw [connected_iff]
  constructor
  · rintro ⟨hp, ⟨v⟩⟩
    exact ⟨v, fun w => hp v w⟩
  · rintro ⟨v, h⟩
    

Proof state:
case mpr.intro
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v : V
h : ∀ (w : V), Reachable G v w
⊢ Preconnected G ∧ Nonempty V

Next tactic:
exact ⟨fun u w => (h u).symm.trans (h w), ⟨v⟩⟩
@[simp]
theorem map_id (C : ConnectedComponent G) : C.map Hom.id = C := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
C : ConnectedComponent G
⊢ map Hom.id C = C

Next tactic:
refine' C.ind _
@[simp]
theorem map_id (C : ConnectedComponent G) : C.map Hom.id = C := by
  refine' C.ind _
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
C : ConnectedComponent G
⊢ ∀ (v : V), map Hom.id (connectedComponentMk G v) = connectedComponentMk G v

Next tactic:
exact fun _ => rfl
@[simp]
theorem map_comp (C : G.ConnectedComponent) (φ : G →g G') (ψ : G' →g G'') :
    (C.map φ).map ψ = C.map (ψ.comp φ) := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
C : ConnectedComponent G
φ : G →g G'
ψ : G' →g G''
⊢ map ψ (map φ C) = map (Hom.comp ψ φ) C

Next tactic:
refine' C.ind _
@[simp]
theorem map_comp (C : G.ConnectedComponent) (φ : G →g G') (ψ : G' →g G'') :
    (C.map φ).map ψ = C.map (ψ.comp φ) := by
  refine' C.ind _
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
C : ConnectedComponent G
φ : G →g G'
ψ : G' →g G''
⊢ ∀ (v : V), map ψ (map φ (connectedComponentMk G v)) = map (Hom.comp ψ φ) (connectedComponentMk G v)

Next tactic:
exact fun _ => rfl
@[simp]
theorem iso_image_comp_eq_map_iff_eq_comp {C : G.ConnectedComponent} :
    G'.connectedComponentMk (φ v) = C.map ↑(↑φ : G ↪g G') ↔ G.connectedComponentMk v = C := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
φ : G ≃g G'
v : V
v' : V'
C : ConnectedComponent G
⊢ connectedComponentMk G' (φ v) = map (RelEmbedding.toRelHom (RelIso.toRelEmbedding φ)) C ↔ connectedComponentMk G v = C

Next tactic:
refine' C.ind fun u => _
@[simp]
theorem iso_image_comp_eq_map_iff_eq_comp {C : G.ConnectedComponent} :
    G'.connectedComponentMk (φ v) = C.map ↑(↑φ : G ↪g G') ↔ G.connectedComponentMk v = C := by
  refine' C.ind fun u => _
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
φ : G ≃g G'
v : V
v' : V'
C : ConnectedComponent G
u : V
⊢ connectedComponentMk G' (φ v) = map (RelEmbedding.toRelHom (RelIso.toRelEmbedding φ)) (connectedComponentMk G u) ↔
    connectedComponentMk G v = connectedComponentMk G u

Next tactic:
simp only [Iso.reachable_iff, ConnectedComponent.map_mk, RelEmbedding.coe_toRelHom,
    RelIso.coe_toRelEmbedding, ConnectedComponent.eq]
@[simp]
theorem iso_inv_image_comp_eq_iff_eq_map {C : G.ConnectedComponent} :
    G.connectedComponentMk (φ.symm v') = C ↔ G'.connectedComponentMk v' = C.map φ := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
φ : G ≃g G'
v : V
v' : V'
C : ConnectedComponent G
⊢ connectedComponentMk G ((Iso.symm φ) v') = C ↔
    connectedComponentMk G' v' = map (RelEmbedding.toRelHom (RelIso.toRelEmbedding φ)) C

Next tactic:
refine' C.ind fun u => _
@[simp]
theorem iso_inv_image_comp_eq_iff_eq_map {C : G.ConnectedComponent} :
    G.connectedComponentMk (φ.symm v') = C ↔ G'.connectedComponentMk v' = C.map φ := by
  refine' C.ind fun u => _
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
φ : G ≃g G'
v : V
v' : V'
C : ConnectedComponent G
u : V
⊢ connectedComponentMk G ((Iso.symm φ) v') = connectedComponentMk G u ↔
    connectedComponentMk G' v' = map (RelEmbedding.toRelHom (RelIso.toRelEmbedding φ)) (connectedComponentMk G u)

Next tactic:
simp only [Iso.symm_apply_reachable, ConnectedComponent.eq, ConnectedComponent.map_mk,
    RelEmbedding.coe_toRelHom, RelIso.coe_toRelEmbedding]
@[simp]
theorem connectedComponentEquiv_refl :
    (Iso.refl : G ≃g G).connectedComponentEquiv = Equiv.refl _ := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
⊢ connectedComponentEquiv refl = Equiv.refl (ConnectedComponent G)

Next tactic:
ext ⟨v⟩
@[simp]
theorem connectedComponentEquiv_refl :
    (Iso.refl : G ≃g G).connectedComponentEquiv = Equiv.refl _ := by
  ext ⟨v⟩
  

Proof state:
case H.mk
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
x✝ : ConnectedComponent G
v : V
⊢ (connectedComponentEquiv refl) (Quot.mk (Reachable G) v) =
    (Equiv.refl (ConnectedComponent G)) (Quot.mk (Reachable G) v)

Next tactic:
rfl
@[simp]
theorem connectedComponentEquiv_symm (φ : G ≃g G') :
    φ.symm.connectedComponentEquiv = φ.connectedComponentEquiv.symm := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
φ : G ≃g G'
⊢ connectedComponentEquiv (symm φ) = (connectedComponentEquiv φ).symm

Next tactic:
ext ⟨_⟩
@[simp]
theorem connectedComponentEquiv_symm (φ : G ≃g G') :
    φ.symm.connectedComponentEquiv = φ.connectedComponentEquiv.symm := by
  ext ⟨_⟩
  

Proof state:
case H.mk
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
φ : G ≃g G'
x✝ : ConnectedComponent G'
a✝ : V'
⊢ (connectedComponentEquiv (symm φ)) (Quot.mk (Reachable G') a✝) =
    (connectedComponentEquiv φ).symm (Quot.mk (Reachable G') a✝)

Next tactic:
rfl
@[simp]
theorem connectedComponentEquiv_trans (φ : G ≃g G') (φ' : G' ≃g G'') :
    connectedComponentEquiv (φ.trans φ') =
    φ.connectedComponentEquiv.trans φ'.connectedComponentEquiv := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
φ : G ≃g G'
φ' : G' ≃g G''
⊢ connectedComponentEquiv (RelIso.trans φ φ') = (connectedComponentEquiv φ).trans (connectedComponentEquiv φ')

Next tactic:
ext ⟨_⟩
@[simp]
theorem connectedComponentEquiv_trans (φ : G ≃g G') (φ' : G' ≃g G'') :
    connectedComponentEquiv (φ.trans φ') =
    φ.connectedComponentEquiv.trans φ'.connectedComponentEquiv := by
  ext ⟨_⟩
  

Proof state:
case H.mk
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
φ : G ≃g G'
φ' : G' ≃g G''
x✝ : ConnectedComponent G
a✝ : V
⊢ (connectedComponentEquiv (RelIso.trans φ φ')) (Quot.mk (Reachable G) a✝) =
    ((connectedComponentEquiv φ).trans (connectedComponentEquiv φ')) (Quot.mk (Reachable G) a✝)

Next tactic:
rfl
@[ext]
theorem supp_injective :
    Function.Injective (ConnectedComponent.supp : G.ConnectedComponent → Set V) := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
⊢ Injective supp

Next tactic:
refine' ConnectedComponent.ind₂ _
@[ext]
theorem supp_injective :
    Function.Injective (ConnectedComponent.supp : G.ConnectedComponent → Set V) := by
  refine' ConnectedComponent.ind₂ _
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
⊢ ∀ (v w : V),
    supp (connectedComponentMk G v) = supp (connectedComponentMk G w) →
      connectedComponentMk G v = connectedComponentMk G w

Next tactic:
intro v w
@[ext]
theorem supp_injective :
    Function.Injective (ConnectedComponent.supp : G.ConnectedComponent → Set V) := by
  refine' ConnectedComponent.ind₂ _
  intro v w
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
⊢ supp (connectedComponentMk G v) = supp (connectedComponentMk G w) →
    connectedComponentMk G v = connectedComponentMk G w

Next tactic:
simp only [ConnectedComponent.supp, Set.ext_iff, ConnectedComponent.eq, Set.mem_setOf_eq]