The areas / V30. Combinatorics
Mathlib.Combinatorics.SimpleGraph.Walk.Traversal
59 declarations. Mathlib docs · Source
theorem SimpleGraph.Walk.firstDart.congr_simp E1 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} (p p_1 : G.Walk v w) (e_p : p = p_1) (hp : ¬p.Nil),
p.firstDart hp = p_1.firstDart ⋯
theorem SimpleGraph.Walk.getVert.match_1.congr_eq_2 E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u : V} (motive : (v : V) → G.Walk u v → ℕ → Sort u_2) (v : V) (x : G.Walk u v)
(x_1 : ℕ) (h_1 : (x : ℕ) → motive u SimpleGraph.Walk.nil x)
(h_2 : (v v_1 : V) → (h : G.Adj u v_1) → (p : G.Walk v_1 v) → motive v (SimpleGraph.Walk.cons h p) 0)
(h_3 : (v v_1 : V) → (h : G.Adj u v_1) → (q : G.Walk v_1 v) → (n : ℕ) → motive v (SimpleGraph.Walk.cons h q) n.succ)
(v_1 v_2 : V) (h : G.Adj u v_2) (p : G.Walk v_2 v_1),
v = v_1 →
x ≍ SimpleGraph.Walk.cons h p →
x_1 = 0 →
(match v, x, x_1 with
| .(u), SimpleGraph.Walk.nil, x => h_1 x
| v, SimpleGraph.Walk.cons h p, 0 => h_2 v v_3 h p
| v, SimpleGraph.Walk.cons h q, n.succ => h_3 v v_3 h q n) ≍
h_2 v_1 v_2 h p
theorem SimpleGraph.Walk.getVert.match_1.congr_eq_3 E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u : V} (motive : (v : V) → G.Walk u v → ℕ → Sort u_2) (v : V) (x : G.Walk u v)
(x_1 : ℕ) (h_1 : (x : ℕ) → motive u SimpleGraph.Walk.nil x)
(h_2 : (v v_1 : V) → (h : G.Adj u v_1) → (p : G.Walk v_1 v) → motive v (SimpleGraph.Walk.cons h p) 0)
(h_3 : (v v_1 : V) → (h : G.Adj u v_1) → (q : G.Walk v_1 v) → (n : ℕ) → motive v (SimpleGraph.Walk.cons h q) n.succ)
(v_1 v_2 : V) (h : G.Adj u v_2) (q : G.Walk v_2 v_1) (n : ℕ),
v = v_1 →
x ≍ SimpleGraph.Walk.cons h q →
x_1 = n.succ →
(match v, x, x_1 with
| .(u), SimpleGraph.Walk.nil, x => h_1 x
| v, SimpleGraph.Walk.cons h p, 0 => h_2 v v_3 h p
| v, SimpleGraph.Walk.cons h q, n.succ => h_3 v v_3 h q n) ≍
h_3 v_1 v_2 h q n
theorem SimpleGraph.Walk.lastDart.congr_simp E1 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} (p p_1 : G.Walk v w) (e_p : p = p_1) (hp : ¬p.Nil),
p.lastDart hp = p_1.lastDart ⋯
theorem SimpleGraph.Walk.getVert.match_1.congr_eq_1 E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u : V} (motive : (v : V) → G.Walk u v → ℕ → Sort u_2) (v : V) (x : G.Walk u v)
(x_1 : ℕ) (h_1 : (x : ℕ) → motive u SimpleGraph.Walk.nil x)
(h_2 : (v v_1 : V) → (h : G.Adj u v_1) → (p : G.Walk v_1 v) → motive v (SimpleGraph.Walk.cons h p) 0)
(h_3 : (v v_1 : V) → (h : G.Adj u v_1) → (q : G.Walk v_1 v) → (n : ℕ) → motive v (SimpleGraph.Walk.cons h q) n.succ)
(x_2 : ℕ),
v = u →
x ≍ SimpleGraph.Walk.nil →
x_1 = x_2 →
(match v, x, x_1 with
| .(u), SimpleGraph.Walk.nil, x => h_1 x
| v, SimpleGraph.Walk.cons h p, 0 => h_2 v v_1 h p
| v, SimpleGraph.Walk.cons h q, n.succ => h_3 v v_1 h q n) ≍
h_1 x_2
def SimpleGraph.Walk.getVert E1 #
{V : Type u} → {G : SimpleGraph V} → {u v : V} → G.Walk u v → ℕ → V
Get the nth vertex from a walk, where n is generally expected to be
between 0 and p.length, inclusive.
If n is greater than or equal to p.length, the result is the path's endpoint.
theorem SimpleGraph.Walk.getVert_zero E0 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} (w : G.Walk u v), w.getVert 0 = u
theorem SimpleGraph.Walk.getVert_nil E0 #
∀ {V : Type u} {G : SimpleGraph V} (u : V) {i : ℕ}, SimpleGraph.Walk.nil.getVert i = u
theorem SimpleGraph.Walk.getVert_of_length_le E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} (w : G.Walk u v) {i : ℕ}, w.length ≤ i → w.getVert i = v
theorem SimpleGraph.Walk.getVert_length E0 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} (w : G.Walk u v), w.getVert w.length = v
theorem SimpleGraph.Walk.adj_getVert_succ E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} (w : G.Walk u v) {i : ℕ},
i < w.length → G.Adj (w.getVert i) (w.getVert (i + 1))
theorem SimpleGraph.Walk.getVert_cons_succ E0 #
∀ {V : Type u} {G : SimpleGraph V} {u v w : V} {n : ℕ} (p : G.Walk v w) (h : G.Adj u v),
(SimpleGraph.Walk.cons h p).getVert (n + 1) = p.getVert n
theorem SimpleGraph.Walk.getVert_cons E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v w : V} {n : ℕ} (p : G.Walk v w) (h : G.Adj u v),
n ≠ 0 → (SimpleGraph.Walk.cons h p).getVert n = p.getVert (n - 1)
theorem SimpleGraph.Walk.getVert_mem_support E0 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) (i : ℕ), p.getVert i ∈ p.support
theorem SimpleGraph.Walk.getVert_eq_support_getElem E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} {n : ℕ} (p : G.Walk u v) (h : n ≤ p.length), p.getVert n = p.support[n]
Use support_getElem_eq_getVert to rewrite in the reverse direction.
theorem SimpleGraph.Walk.support_getElem_eq_getVert E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} {n : ℕ} (p : G.Walk u v) (h : n < p.support.length),
p.support[n] = p.getVert n
Use getVert_eq_support_getElem to rewrite in the reverse direction.
theorem SimpleGraph.Walk.getVert_eq_support_getElem? E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} {n : ℕ} (p : G.Walk u v), n ≤ p.length → some (p.getVert n) = p.support[n]?
theorem SimpleGraph.Walk.getVert_eq_getD_support E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) (n : ℕ), p.getVert n = p.support.getD n v
theorem SimpleGraph.Walk.getVert_support_idxOf E0 #
∀ {V : Type u} {G : SimpleGraph V} {u v w : V} [inst : DecidableEq V] (p : G.Walk u v),
w ∈ p.support → p.getVert (List.idxOf w p.support) = w
theorem SimpleGraph.Walk.getVert_comp_val_eq_get_support E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), p.getVert ∘ Fin.val = p.support.get
theorem SimpleGraph.Walk.range_getVert_eq_range_support_getElem E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v), Set.range p.getVert = Set.range p.support.get
theorem SimpleGraph.Walk.darts_getElem_eq_getVert E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} (n : ℕ) (h : n < p.darts.length),
p.darts[n] = { fst := p.getVert n, snd := p.getVert (n + 1), adj := ⋯ }
theorem SimpleGraph.Walk.getElem_edges E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} {i : ℕ} (h : i < p.edges.length),
p.edges[i] = s(p.getVert i, p.getVert (i + 1))
theorem SimpleGraph.Walk.mk_mem_edges_iff_exists E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v u' v' : V} (p : G.Walk u v),
s(u', v') ∈ p.edges ↔ ∃ i < p.length, s(p.getVert i, p.getVert (i + 1)) = s(u', v')
theorem SimpleGraph.Walk.adj_of_infix_support E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v u' v' : V} {p : G.Walk u v}, [u', v'] <:+: p.support → G.Adj u' v'
abbrev SimpleGraph.Walk.snd E1 #
{V : Type u} → {G : SimpleGraph V} → {u v : V} → G.Walk u v → V
The second vertex of a walk, or the only vertex in a nil walk.
theorem SimpleGraph.Walk.adj_snd E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w}, ¬p.Nil → G.Adj v p.snd
theorem SimpleGraph.Walk.snd_cons E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (q : G.Walk v w) (hadj : G.Adj u v),
(SimpleGraph.Walk.cons hadj q).snd = v
theorem SimpleGraph.Walk.snd_mem_tail_support E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v}, ¬p.Nil → p.snd ∈ p.support.tail
theorem SimpleGraph.Walk.support_getElem_one E0 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} (hp : 1 < p.support.length), p.support[1] = p.snd
Use snd_eq_support_getElem_one to rewrite in the reverse direction.
theorem SimpleGraph.Walk.snd_eq_support_getElem_one E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} (hnil : ¬p.Nil), p.snd = p.support[1]
Use support_getElem_one to rewrite in the reverse direction.
abbrev SimpleGraph.Walk.penultimate E1 #
{V : Type u} → {G : SimpleGraph V} → {u v : V} → G.Walk u v → V
The penultimate vertex of a walk, or the only vertex in a nil walk.
theorem SimpleGraph.Walk.penultimate_nil E0 #
∀ {V : Type u} {G : SimpleGraph V} {v : V}, SimpleGraph.Walk.nil.penultimate = v
theorem SimpleGraph.Walk.penultimate_cons_nil E0 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} (h : G.Adj u v),
(SimpleGraph.Walk.cons h SimpleGraph.Walk.nil).penultimate = u
theorem SimpleGraph.Walk.penultimate_cons_cons E0 #
∀ {V : Type u} {G : SimpleGraph V} {u v w w' : V} (h : G.Adj u v) (h₂ : G.Adj v w) (p : G.Walk w w'),
(SimpleGraph.Walk.cons h (SimpleGraph.Walk.cons h₂ p)).penultimate = (SimpleGraph.Walk.cons h₂ p).penultimate
theorem SimpleGraph.Walk.penultimate_cons_of_not_nil E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v w : V} (h : G.Adj u v) (p : G.Walk v w),
¬p.Nil → (SimpleGraph.Walk.cons h p).penultimate = p.penultimate
theorem SimpleGraph.Walk.adj_penultimate E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w}, ¬p.Nil → G.Adj p.penultimate w
theorem SimpleGraph.Walk.penultimate_mem_dropLast_support E1 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v}, ¬p.Nil → p.penultimate ∈ p.support.dropLast
theorem SimpleGraph.Walk.support_getElem_length_sub_one_eq_penultimate E0 #
∀ {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v}, p.support[p.length - 1] = p.penultimate
def SimpleGraph.Walk.firstDart E1 #
{V : Type u} → {G : SimpleGraph V} → {v w : V} → (p : G.Walk v w) → ¬p.Nil → G.Dart
The first dart of a walk.
theorem SimpleGraph.Walk.firstDart_toProd E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} (p : G.Walk v w) (hp : ¬p.Nil), (p.firstDart hp).toProd = (v, p.snd)
def SimpleGraph.Walk.lastDart E1 #
{V : Type u} → {G : SimpleGraph V} → {v w : V} → (p : G.Walk v w) → ¬p.Nil → G.Dart
The last dart of a walk.
theorem SimpleGraph.Walk.lastDart_toProd E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} (p : G.Walk v w) (hp : ¬p.Nil), (p.lastDart hp).toProd = (p.penultimate, w)
theorem SimpleGraph.Walk.edge_firstDart E1 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} (p : G.Walk v w) (hp : ¬p.Nil), (p.firstDart hp).edge = s(v, p.snd)
theorem SimpleGraph.Walk.edge_lastDart E1 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} (p : G.Walk v w) (hp : ¬p.Nil), (p.lastDart hp).edge = s(p.penultimate, w)
theorem SimpleGraph.Walk.firstDart_eq E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (h₁ : ¬p.Nil) (h₂ : 0 < p.darts.length),
p.firstDart h₁ = p.darts[0]
theorem SimpleGraph.Walk.lastDart_eq E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (h₁ : ¬p.Nil) (h₂ : 0 < p.darts.length),
p.lastDart h₁ = p.darts[p.darts.length - 1]
theorem SimpleGraph.Walk.head_darts_eq_firstDart E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : p.darts ≠ []), p.darts.head hnil = p.firstDart ⋯
Use firstDart_eq_head_darts to rewrite in the reverse direction.
theorem SimpleGraph.Walk.firstDart_eq_head_darts E1 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil), p.firstDart hnil = p.darts.head ⋯
Use head_darts_eq_firstDart to rewrite in the reverse direction.
theorem SimpleGraph.Walk.firstDart_mem_darts E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil), p.firstDart hnil ∈ p.darts
theorem SimpleGraph.Walk.getLast_darts_eq_lastDart E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : p.darts ≠ []), p.darts.getLast hnil = p.lastDart ⋯
theorem SimpleGraph.Walk.lastDart_eq_getLast_darts E1 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil), p.lastDart hnil = p.darts.getLast ⋯
theorem SimpleGraph.Walk.lastDart_mem_darts E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil), p.lastDart hnil ∈ p.darts
theorem SimpleGraph.Walk.head_edges_eq_mk_start_snd E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hp : p.edges ≠ []), p.edges.head hp = s(v, p.snd)
Use mk_start_snd_eq_head_edges to rewrite in the reverse direction.
theorem SimpleGraph.Walk.mk_start_snd_eq_head_edges E1 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil), s(v, p.snd) = p.edges.head ⋯
Use head_edges_eq_mk_start_snd to rewrite in the reverse direction.
theorem SimpleGraph.Walk.mk_start_snd_mem_edges E1 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w}, ¬p.Nil → s(v, p.snd) ∈ p.edges
theorem SimpleGraph.Walk.getLast_edges_eq_mk_penultimate_end E0 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hp : p.edges ≠ []),
p.edges.getLast hp = s(p.penultimate, w)
Use mk_penultimate_end_eq_getLast_edges to rewrite in the reverse direction.
theorem SimpleGraph.Walk.mk_penultimate_end_eq_getLast_edges E1 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil), s(p.penultimate, w) = p.edges.getLast ⋯
Use getLast_edges_eq_mk_penultimate_end to rewrite in the reverse direction.
theorem SimpleGraph.Walk.mk_penultimate_end_mem_edges E1 #
∀ {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w}, ¬p.Nil → s(p.penultimate, w) ∈ p.edges