Cutting and closing up paths and cycles #
This file collects general facts about paths and cycles in a simple graph, complementing Mathlib's
Mathlib/Combinatorics/SimpleGraph/Paths.lean.
Main results #
SimpleGraph.Walk.IsPath.start_notMem_tail_support: a path does not return to its start.SimpleGraph.Walk.IsPath.exists_support_eq_cons_append: the support of a path between distinct endpoints splits asa :: (I ++ [b])with duplicate-free internal vertices and adjacent predecessor and successor sublists.SimpleGraph.Walk.IsCycle.isPath_append_of_append_append: cutting an arc of positive length out of a cycle leaves a path.SimpleGraph.Walk.mem_support_append_of_mem_support_append_append: the vertices of a closed walk outside the interior of such an arc lie on the remaining path.SimpleGraph.Walk.IsPath.isCycle_append_append_reverse: two paths from a common vertex close up with a third path into a cycle.SimpleGraph.Walk.IsPath.isCycle_cons_append_cons_reverse: two vertex-disjoint paths joined at both ends by distinct edges form a cycle.SimpleGraph.Walk.exists_eq_append_of_exists_mem_support: a walk meeting a finset splits at its first vertex in it.SimpleGraph.Walk.exists_eq_append_append_of_countP_lt: a walk starting inFwith fewer vertices ofT \ Fthan ofFhas an arc between consecutive vertices ofFwhose interior avoidsT.SimpleGraph.Walk.IsCycle.exists_eq_append_append: a cycle with fewer vertices ofToutsideFthan inFhas an arc between two distinct vertices ofFwhose interior avoidsT.SimpleGraph.exists_isPath_notMem_support_iff: every walk avoiding one vertex can be shortened to a path avoiding it.
A path does not return to its start.
Decompose the support of a path R : G.Walk a b between distinct endpoints a ≠ b as
a :: (I ++ [b]), where the internal-vertex list I is duplicate-free, contains neither endpoint,
and gives every vertex in I both an adjacent predecessor and an adjacent successor in
R.support.
Removing a subwalk of positive length from a cycle leaves a path: if W₁, A, W₂ traverse
a cycle in turn and A is not trivial, then W₂ followed by W₁ is a path.
If W₁, A, W₂ traverse a closed walk in turn, then every vertex of it that is not an
interior vertex of A lies on W₂ followed by W₁.
Two paths P and Q from x to distinct vertices a and b, sharing only x, close up
with a path R from b to a meeting them only at a and b into a cycle.
Two vertex-disjoint paths P from x to y and Q from x' to y', joined by distinct
edges s(x, x') and s(y', y), close up into a cycle through both edges.
A walk meeting a set F splits at its first vertex b in F: the first part has b as its
only vertex in F, occurring once.
Let W be a walk starting in F, with fewer vertices of T \ F than of F after its start,
counted with multiplicity. Then some subwalk A of W of positive length runs between two
vertices of F, has its end as its only vertex in F after its start, and has no vertex of T
other than its ends.
Let F be a set of at least two vertices of a cycle c starting in F, with fewer vertices
of T outside F than vertices in F. Then c has an arc between two distinct vertices of F
whose interior avoids T.