Theorem: SimpleGraph.adj_and_reachable_delete_edges_iff_exists_cycle
File: Mathlib/Combinatorics/SimpleGraph/Connectivity.lean

tactic: rw [reachable_delete_edges_iff_exists_walk]
state_before: V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
⊢ Adj G v w ∧ Reachable (G \ fromEdgeSet {Quotient.mk (Sym2.Rel.setoid V) (v, w)}) v w ↔
    ∃ u p, Walk.IsCycle p ∧ Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p

tactic: constructor
state_before: V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
⊢ (Adj G v w ∧ ∃ p, ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p) ↔
    ∃ u p, Walk.IsCycle p ∧ Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p

tactic: rintro ⟨h, p, hp⟩
state_before: case mp
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
⊢ (Adj G v w ∧ ∃ p, ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p) →
    ∃ u p, Walk.IsCycle p ∧ Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p

tactic: refine ⟨w, Walk.cons h.symm p.toPath, ?_, ?_⟩
state_before: case mp.intro.intro
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
h : Adj G v w
p : Walk G v w
hp : ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
⊢ ∃ u p, Walk.IsCycle p ∧ Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p

tactic: apply Path.cons_isCycle
state_before: case mp.intro.intro.refine_1
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
h : Adj G v w
p : Walk G v w
hp : ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
⊢ Walk.IsCycle (Walk.cons (_ : Adj G w v) ↑(Walk.toPath p))

tactic: rw [Sym2.eq_swap]
state_before: case mp.intro.intro.refine_1.he
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
h : Adj G v w
p : Walk G v w
hp : ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
⊢ ¬Quotient.mk (Sym2.Rel.setoid V) (w, v) ∈ Walk.edges ↑(Walk.toPath p)

tactic: intro h
state_before: case mp.intro.intro.refine_1.he
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
h : Adj G v w
p : Walk G v w
hp : ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
⊢ ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges ↑(Walk.toPath p)

tactic: cases hp (Walk.edges_toPath_subset p h)
state_before: case mp.intro.intro.refine_1.he
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
h✝ : Adj G v w
p : Walk G v w
hp : ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
h : Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges ↑(Walk.toPath p)
⊢ False

tactic: simp only [Sym2.eq_swap, Walk.edges_cons, List.mem_cons, eq_self_iff_true, true_or_iff]
state_before: case mp.intro.intro.refine_2
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
h : Adj G v w
p : Walk G v w
hp : ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
⊢ Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges (Walk.cons (_ : Adj G w v) ↑(Walk.toPath p))

tactic: rintro ⟨u, c, hc, he⟩
state_before: case mpr
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w : V
⊢ (∃ u p, Walk.IsCycle p ∧ Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p) →
    Adj G v w ∧ ∃ p, ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p

tactic: refine ⟨c.adj_of_mem_edges he, ?_⟩
state_before: case mpr.intro.intro.intro
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w u : V
c : Walk G u u
hc : Walk.IsCycle c
he : Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges c
⊢ Adj G v w ∧ ∃ p, ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p

tactic: by_contra' hb
state_before: case mpr.intro.intro.intro
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w u : V
c : Walk G u u
hc : Walk.IsCycle c
he : Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges c
⊢ ∃ p, ¬Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p

tactic: have hb' : ∀ p : G.Walk w v, ⟦(w, v)⟧ ∈ p.edges := by
  intro p
  simpa [Sym2.eq_swap] using hb p.reverse
state_before: case mpr.intro.intro.intro
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w u : V
c : Walk G u u
hc : Walk.IsCycle c
he : Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges c
hb : ∀ (p : Walk G v w), Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
⊢ False

tactic: have hvc : v ∈ c.support := Walk.fst_mem_support_of_mem_edges c he
state_before: case mpr.intro.intro.intro
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w u : V
c : Walk G u u
hc : Walk.IsCycle c
he : Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges c
hb : ∀ (p : Walk G v w), Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
hb' : ∀ (p : Walk G w v), Quotient.mk (Sym2.Rel.setoid V) (w, v) ∈ Walk.edges p
⊢ False

tactic: refine reachable_deleteEdges_iff_exists_cycle.aux hb' (c.rotate hvc) (hc.isTrail.rotate hvc)
  ?_ (Walk.start_mem_support _)
state_before: case mpr.intro.intro.intro
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w u : V
c : Walk G u u
hc : Walk.IsCycle c
he : Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges c
hb : ∀ (p : Walk G v w), Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
hb' : ∀ (p : Walk G w v), Quotient.mk (Sym2.Rel.setoid V) (w, v) ∈ Walk.edges p
hvc : v ∈ Walk.support c
⊢ False

tactic: rwa [(Walk.rotate_edges c hvc).mem_iff, Sym2.eq_swap]
state_before: case mpr.intro.intro.intro
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w u : V
c : Walk G u u
hc : Walk.IsCycle c
he : Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges c
hb : ∀ (p : Walk G v w), Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
hb' : ∀ (p : Walk G w v), Quotient.mk (Sym2.Rel.setoid V) (w, v) ∈ Walk.edges p
hvc : v ∈ Walk.support c
⊢ Quotient.mk (Sym2.Rel.setoid V) (w, v) ∈ Walk.edges (Walk.rotate c hvc)

tactic: intro p
state_before: V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w u : V
c : Walk G u u
hc : Walk.IsCycle c
he : Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges c
hb : ∀ (p : Walk G v w), Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
⊢ ∀ (p : Walk G w v), Quotient.mk (Sym2.Rel.setoid V) (w, v) ∈ Walk.edges p

tactic: simpa [Sym2.eq_swap] using hb p.reverse
state_before: V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v w u : V
c : Walk G u u
hc : Walk.IsCycle c
he : Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges c
hb : ∀ (p : Walk G v w), Quotient.mk (Sym2.Rel.setoid V) (v, w) ∈ Walk.edges p
p : Walk G w v
⊢ Quotient.mk (Sym2.Rel.setoid V) (w, v) ∈ Walk.edges p