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

142 declarations and 2 deprecated aliases. Mathlib docs · Source

Definitions for finite and locally finite graphs

This file defines finite versions of edgeSet, neighborSet and incidenceSet and proves some of their basic properties. It also defines the notion of a locally finite graph, which is one whose vertices have finite degree.

The design for finiteness is that each definition takes the smallest finiteness assumption necessary. For example, SimpleGraph.neighborFinset v only requires that v have finitely many neighbors.

Main definitions

  • SimpleGraph.edgeFinset is the Finset of edges in a graph, if edgeSet is finite
  • SimpleGraph.neighborFinset is the Finset of vertices adjacent to a given vertex, if neighborSet is finite
  • SimpleGraph.incidenceFinset is the Finset of edges containing a given vertex, if incidenceSet is finite

Naming conventions

If the vertex type of a graph is finite, we refer to its cardinality as CardVerts or card_verts.

Implementation notes

  • A locally finite graph is one with instances Π v, Fintype (G.neighborSet v).
  • Given instances DecidableRel G.Adj and Fintype V, then the graph is locally finite, too.

Finiteness at a vertex

This section contains definitions and lemmas concerning vertices that have finitely many adjacent vertices. We denote this condition by Fintype (G.neighborSet v).

We define G.neighborFinset v to be the Finset version of G.neighborSet v. Use neighborFinset_eq_filter to rewrite this definition as a Finset.filter expression.

theorem SimpleGraph.minDegree.congr_simp E1 #

∀ {V : Type u_1} (G G_1 : SimpleGraph V),
  G = G_1 →
    ∀ [inst : Fintype V] {inst_1 : DecidableRel G.Adj} [inst_2 : DecidableRel G_1.Adj], G.minDegree = G_1.minDegree

theorem SimpleGraph.maxDegree.congr_simp E1 #

∀ {V : Type u_1} (G G_1 : SimpleGraph V),
  G = G_1 →
    ∀ [inst : Fintype V] {inst_1 : DecidableRel G.Adj} [inst_2 : DecidableRel G_1.Adj], G.maxDegree = G_1.maxDegree

def SimpleGraph.edgeFinset E3 #

{V : Type u_1} → (G : SimpleGraph V) → [Fintype ↑G.edgeSet] → Finset (Sym2 V)

The edgeSet of the graph as a Finset.

theorem SimpleGraph.coe_edgeFinset E0 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype ↑G.edgeSet], ↑G.edgeFinset = G.edgeSet

theorem SimpleGraph.mem_edgeFinset E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {e : Sym2 V} [inst : Fintype ↑G.edgeSet], e ∈ G.edgeFinset ↔ e ∈ G.edgeSet

theorem SimpleGraph.not_isDiag_of_mem_edgeFinset E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {e : Sym2 V} [inst : Fintype ↑G.edgeSet], e ∈ G.edgeFinset → ¬e.IsDiag

theorem SimpleGraph.card_toFinset_mem_edgeFinset E1 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype ↑G.edgeSet] [inst_1 : DecidableEq V] (e : ↥G.edgeFinset),
  (↑e).toFinset.card = 2

Mapping an edge to a finite set produces a finset of size 2.

theorem SimpleGraph.edgeFinset_inj E0 #

∀ {V : Type u_1} {G₁ G₂ : SimpleGraph V} [inst : Fintype ↑G₁.edgeSet] [inst_1 : Fintype ↑G₂.edgeSet],
  G₁.edgeFinset = G₂.edgeFinset ↔ G₁ = G₂

theorem SimpleGraph.edgeFinset_subset_edgeFinset E0 #

∀ {V : Type u_1} {G₁ G₂ : SimpleGraph V} [inst : Fintype ↑G₁.edgeSet] [inst_1 : Fintype ↑G₂.edgeSet],
  G₁.edgeFinset ⊆ G₂.edgeFinset ↔ G₁ ≤ G₂

theorem SimpleGraph.edgeFinset_ssubset_edgeFinset E0 #

∀ {V : Type u_1} {G₁ G₂ : SimpleGraph V} [inst : Fintype ↑G₁.edgeSet] [inst_1 : Fintype ↑G₂.edgeSet],
  G₁.edgeFinset ⊂ G₂.edgeFinset ↔ G₁ < G₂

theorem SimpleGraph.edgeFinset_mono E1 #

∀ {V : Type u_1} {G₁ G₂ : SimpleGraph V} [inst : Fintype ↑G₁.edgeSet] [inst_1 : Fintype ↑G₂.edgeSet],
  G₁ ≤ G₂ → G₁.edgeFinset ⊆ G₂.edgeFinset

Alias of the reverse direction of SimpleGraph.edgeFinset_subset_edgeFinset.

theorem SimpleGraph.edgeFinset_strict_mono E1 #

∀ {V : Type u_1} {G₁ G₂ : SimpleGraph V} [inst : Fintype ↑G₁.edgeSet] [inst_1 : Fintype ↑G₂.edgeSet],
  G₁ < G₂ → G₁.edgeFinset ⊂ G₂.edgeFinset

Alias of the reverse direction of SimpleGraph.edgeFinset_ssubset_edgeFinset.

theorem SimpleGraph.edgeFinset_bot E0 #

∀ {V : Type u_1}, ⊥.edgeFinset = ∅

theorem SimpleGraph.edgeFinset_sup E0 #

∀ {V : Type u_1} {G₁ G₂ : SimpleGraph V} [inst : Fintype ↑G₁.edgeSet] [inst_1 : Fintype ↑G₂.edgeSet]
  [inst_2 : Fintype ↑(G₁ ⊔ G₂).edgeSet] [inst_3 : DecidableEq V], (G₁ ⊔ G₂).edgeFinset = G₁.edgeFinset ∪ G₂.edgeFinset

theorem SimpleGraph.edgeFinset_inf E0 #

∀ {V : Type u_1} {G₁ G₂ : SimpleGraph V} [inst : Fintype ↑G₁.edgeSet] [inst_1 : Fintype ↑G₂.edgeSet]
  [inst_2 : Fintype ↑(G₁ ⊓ G₂).edgeSet] [inst_3 : DecidableEq V], (G₁ ⊓ G₂).edgeFinset = G₁.edgeFinset ∩ G₂.edgeFinset

theorem SimpleGraph.edgeFinset_sdiff E0 #

∀ {V : Type u_1} {G₁ G₂ : SimpleGraph V} [inst : Fintype ↑G₁.edgeSet] [inst_1 : Fintype ↑G₂.edgeSet]
  [inst_2 : DecidableEq V], (G₁ \ G₂).edgeFinset = G₁.edgeFinset \ G₂.edgeFinset

theorem SimpleGraph.disjoint_edgeFinset E0 #

∀ {V : Type u_1} {G₁ G₂ : SimpleGraph V} [inst : Fintype ↑G₁.edgeSet] [inst_1 : Fintype ↑G₂.edgeSet],
  Disjoint G₁.edgeFinset G₂.edgeFinset ↔ Disjoint G₁ G₂

theorem SimpleGraph.edgeFinset_eq_empty E0 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype ↑G.edgeSet], G.edgeFinset = ∅ ↔ G = ⊥

theorem SimpleGraph.edgeFinset_nonempty E0 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype ↑G.edgeSet], G.edgeFinset.Nonempty ↔ G ≠ ⊥

theorem SimpleGraph.edgeFinset_card E1 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype ↑G.edgeSet], G.edgeFinset.card = Fintype.card ↑G.edgeSet

theorem SimpleGraph.card_edgeSet E1 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype ↑G.edgeSet], Fintype.card ↑G.edgeSet = G.edgeFinset.card

theorem SimpleGraph.edgeSet_univ_card E1 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype ↑G.edgeSet], Finset.univ.card = G.edgeFinset.card

theorem SimpleGraph.edgeFinset_top E0 #

∀ {V : Type u_1} [inst : Fintype V] [inst_1 : DecidableEq V], ⊤.edgeFinset = Sym2.diagSetᶜ.toFinset

theorem SimpleGraph.card_edgeFinset_top_eq_card_choose_two E1 #

∀ {V : Type u_1} [inst : Fintype V] [inst_1 : DecidableEq V], ⊤.edgeFinset.card = (Fintype.card V).choose 2

The complete graph on n vertices has n.choose 2 edges.

theorem SimpleGraph.card_edgeFinset_le_card_choose_two E1 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype ↑G.edgeSet] [inst_1 : Fintype V],
  G.edgeFinset.card ≤ (Fintype.card V).choose 2

Any graph on n vertices has at most n.choose 2 edges.

def SimpleGraph.neighborFinset E3 #

{V : Type u_1} → (G : SimpleGraph V) → (v : V) → [Fintype ↑(G.neighborSet v)] → Finset V

G.neighborFinset v is the Finset version of G.neighborSet v in case G is locally finite at v.

theorem SimpleGraph.neighborFinset_def E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)],
  G.neighborFinset v = (G.neighborSet v).toFinset

theorem SimpleGraph.coe_neighborFinset E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)],
  ↑(G.neighborFinset v) = G.neighborSet v

theorem SimpleGraph.mem_neighborFinset E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)] (w : V),
  w ∈ G.neighborFinset v ↔ G.Adj v w

theorem SimpleGraph.notMem_neighborFinset_self E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], v ∉ G.neighborFinset v

theorem SimpleGraph.neighborFinset_disjoint_singleton E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], Disjoint (G.neighborFinset v) {v}

theorem SimpleGraph.singleton_disjoint_neighborFinset E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], Disjoint {v} (G.neighborFinset v)

theorem SimpleGraph.neighborFinset_bot E1 #

∀ {V : Type u_1} (v : V) [inst : Fintype ↑(⊥.neighborSet v)], ⊥.neighborFinset v = ∅

theorem SimpleGraph.neighborFinset_top E0 #

∀ {V : Type u_1} (v : V) [inst : Fintype V] [inst_1 : DecidableEq V], ⊤.neighborFinset v = {v}ᶜ

theorem SimpleGraph.neighborFinset_sup E0 #

∀ {V : Type u_1} (v : V) [inst : DecidableEq V] {G₁ G₂ : SimpleGraph V} [inst_1 : Fintype ↑((G₁ ⊔ G₂).neighborSet v)]
  [inst_2 : Fintype ↑(G₁.neighborSet v)] [inst_3 : Fintype ↑(G₂.neighborSet v)],
  (G₁ ⊔ G₂).neighborFinset v = G₁.neighborFinset v ∪ G₂.neighborFinset v

theorem SimpleGraph.neighborFinset_inf E0 #

∀ {V : Type u_1} (v : V) [inst : DecidableEq V] {G₁ G₂ : SimpleGraph V} [inst_1 : Fintype ↑((G₁ ⊓ G₂).neighborSet v)]
  [inst_2 : Fintype ↑(G₁.neighborSet v)] [inst_3 : Fintype ↑(G₂.neighborSet v)],
  (G₁ ⊓ G₂).neighborFinset v = G₁.neighborFinset v ∩ G₂.neighborFinset v

theorem SimpleGraph.neighborFinset_sdiff E0 #

∀ {V : Type u_1} (v : V) [inst : DecidableEq V] {G₁ G₂ : SimpleGraph V} [inst_1 : Fintype ↑((G₁ \ G₂).neighborSet v)]
  [inst_2 : Fintype ↑(G₁.neighborSet v)] [inst_3 : Fintype ↑(G₂.neighborSet v)],
  (G₁ \ G₂).neighborFinset v = G₁.neighborFinset v \ G₂.neighborFinset v

theorem SimpleGraph.disjoint_neighborFinset_of_disjoint E1 #

∀ {V : Type u_1} (G H : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)]
  [inst_1 : Fintype ↑(H.neighborSet v)], Disjoint G H → Disjoint (G.neighborFinset v) (H.neighborFinset v)

theorem SimpleGraph.neighborFinset_sup_of_disjoint E1 #

∀ {V : Type u_1} (v : V) {G₁ G₂ : SimpleGraph V} [inst : Fintype ↑((G₁ ⊔ G₂).neighborSet v)]
  [inst_1 : Fintype ↑(G₁.neighborSet v)] [inst_2 : Fintype ↑(G₂.neighborSet v)] (h : Disjoint G₁ G₂),
  (G₁ ⊔ G₂).neighborFinset v = (G₁.neighborFinset v).disjUnion (G₂.neighborFinset v) ⋯

theorem SimpleGraph.neighborFinset_eq_empty E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)],
  G.neighborFinset v = ∅ ↔ G.IsIsolated v

theorem SimpleGraph.neighborFinset_nonempty E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)],
  (G.neighborFinset v).Nonempty ↔ ¬G.IsIsolated v

theorem SimpleGraph.IsIsolated.neighborFinset_eq_empty E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)],
  G.IsIsolated v → G.neighborFinset v = ∅

Alias of the reverse direction of SimpleGraph.neighborFinset_eq_empty.

theorem SimpleGraph.IsIsolated.of_neighborFinset_eq_empty E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)],
  G.neighborFinset v = ∅ → G.IsIsolated v

Alias of the forward direction of SimpleGraph.neighborFinset_eq_empty.

def SimpleGraph.degree E1 #

{V : Type u_1} → (G : SimpleGraph V) → (v : V) → [Fintype ↑(G.neighborSet v)] → ℕ

G.degree v is the number of vertices adjacent to v.

theorem SimpleGraph.card_neighborFinset_eq_degree E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], (G.neighborFinset v).card = G.degree v

theorem SimpleGraph.card_neighborSet_eq_degree E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)],
  Fintype.card ↑(G.neighborSet v) = G.degree v

theorem SimpleGraph.ncard_neighborSet E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], (G.neighborSet v).ncard = G.degree v

theorem SimpleGraph.encard_neighborSet E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)],
  (G.neighborSet v).encard = ↑(G.degree v)

theorem SimpleGraph.degree_eq_zero E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], G.degree v = 0 ↔ G.IsIsolated v

theorem SimpleGraph.degree_pos E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], 0 < G.degree v ↔ ¬G.IsIsolated v

theorem SimpleGraph.IsIsolated.of_degree_eq_zero E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], G.degree v = 0 → G.IsIsolated v

Alias of the forward direction of SimpleGraph.degree_eq_zero.

theorem SimpleGraph.IsIsolated.degree_eq_zero E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], G.IsIsolated v → G.degree v = 0

Alias of the reverse direction of SimpleGraph.degree_eq_zero.

theorem SimpleGraph.degree_pos_iff_exists_adj E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], 0 < G.degree v ↔ ∃ w, G.Adj v w

theorem SimpleGraph.degree_pos_iff_nonempty E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {v : V} [inst : Fintype ↑(G.neighborSet v)],
  0 < G.degree v ↔ (G.neighborSet v).Nonempty

theorem SimpleGraph.Adj.degree_pos_left E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {v : V} [inst : Fintype ↑(G.neighborSet v)] {w : V}, G.Adj v w → 0 < G.degree v

theorem SimpleGraph.Adj.degree_pos_right E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {v : V} [inst : Fintype ↑(G.neighborSet v)] {w : V}, G.Adj w v → 0 < G.degree v

theorem SimpleGraph.degree_pos_iff_mem_support E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], 0 < G.degree v ↔ v ∈ G.support

theorem SimpleGraph.degree_eq_zero_iff_notMem_support E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], G.degree v = 0 ↔ v ∉ G.support

theorem SimpleGraph.degree_eq_zero_of_subsingleton E1 #

∀ {V : Type u_1} {G : SimpleGraph V} (v : V) [inst : Fintype ↑(G.neighborSet v)] [Subsingleton V], G.degree v = 0

theorem SimpleGraph.nontrivial_of_degree_ne_zero E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {v : V} [inst : Fintype ↑(G.neighborSet v)], G.degree v ≠ 0 → Nontrivial V

theorem SimpleGraph.degree_eq_one_iff_existsUnique_adj E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {v : V} [inst : Fintype ↑(G.neighborSet v)], G.degree v = 1 ↔ ∃! w, G.Adj v w

theorem SimpleGraph.degree_compl E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)] [inst_1 : Fintype ↑(Gᶜ.neighborSet v)]
  [inst_2 : Fintype V], Gᶜ.degree v = Fintype.card V - 1 - G.degree v

instance SimpleGraph.incidenceSetFintype E0 #

{V : Type u_1} → (G : SimpleGraph V) → (v : V) → [Fintype ↑(G.neighborSet v)] → Fintype ↑(G.incidenceSet v)

def SimpleGraph.incidenceFinset E3 #

{V : Type u_1} → (G : SimpleGraph V) → (v : V) → [Fintype ↑(G.incidenceSet v)] → Finset (Sym2 V)

This is the Finset version of incidenceSet.

theorem SimpleGraph.coe_incidenceFinset E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.incidenceSet v)],
  ↑(G.incidenceFinset v) = G.incidenceSet v

theorem SimpleGraph.mem_incidenceFinset E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {v : V} [inst : Fintype ↑(G.incidenceSet v)] {e : Sym2 V},
  e ∈ G.incidenceFinset v ↔ e ∈ G.incidenceSet v

theorem SimpleGraph.incidenceFinset_eq_filter E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.incidenceSet v)] [inst_1 : DecidableEq V]
  [inst_2 : Fintype ↑G.edgeSet], G.incidenceFinset v = {e ∈ G.edgeFinset | v ∈ e}

theorem SimpleGraph.incidenceFinset_subset E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.incidenceSet v)] [inst_1 : Fintype ↑G.edgeSet],
  G.incidenceFinset v ⊆ G.edgeFinset

theorem SimpleGraph.card_incidenceSet_eq_degree E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)],
  Fintype.card ↑(G.incidenceSet v) = G.degree v

theorem SimpleGraph.ncard_incidenceSet E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)], (G.incidenceSet v).ncard = G.degree v

theorem SimpleGraph.encard_incidenceSet E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)],
  (G.incidenceSet v).encard = ↑(G.degree v)

theorem SimpleGraph.card_incidenceFinset_eq_degree E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)],
  (G.incidenceFinset v).card = G.degree v

theorem SimpleGraph.disjoint_incidenceFinset_of_disjoint E1 #

∀ {V : Type u_1} (G H : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)]
  [inst_1 : Fintype ↑(H.neighborSet v)], Disjoint G H → Disjoint (G.incidenceFinset v) (H.incidenceFinset v)

theorem SimpleGraph.degree_le_card_edgeFinset E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (v : V) [inst : Fintype ↑(G.neighborSet v)] [inst_1 : Fintype ↑G.edgeSet],
  G.degree v ≤ G.edgeFinset.card

The degree of a vertex is at most the number of edges.

theorem SimpleGraph.degree_le_of_le E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {v : V} [inst : Fintype ↑(G.neighborSet v)] {H : SimpleGraph V}
  [inst_1 : Fintype ↑(H.neighborSet v)], G ≤ H → G.degree v ≤ H.degree v

If G ≤ H then G.degree v ≤ H.degree v for any vertex v.

theorem SimpleGraph.degree_lt_card_verts E1 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype V] [inst_1 : DecidableRel G.Adj] (v : V),
  G.degree v < Fintype.card V

abbrev SimpleGraph.LocallyFinite E1 #

{V : Type u_1} → SimpleGraph V → Type u_1

A graph is locally finite if every vertex has a finite neighbor set.

def SimpleGraph.IsRegularOfDegree E1 #

{V : Type u_1} → (G : SimpleGraph V) → [G.LocallyFinite] → ℕ → Prop

A locally finite simple graph is regular of degree d if every vertex has degree d.

theorem SimpleGraph.IsRegularOfDegree.degree_eq E0 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : G.LocallyFinite] {d : ℕ}, G.IsRegularOfDegree d → ∀ (v : V), G.degree v = d

theorem SimpleGraph.IsRegularOfDegree.of_isEmpty E0 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : G.LocallyFinite] [IsEmpty V] {d : ℕ}, G.IsRegularOfDegree d

The empty graph is regular of any degree d

theorem SimpleGraph.IsRegularOfDegree.compl E1 #

∀ {V : Type u_1} [inst : Fintype V] [inst_1 : DecidableEq V] {G : SimpleGraph V} [inst_2 : DecidableRel G.Adj] {k : ℕ},
  G.IsRegularOfDegree k → Gᶜ.IsRegularOfDegree (Fintype.card V - 1 - k)

theorem SimpleGraph.neighborFinset_eq_filter E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] {v : V} [inst_1 : DecidableRel G.Adj],
  G.neighborFinset v = {w | G.Adj v w}

theorem SimpleGraph.neighborFinset_compl E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableEq V] [inst_2 : DecidableRel G.Adj] (v : V),
  Gᶜ.neighborFinset v = (G.neighborFinset v)ᶜ \ {v}

theorem SimpleGraph.complete_graph_degree E0 #

∀ {V : Type u_1} [inst : Fintype V] [inst_1 : DecidableEq V] (v : V),
  (SimpleGraph.completeGraph V).degree v = Fintype.card V - 1

theorem SimpleGraph.bot_degree E1 #

∀ {V : Type u_1} [inst : Fintype V] (v : V), ⊥.degree v = 0

theorem SimpleGraph.IsRegularOfDegree.top E1 #

∀ {V : Type u_1} [inst : Fintype V] [inst_1 : DecidableEq V], ⊤.IsRegularOfDegree (Fintype.card V - 1)

theorem SimpleGraph.IsRegularOfDegree.bot E0 #

∀ {V : Type u_1} [inst : Fintype V], ⊥.IsRegularOfDegree 0

def SimpleGraph.minDegree E1 #

{V : Type u_1} → (G : SimpleGraph V) → [Fintype V] → [DecidableRel G.Adj] → ℕ

The minimum degree of all vertices (and 0 if there are no vertices). The key properties of this are given in exists_minimal_degree_vertex, minDegree_le_degree and le_minDegree_of_forall_le_degree.

theorem SimpleGraph.exists_minimal_degree_vertex E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] [Nonempty V],
  ∃ v, G.minDegree = G.degree v

There exists a vertex of minimal degree. Note the assumption of being nonempty is necessary, as the lemma implies there exists a vertex.

theorem SimpleGraph.minDegree_le_degree E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] (v : V), G.minDegree ≤ G.degree v

The minimum degree in the graph is at most the degree of any particular vertex.

theorem SimpleGraph.le_minDegree_of_forall_le_degree E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] [Nonempty V] (k : ℕ),
  (∀ (v : V), k ≤ G.degree v) → k ≤ G.minDegree

In a nonempty graph, if k is at most the degree of every vertex, it is at most the minimum degree. Note the assumption that the graph is nonempty is necessary as long as G.minDegree is defined to be a natural.

theorem SimpleGraph.minDegree_of_subsingleton E0 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] [Subsingleton V], G.minDegree = 0

theorem SimpleGraph.minDegree_le_minDegree E1 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype V] {H : SimpleGraph V} [inst_1 : DecidableRel G.Adj]
  [inst_2 : DecidableRel H.Adj], G ≤ H → G.minDegree ≤ H.minDegree

If G is a subgraph of H then G.minDegree ≤ H.minDegree.

theorem SimpleGraph.minDegree_lt_card E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] [Nonempty V],
  G.minDegree < Fintype.card V

In a nonempty graph, the minimal degree is less than the number of vertices.

def SimpleGraph.maxDegree E1 #

{V : Type u_1} → (G : SimpleGraph V) → [Fintype V] → [DecidableRel G.Adj] → ℕ

The maximum degree of all vertices (and 0 if there are no vertices). The key properties of this are given in exists_maximal_degree_vertex, degree_le_maxDegree and maxDegree_le_of_forall_degree_le.

theorem SimpleGraph.exists_maximal_degree_vertex E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] [Nonempty V],
  ∃ v, G.maxDegree = G.degree v

There exists a vertex of maximal degree. Note the assumption of being nonempty is necessary, as the lemma implies there exists a vertex.

theorem SimpleGraph.degree_le_maxDegree E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] (v : V), G.degree v ≤ G.maxDegree

The maximum degree in the graph is at least the degree of any particular vertex.

theorem SimpleGraph.maxDegree_of_subsingleton E0 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] [Subsingleton V], G.maxDegree = 0

theorem SimpleGraph.maxDegree_le_of_forall_degree_le E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] (k : ℕ),
  (∀ (v : V), G.degree v ≤ k) → G.maxDegree ≤ k

In a graph, if k is at least the degree of every vertex, then it is at least the maximum degree.

theorem SimpleGraph.IsRegularOfDegree.maxDegree_eq E0 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [Nonempty V] [inst_2 : DecidableRel G.Adj] {d : ℕ},
  G.IsRegularOfDegree d → G.maxDegree = d

theorem SimpleGraph.maxDegree_bot_eq_zero E0 #

∀ {V : Type u_1} [inst : Fintype V], ⊥.maxDegree = 0

theorem SimpleGraph.maxDegree_eq_zero_iff E0 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype V] [inst_1 : DecidableRel G.Adj], G.maxDegree = 0 ↔ G = ⊥

theorem SimpleGraph.maxDegree_top E0 #

∀ {V : Type u_1} [inst : Fintype V] [inst_1 : DecidableEq V], ⊤.maxDegree = Fintype.card V - 1

theorem SimpleGraph.minDegree_le_maxDegree E0 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj], G.minDegree ≤ G.maxDegree

theorem SimpleGraph.IsRegularOfDegree.minDegree_eq E0 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [Nonempty V] [inst_2 : DecidableRel G.Adj] {d : ℕ},
  G.IsRegularOfDegree d → G.minDegree = d

theorem SimpleGraph.minDegree_bot_eq_zero E0 #

∀ {V : Type u_1} [inst : Fintype V], ⊥.minDegree = 0

theorem SimpleGraph.minDegree_eq_zero_iff E0 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype V] [inst_1 : DecidableRel G.Adj] [Nonempty V],
  G.minDegree = 0 ↔ ∃ v, G.IsIsolated v

theorem SimpleGraph.minDegree_eq_zero_iff_support_ne E1 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype V] [inst_1 : DecidableRel G.Adj] [Nonempty V],
  G.minDegree = 0 ↔ G.support ≠ Set.univ

theorem SimpleGraph.minDegree_top E0 #

∀ {V : Type u_1} [inst : Fintype V] [inst_1 : DecidableEq V], ⊤.minDegree = Fintype.card V - 1

theorem SimpleGraph.maxDegree_lt_card_verts E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] [Nonempty V],
  G.maxDegree < Fintype.card V

The maximum degree of a nonempty graph is less than the number of vertices. Note that the assumption that V is nonempty is necessary, as otherwise this would assert the existence of a natural number less than zero.

theorem SimpleGraph.card_commonNeighbors_le_degree_left E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] (v w : V),
  Fintype.card ↑(G.commonNeighbors v w) ≤ G.degree v

theorem SimpleGraph.card_commonNeighbors_le_degree_right E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] (v w : V),
  Fintype.card ↑(G.commonNeighbors v w) ≤ G.degree w

theorem SimpleGraph.card_commonNeighbors_lt_card_verts E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] (v w : V),
  Fintype.card ↑(G.commonNeighbors v w) < Fintype.card V

theorem SimpleGraph.Adj.card_commonNeighbors_lt_degree E1 #

∀ {V : Type u_1} [inst : Fintype V] {G : SimpleGraph V} [inst_1 : DecidableRel G.Adj] {v w : V},
  G.Adj v w → Fintype.card ↑(G.commonNeighbors v w) < G.degree v

If the condition G.Adj v w fails, then card_commonNeighbors_le_degree is the best we can do in general.

theorem SimpleGraph.card_commonNeighbors_top E1 #

∀ {V : Type u_1} [inst : Fintype V] [inst_1 : DecidableEq V] {v w : V},
  v ≠ w → Fintype.card ↑(⊤.commonNeighbors v w) = Fintype.card V - 2

theorem SimpleGraph.encard_commonNeighbors_top E1 #

∀ {V : Type u_1} {u v : V}, u ≠ v → (⊤.commonNeighbors u v).encard = ENat.card V - 2

theorem SimpleGraph.insert_neighborFinset_eq_univ E0 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableEq V] [inst_2 : DecidableRel G.Adj] (v : V),
  insert v (G.neighborFinset v) = Finset.univ ↔ G.IsUniversal v

theorem SimpleGraph.neighborFinset_eq_erase_univ E0 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableEq V] [inst_2 : DecidableRel G.Adj] (v : V),
  G.neighborFinset v = Finset.univ.erase v ↔ G.IsUniversal v

theorem SimpleGraph.degree_eq_card_sub_one E0 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] (v : V),
  G.degree v = Fintype.card V - 1 ↔ G.IsUniversal v

theorem SimpleGraph.degree_lt_card_sub_one E1 #

∀ {V : Type u_1} (G : SimpleGraph V) [inst : Fintype V] [inst_1 : DecidableRel G.Adj] (v : V),
  G.degree v < Fintype.card V - 1 ↔ ¬G.IsUniversal v

theorem SimpleGraph.Iso.card_edgeFinset_eq E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {W : Type u_2} {G' : SimpleGraph W} (f : G ≃g G') [inst : Fintype ↑G.edgeSet]
  [inst_1 : Fintype ↑G'.edgeSet], G.edgeFinset.card = G'.edgeFinset.card

theorem SimpleGraph.Iso.degree_eq E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {W : Type u_2} {G' : SimpleGraph W} (f : G ≃g G') (x : V)
  [inst : Fintype ↑(G.neighborSet x)] [inst_1 : Fintype ↑(G'.neighborSet (f x))], G'.degree (f x) = G.degree x

theorem SimpleGraph.Iso.minDegree_eq E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {W : Type u_2} {G' : SimpleGraph W} [inst : Fintype V]
  [inst_1 : DecidableRel G.Adj] [inst_2 : Fintype W] [inst_3 : DecidableRel G'.Adj] (f : G ≃g G'),
  G.minDegree = G'.minDegree

theorem SimpleGraph.Iso.maxDegree_eq E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {W : Type u_2} {G' : SimpleGraph W} [inst : Fintype V]
  [inst_1 : DecidableRel G.Adj] [inst_2 : Fintype W] [inst_3 : DecidableRel G'.Adj] (f : G ≃g G'),
  G.maxDegree = G'.maxDegree

theorem SimpleGraph.edgeFinset_subset_sym2_of_support_subset E1 #

∀ {V : Type u_1} {s : Set V} [inst : DecidablePred fun x ↦ x ∈ s] [inst_1 : Fintype V] {G : SimpleGraph V}
  [inst_2 : DecidableRel G.Adj], G.support ⊆ s → G.edgeFinset ⊆ s.toFinset.sym2

instance SimpleGraph.instDecidablePredMemSetSupport E0 #

{V : Type u_1} → [Fintype V] → {G : SimpleGraph V} → [DecidableRel G.Adj] → DecidablePred fun x ↦ x ∈ G.support

theorem SimpleGraph.map_edgeFinset_induce E0 #

∀ {V : Type u_1} {s : Set V} [inst : DecidablePred fun x ↦ x ∈ s] [inst_1 : Fintype V] {G : SimpleGraph V}
  [inst_2 : DecidableRel G.Adj] [inst_3 : DecidableEq V],
  Finset.map (Function.Embedding.subtype fun x ↦ x ∈ s).sym2Map (SimpleGraph.induce s G).edgeFinset =
    G.edgeFinset ∩ s.toFinset.sym2

theorem SimpleGraph.map_edgeFinset_induce_of_support_subset E0 #

∀ {V : Type u_1} {s : Set V} [inst : DecidablePred fun x ↦ x ∈ s] [inst_1 : Fintype V] {G : SimpleGraph V}
  [inst_2 : DecidableRel G.Adj],
  G.support ⊆ s →
    Finset.map (Function.Embedding.subtype fun x ↦ x ∈ s).sym2Map (SimpleGraph.induce s G).edgeFinset = G.edgeFinset

theorem SimpleGraph.card_edgeFinset_induce_of_support_subset E1 #

∀ {V : Type u_1} {s : Set V} [inst : DecidablePred fun x ↦ x ∈ s] [inst_1 : Fintype V] {G : SimpleGraph V}
  [inst_2 : DecidableRel G.Adj], G.support ⊆ s → (SimpleGraph.induce s G).edgeFinset.card = G.edgeFinset.card

If the support of the simple graph G is a subset of the set s, then the induced subgraph of s has the same number of edges as G.

theorem SimpleGraph.card_edgeFinset_induce_support E1 #

∀ {V : Type u_1} [inst : Fintype V] {G : SimpleGraph V} [inst_1 : DecidableRel G.Adj],
  (SimpleGraph.induce G.support G).edgeFinset.card = G.edgeFinset.card

theorem SimpleGraph.map_neighborFinset_induce E0 #

∀ {V : Type u_1} {s : Set V} [inst : DecidablePred fun x ↦ x ∈ s] [inst_1 : Fintype V] {G : SimpleGraph V}
  [inst_2 : DecidableRel G.Adj] [inst_3 : DecidableEq V] (v : ↑s),
  Finset.map (Function.Embedding.subtype fun x ↦ x ∈ s) ((SimpleGraph.induce s G).neighborFinset v) =
    G.neighborFinset ↑v ∩ s.toFinset

theorem SimpleGraph.map_neighborFinset_induce_of_neighborSet_subset E0 #

∀ {V : Type u_1} {s : Set V} [inst : DecidablePred fun x ↦ x ∈ s] [inst_1 : Fintype V] {G : SimpleGraph V}
  [inst_2 : DecidableRel G.Adj] {v : ↑s},
  G.neighborSet ↑v ⊆ s →
    Finset.map (Function.Embedding.subtype fun x ↦ x ∈ s) ((SimpleGraph.induce s G).neighborFinset v) =
      G.neighborFinset ↑v

theorem SimpleGraph.degree_induce_of_neighborSet_subset E1 #

∀ {V : Type u_1} {s : Set V} [inst : DecidablePred fun x ↦ x ∈ s] [inst_1 : Fintype V] {G : SimpleGraph V}
  [inst_2 : DecidableRel G.Adj] {v : ↑s}, G.neighborSet ↑v ⊆ s → (SimpleGraph.induce s G).degree v = G.degree ↑v

If the neighbor set of a vertex v is a subset of s, then the degree of the vertex in the induced subgraph of s is the same as in G.

theorem SimpleGraph.degree_induce_of_support_subset E1 #

∀ {V : Type u_1} {s : Set V} [inst : DecidablePred fun x ↦ x ∈ s] [inst_1 : Fintype V] {G : SimpleGraph V}
  [inst_2 : DecidableRel G.Adj], G.support ⊆ s → ∀ (v : ↑s), (SimpleGraph.induce s G).degree v = G.degree ↑v

If the support of the simple graph G is a subset of the set s, then the degree of vertices in the induced subgraph of s are the same as in G.

theorem SimpleGraph.degree_induce_support E0 #

∀ {V : Type u_1} [inst : Fintype V] {G : SimpleGraph V} [inst_1 : DecidableRel G.Adj] (v : ↑G.support),
  (SimpleGraph.induce G.support G).degree v = G.degree ↑v

theorem SimpleGraph.le_minDegree_induce_of_support_subset E1 #

∀ {V : Type u_1} {s : Set V} [inst : DecidablePred fun x ↦ x ∈ s] [inst_1 : Fintype V] {G : SimpleGraph V}
  [inst_2 : DecidableRel G.Adj], G.support ⊆ s → G.minDegree ≤ (SimpleGraph.induce s G).minDegree

theorem SimpleGraph.filter_edgeFinset_toFinset_subset E1 #

∀ {V : Type u_1} [inst : Fintype V] {G : SimpleGraph V} [inst_1 : DecidableRel G.Adj] [inst_2 : DecidableEq V]
  (s : Finset V), {e ∈ G.edgeFinset | e.toFinset ⊆ s} = G.edgeFinset ∩ s.sym2

theorem SimpleGraph.card_filter_edgeFinset_toFinset_subset E1 #

∀ {V : Type u_1} [inst : Fintype V] {G : SimpleGraph V} [inst_1 : DecidableRel G.Adj] [inst_2 : DecidableEq V]
  (s : Finset V), {e ∈ G.edgeFinset | e.toFinset ⊆ s}.card = (SimpleGraph.induce (↑s) G).edgeFinset.card

The edges whose vertices lie in s are in bijection with the edges of the induced subgraph G.induce s.

theorem SimpleGraph.edgeFinset_map E0 #

∀ {V : Type u_1} [inst : Fintype V] {W : Type u_2} [inst_1 : Fintype W] [inst_2 : DecidableEq W] (f : V ↪ W)
  (G : SimpleGraph V) [inst_3 : DecidableRel G.Adj],
  (SimpleGraph.map (⇑f) G).edgeFinset = Finset.map f.sym2Map G.edgeFinset

theorem SimpleGraph.card_edgeFinset_map E1 #

∀ {V : Type u_1} [inst : Fintype V] {W : Type u_2} [inst_1 : Fintype W] [inst_2 : DecidableEq W] (f : V ↪ W)
  (G : SimpleGraph V) [inst_3 : DecidableRel G.Adj], (SimpleGraph.map (⇑f) G).edgeFinset.card = G.edgeFinset.card

theorem SimpleGraph.degree_map_apply E0 #

∀ {V : Type u_3} {W : Type u_4} (G : SimpleGraph V) (f : V ↪ W) (v : V) [inst : Fintype ↑(G.neighborSet v)]
  [inst_1 : Fintype ↑((SimpleGraph.map (⇑f) G).neighborSet (f v))], (SimpleGraph.map (⇑f) G).degree (f v) = G.degree v

theorem SimpleGraph.Embedding.degree_eq_of_neighborSet_subset_range E1 #

∀ {V : Type u_3} {V' : Type u_4} {G : SimpleGraph V} {G' : SimpleGraph V'} {f : G ↪g G'} {v : V}
  [inst : Fintype ↑(G.neighborSet v)] [inst_1 : Fintype ↑(G'.neighborSet (f v))],
  G'.neighborSet (f v) ⊆ Set.range ⇑f → G'.degree (f v) = G.degree v

Deprecated aliases

NameNew nameSince
SimpleGraph.maxDegree_of_isEmptySimpleGraph.maxDegree_of_subsingleton2026-06-15
SimpleGraph.minDegree_of_isEmptySimpleGraph.minDegree_of_subsingleton2026-06-15