A path presented as a graph #
Schoenflies/Graph/Walk.lean says what it means for an edge list to run through a graph.
This file says what it means for a graph to be a path, and — the point of the file —
constructs one.
Why the object exists #
An ear is a path that gets glued onto a graph, so it has to be a graph itself, not a walk
inside one. Graph.IsPathGraph P u W v says that P's own edges, listed in the order W,
form a path from u to v and that P's vertices are exactly the ones that path visits.
The list W is an index of the predicate rather than an existential: its order is part
of the claim, and it is what lets every later argument cut the path at a vertex without first
having to sort anything.
Mathlib's Graph α β carries a Set β of edges, not a list, so the correspondence between
the two is a clause of the definition (Graph.IsPathGraph.edgeSet_eq) rather than something
a list-based graph would give for free.
Constructing one #
Graph.pathGraphOf G u W is the subgraph of G spanned by the walk W from u: the
vertices the walk visits, and its own edges. Everything else in the file is a hypothesis of
the form IsPathGraph; this is where one is produced, and it is what an ear decomposition
runs on — a path found inside a big graph has to be turned into a graph before it can be
unioned back in.
What the ear argument actually asks #
Always the same thing: whatever vertex is deleted, every remaining vertex of the path still
reaches one of the two ends (Graph.IsPathGraph.reaches_an_end). The proof is uniform in
the deleted vertex c, with no case split on whether c is an end, an interior vertex or
off the path at all:
- if
cis on the path, cut there (Graph.IsPath.split); each remaining vertex lies on one of the two halves, and a half runs to its far end without meeting the cut, because the split's last clause says the far half never returns to the source; - if
cis not on the path, cut at the vertex itself and reverse the near half.
Both branches go through the same two lemmas, Graph.IsPath.reaches_target_of_ne_source and
its mirror, so the interior case has no separate content.
Blueprint #
Graph.IsPathGraph— the object called "a pathP" in Lemmalem:subdivision-ear-preserve(b) ("ifPis a path whose distinct endpoints lie inG… thenG ∪ Pis 2-connected") and "an ear" in Lemmalem:relative-ear.Graph.IsPathGraph.reaches_an_end— the blueprint's "every component ofP - xis attached toG - xat one of the two endpoints ofP; whenxis an endpoint, the remainder ofPis attached at the other endpoint", both sentences at once.Graph.pathGraphOf— the "shortest path throughLbetween two such neighbors is an ear" oflem:relative-ear: a path of the ambient graph, presented as a graph.
Nothing here mentions 2-connectivity; the union of a 2-connected graph with an ear is a later module.
Namespace #
Root Graph, as fixed by Schoenflies/Graph/Walk.lean, so that h.reaches_an_end and
G.pathGraphOf u W resolve by dot notation.
Walks and vertex deletion #
Mathlib's Graph.deleteVerts takes a set; a single deleted vertex is {c}.
Pushing the visited set down an inclusion: a subgraph's edges have ends the big graph's
edges have too. This is the direction the freshness clause of a path travels in, and the
whole content of Graph.IsPath.anti.
A walk that never visits c survives the deletion of c. Every deletion argument in
the ear layer reduces to this.
Reversal does not change which vertices a walk visits — but it does change the source, so
this is not Graph.walkVertices_reverse, which keeps it.
Splitting the visited set along a concatenation. Purely about lists: no walk is needed,
and the middle vertex w is arbitrary.
Reaching an end of a path after a deletion #
A vertex of a path other than its source still reaches the target once the source is deleted: cut the path at the vertex, and the far half never returns to the source.
The mirror image, run on the reversed path.
Deleting any vertex leaves every other vertex of a path able to reach an end.
Uniform in the deleted vertex c: if c is on the path the path is cut there and each
remaining vertex sits on a half that runs to that half's far end; if c is off the path the
path is cut at the vertex itself and its near half, reversed, runs to the source.
A graph that is a path #
P.IsPathGraph u W v : the graph P is the path from u to v along W. Its own
edges are exactly the entries of W, and its vertices are exactly the ones that path visits.
The edge list is an index rather than an existential because its order is used: an argument
that deletes a vertex cuts W in two, and a graph whose edges were only a set would have to
recover the order first.
- isPath : P.IsPath u W v
The graph's own edges, in the given order, form a path from one end to the other.
The graph has no edges beyond that path's.
The graph has no vertices beyond the ones that path visits.
Instances For
A vertex of a path graph is visited by its path.
Conversely, whatever the path visits is a vertex.
A path graph read from the other end.
A path graph is connected: every vertex is visited, so the path's own prefix runs to it from the source.
Whatever vertex is deleted, every remaining vertex of a path graph still reaches one of its two ends. This is what the ear argument turns on: the ear's two ends are the only vertices it shares with the graph it is glued to, so a surviving vertex of the ear has to reach one of them inside the ear itself.
Constructing a path graph #
The subgraph of G spanned by the walk W from u: the vertices that walk visits,
carrying exactly the walk's own edges.
This is the construction an ear decomposition needs — a path found inside a big graph, turned
into a graph of its own so that it can be unioned back in. It is built from Mathlib's
Graph.domRestrict and Graph.induce, so that Graph.pathGraphOf_le is almost free.
Equations
- G.pathGraphOf u W = (G.restrict {e : β | e ∈ W}).induce (G.walkVertices u W)
Instances For
The spanned subgraph visits the same vertices as the ambient graph does along W: its
edges are the same edges, joining the same pairs. No walk is needed — an end of an edge of
W is visited by definition, so it survives the induced subgraph.
The walk runs inside the subgraph it spans.
The path runs inside the subgraph it spans.
A path of G spans a path graph. This is the construction the whole file exists
for: the object every Graph.IsPathGraph hypothesis elsewhere is discharged by.
Finiteness #
A walk visits finitely many vertices and takes finitely many edges, so the graph it spans is finite with no hypothesis on the ambient graph.
The graph spanned by a walk has finitely many vertices, whatever the ambient graph.
Stated as a Set.Finite rather than as a Graph.Finite instance so that this file does not
have to depend on Schoenflies/Graph/Degree.lean; the two halves build one in a line.