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.Maps

56 declarations and 3 deprecated aliases. Mathlib docs · Source

Mapping walks between graphs

Functions that map walks between different graphs.

Main definitions

  • SimpleGraph.Walk.map: The map on walks induced by a graph homomorphism
  • SimpleGraph.Walk.mapLe: Map a walk to a supergraph
  • SimpleGraph.Walk.transfer: Map a walk to another graph that contains its edges
  • SimpleGraph.Walk.induce: Map a walk that's fully contained in a set of vertices to the subgraph induced by that set
  • SimpleGraph.Walk.toDeleteEdges: Map a walk that avoids a set of edges to the subgraph with those edges deleted
  • SimpleGraph.Walk.toDeleteEdge: Map a walk that avoids an edge to the subgraph with that edge deleted

Tags

walks

Mapping walks

Transferring between graphs

Inducing a walk

Deleting edges

theorem SimpleGraph.Walk.mapLe.congr_simp E1 #

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

theorem SimpleGraph.Walk.transfer.congr_simp E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p p_1 : G.Walk u v) (e_p : p = p_1) (H : SimpleGraph V)
  (h : ∀ e ∈ p.edges, e ∈ H.edgeSet), p.transfer H h = p_1.transfer H ⋯

theorem SimpleGraph.Hom.ofLE.congr_simp E1 #

∀ {V : Type u_1} {G₁ G₂ : SimpleGraph V} (h : G₁ ≤ G₂), SimpleGraph.Hom.ofLE h = SimpleGraph.Hom.ofLE h

theorem SimpleGraph.Walk.map.hcongr_8 E1 #

∀ (V V' : Type u),
  V = V' →
    ∀ (V'_1 V'' : Type v),
      V'_1 = V'' →
        ∀ (G : SimpleGraph V) (G' : SimpleGraph V'),
          G ≍ G' →
            ∀ (G'_1 : SimpleGraph V'_1) (G'' : SimpleGraph V''),
              G'_1 ≍ G'' →
                ∀ (f : G →g G'_1) (f' : G' →g G''),
                  f ≍ f' →
                    ∀ (u : V) (u' : V'),
                      u ≍ u' →
                        ∀ (v : V) (v' : V'),
                          v ≍ v' →
                            ∀ (a : G.Walk u v) (a' : G'.Walk u' v'),
                              a ≍ a' → SimpleGraph.Walk.map f a ≍ SimpleGraph.Walk.map f' a'

theorem SimpleGraph.Walk.transfer.match_1.congr_eq_1 E1 #

∀ {V : Type u_1} {G : SimpleGraph V} (H : SimpleGraph V)
  (motive : (u v : V) → (p : G.Walk u v) → (∀ e ∈ p.edges, e ∈ H.edgeSet) → Sort u_2) (u v : V) (p : G.Walk u v)
  (h : ∀ e ∈ p.edges, e ∈ H.edgeSet)
  (h_1 : (u : V) → (h : ∀ e ∈ SimpleGraph.Walk.nil.edges, e ∈ H.edgeSet) → motive u u SimpleGraph.Walk.nil h)
  (h_2 :
    (u w v : V) →
      (h : G.Adj u v) →
        (p : G.Walk v w) →
          (h_2 : ∀ e ∈ (SimpleGraph.Walk.cons' u v w h p).edges, e ∈ H.edgeSet) →
            motive u w (SimpleGraph.Walk.cons h p) h_2)
  (u_1 : V) (h_3 : ∀ e ∈ SimpleGraph.Walk.nil.edges, e ∈ H.edgeSet),
  u = u_1 →
    v = u_1 →
      p ≍ SimpleGraph.Walk.nil →
        h ≍ h_3 →
          (match u, v, p, h with
            | u, .(u), SimpleGraph.Walk.nil, h => h_1 u h
            | u, w, SimpleGraph.Walk.cons h p, h_4 => h_2 u w v h p h_4) ≍
            h_1 u_1 h_3

theorem SimpleGraph.Walk.transfer.match_1.congr_eq_2 E1 #

∀ {V : Type u_1} {G : SimpleGraph V} (H : SimpleGraph V)
  (motive : (u v : V) → (p : G.Walk u v) → (∀ e ∈ p.edges, e ∈ H.edgeSet) → Sort u_2) (u v : V) (p : G.Walk u v)
  (h : ∀ e ∈ p.edges, e ∈ H.edgeSet)
  (h_1 : (u : V) → (h : ∀ e ∈ SimpleGraph.Walk.nil.edges, e ∈ H.edgeSet) → motive u u SimpleGraph.Walk.nil h)
  (h_2 :
    (u w v : V) →
      (h : G.Adj u v) →
        (p : G.Walk v w) →
          (h_2 : ∀ e ∈ (SimpleGraph.Walk.cons' u v w h p).edges, e ∈ H.edgeSet) →
            motive u w (SimpleGraph.Walk.cons h p) h_2)
  (u_1 w v_1 : V) (h_3 : G.Adj u_1 v_1) (p_1 : G.Walk v_1 w)
  (h_4 : ∀ e ∈ (SimpleGraph.Walk.cons' u_1 v_1 w h_3 p_1).edges, e ∈ H.edgeSet),
  u = u_1 →
    v = w →
      p ≍ SimpleGraph.Walk.cons h_3 p_1 →
        h ≍ h_4 →
          (match u, v, p, h with
            | u, .(u), SimpleGraph.Walk.nil, h => h_1 u h
            | u, w, SimpleGraph.Walk.cons h p, h_5 => h_2 u w v h p h_5) ≍
            h_2 u_1 w v_1 h_3 p_1 h_4

def SimpleGraph.Walk.map E3 #

{V : Type u} →
  {V' : Type v} →
    {G : SimpleGraph V} → {G' : SimpleGraph V'} → (f : G →g G') → {u v : V} → G.Walk u v → G'.Walk (f u) (f v)

Given a graph homomorphism, map walks to walks.

theorem SimpleGraph.Walk.map_nil E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u : V},
  SimpleGraph.Walk.map f SimpleGraph.Walk.nil = SimpleGraph.Walk.nil

theorem SimpleGraph.Walk.map_cons E0 #

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

theorem SimpleGraph.Walk.map_copy E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u v u' v' : V} (p : G.Walk u v)
  (hu : u = u') (hv : v = v'), SimpleGraph.Walk.map f (p.copy hu hv) = (SimpleGraph.Walk.map f p).copy ⋯ ⋯

theorem SimpleGraph.Walk.map_id E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), SimpleGraph.Walk.map SimpleGraph.Hom.id p = p

theorem SimpleGraph.Walk.map_map E0 #

∀ {V : Type u} {V' : Type v} {V'' : Type w} {G : SimpleGraph V} {G' : SimpleGraph V'} {G'' : SimpleGraph V''}
  (f : G →g G') (f' : G' →g G'') {u v : V} (p : G.Walk u v),
  SimpleGraph.Walk.map f' (SimpleGraph.Walk.map f p) = SimpleGraph.Walk.map (f'.comp f) p

theorem SimpleGraph.Walk.map_eq_of_eq E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} {u v : V} (p : G.Walk u v) {f : G →g G'}
  (f' : G →g G') (h : f = f'), SimpleGraph.Walk.map f p = (SimpleGraph.Walk.map f' p).copy ⋯ ⋯

Unlike categories, for graphs vertex equality is an important notion, so needing to be able to work with equality of graph homomorphisms is a necessary evil.

theorem SimpleGraph.Walk.nil_map_iff E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u v : V} {p : G.Walk u v},
  (SimpleGraph.Walk.map f p).Nil ↔ p.Nil

theorem SimpleGraph.Walk.length_map E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u v : V} (p : G.Walk u v),
  (SimpleGraph.Walk.map f p).length = p.length

theorem SimpleGraph.Walk.map_append E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u v w : V} (p : G.Walk u v)
  (q : G.Walk v w), SimpleGraph.Walk.map f (p.append q) = (SimpleGraph.Walk.map f p).append (SimpleGraph.Walk.map f q)

theorem SimpleGraph.Walk.reverse_map E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u v : V} (p : G.Walk u v),
  (SimpleGraph.Walk.map f p).reverse = SimpleGraph.Walk.map f p.reverse

theorem SimpleGraph.Walk.support_map E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u v : V} (p : G.Walk u v),
  (SimpleGraph.Walk.map f p).support = List.map (⇑f) p.support

theorem SimpleGraph.Walk.darts_map E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u v : V} (p : G.Walk u v),
  (SimpleGraph.Walk.map f p).darts = List.map f.mapDart p.darts

theorem SimpleGraph.Walk.edges_map E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u v : V} (p : G.Walk u v),
  (SimpleGraph.Walk.map f p).edges = List.map (Sym2.map ⇑f) p.edges

theorem SimpleGraph.Walk.edgeSet_map E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u v : V} (p : G.Walk u v),
  (SimpleGraph.Walk.map f p).edgeSet = Sym2.map ⇑f '' p.edgeSet

theorem SimpleGraph.Walk.getVert_map E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u v : V} (p : G.Walk u v) (n : ℕ),
  (SimpleGraph.Walk.map f p).getVert n = f (p.getVert n)

theorem SimpleGraph.Walk.map_injective_of_injective E0 #

∀ {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} {f : G →g G'},
  Function.Injective ⇑f → ∀ (u v : V), Function.Injective (SimpleGraph.Walk.map f)

abbrev SimpleGraph.Walk.mapLe E3 #

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

The specialization of SimpleGraph.Walk.map for mapping walks to supergraphs.

theorem SimpleGraph.Walk.length_mapLe E1 #

∀ {V : Type u} {G G' : SimpleGraph V} (h : G ≤ G') {u v : V} (p : G.Walk u v),
  (SimpleGraph.Walk.mapLe h p).length = p.length

theorem SimpleGraph.Walk.support_mapLe_eq_support E1 #

∀ {V : Type u} {G G' : SimpleGraph V} (h : G ≤ G') {u v : V} (p : G.Walk u v),
  (SimpleGraph.Walk.mapLe h p).support = p.support

theorem SimpleGraph.Walk.edges_mapLe_eq_edges E1 #

∀ {V : Type u} {G G' : SimpleGraph V} (h : G ≤ G') {u v : V} (p : G.Walk u v),
  (SimpleGraph.Walk.mapLe h p).edges = p.edges

theorem SimpleGraph.Walk.edgeSet_mapLe_eq_edgeSet E1 #

∀ {V : Type u} {G G' : SimpleGraph V} (h : G ≤ G') {u v : V} (p : G.Walk u v),
  (SimpleGraph.Walk.mapLe h p).edgeSet = p.edgeSet

theorem SimpleGraph.Walk.reverse_mapLe E1 #

∀ {V : Type u} {G G' : SimpleGraph V} (h : G ≤ G') {u v : V} (p : G.Walk u v),
  (SimpleGraph.Walk.mapLe h p).reverse = SimpleGraph.Walk.mapLe h p.reverse

theorem SimpleGraph.Walk.mapLe_append E1 #

∀ {V : Type u} {G G' : SimpleGraph V} (h : G ≤ G') {u v w : V} (p : G.Walk u v) (q : G.Walk v w),
  SimpleGraph.Walk.mapLe h (p.append q) = (SimpleGraph.Walk.mapLe h p).append (SimpleGraph.Walk.mapLe h q)

def SimpleGraph.Walk.transfer E3 #

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

The walk p transferred to lie in H, given that H contains its edges.

theorem SimpleGraph.Walk.transfer_self E1 #

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

theorem SimpleGraph.Walk.transfer_eq_mapLe E1 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) {H : SimpleGraph V} (hp : ∀ e ∈ p.edges, e ∈ H.edgeSet)
  (GH : G ≤ H), p.transfer H hp = SimpleGraph.Walk.mapLe GH p

theorem SimpleGraph.Walk.nil_transfer E0 #

∀ {V : Type u} {G H : SimpleGraph V} {u v : V} {p : G.Walk u v} {h : ∀ e ∈ p.edges, e ∈ H.edgeSet},
  (p.transfer H h).Nil ↔ p.Nil

theorem SimpleGraph.Walk.edges_transfer E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) {H : SimpleGraph V} (hp : ∀ e ∈ p.edges, e ∈ H.edgeSet),
  (p.transfer H hp).edges = p.edges

theorem SimpleGraph.Walk.edgeSet_transfer E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) {H : SimpleGraph V} (hp : ∀ e ∈ p.edges, e ∈ H.edgeSet),
  (p.transfer H hp).edgeSet = p.edgeSet

theorem SimpleGraph.Walk.support_transfer E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) {H : SimpleGraph V} (hp : ∀ e ∈ p.edges, e ∈ H.edgeSet),
  (p.transfer H hp).support = p.support

theorem SimpleGraph.Walk.length_transfer E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) {H : SimpleGraph V} (hp : ∀ e ∈ p.edges, e ∈ H.edgeSet),
  (p.transfer H hp).length = p.length

theorem SimpleGraph.Walk.transfer_transfer E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) {H : SimpleGraph V} (hp : ∀ e ∈ p.edges, e ∈ H.edgeSet)
  {K : SimpleGraph V} (hp' : ∀ e ∈ (p.transfer H hp).edges, e ∈ K.edgeSet),
  (p.transfer H hp).transfer K hp' = p.transfer K ⋯

theorem SimpleGraph.Walk.transfer_append E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) {H : SimpleGraph V} {w : V} (q : G.Walk v w)
  (hpq : ∀ e ∈ (p.append q).edges, e ∈ H.edgeSet),
  (p.append q).transfer H hpq = (p.transfer H ⋯).append (q.transfer H ⋯)

theorem SimpleGraph.Walk.reverse_transfer E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) {H : SimpleGraph V} (hp : ∀ e ∈ p.edges, e ∈ H.edgeSet),
  (p.transfer H hp).reverse = p.reverse.transfer H ⋯

def SimpleGraph.Walk.induce E3 #

{V : Type u} →
  {G : SimpleGraph V} →
    (s : Set V) →
      {u v : V} → (w : G.Walk u v) → (hw : ∀ x ∈ w.support, x ∈ s) → (SimpleGraph.induce s G).Walk ⟨u, ⋯⟩ ⟨v, ⋯⟩

A walk in G which is fully contained in a set s of vertices lifts to a walk of G[s].

theorem SimpleGraph.Walk.induce_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} {u : V} {s : Set V} (hw : ∀ x ∈ SimpleGraph.Walk.nil.support, x ∈ s),
  SimpleGraph.Walk.induce s SimpleGraph.Walk.nil hw = SimpleGraph.Walk.nil

theorem SimpleGraph.Walk.induce_cons E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v u' : V} {s : Set V} (huu' : G.Adj u u') (w : G.Walk u' v)
  (hw : ∀ x ∈ (SimpleGraph.Walk.cons huu' w).support, x ∈ s),
  SimpleGraph.Walk.induce s (SimpleGraph.Walk.cons huu' w) hw = SimpleGraph.Walk.cons ⋯ (SimpleGraph.Walk.induce s w ⋯)

theorem SimpleGraph.Walk.nil_induce E0 #

∀ {V : Type u} {G : SimpleGraph V} {u v : V} {s : Set V} {w : G.Walk u v} (hw : ∀ x ∈ w.support, x ∈ s),
  (SimpleGraph.Walk.induce s w hw).Nil ↔ w.Nil

theorem SimpleGraph.Walk.length_induce E0 #

∀ {V : Type u} {G : SimpleGraph V} {s : Set V} {u v : V} {w : G.Walk u v} (hw : ∀ x ∈ w.support, x ∈ s),
  (SimpleGraph.Walk.induce s w hw).length = w.length

theorem SimpleGraph.Walk.support_induce E0 #

∀ {V : Type u} {G : SimpleGraph V} {s : Set V} {u v : V} (w : G.Walk u v) (hw : ∀ x ∈ w.support, x ∈ s),
  (SimpleGraph.Walk.induce s w hw).support = w.support.attachWith (Membership.mem s) hw

theorem SimpleGraph.Walk.darts_induce E1 #

∀ {V : Type u} {G : SimpleGraph V} {s : Set V} {u v : V} {w : G.Walk u v} (hw : ∀ x ∈ w.support, x ∈ s),
  (SimpleGraph.Walk.induce s w hw).darts =
    List.map
      (fun x ↦
        match x with
        | ⟨d, hd⟩ => { fst := ⟨d.toProd.1, ⋯⟩, snd := ⟨d.toProd.2, ⋯⟩, adj := ⋯ })
      w.darts.attach

theorem SimpleGraph.Walk.edges_induce E1 #

∀ {V : Type u} {G : SimpleGraph V} {s : Set V} {u v : V} {w : G.Walk u v} (hw : ∀ x ∈ w.support, x ∈ s),
  (SimpleGraph.Walk.induce s w hw).edges =
    List.map
      (fun x ↦
        match x with
        | ⟨e, he⟩ => e.attachWith ⋯)
      w.edges.attach

theorem SimpleGraph.Walk.map_induce E0 #

∀ {V : Type u} {G : SimpleGraph V} {s : Set V} {u v : V} (w : G.Walk u v) (hw : ∀ x ∈ w.support, x ∈ s),
  SimpleGraph.Walk.map (SimpleGraph.Embedding.induce s).toHom (SimpleGraph.Walk.induce s w hw) = w

theorem SimpleGraph.Walk.map_induce_induceHomOfLE E0 #

∀ {V : Type u} {G : SimpleGraph V} {s s' : Set V} (hs : s ⊆ s') {u v : V} (w : G.Walk u v)
  (hw : ∀ x ∈ w.support, x ∈ s),
  SimpleGraph.Walk.map (G.induceHomOfLE hs).toHom (SimpleGraph.Walk.induce s w hw) = SimpleGraph.Walk.induce s' w ⋯

abbrev SimpleGraph.Walk.toDeleteEdges E3 #

{V : Type u} →
  {G : SimpleGraph V} →
    (s : Set (Sym2 V)) → {v w : V} → (p : G.Walk v w) → (∀ e ∈ p.edges, e ∉ s) → (G.deleteEdges s).Walk v w

Given a walk that avoids a set of edges, produce a walk in the graph with those edges deleted.

theorem SimpleGraph.Walk.toDeleteEdges_nil E0 #

∀ {V : Type u} {G : SimpleGraph V} (s : Set (Sym2 V)) {v : V} (hp : ∀ e ∈ SimpleGraph.Walk.nil.edges, e ∉ s),
  SimpleGraph.Walk.toDeleteEdges s SimpleGraph.Walk.nil hp = SimpleGraph.Walk.nil

theorem SimpleGraph.Walk.toDeleteEdges_cons E0 #

∀ {V : Type u} {G : SimpleGraph V} (s : Set (Sym2 V)) {u v w : V} (h : G.Adj u v) (p : G.Walk v w)
  (hp : ∀ e ∈ (SimpleGraph.Walk.cons h p).edges, e ∉ s),
  SimpleGraph.Walk.toDeleteEdges s (SimpleGraph.Walk.cons h p) hp =
    SimpleGraph.Walk.cons ⋯ (SimpleGraph.Walk.toDeleteEdges s p ⋯)

abbrev SimpleGraph.Walk.toDeleteEdge E3 #

{V : Type u} →
  {G : SimpleGraph V} → {v w : V} → (e : Sym2 V) → (p : G.Walk v w) → e ∉ p.edges → (G.deleteEdges {e}).Walk v w

Given a walk that avoids an edge, create a walk in the subgraph with that edge deleted. This is an abbreviation for SimpleGraph.Walk.toDeleteEdges.

theorem SimpleGraph.Walk.mapLe_toDeleteEdges_eq E0 #

∀ {V : Type u} {G : SimpleGraph V} {v w : V} (s : Set (Sym2 V)) {p : G.Walk v w} (hp : ∀ e ∈ p.edges, e ∉ s),
  SimpleGraph.Walk.mapLe ⋯ (SimpleGraph.Walk.toDeleteEdges s p hp) = p

Deprecated aliases

NameNew nameSince
SimpleGraph.Walk.map_eq_nil_iffSimpleGraph.Walk.nil_map_iff2026-05-12
SimpleGraph.Walk.map_toDeleteEdges_eqSimpleGraph.Walk.mapLe_toDeleteEdges_eq2026-09-14
SimpleGraph.Walk.transfer_eq_map_ofLESimpleGraph.Walk.transfer_eq_mapLe2026-09-14