mathlib documentation


Degree-sum formula and handshaking lemma #

The degree-sum formula is that the sum of the degrees of the vertices in a finite graph is equal to twice the number of edges. The handshaking lemma, a corollary, is that the number of odd-degree vertices is even.

Main definitions #

Implementation notes #

We give a combinatorial proof by using the facts that (1) the map from darts to vertices is such that each fiber has cardinality the degree of the corresponding vertex and that (2) the map from darts to edges is 2-to-1.

Tags #

simple graphs, sums, degree-sum formula, handshaking lemma

theorem simple_graph.dart.edge_fiber {V : Type u} {G : simple_graph V} [fintype V] [decidable_rel G.adj] [decidable_eq V] (d : G.dart) :
finset.filter (λ (d' : G.dart), d'.edge = d.edge) finset.univ = {d, d.symm}
theorem simple_graph.dart_edge_fiber_card {V : Type u} (G : simple_graph V) [fintype V] [decidable_rel G.adj] [decidable_eq V] (e : sym2 V) (h : e G.edge_set) :
(finset.filter (λ (d : G.dart), d.edge = e) finset.univ).card = 2

The degree-sum formula. This is also known as the handshaking lemma, which might more specifically refer to simple_graph.even_card_odd_degree_vertices.

theorem simple_graph.odd_card_odd_degree_vertices_ne {V : Type u} (G : simple_graph V) [fintype V] [decidable_eq V] [decidable_rel G.adj] (v : V) (h : odd ( v)) :
odd (finset.filter (λ (w : V), w v odd ( w)) finset.univ).card
theorem simple_graph.exists_ne_odd_degree_of_exists_odd_degree {V : Type u} (G : simple_graph V) [fintype V] [decidable_rel G.adj] (v : V) (h : odd ( v)) :
∃ (w : V), w v odd ( w)