The areas / V30. Combinatorics
Mathlib.Combinatorics.SimpleGraph.Trails
26 declarations. Mathlib docs · Source
Trails and Eulerian trails
This module contains additional theory about trails, including Eulerian trails (also known as Eulerian circuits).
Main definitions
SimpleGraph.Walk.IsEulerianis the predicate that a trail is an Eulerian trail.SimpleGraph.Walk.IsTrail.even_countP_edges_iffgives a condition on the number of edges in a trail that can be incident to a given vertex.SimpleGraph.Walk.IsEulerian.even_degree_iffgives a condition on the degrees of vertices when there exists an Eulerian trail.SimpleGraph.Walk.IsEulerian.card_odd_degreegives the possible numbers of odd-degree vertices when there exists an Eulerian trail.
TODO
- Prove that there exists an Eulerian trail when the conclusion to
SimpleGraph.Walk.IsEulerian.card_odd_degreeholds.
Tags
Eulerian trails
theorem SimpleGraph.Walk.IsEulerian.congr_simp E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {inst : DecidableEq V} [inst_1 : DecidableEq V] (p p_1 : G.Walk u v),
p = p_1 → p.IsEulerian = p_1.IsEulerian
theorem SimpleGraph.Walk.IsTrail.edgesFinset.congr_simp E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p p_1 : G.Walk u v} (e_p : p = p_1) (h : p.IsTrail),
h.edgesFinset = ⋯.edgesFinset
abbrev SimpleGraph.Walk.IsTrail.edgesFinset E1 #
{V : Type u_1} → {G : SimpleGraph V} → {u v : V} → {p : G.Walk u v} → p.IsTrail → Finset (Sym2 V)
The edges of a trail as a finset, since each edge in a trail appears exactly once.
theorem SimpleGraph.Walk.IsTrail.even_countP_edges_iff E3 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsTrail → ∀ (x : V), Even (List.countP (fun e ↦ decide (x ∈ e)) p.edges) ↔ u ≠ v → x ≠ u ∧ x ≠ v
def SimpleGraph.Walk.IsEulerian E3 #
{V : Type u_1} → {G : SimpleGraph V} → {u v : V} → [DecidableEq V] → G.Walk u v → Prop
An Eulerian trail (also known as an "Eulerian path") is a walk
p that visits every edge exactly once. The lemma SimpleGraph.Walk.IsEulerian.IsTrail shows
that these are trails.
Combine with p.IsCircuit to get an Eulerian circuit (also known as an "Eulerian cycle").
theorem SimpleGraph.Walk.IsEulerian.isTrail E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V], p.IsEulerian → p.IsTrail
theorem SimpleGraph.Walk.IsEulerian.mem_edges_iff E0 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsEulerian → ∀ {e : Sym2 V}, e ∈ p.edges ↔ e ∈ G.edgeSet
def SimpleGraph.Walk.IsEulerian.fintypeEdgeSet E1 #
{V : Type u_1} →
{G : SimpleGraph V} → {u v : V} → {p : G.Walk u v} → [inst : DecidableEq V] → p.IsEulerian → Fintype ↑G.edgeSet
The edge set of an Eulerian graph is finite.
theorem SimpleGraph.Walk.IsTrail.isEulerian_of_forall_mem E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsTrail → (∀ e ∈ G.edgeSet, e ∈ p.edges) → p.IsEulerian
theorem SimpleGraph.Walk.isEulerian_iff E0 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} [inst : DecidableEq V] (p : G.Walk u v),
p.IsEulerian ↔ p.IsTrail ∧ ∀ e ∈ G.edgeSet, e ∈ p.edges
theorem SimpleGraph.Walk.isEulerian_iff_isTrail_and_edgeSet_eq E0 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsEulerian ↔ p.IsTrail ∧ p.edgeSet = G.edgeSet
theorem SimpleGraph.Walk.isEulerian_iff_isTrail_and_length_eq_encard_edgeSet E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsEulerian ↔ p.IsTrail ∧ ↑p.length = G.edgeSet.encard
theorem SimpleGraph.Walk.IsTrail.isEulerian_iff E0 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsTrail → (p.IsEulerian ↔ p.edgeSet = G.edgeSet)
theorem SimpleGraph.Walk.IsEulerian.edgeSet_eq E0 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsEulerian → p.edgeSet = G.edgeSet
theorem SimpleGraph.Walk.IsEulerian.finite_edgeSet E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V], p.IsEulerian → G.edgeSet.Finite
theorem SimpleGraph.Walk.IsEulerian.length_eq_ncard_edgeSet E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsEulerian → p.length = G.edgeSet.ncard
theorem SimpleGraph.Walk.IsEulerian.edgesFinset_eq E0 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V] [inst_1 : Fintype ↑G.edgeSet]
(h : p.IsEulerian), ⋯.edgesFinset = G.edgeFinset
theorem SimpleGraph.Walk.IsEulerian.mem_support_of_not_isIsolated E0 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v w : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsEulerian → ¬G.IsIsolated w → w ∈ p.support
theorem SimpleGraph.Walk.IsEulerian.nil_iff E0 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V], p.IsEulerian → (p.Nil ↔ G = ⊥)
theorem SimpleGraph.Walk.isEulerian_of_bot E1 #
∀ {V : Type u_1} {u v : V} [inst : DecidableEq V] (p : ⊥.Walk u v), p.IsEulerian
theorem SimpleGraph.Walk.IsEulerian.mem_support_iff E0 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v w : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsEulerian → ¬p.Nil → (w ∈ p.support ↔ ¬G.IsIsolated w)
The support of a non-nil Eulerian trail equals the support of the graph.
theorem SimpleGraph.Walk.IsEulerian.connected_of_forall_not_isIsolated E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsEulerian → (∀ (v : V), ¬G.IsIsolated v) → G.Connected
theorem SimpleGraph.Walk.IsEulerian.isChordless E1 #
∀ {V : Type u_1} {G : SimpleGraph V} [inst : DecidableEq V] {u v : V} {p : G.Walk u v}, p.IsEulerian → p.IsChordless
theorem SimpleGraph.Walk.IsEulerian.even_degree_iff E3 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v w : V} {p : G.Walk u v} [inst : DecidableEq V],
p.IsEulerian → ∀ [inst : Fintype V] [inst_1 : DecidableRel G.Adj], Even (G.degree w) ↔ u ≠ v → w ≠ u ∧ w ≠ v
theorem SimpleGraph.Walk.IsEulerian.card_filter_odd_degree E1 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V] [inst_1 : Fintype V]
[inst_2 : DecidableRel G.Adj], p.IsEulerian → ∀ {s : Finset V}, s = {v | Odd (G.degree v)} → s.card = 0 ∨ s.card = 2
theorem SimpleGraph.Walk.IsEulerian.card_odd_degree E3 #
∀ {V : Type u_1} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} [inst : DecidableEq V] [inst_1 : Fintype V]
[inst_2 : DecidableRel G.Adj],
p.IsEulerian → Fintype.card ↑{v | Odd (G.degree v)} = 0 ∨ Fintype.card ↑{v | Odd (G.degree v)} = 2