@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44Authors: Kyle Miller
55-/
66import Mathlib.Combinatorics.SimpleGraph.Maps
7+ import Mathlib.Data.List.Lemmas
78
89/-!
910
@@ -499,6 +500,17 @@ theorem support_reverse {u v : V} (p : G.Walk u v) : p.reverse.support = p.suppo
499500@[simp]
500501theorem support_ne_nil {u v : V} (p : G.Walk u v) : p.support ≠ [] := by cases p <;> simp
501502
503+ @[simp]
504+ theorem head_support {G : SimpleGraph V} {a b : V} (p : G.Walk a b) :
505+ p.support.head (by simp) = a := by cases p <;> simp
506+
507+ @[simp]
508+ theorem getLast_support {G : SimpleGraph V} {a b : V} (p : G.Walk a b) :
509+ p.support.getLast (by simp) = b := by
510+ induction p
511+ · simp
512+ · simpa
513+
502514theorem tail_support_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) :
503515 (p.append p').support.tail = p.support.tail ++ p'.support.tail := by
504516 rw [support_append, List.tail_append_of_ne_nil _ _ (support_ne_nil _)]
@@ -641,6 +653,21 @@ theorem map_fst_darts_append {u v : V} (p : G.Walk u v) :
641653theorem map_fst_darts {u v : V} (p : G.Walk u v) : p.darts.map (·.fst) = p.support.dropLast := by
642654 simpa! using congr_arg List.dropLast (map_fst_darts_append p)
643655
656+ @[simp]
657+ theorem head_darts_fst {G : SimpleGraph V} {a b : V} (p : G.Walk a b) (hp : p.darts ≠ []) :
658+ (p.darts.head hp).fst = a := by
659+ cases p
660+ · contradiction
661+ · simp
662+
663+ @[simp]
664+ theorem getLast_darts_snd {G : SimpleGraph V} {a b : V} (p : G.Walk a b) (hp : p.darts ≠ []) :
665+ (p.darts.getLast hp).snd = b := by
666+ rw [← List.getLast_map (f := fun x : G.Dart ↦ x.snd)]
667+ simp_rw [p.map_snd_darts, List.getLast_tail]
668+ exact p.getLast_support
669+ simpa
670+
644671@[simp]
645672theorem edges_nil {u : V} : (nil : G.Walk u u).edges = [] := rfl
646673
0 commit comments