The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V30. Combinatorics

Mathlib.Combinatorics.SimpleGraph.Walk.Basic

133 declarations and 2 deprecated aliases. Mathlib docs · Source

Walks

In a simple graph, a walk is a finite sequence of adjacent vertices, and can be thought of equally well as a sequence of directed edges.

Warning: graph theorists mean something different by "path" than do homotopy theorists. A "walk" in graph theory is a "path" in homotopy theory. Another warning: some graph theorists use "path" and "simple path" for "walk" and "path."

Some definitions and theorems have inspiration from multigraph counterparts in [Chou1994].

Main definitions

  • SimpleGraph.Walk (with accompanying pattern definitions SimpleGraph.Walk.nil' and SimpleGraph.Walk.cons')
  • SimpleGraph.Walk.Nil: A predicate for the empty walk
  • SimpleGraph.Walk.length: The length of a walk
  • SimpleGraph.Walk.support: The list of vertices a walk visits in order
  • SimpleGraph.Walk.darts: The list of darts a walk visits in order
  • SimpleGraph.Walk.edges: The list of edges a walk visits in order
  • SimpleGraph.Walk.edgeSet: The set of edges of a walk visits

Tags

walks

theorem SimpleGraph.Walk.length.hcongr_5 E1 #

∀ (V V' : Type u),
  V = V' →
    ∀ (G : SimpleGraph V) (G' : SimpleGraph V'),
      G ≍ G' →
        ∀ (u : V) (u' : V'),
          u ≍ u' → ∀ (v : V) (v' : V'), v ≍ v' → ∀ (a : G.Walk u v) (a' : G'.Walk u' v'), a ≍ a' → a.length ≍ a'.length

theorem SimpleGraph.Walk.cons.injEq E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (h : G.Adj u v) (p : G.Walk v w) (v_1 : V) (h_1 : G.Adj u v_1)
  (p_1 : G.Walk v_1 w), (SimpleGraph.Walk.cons h p = SimpleGraph.Walk.cons h_1 p_1) = (v = v_1 ∧ p ≍ p_1)

theorem SimpleGraph.Walk.cons.hinj E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} {h : G.Adj u v} {p : G.Walk v w} {V_1 : Type u} {G_1 : SimpleGraph V_1}
  {u_1 v_1 w_1 : V_1} {h_1 : G_1.Adj u_1 v_1} {p_1 : G_1.Walk v_1 w_1},
  V = V_1 →
    G ≍ G_1 →
      u ≍ u_1 →
        w ≍ w_1 →
          SimpleGraph.Walk.cons h p ≍ SimpleGraph.Walk.cons h_1 p_1 →
            V = V_1 ∧ G ≍ G_1 ∧ u ≍ u_1 ∧ v ≍ v_1 ∧ w ≍ w_1 ∧ p ≍ p_1

theorem SimpleGraph.Adj.toWalk.congr_simp E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (h : G.Adj u v), h.toWalk = h.toWalk

theorem SimpleGraph.Walk.cons.inj E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} {h : G.Adj u v} {p : G.Walk v w} {v_1 : V} {h_1 : G.Adj u v_1}
  {p_1 : G.Walk v_1 w}, SimpleGraph.Walk.cons h p = SimpleGraph.Walk.cons h_1 p_1 → v = v_1 ∧ p ≍ p_1

theorem SimpleGraph.Walk.nil.hinj E1 #

∀ {V : Type u} {G : SimpleGraph V} {u : V} {V_1 : Type u} {G_1 : SimpleGraph V_1} {u_1 : V_1},
  V = V_1 → G ≍ G_1 → u ≍ u_1 → u ≍ u_1 → SimpleGraph.Walk.nil ≍ SimpleGraph.Walk.nil → V = V_1 ∧ G ≍ G_1 ∧ u ≍ u_1

abbrev SimpleGraph.Walk.ctorElimType E1 #

{V : Type u} →
  {G : SimpleGraph V} →
    {motive : (a a_1 : V) → G.Walk a a_1 → Sort u_1} →
      ℕ → Sort (max 1 (imax (u + 1) u_1) (imax (u + 1) (u + 1) (u + 1) (u + 1) u_1))

theorem SimpleGraph.Walk.cons'.congr_simp E1 #

∀ {V : Type u} {G : SimpleGraph V} (u v w : V) (h : G.Adj u v) (p p_1 : G.Walk v w),
  p = p_1 → SimpleGraph.Walk.cons' u v w h p = SimpleGraph.Walk.cons' u v w h p_1

theorem SimpleGraph.Walk.cons.congr_simp E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (h : G.Adj u v) (p p_1 : G.Walk v w),
  p = p_1 → SimpleGraph.Walk.cons h p = SimpleGraph.Walk.cons h p_1

theorem SimpleGraph.Walk.brecOn.eq E1 #

∀ {V : Type u} {G : SimpleGraph V} {motive : (a a_1 : V) → G.Walk a a_1 → Sort u_1} {a a_1 : V} (t : G.Walk a a_1)
  (F_1 : (a a_2 : V) → (t : G.Walk a a_2) → SimpleGraph.Walk.below t → motive a a_2 t),
  SimpleGraph.Walk.brecOn t F_1 = F_1 a a_1 t (SimpleGraph.Walk.brecOn.go t F_1).2

abbrev SimpleGraph.Walk.brecOn.go E1 #

{V : Type u} →
  {G : SimpleGraph V} →
    {motive : (a a_1 : V) → G.Walk a a_1 → Sort u_1} →
      {a a_1 : V} →
        (t : G.Walk a a_1) →
          ((a a_2 : V) → (t : G.Walk a a_2) → SimpleGraph.Walk.below t → motive a a_2 t) →
            motive a a_1 t ×' SimpleGraph.Walk.below t

theorem SimpleGraph.Walk.ofDarts.congr_simp E1 #

∀ {V : Type u} {G : SimpleGraph V} (l : List G.Dart) (hne : l ≠ []) (hchain : List.IsChain G.DartAdj l),
  SimpleGraph.Walk.ofDarts l hne hchain = SimpleGraph.Walk.ofDarts l hne hchain

theorem SimpleGraph.Walk.nil.hcongr_3 E1 #

∀ (V V' : Type u),
  V = V' →
    ∀ (G : SimpleGraph V) (G' : SimpleGraph V'),
      G ≍ G' → ∀ (u : V) (u' : V'), u ≍ u' → SimpleGraph.Walk.nil ≍ SimpleGraph.Walk.nil

theorem SimpleGraph.Walk.ofSupport.congr_simp E1 #

∀ {V : Type u} {G : SimpleGraph V} (l : List V) (hne : l ≠ []) (hchain : List.IsChain G.Adj l),
  SimpleGraph.Walk.ofSupport l hne hchain = SimpleGraph.Walk.ofSupport l hne hchain

def SimpleGraph.Walk.ctorIdx E1 #

{V : Type u} → {G : SimpleGraph V} → {a a_1 : V} → G.Walk a a_1 → ℕ

theorem SimpleGraph.Walk.cons.hcongr_7 E1 #

∀ (V V' : Type u),
  V = V' →
    ∀ (G : SimpleGraph V) (G' : SimpleGraph V'),
      G ≍ G' →
        ∀ (u : V) (u' : V'),
          u ≍ u' →
            ∀ (v : V) (v' : V'),
              v ≍ v' →
                ∀ (w : V) (w' : V'),
                  w ≍ w' →
                    ∀ (h : G.Adj u v) (h' : G'.Adj u' v'),
                      h ≍ h' →
                        ∀ (p : G.Walk v w) (p' : G'.Walk v' w'),
                          p ≍ p' → SimpleGraph.Walk.cons h p ≍ SimpleGraph.Walk.cons h' p'

inductive SimpleGraph.Walk E3 #

{V : Type u} → SimpleGraph V → V → V → Type u

A walk is a sequence of adjacent vertices. For vertices u v : V, the type walk u v consists of all walks starting at u and ending at v.

We say that a walk visits the vertices it contains. The set of vertices a walk visits is SimpleGraph.Walk.support.

See SimpleGraph.Walk.nil' and SimpleGraph.Walk.cons' for patterns that can be useful in definitions since they make the vertices explicit.

ctor SimpleGraph.Walk.nil E0 #

{V : Type u} → {G : SimpleGraph V} → {u : V} → G.Walk u u

ctor SimpleGraph.Walk.cons E0 #

{V : Type u} → {G : SimpleGraph V} → {u v w : V} → G.Adj u v → G.Walk v w → G.Walk u w

instance SimpleGraph.instDecidableEqWalk E0 #

{V : Type u_1} → {G : SimpleGraph V} → {a a_1 : V} → [DecidableEq V] → DecidableEq (G.Walk a a_1)

def SimpleGraph.instDecidableEqWalk.decEq E1 #

{V : Type u_1} → {G : SimpleGraph V} → {a a_1 : V} → [DecidableEq V] → (x x_1 : G.Walk a a_1) → Decidable (x = x_1)

theorem SimpleGraph.Walk.default_def E0 #

∀ {V : Type u} (G : SimpleGraph V) (v : V), default = SimpleGraph.Walk.nil

instance SimpleGraph.Walk.instInhabited E0 #

{V : Type u} → (G : SimpleGraph V) → (v : V) → Inhabited (G.Walk v v)

def SimpleGraph.Adj.toWalk E1 #

{V : Type u} → {G : SimpleGraph V} → {u v : V} → G.Adj u v → G.Walk u v

The one-edge walk associated to a pair of adjacent vertices.

abbrev SimpleGraph.Walk.nil' E3 #

{V : Type u} → {G : SimpleGraph V} → (u : V) → G.Walk u u

Pattern to get Walk.nil with the vertex as an explicit argument.

abbrev SimpleGraph.Walk.cons' E3 #

{V : Type u} → {G : SimpleGraph V} → (u v w : V) → G.Adj u v → G.Walk v w → G.Walk u w

Pattern to get Walk.cons with the vertices as explicit arguments.

theorem SimpleGraph.Walk.exists_eq_cons_of_ne E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V},
  u ≠ v → ∀ (p : G.Walk u v), ∃ w, ∃ (h : G.Adj u w), ∃ p', p = SimpleGraph.Walk.cons h p'

def SimpleGraph.Walk.length E3 #

{V : Type u} → {G : SimpleGraph V} → {u v : V} → G.Walk u v → ℕ

The length of a walk is the number of edges/darts along it.

theorem SimpleGraph.Walk.length_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} {u : V}, SimpleGraph.Walk.nil.length = 0

theorem SimpleGraph.Walk.length_cons E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (h : G.Adj u v) (p : G.Walk v w),
  (SimpleGraph.Walk.cons h p).length = p.length + 1

theorem SimpleGraph.Adj.length_toWalk E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (h : G.Adj u v), h.toWalk.length = 1

theorem SimpleGraph.Walk.adj_of_length_eq_one E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v}, p.length = 1 → G.Adj u v

theorem SimpleGraph.Walk.length_ne_one E1 #

∀ {V : Type u} {G : SimpleGraph V} {v : V} (p : G.Walk v v), p.length ≠ 1

theorem SimpleGraph.Walk.exists_length_eq_zero_iff E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V}, (∃ p, p.length = 0) ↔ u = v

theorem SimpleGraph.Walk.exists_length_eq_one_iff E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V}, (∃ p, p.length = 1) ↔ G.Adj u v

def SimpleGraph.Walk.support E3 #

{V : Type u} → {G : SimpleGraph V} → {u v : V} → G.Walk u v → List V

The support of a walk is the list of vertices it visits in order.

def SimpleGraph.Walk.darts E3 #

{V : Type u} → {G : SimpleGraph V} → {u v : V} → G.Walk u v → List G.Dart

The darts of a walk is the list of darts it visits in order.

def SimpleGraph.Walk.edges E3 #

{V : Type u} → {G : SimpleGraph V} → {u v : V} → G.Walk u v → List (Sym2 V)

The edges of a walk is the list of edges it visits in order. This is defined to be the list of edges underlying SimpleGraph.Walk.darts.

theorem SimpleGraph.Walk.edges_eq_map_darts E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), p.edges = List.map SimpleGraph.Dart.edge p.darts

theorem SimpleGraph.Walk.support_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} {u : V}, SimpleGraph.Walk.nil.support = [u]

theorem SimpleGraph.Walk.support_cons E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (h : G.Adj u v) (p : G.Walk v w),
  (SimpleGraph.Walk.cons h p).support = u :: p.support

theorem SimpleGraph.Adj.support_toWalk E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (h : G.Adj u v), h.toWalk.support = [u, v]

theorem SimpleGraph.Walk.support_ne_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), p.support ≠ []

theorem SimpleGraph.Walk.head_support E0 #

∀ {V : Type u} {G : SimpleGraph V} {a b : V} (p : G.Walk a b), p.support.head ⋯ = a

theorem SimpleGraph.Walk.getLast_support E0 #

∀ {V : Type u} {G : SimpleGraph V} {a b : V} (p : G.Walk a b), p.support.getLast ⋯ = b

theorem SimpleGraph.Walk.cons_tail_support E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), u :: p.support.tail = p.support

theorem SimpleGraph.Walk.start_mem_support E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), u ∈ p.support

theorem SimpleGraph.Walk.end_mem_support E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), v ∈ p.support

theorem SimpleGraph.Walk.support_nonempty E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), {w | w ∈ p.support}.Nonempty

theorem SimpleGraph.Walk.mem_support_iff E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (p : G.Walk u v), w ∈ p.support ↔ w = u ∨ w ∈ p.support.tail

theorem SimpleGraph.Walk.mem_support_nil_iff E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V}, u ∈ SimpleGraph.Walk.nil.support ↔ u = v

theorem SimpleGraph.Walk.end_mem_tail_support_of_ne E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V}, u ≠ v → ∀ (p : G.Walk u v), v ∈ p.support.tail

theorem SimpleGraph.Walk.support_suffix_support_cons E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (p : G.Walk v w) (hadj : G.Adj u v),
  p.support <:+ (SimpleGraph.Walk.cons hadj p).support

theorem SimpleGraph.Walk.support_subset_support_cons E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (p : G.Walk v w) (hadj : G.Adj u v),
  p.support ⊆ (SimpleGraph.Walk.cons hadj p).support

theorem SimpleGraph.Walk.coe_support E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), ↑p.support = {u} + ↑p.support.tail

theorem SimpleGraph.Walk.isChain_adj_cons_support E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V}, G.Adj u v → ∀ (p : G.Walk v w), List.IsChain G.Adj (u :: p.support)

theorem SimpleGraph.Walk.isChain_adj_support E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), List.IsChain G.Adj p.support

theorem SimpleGraph.Walk.isChain_dartAdj_cons_darts E1 #

∀ {V : Type u} {G : SimpleGraph V} {d : G.Dart} {v w : V},
  d.toProd.2 = v → ∀ (p : G.Walk v w), List.IsChain G.DartAdj (d :: p.darts)

theorem SimpleGraph.Walk.isChain_dartAdj_darts E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), List.IsChain G.DartAdj p.darts

theorem SimpleGraph.Walk.edges_subset_edgeSet E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) ⦃e : Sym2 V⦄, e ∈ p.edges → e ∈ G.edgeSet

Every edge in a walk's edge list is an edge of the graph. It is written in this form (rather than using ⊆) to avoid unsightly coercions.

theorem SimpleGraph.Walk.adj_of_mem_edges E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v x y : V} (p : G.Walk u v), s(x, y) ∈ p.edges → G.Adj x y

theorem SimpleGraph.Walk.darts_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} {u : V}, SimpleGraph.Walk.nil.darts = []

theorem SimpleGraph.Walk.darts_cons E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (h : G.Adj u v) (p : G.Walk v w),
  (SimpleGraph.Walk.cons h p).darts = { fst := u, snd := v, adj := h } :: p.darts

theorem SimpleGraph.Adj.darts_toWalk E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (h : G.Adj u v), h.toWalk.darts = [{ fst := u, snd := v, adj := h }]

theorem SimpleGraph.Walk.cons_map_snd_darts E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), u :: List.map (fun x ↦ x.toProd.2) p.darts = p.support

theorem SimpleGraph.Walk.map_snd_darts E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), List.map (fun x ↦ x.toProd.2) p.darts = p.support.tail

theorem SimpleGraph.Walk.map_fst_darts_append E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), List.map (fun x ↦ x.toProd.1) p.darts ++ [v] = p.support

theorem SimpleGraph.Walk.map_fst_darts E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v),
  List.map (fun x ↦ x.toProd.1) p.darts = p.support.dropLast

theorem SimpleGraph.Walk.edges_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} {u : V}, SimpleGraph.Walk.nil.edges = []

theorem SimpleGraph.Walk.edges_cons E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (h : G.Adj u v) (p : G.Walk v w),
  (SimpleGraph.Walk.cons h p).edges = s(u, v) :: p.edges

theorem SimpleGraph.Adj.edges_toWalk E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (h : G.Adj u v), h.toWalk.edges = [s(u, v)]

theorem SimpleGraph.Walk.length_support E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), p.support.length = p.length + 1

theorem SimpleGraph.Walk.length_darts E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), p.darts.length = p.length

theorem SimpleGraph.Walk.length_edges E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), p.edges.length = p.length

theorem SimpleGraph.Walk.edge_mem_edges_of_mem_darts E1 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} {d : G.Dart} {p : G.Walk v w}, d ∈ p.darts → d.edge ∈ p.edges

theorem SimpleGraph.Walk.getElem_edges_eq_edge_getElem_darts E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} {i : ℕ} (h : i < p.edges.length),
  p.edges[i] = p.darts[i].edge

Use edge_getElem_darts to rewrite in the reverse direction.

theorem SimpleGraph.Walk.edge_getElem_darts E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} {i : ℕ} (h : i < p.darts.length),
  p.darts[i].edge = p.edges[i]

Use getElem_edges_eq_edge_getElem_darts to rewrite in the reverse direction.

theorem SimpleGraph.Walk.fst_darts_getElem E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} {i : ℕ} (hi : i < p.darts.length),
  p.darts[i].toProd.1 = p.support.dropLast[i]

theorem SimpleGraph.Walk.snd_darts_getElem E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} {i : ℕ} (hi : i < p.darts.length),
  p.darts[i].toProd.2 = p.support.tail[i]

theorem SimpleGraph.Walk.support_getElem_zero E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), p.support[0] = u

theorem SimpleGraph.Walk.support_getElem_length E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), p.support[p.length] = v

theorem SimpleGraph.Walk.mem_darts_iff_infix_support E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v u' v' : V} {p : G.Walk u v} (h : G.Adj u' v'),
  { fst := u', snd := v', adj := h } ∈ p.darts ↔ [u', v'] <:+: p.support

theorem SimpleGraph.Walk.mem_darts_iff_fst_snd_infix_support E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} {d : G.Dart},
  d ∈ p.darts ↔ [d.toProd.1, d.toProd.2] <:+: p.support

theorem SimpleGraph.Walk.dart_fst_mem_support_of_mem_darts E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) {d : G.Dart}, d ∈ p.darts → d.toProd.1 ∈ p.support

theorem SimpleGraph.Walk.mem_support_iff_exists_mem_edges E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} {p : G.Walk u v}, w ∈ p.support ↔ w = v ∨ ∃ e ∈ p.edges, w ∈ e

theorem SimpleGraph.Walk.darts_nodup_of_support_nodup E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v}, p.support.Nodup → p.darts.Nodup

theorem SimpleGraph.Walk.edges_eq_zipWith_support E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v},
  p.edges = List.zipWith (fun x1 x2 ↦ s(x1, x2)) p.support p.support.tail

theorem SimpleGraph.Walk.edges_injective E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V}, Function.Injective SimpleGraph.Walk.edges

theorem SimpleGraph.Walk.darts_injective E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V}, Function.Injective SimpleGraph.Walk.darts

def SimpleGraph.Walk.edgeSet E3 #

{V : Type u} → {G : SimpleGraph V} → {u v : V} → G.Walk u v → Set (Sym2 V)

The Set of edges of a walk.

theorem SimpleGraph.Walk.mem_edgeSet E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} {e : Sym2 V}, e ∈ p.edgeSet ↔ e ∈ p.edges

theorem SimpleGraph.Walk.edgeSet_subset_edgeSet E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), p.edgeSet ⊆ G.edgeSet

theorem SimpleGraph.Walk.edgeSet_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} (u : V), SimpleGraph.Walk.nil.edgeSet = ∅

theorem SimpleGraph.Walk.edgeSet_cons E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (h : G.Adj u v) (p : G.Walk v w),
  (SimpleGraph.Walk.cons h p).edgeSet = insert s(u, v) p.edgeSet

theorem SimpleGraph.Walk.coe_edges_toFinset E0 #

∀ {V : Type u} {G : SimpleGraph V} [inst : DecidableEq V] {u v : V} (p : G.Walk u v), ↑p.edges.toFinset = p.edgeSet

theorem SimpleGraph.Walk.finite_edgeSet E1 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} (p : G.Walk v w), p.edgeSet.Finite

def SimpleGraph.Walk.fintypeEdgeSet E1 #

{V : Type u} → {G : SimpleGraph V} → {v w : V} → [DecidableEq V] → (p : G.Walk v w) → Fintype ↑p.edgeSet

The edge set of a walk is a Fintype.

inductive SimpleGraph.Walk.Nil E3 #

{V : Type u} → {G : SimpleGraph V} → {v w : V} → G.Walk v w → Prop

Predicate for the empty walk.

Solves the dependent type problem where p = G.Walk.nil typechecks only if p has defeq endpoints.

ctor SimpleGraph.Walk.Nil.nil E0 #

∀ {V : Type u} {G : SimpleGraph V} {u : V}, SimpleGraph.Walk.nil.Nil

theorem SimpleGraph.Walk.nil_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} {u : V}, SimpleGraph.Walk.nil.Nil

theorem SimpleGraph.Walk.not_nil_cons E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} {h : G.Adj u v} {p : G.Walk v w}, ¬(SimpleGraph.Walk.cons h p).Nil

instance SimpleGraph.Walk.instDecidableNil E0 #

{V : Type u} → {G : SimpleGraph V} → {v w : V} → (p : G.Walk v w) → Decidable p.Nil

theorem SimpleGraph.Walk.Nil.eq E1 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w}, p.Nil → v = w

theorem SimpleGraph.Walk.not_nil_of_ne E1 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w}, v ≠ w → ¬p.Nil

theorem SimpleGraph.Walk.nil_iff_support_eq E0 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w}, p.Nil ↔ p.support = [v]

theorem SimpleGraph.Walk.darts_eq_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w}, p.darts = [] ↔ p.Nil

theorem SimpleGraph.Walk.edges_eq_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w}, p.edges = [] ↔ p.Nil

theorem SimpleGraph.Walk.edgeSet_eq_empty E0 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w}, p.edgeSet = ∅ ↔ p.Nil

theorem SimpleGraph.Walk.length_eq_zero_iff E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v}, p.length = 0 ↔ p.Nil

theorem SimpleGraph.Walk.Nil.length_eq_zero E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v}, p.Nil → p.length = 0

Alias of the reverse direction of SimpleGraph.Walk.length_eq_zero_iff.

theorem SimpleGraph.Walk.not_nil_iff_lt_length E1 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w}, ¬p.Nil ↔ 0 < p.length

theorem SimpleGraph.Walk.not_nil_iff E0 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w},
  ¬p.Nil ↔ ∃ u, ∃ (h : G.Adj v u), ∃ q, p = SimpleGraph.Walk.cons h q

theorem SimpleGraph.Walk.nil_of_subsingleton E1 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} [Subsingleton V] (p : G.Walk v w), p.Nil

theorem SimpleGraph.Walk.nil_of_bot E1 #

∀ {V : Type u} {u v : V} (p : ⊥.Walk u v), p.Nil

theorem SimpleGraph.Walk.exists_nil_iff E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V}, (∃ p, p.Nil) ↔ u = v

def SimpleGraph.Walk.notNilRec E1 #

{V : Type u} →
  {G : SimpleGraph V} →
    {u w : V} →
      {motive : {u w : V} → (p : G.Walk u w) → ¬p.Nil → Sort u_1} →
        ({u v w : V} → (h : G.Adj u v) → (q : G.Walk v w) → motive (SimpleGraph.Walk.cons h q) ⋯) →
          (p : G.Walk u w) → (hp : ¬p.Nil) → motive p hp

The recursion principle for nonempty walks

theorem SimpleGraph.Walk.notNilRec_cons E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} {motive : {u w : V} → (p : G.Walk u w) → ¬p.Nil → Sort u_1}
  (cons : {u v w : V} → (h : G.Adj u v) → (q : G.Walk v w) → motive (SimpleGraph.Walk.cons h q) ⋯) (h' : G.Adj u v)
  (q' : G.Walk v w), SimpleGraph.Walk.notNilRec (fun {u v w} ↦ cons) (SimpleGraph.Walk.cons h' q') ⋯ = cons h' q'

theorem SimpleGraph.Walk.end_mem_tail_support E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v}, ¬p.Nil → v ∈ p.support.tail

theorem SimpleGraph.Walk.mem_support_iff_exists_mem_edges_of_not_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} {p : G.Walk u v}, ¬p.Nil → (w ∈ p.support ↔ ∃ e ∈ p.edges, w ∈ e)

theorem SimpleGraph.Walk.nil_of_isIsolated_of_mem_support E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v w : V} {p : G.Walk u v}, G.IsIsolated w → w ∈ p.support → p.Nil

theorem SimpleGraph.Walk.exists_boundary_dart E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) (S : Set V),
  u ∈ S → v ∉ S → ∃ d ∈ p.darts, d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S

Given a set S and a walk w from u to v such that u ∈ S but v ∉ S, there exists a dart in the walk whose start is in S but whose end is not.

def SimpleGraph.Walk.ofSupport E1 #

{V : Type u} →
  {G : SimpleGraph V} → (l : List V) → (hne : l ≠ []) → List.IsChain G.Adj l → G.Walk (l.head hne) (l.getLast hne)

Construct a walk from a list of vertices where adjacent vertices in the list are also adjacent in the graph

theorem SimpleGraph.Walk.ofSupport_singleton E0 #

∀ {V : Type u} (G : SimpleGraph V) (v : V), SimpleGraph.Walk.ofSupport [v] ⋯ ⋯ = SimpleGraph.Walk.nil

theorem SimpleGraph.Walk.ofSupport_cons_cons E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {l : List V} (hchain : List.IsChain G.Adj (u :: v :: l)),
  SimpleGraph.Walk.ofSupport (u :: v :: l) ⋯ hchain = SimpleGraph.Walk.cons ⋯ (SimpleGraph.Walk.ofSupport (v :: l) ⋯ ⋯)

theorem SimpleGraph.Walk.support_ofSupport E0 #

∀ {V : Type u} {G : SimpleGraph V} {l : List V} (hne : l ≠ []) (hchain : List.IsChain G.Adj l),
  (SimpleGraph.Walk.ofSupport l hne hchain).support = l

theorem SimpleGraph.Walk.length_ofSupport E0 #

∀ {V : Type u} {G : SimpleGraph V} {l : List V} (hne : l ≠ []) (hchain : List.IsChain G.Adj l),
  (SimpleGraph.Walk.ofSupport l hne hchain).length = l.length - 1

def SimpleGraph.Walk.ofDarts E1 #

{V : Type u} →
  {G : SimpleGraph V} →
    (l : List G.Dart) →
      (hne : l ≠ []) → List.IsChain G.DartAdj l → G.Walk (l.head hne).toProd.1 (l.getLast hne).toProd.2

Construct a walk from a list of darts where adjacent darts in the list are also adjacent in the graph

theorem SimpleGraph.Walk.ofDarts_singleton E0 #

∀ {V : Type u} {G : SimpleGraph V} (d : G.Dart),
  SimpleGraph.Walk.ofDarts [d] ⋯ ⋯ = SimpleGraph.Walk.cons ⋯ SimpleGraph.Walk.nil

theorem SimpleGraph.Walk.ofDarts_singleton' E1 #

∀ {V : Type u} {G : SimpleGraph V} (d : G.Dart), SimpleGraph.Walk.ofDarts [d] ⋯ ⋯ = ⋯.toWalk

theorem SimpleGraph.Walk.ofDarts_cons_cons E0 #

∀ {V : Type u} {G : SimpleGraph V} {d₁ d₂ : G.Dart} {l : List G.Dart} (hchain : List.IsChain G.DartAdj (d₁ :: d₂ :: l)),
  SimpleGraph.Walk.ofDarts (d₁ :: d₂ :: l) ⋯ hchain = SimpleGraph.Walk.cons ⋯ (SimpleGraph.Walk.ofDarts (d₂ :: l) ⋯ ⋯)

theorem SimpleGraph.Walk.darts_ofDarts E0 #

∀ {V : Type u} {G : SimpleGraph V} {l : List G.Dart} (hne : l ≠ []) (hchain : List.IsChain G.DartAdj l),
  (SimpleGraph.Walk.ofDarts l hne hchain).darts = l

theorem SimpleGraph.Walk.edges_ofDarts E0 #

∀ {V : Type u} {G : SimpleGraph V} {l : List G.Dart} (hne : l ≠ []) (hchain : List.IsChain G.DartAdj l),
  (SimpleGraph.Walk.ofDarts l hne hchain).edges = List.map SimpleGraph.Dart.edge l

theorem SimpleGraph.Walk.length_ofDarts E0 #

∀ {V : Type u} {G : SimpleGraph V} {l : List G.Dart} (hne : l ≠ []) (hchain : List.IsChain G.DartAdj l),
  (SimpleGraph.Walk.ofDarts l hne hchain).length = l.length

Deprecated aliases

NameNew nameSince
SimpleGraph.Walk.nil_iff_eq_nilSimpleGraph.Walk.eq_nil_iff_nil2026-05-11
SimpleGraph.Walk.nil_iff_length_eqSimpleGraph.Walk.length_eq_zero_iff2026-05-11