Section GraphTheory_basic1.
Context {G : GRAPH.t}.
#[local] Notation V := G.(vertices).
#[local] Notation E := G.(edges).
#[local] Notation In := L.In.
#[local] Infix "\in" := E.In : type_scope.
Inductive walk (v : V) : V -> list V -> Prop :=
| walk_refl
: v ~~~[ [] ]~~> v
| walk_step (v0 : V) (v1 : V) (w : list V)
(H_edge : (v0, v1) \in E)
(H_walk : v1 ~~~[ w ]~~> v)
: v0 ~~~[ v1 :: w ]~~> v
where " src ~~~[ w ]~~> tgt " := (walk tgt src w) : type_scope.
#[local] Hint Constructors walk : core.
Inductive path (v : V) : V -> list V -> Prop :=
| path_refl
: v ---[ [] ]--> v
| path_step (v0 : V) (v1 : V) (p : list V)
(H_edge : (v0, v1) \in E)
(H_path : v1 ---[ p ]--> v)
(NOT_IN : ~ In v1 p)
: v0 ---[ v1 :: p ]--> v
where " src ---[ p ]--> tgt " := (path tgt src p) : type_scope.
#[local] Hint Constructors path : core.
Proof with eauto.
split.
- intros H_path. split.
+ induction H_path; simpl...
+ eapply path_vertices_no_dup...
- intros [H_walk NO_DUP].
eapply no_dup_walk_is_path...
Qed.

Lemma path_app_inv (v0 : V) (v' : V) (vs1 : list V) (vs2 : list V)
(PATH : v0 ---[ vs1 ++ vs2 ]--> v')
: exists v, v0 ---[ vs1 ]--> v /\ v ---[ vs2 ]--> v'.