Theorem: Graph.redCons_eq_cons_of_reduced (GroupComp/Graph/ReducedPaths.lean)

State before:
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
hyp : reduced (cons e p)
⊢ redCons e p = cons e p
Tactic:
cases prepend_cases e p with
| inl h =>
    rw [h]
| inr h =>
    let ⟨t, h₁, h₂⟩ := h
    rw [h₁] at hyp
    have split :
      cons e (cons e.bar t) =
        (nil u : EdgePath G u u) ++
          cons e (cons e.bar t) := by
        simp [nil_append]
    have :¬ reduced (cons e (cons e.bar t)) := by
            apply not_reduced_of_split split
    contradiction
State after:
no goals

State before:
case inl
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
hyp : reduced (cons e p)
h : redCons e p = cons e p
⊢ redCons e p = cons e p
Tactic:
rw [h]
State after:
no goals

State before:
case inr
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
hyp : reduced (cons e p)
h : ∃ t, p = cons (EdgeBetween.bar e) t ∧ redCons e p = t
⊢ redCons e p = cons e p
Tactic:
let ⟨t, h₁, h₂⟩ := h
State after:
case inr
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
hyp : reduced (cons e p)
h : ∃ t, p = cons (EdgeBetween.bar e) t ∧ redCons e p = t
t : EdgePath G u w
h₁ : p = cons (EdgeBetween.bar e) t
h₂ : redCons e p = t
⊢ redCons e p = cons e p

State before:
case inr
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
hyp : reduced (cons e p)
h : ∃ t, p = cons (EdgeBetween.bar e) t ∧ redCons e p = t
t : EdgePath G u w
h₁ : p = cons (EdgeBetween.bar e) t
h₂ : redCons e p = t
⊢ redCons e p = cons e p
Tactic:
rw [h₁] at hyp
State after:
case inr
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
h : ∃ t, p = cons (EdgeBetween.bar e) t ∧ redCons e p = t
t : EdgePath G u w
hyp : reduced (cons e (cons (EdgeBetween.bar e) t))
h₁ : p = cons (EdgeBetween.bar e) t
h₂ : redCons e p = t
⊢ redCons e p = cons e p

State before:
case inr
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
h : ∃ t, p = cons (EdgeBetween.bar e) t ∧ redCons e p = t
t : EdgePath G u w
hyp : reduced (cons e (cons (EdgeBetween.bar e) t))
h₁ : p = cons (EdgeBetween.bar e) t
h₂ : redCons e p = t
⊢ redCons e p = cons e p
Tactic:
have split :
  cons e (cons e.bar t) =
    (nil u : EdgePath G u u) ++
      cons e (cons e.bar t) := by
    simp [nil_append]
State after:
case inr
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
h : ∃ t, p = cons (EdgeBetween.bar e) t ∧ redCons e p = t
t : EdgePath G u w
hyp : reduced (cons e (cons (EdgeBetween.bar e) t))
h₁ : p = cons (EdgeBetween.bar e) t
h₂ : redCons e p = t
split : cons e (cons (EdgeBetween.bar e) t) = nil u ++ cons e (cons (EdgeBetween.bar e) t)
⊢ redCons e p = cons e p

State before:
case inr
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
h : ∃ t, p = cons (EdgeBetween.bar e) t ∧ redCons e p = t
t : EdgePath G u w
hyp : reduced (cons e (cons (EdgeBetween.bar e) t))
h₁ : p = cons (EdgeBetween.bar e) t
h₂ : redCons e p = t
split : cons e (cons (EdgeBetween.bar e) t) = nil u ++ cons e (cons (EdgeBetween.bar e) t)
⊢ redCons e p = cons e p
Tactic:
have :¬ reduced (cons e (cons e.bar t)) := by
        apply not_reduced_of_split split
State after:
case inr
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
h : ∃ t, p = cons (EdgeBetween.bar e) t ∧ redCons e p = t
t : EdgePath G u w
hyp : reduced (cons e (cons (EdgeBetween.bar e) t))
h₁ : p = cons (EdgeBetween.bar e) t
h₂ : redCons e p = t
split : cons e (cons (EdgeBetween.bar e) t) = nil u ++ cons e (cons (EdgeBetween.bar e) t)
this : ¬reduced (cons e (cons (EdgeBetween.bar e) t))
⊢ redCons e p = cons e p

State before:
case inr
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
h : ∃ t, p = cons (EdgeBetween.bar e) t ∧ redCons e p = t
t : EdgePath G u w
hyp : reduced (cons e (cons (EdgeBetween.bar e) t))
h₁ : p = cons (EdgeBetween.bar e) t
h₂ : redCons e p = t
split : cons e (cons (EdgeBetween.bar e) t) = nil u ++ cons e (cons (EdgeBetween.bar e) t)
this : ¬reduced (cons e (cons (EdgeBetween.bar e) t))
⊢ redCons e p = cons e p
Tactic:
contradiction
State after:
no goals

State before:
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
h : ∃ t, p = cons (EdgeBetween.bar e) t ∧ redCons e p = t
t : EdgePath G u w
hyp : reduced (cons e (cons (EdgeBetween.bar e) t))
h₁ : p = cons (EdgeBetween.bar e) t
h₂ : redCons e p = t
⊢ cons e (cons (EdgeBetween.bar e) t) = nil u ++ cons e (cons (EdgeBetween.bar e) t)
Tactic:
simp [nil_append]
State after:
no goals

State before:
V : Type u
E : Type v
inst✝¹ : DecidableEq V
inst✝ : DecidableEq E
G : Graph V E
u v w : V
e : EdgeBetween G u v
p : EdgePath G v w
h : ∃ t, p = cons (EdgeBetween.bar e) t ∧ redCons e p = t
t : EdgePath G u w
hyp : reduced (cons e (cons (EdgeBetween.bar e) t))
h₁ : p = cons (EdgeBetween.bar e) t
h₂ : redCons e p = t
split : cons e (cons (EdgeBetween.bar e) t) = nil u ++ cons e (cons (EdgeBetween.bar e) t)
⊢ ¬reduced (cons e (cons (EdgeBetween.bar e) t))
Tactic:
apply not_reduced_of_split split
State after:
no goals