Theorem: SimpleGraph.Walk.IsTrail.even_countp_edges_iff
File: Mathlib/Combinatorics/SimpleGraph/Trails.lean

tactic: induction' p with u u v w huv p ih
state_before: V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u v : V
p : Walk G u v
ht : IsTrail p
x : V
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ u ≠ v → x ≠ u ∧ x ≠ v

tactic: simp
state_before: case nil
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v : V
p : Walk G u✝ v
ht✝ : IsTrail p
x u : V
ht : IsTrail Walk.nil
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges Walk.nil)) ↔ u ≠ u → x ≠ u ∧ x ≠ u

tactic: rw [cons_isTrail_iff] at ht
state_before: case cons
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v w : V
huv : Adj G u v
p : Walk G v w
ih : IsTrail p → (Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ v ≠ w → x ≠ v ∧ x ≠ w)
ht : IsTrail (cons huv p)
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges (cons huv p))) ↔ u ≠ w → x ≠ u ∧ x ≠ w

tactic: specialize ih ht.1
state_before: case cons
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v w : V
huv : Adj G u v
p : Walk G v w
ih : IsTrail p → (Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ v ≠ w → x ≠ v ∧ x ≠ w)
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, v) ∈ edges p
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges (cons huv p))) ↔ u ≠ w → x ≠ u ∧ x ≠ w

tactic: simp only [List.countp_cons, Ne.def, edges_cons, Sym2.mem_iff]
state_before: case cons
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v w : V
huv : Adj G u v
p : Walk G v w
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, v) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ v ≠ w → x ≠ v ∧ x ≠ w
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges (cons huv p))) ↔ u ≠ w → x ≠ u ∧ x ≠ w

tactic: split_ifs with h
state_before: case cons
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v w : V
huv : Adj G u v
p : Walk G v w
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, v) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ v ≠ w → x ≠ v ∧ x ≠ w
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges p) + if decide (x = u ∨ x = v) = true then 1 else 0) ↔
    ¬u = w → ¬x = u ∧ ¬x = w

tactic: rw [decide_eq_true_eq] at h
state_before: case cons.inl
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v w : V
huv : Adj G u v
p : Walk G v w
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, v) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ v ≠ w → x ≠ v ∧ x ≠ w
h : decide (x = u ∨ x = v) = true
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges p) + 1) ↔ ¬u = w → ¬x = u ∧ ¬x = w

tactic: obtain (rfl | rfl) := h
state_before: case cons.inl
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v w : V
huv : Adj G u v
p : Walk G v w
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, v) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ v ≠ w → x ≠ v ∧ x ≠ w
h : x = u ∨ x = v
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges p) + 1) ↔ ¬u = w → ¬x = u ∧ ¬x = w

tactic: rw [Nat.even_add_one, ih]
state_before: case cons.inl.inl
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u v✝ : V
p✝ : Walk G u v✝
ht✝ : IsTrail p✝
x v w : V
p : Walk G v w
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ v ≠ w → x ≠ v ∧ x ≠ w
huv : Adj G x v
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (x, v) ∈ edges p
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges p) + 1) ↔ ¬x = w → ¬x = x ∧ ¬x = w

tactic: simp only [huv.ne, imp_false, Ne.def, not_false_iff, true_and_iff, not_forall,
  Classical.not_not, exists_prop, eq_self_iff_true, not_true, false_and_iff,
  and_iff_right_iff_imp]
state_before: case cons.inl.inl
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u v✝ : V
p✝ : Walk G u v✝
ht✝ : IsTrail p✝
x v w : V
p : Walk G v w
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ v ≠ w → x ≠ v ∧ x ≠ w
huv : Adj G x v
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (x, v) ∈ edges p
⊢ ¬(v ≠ w → x ≠ v ∧ x ≠ w) ↔ ¬x = w → ¬x = x ∧ ¬x = w

tactic: rintro rfl rfl
state_before: case cons.inl.inl
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u v✝ : V
p✝ : Walk G u v✝
ht✝ : IsTrail p✝
x v w : V
p : Walk G v w
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ v ≠ w → x ≠ v ∧ x ≠ w
huv : Adj G x v
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (x, v) ∈ edges p
⊢ x = w → ¬v = w

tactic: exact G.loopless _ huv
state_before: case cons.inl.inl
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u v✝ : V
p✝ : Walk G u v✝
ht✝ : IsTrail p✝
v : V
huv : Adj G v v
p : Walk G v v
ih : Even (List.countp (fun e => decide (v ∈ e)) (edges p)) ↔ v ≠ v → v ≠ v ∧ v ≠ v
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (v, v) ∈ edges p
⊢ False

tactic: rw [Nat.even_add_one, ih, ← not_iff_not]
state_before: case cons.inl.inr
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v : V
p✝ : Walk G u✝ v
ht✝ : IsTrail p✝
x u w : V
huv : Adj G u x
p : Walk G x w
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, x) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ x ≠ w → x ≠ x ∧ x ≠ w
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges p) + 1) ↔ ¬u = w → ¬x = u ∧ ¬x = w

tactic: simp only [huv.ne.symm, Ne.def, eq_self_iff_true, not_true, false_and_iff, not_forall,
  not_false_iff, exists_prop, and_true_iff, Classical.not_not, true_and_iff, iff_and_self]
state_before: case cons.inl.inr
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v : V
p✝ : Walk G u✝ v
ht✝ : IsTrail p✝
x u w : V
huv : Adj G u x
p : Walk G x w
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, x) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ x ≠ w → x ≠ x ∧ x ≠ w
⊢ ¬¬(x ≠ w → x ≠ x ∧ x ≠ w) ↔ ¬(¬u = w → ¬x = u ∧ ¬x = w)

tactic: rintro rfl
state_before: case cons.inl.inr
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v : V
p✝ : Walk G u✝ v
ht✝ : IsTrail p✝
x u w : V
huv : Adj G u x
p : Walk G x w
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, x) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ x ≠ w → x ≠ x ∧ x ≠ w
⊢ x = w → ¬u = w

tactic: exact huv.ne
state_before: case cons.inl.inr
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v : V
p✝ : Walk G u✝ v
ht✝ : IsTrail p✝
x u : V
huv : Adj G u x
p : Walk G x x
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, x) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ x ≠ x → x ≠ x ∧ x ≠ x
⊢ ¬u = x

tactic: rw [decide_eq_true_eq, not_or] at h
state_before: case cons.inr
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v w : V
huv : Adj G u v
p : Walk G v w
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, v) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ v ≠ w → x ≠ v ∧ x ≠ w
h : ¬decide (x = u ∨ x = v) = true
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges p) + 0) ↔ ¬u = w → ¬x = u ∧ ¬x = w

tactic: simp only [h.1, h.2, not_false_iff, true_and_iff, add_zero, Ne.def] at ih⊢
state_before: case cons.inr
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v w : V
huv : Adj G u v
p : Walk G v w
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, v) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ v ≠ w → x ≠ v ∧ x ≠ w
h : ¬x = u ∧ ¬x = v
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges p) + 0) ↔ ¬u = w → ¬x = u ∧ ¬x = w

tactic: rw [ih]
state_before: case cons.inr
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v w : V
huv : Adj G u v
p : Walk G v w
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, v) ∈ edges p
h : ¬x = u ∧ ¬x = v
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ ¬v = w → ¬x = w
⊢ Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ ¬u = w → ¬x = w

tactic: rintro h' h'' rfl
state_before: case cons.inr.mpr
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v w : V
huv : Adj G u v
p : Walk G v w
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, v) ∈ edges p
h : ¬x = u ∧ ¬x = v
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ ¬v = w → ¬x = w
⊢ (¬u = w → ¬x = w) → ¬v = w → ¬x = w

tactic: simp only [imp_false, eq_self_iff_true, not_true, Classical.not_not] at h'
state_before: case cons.inr.mpr
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v : V
huv : Adj G u v
h : ¬x = u ∧ ¬x = v
p : Walk G v x
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, v) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ ¬v = x → ¬x = x
h' : ¬u = x → ¬x = x
h'' : ¬v = x
⊢ False

tactic: cases h'
state_before: case cons.inr.mpr
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u✝ v✝ : V
p✝ : Walk G u✝ v✝
ht✝ : IsTrail p✝
x u v : V
huv : Adj G u v
h : ¬x = u ∧ ¬x = v
p : Walk G v x
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (u, v) ∈ edges p
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ ¬v = x → ¬x = x
h'' : ¬v = x
h' : u = x
⊢ False

tactic: simp only [not_true, and_false, false_and] at h
state_before: case cons.inr.mpr.refl
V : Type u_1
G : SimpleGraph V
inst✝ : DecidableEq V
u v✝ : V
p✝ : Walk G u v✝
ht✝ : IsTrail p✝
x v : V
p : Walk G v x
ih : Even (List.countp (fun e => decide (x ∈ e)) (edges p)) ↔ ¬v = x → ¬x = x
h'' : ¬v = x
huv : Adj G x v
h : ¬x = x ∧ ¬x = v
ht : IsTrail p ∧ ¬Quotient.mk (Sym2.Rel.setoid V) (x, v) ∈ edges p
⊢ False