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

59 declarations and 1 deprecated aliases. Mathlib docs · Source

Complete Multipartite Graphs

A graph is complete multipartite iff non-adjacency is transitive.

Main declarations

  • SimpleGraph.IsCompleteMultipartite: predicate for a graph to be complete multipartite.

  • SimpleGraph.IsCompleteMultipartite.setoid: the Setoid given by non-adjacency.

  • SimpleGraph.IsCompleteMultipartite.iso: the graph isomorphism from a graph that IsCompleteMultipartite to the corresponding completeMultipartiteGraph.

  • SimpleGraph.IsPathGraph3Compl: predicate for three vertices to witness the non-complete-multipartiteness of a graph G. (The name refers to the fact that the three vertices form the complement of pathGraph 3.)

  • See also: Mathlib/Combinatorics/SimpleGraph/FiveWheelLike.lean. The lemma colorable_iff_isCompleteMultipartite_of_maximal_cliqueFree states that a maximally r + 1-cliquefree graph is r-colorable iff it is complete multipartite.

  • SimpleGraph.completeEquipartiteGraph: the complete equipartite graph in parts of equal size such that two vertices are adjacent if and only if they are in different parts.

  • SimpleGraph.CompleteEquipartiteSubgraph G r t is a complete equipartite subgraph, that is, r subsets of vertices each of size t such that the vertices in distinct subsets are adjacent.

Implementation notes

The definition of completeEquipartiteGraph is similar to completeMultipartiteGraph except that Sigma.fst is replaced by Prod.fst in the definition. The difference is that the former vertices are a product type whereas the latter vertices are a dependent product type.

While completeEquipartiteGraph r t could have been defined as the specialisation completeMultipartiteGraph (const (Fin r) (Fin t)) (or turanGraph (r * t) r), it is convenient to instead have a non-dependent product type for the vertices.

See completeEquipartiteGraph.completeMultipartiteGraph, completeEquipartiteGraph.turanGraph for the isomorphisms between a completeEquipartiteGraph and a corresponding completeMultipartiteGraph, turanGraph.

theorem SimpleGraph.CompleteEquipartiteSubgraph.mk.injEq E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} (parts : Finset (Finset V)) (card_parts : parts.card = r ∨ t = 0)
  (card_mem_parts : ∀ {p : Finset V}, p ∈ parts → p.card = t)
  (isCompleteBetween : (↑parts).Pairwise fun x1 x2 ↦ G.IsCompleteBetween ↑x1 ↑x2) (parts_1 : Finset (Finset V))
  (card_parts_1 : parts_1.card = r ∨ t = 0) (card_mem_parts_1 : ∀ {p : Finset V}, p ∈ parts_1 → p.card = t)
  (isCompleteBetween_1 : (↑parts_1).Pairwise fun x1 x2 ↦ G.IsCompleteBetween ↑x1 ↑x2),
  ({ parts := parts, card_parts := card_parts, card_mem_parts := card_mem_parts,
        isCompleteBetween := isCompleteBetween } =
      { parts := parts_1, card_parts := card_parts_1, card_mem_parts := card_mem_parts_1,
        isCompleteBetween := isCompleteBetween_1 }) =
    (parts = parts_1)

def SimpleGraph.CompleteEquipartiteSubgraph.ctorIdx E1 #

{V : Type u_1} → {G : SimpleGraph V} → {r t : ℕ} → G.CompleteEquipartiteSubgraph r t → ℕ

theorem SimpleGraph.CompleteEquipartiteSubgraph.mk.inj E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} {parts : Finset (Finset V)} {card_parts : parts.card = r ∨ t = 0}
  {card_mem_parts : ∀ {p : Finset V}, p ∈ parts → p.card = t}
  {isCompleteBetween : (↑parts).Pairwise fun x1 x2 ↦ G.IsCompleteBetween ↑x1 ↑x2} {parts_1 : Finset (Finset V)}
  {card_parts_1 : parts_1.card = r ∨ t = 0} {card_mem_parts_1 : ∀ {p : Finset V}, p ∈ parts_1 → p.card = t}
  {isCompleteBetween_1 : (↑parts_1).Pairwise fun x1 x2 ↦ G.IsCompleteBetween ↑x1 ↑x2},
  { parts := parts, card_parts := card_parts, card_mem_parts := card_mem_parts,
        isCompleteBetween := isCompleteBetween } =
      { parts := parts_1, card_parts := card_parts_1, card_mem_parts := card_mem_parts_1,
        isCompleteBetween := isCompleteBetween_1 } →
    parts = parts_1

def SimpleGraph.IsCompleteMultipartite E3 #

{α : Type u} → SimpleGraph α → Prop

G is IsCompleteMultipartite iff non-adjacency is transitive

theorem SimpleGraph.IsCompleteMultipartite.top E1 #

∀ {α : Type u}, ⊤.IsCompleteMultipartite

theorem SimpleGraph.IsCompleteMultipartite.bot E1 #

∀ {α : Type u}, ⊥.IsCompleteMultipartite

theorem SimpleGraph.IsCompleteMultipartite.completeBipartiteGraph E1 #

∀ (V : Type u_1) (W : Type u_2), (completeBipartiteGraph V W).IsCompleteMultipartite

theorem SimpleGraph.IsCompleteMultipartite.induce E1 #

∀ {α : Type u} {G : SimpleGraph α} {s : Set α},
  G.IsCompleteMultipartite → (SimpleGraph.induce s G).IsCompleteMultipartite

def SimpleGraph.IsCompleteMultipartite.setoid E3 #

{α : Type u} → {G : SimpleGraph α} → G.IsCompleteMultipartite → Setoid α

The setoid given by non-adjacency

theorem SimpleGraph.completeMultipartiteGraph.isCompleteMultipartite E1 #

∀ {ι : Type u_1} (V : ι → Type u_2), (SimpleGraph.completeMultipartiteGraph V).IsCompleteMultipartite

def SimpleGraph.IsCompleteMultipartite.iso E3 #

{α : Type u} →
  {G : SimpleGraph α} →
    (h : G.IsCompleteMultipartite) → G ≃g SimpleGraph.completeMultipartiteGraph fun c ↦ { x // h.setoid c.out x }

The graph isomorphism from a graph G that IsCompleteMultipartite to the corresponding completeMultipartiteGraph (see also isCompleteMultipartite_iff)

theorem SimpleGraph.isCompleteMultipartite_iff E0 #

∀ {α : Type u} {G : SimpleGraph α},
  G.IsCompleteMultipartite ↔
    ∃ ι V, ∃ (_ : ∀ (i : ι), Nonempty (V i)), Nonempty (G ≃g SimpleGraph.completeMultipartiteGraph V)

theorem SimpleGraph.IsCompleteMultipartite.colorable_of_cliqueFree E1 #

∀ {α : Type u} {G : SimpleGraph α} {n : ℕ}, G.IsCompleteMultipartite → G.CliqueFree n → G.Colorable (n - 1)

structure SimpleGraph.IsPathGraph3Compl E3 #

{α : Type u} → SimpleGraph α → α → α → α → Prop

The vertices v, w₁, w₂ form an IsPathGraph3Compl in G iff w₁w₂ is the only edge present between these three vertices. It is a witness to the non-complete-multipartite-ness of G (see not_isCompleteMultipartite_iff_exists_isPathGraph3Compl). This structure is an explicit way of saying that the induced graph on {v, w₁, w₂} is the complement of P3.

ctor SimpleGraph.IsPathGraph3Compl.mk E0 #

∀ {α : Type u} {G : SimpleGraph α} {v w₁ w₂ : α}, G.Adj w₁ w₂ → ¬G.Adj v w₁ → ¬G.Adj v w₂ → G.IsPathGraph3Compl v w₁ w₂

theorem SimpleGraph.IsPathGraph3Compl.adj E1 #

∀ {α : Type u} {G : SimpleGraph α} {v w₁ w₂ : α}, G.IsPathGraph3Compl v w₁ w₂ → G.Adj w₁ w₂

theorem SimpleGraph.IsPathGraph3Compl.not_adj_fst E1 #

∀ {α : Type u} {G : SimpleGraph α} {v w₁ w₂ : α}, G.IsPathGraph3Compl v w₁ w₂ → ¬G.Adj v w₁

theorem SimpleGraph.IsPathGraph3Compl.not_adj_snd E1 #

∀ {α : Type u} {G : SimpleGraph α} {v w₁ w₂ : α}, G.IsPathGraph3Compl v w₁ w₂ → ¬G.Adj v w₂

theorem SimpleGraph.IsPathGraph3Compl.ne_fst E1 #

∀ {α : Type u} {G : SimpleGraph α} {v w₁ w₂ : α}, G.IsPathGraph3Compl v w₁ w₂ → v ≠ w₁

theorem SimpleGraph.IsPathGraph3Compl.ne_snd E1 #

∀ {α : Type u} {G : SimpleGraph α} {v w₁ w₂ : α}, G.IsPathGraph3Compl v w₁ w₂ → v ≠ w₂

theorem SimpleGraph.IsPathGraph3Compl.fst_ne_snd E1 #

∀ {α : Type u} {G : SimpleGraph α} {v w₁ w₂ : α}, G.IsPathGraph3Compl v w₁ w₂ → w₁ ≠ w₂

theorem SimpleGraph.IsPathGraph3Compl.symm E1 #

∀ {α : Type u} {G : SimpleGraph α} {v w₁ w₂ : α}, G.IsPathGraph3Compl v w₁ w₂ → G.IsPathGraph3Compl v w₂ w₁

theorem SimpleGraph.exists_isPathGraph3Compl_of_not_isCompleteMultipartite E1 #

∀ {α : Type u} {G : SimpleGraph α}, ¬G.IsCompleteMultipartite → ∃ v w₁ w₂, G.IsPathGraph3Compl v w₁ w₂

theorem SimpleGraph.not_isCompleteMultipartite_iff_exists_isPathGraph3Compl E1 #

∀ {α : Type u} {G : SimpleGraph α}, ¬G.IsCompleteMultipartite ↔ ∃ v w₁ w₂, G.IsPathGraph3Compl v w₁ w₂

def SimpleGraph.IsPathGraph3Compl.pathGraph3ComplEmbedding E1 #

{α : Type u} → {G : SimpleGraph α} → {v w₁ w₂ : α} → G.IsPathGraph3Compl v w₁ w₂ → (SimpleGraph.pathGraph 3)ᶜ ↪g G

Any IsPathGraph3Compl in G gives rise to a graph embedding of the complement of the path graph

def SimpleGraph.pathGraph3ComplEmbeddingOf E1 #

{α : Type u} → {G : SimpleGraph α} → ¬G.IsCompleteMultipartite → (SimpleGraph.pathGraph 3)ᶜ ↪g G

Embedding of (pathGraph 3)ᶜ into G that is not complete-multipartite.

theorem SimpleGraph.not_isCompleteMultipartite_of_pathGraph3ComplEmbedding E1 #

∀ {α : Type u} {G : SimpleGraph α} (e : (SimpleGraph.pathGraph 3)ᶜ ↪g G), ¬G.IsCompleteMultipartite

theorem SimpleGraph.IsCompleteMultipartite.comap E1 #

∀ {α : Type u} {G : SimpleGraph α} {β : Type u_1} {H : SimpleGraph β} (f : H ↪g G),
  G.IsCompleteMultipartite → H.IsCompleteMultipartite

abbrev SimpleGraph.completeEquipartiteGraph E3 #

(r t : ℕ) → SimpleGraph (Fin r × Fin t)

The complete equipartite graph in r parts each of equal size t such that two vertices are adjacent if and only if they are in different parts, often denoted $K_r(t)$.

This is isomorphic to a corresponding completeMultipartiteGraph and turanGraph. The difference is that the former vertices are a product type.

See completeEquipartiteGraph.completeMultipartiteGraph, completeEquipartiteGraph.turanGraph.

theorem SimpleGraph.completeEquipartiteGraph_adj E1 #

∀ {r t : ℕ} {v w : Fin r × Fin t}, (SimpleGraph.completeEquipartiteGraph r t).Adj v w ↔ v.1 ≠ w.1

def SimpleGraph.completeEquipartiteGraph.completeMultipartiteGraph E3 #

{r t : ℕ} →
  SimpleGraph.completeEquipartiteGraph r t ≃g SimpleGraph.completeMultipartiteGraph (Function.const (Fin r) (Fin t))

A completeEquipartiteGraph is isomorphic to a corresponding completeMultipartiteGraph.

The difference is that the former vertices are a product type whereas the latter vertices are a dependent product type.

def SimpleGraph.completeEquipartiteGraph.turanGraph E1 #

{r t : ℕ} → SimpleGraph.completeEquipartiteGraph r t ≃g SimpleGraph.turanGraph (r * t) r

A completeEquipartiteGraph is isomorphic to a corresponding turanGraph.

The difference is that the former vertices are a product type whereas the latter vertices are not.

theorem SimpleGraph.completeEquipartiteGraph_eq_bot_iff E0 #

∀ {r t : ℕ}, SimpleGraph.completeEquipartiteGraph r t = ⊥ ↔ r ≤ 1 ∨ t = 0

completeEquipartiteGraph r t contains no edges when r ≤ 1 or t = 0.

theorem SimpleGraph.completeEquipartiteGraph.isCompleteMultipartite E1 #

∀ {r t : ℕ}, (SimpleGraph.completeEquipartiteGraph r t).IsCompleteMultipartite

theorem SimpleGraph.neighborSet_completeEquipartiteGraph E1 #

∀ {r t : ℕ} (v : Fin r × Fin t), (SimpleGraph.completeEquipartiteGraph r t).neighborSet v = {v.1}ᶜ ×ˢ Set.univ

theorem SimpleGraph.neighborFinset_completeEquipartiteGraph E1 #

∀ {r t : ℕ} (v : Fin r × Fin t), (SimpleGraph.completeEquipartiteGraph r t).neighborFinset v = {v.1}ᶜ ×ˢ Finset.univ

theorem SimpleGraph.degree_completeEquipartiteGraph E1 #

∀ {r t : ℕ} (v : Fin r × Fin t), (SimpleGraph.completeEquipartiteGraph r t).degree v = (r - 1) * t

theorem SimpleGraph.card_edgeFinset_completeEquipartiteGraph E1 #

∀ {r t : ℕ}, (SimpleGraph.completeEquipartiteGraph r t).edgeFinset.card = r.choose 2 * t ^ 2

theorem SimpleGraph.isContained_completeEquipartiteGraph_of_colorable E1 #

∀ {α : Type u} {G : SimpleGraph α} [inst : Fintype α] {n : ℕ} (C : G.Coloring (Fin n)) (t : ℕ),
  (∀ (c : Fin n), Fintype.card ↑(C.colorClass c) ≤ t) → G.IsContained (SimpleGraph.completeEquipartiteGraph n t)

Every n-colorable graph is contained in a completeEquipartiteGraph in n parts (as long as the parts are at least as large as the largest color class).

structure SimpleGraph.CompleteEquipartiteSubgraph E1 #

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

A complete equipartite subgraph in r > 0 parts each of size t ≠ 0 in G is r subsets of vertices each of size t such that vertices in distinct subsets are adjacent.

If r > 0 but t = 0, then parts = {{}}. If r = 0, then parts = {}. These are the two distinct "empty" complete equipartite subgraphs, that is, the complete equipartite subgraphs having no vertices.

theorem SimpleGraph.CompleteEquipartiteSubgraph.ext E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} {x y : G.CompleteEquipartiteSubgraph r t}, x.parts = y.parts → x = y

theorem SimpleGraph.CompleteEquipartiteSubgraph.ext_iff E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} {x y : G.CompleteEquipartiteSubgraph r t}, x = y ↔ x.parts = y.parts

ctor SimpleGraph.CompleteEquipartiteSubgraph.mk E0 #

{V : Type u_1} →
  {G : SimpleGraph V} →
    {r t : ℕ} →
      (parts : Finset (Finset V)) →
        parts.card = r ∨ t = 0 →
          (∀ {p : Finset V}, p ∈ parts → p.card = t) →
            ((↑parts).Pairwise fun x1 x2 ↦ G.IsCompleteBetween ↑x1 ↑x2) → G.CompleteEquipartiteSubgraph r t

abbrev SimpleGraph.CompleteEquipartiteSubgraph.parts E1 #

{V : Type u_1} → {G : SimpleGraph V} → {r t : ℕ} → G.CompleteEquipartiteSubgraph r t → Finset (Finset V)

The parts in a complete equipartite subgraph.

theorem SimpleGraph.CompleteEquipartiteSubgraph.card_parts E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} (self : G.CompleteEquipartiteSubgraph r t), self.parts.card = r ∨ t = 0

There are r parts or t = 0.

theorem SimpleGraph.CompleteEquipartiteSubgraph.card_mem_parts E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} (self : G.CompleteEquipartiteSubgraph r t) {p : Finset V},
  p ∈ self.parts → p.card = t

There are t vertices in each part.

theorem SimpleGraph.CompleteEquipartiteSubgraph.isCompleteBetween E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} (self : G.CompleteEquipartiteSubgraph r t),
  (↑self.parts).Pairwise fun x1 x2 ↦ G.IsCompleteBetween ↑x1 ↑x2

The vertices in distinct parts are adjacent.

theorem SimpleGraph.CompleteEquipartiteSubgraph.nonempty_of_eq_zero_or_eq_zero E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ}, r = 0 ∨ t = 0 → Nonempty (G.CompleteEquipartiteSubgraph r t)

At least one of the "empty" complete equipartite subgraphs is contained in a simple graph.

theorem SimpleGraph.CompleteEquipartiteSubgraph.disjoint E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} (K : G.CompleteEquipartiteSubgraph r t), (↑K.parts).PairwiseDisjoint id

The parts in a complete equipartite subgraph are pairwise disjoint.

def SimpleGraph.CompleteEquipartiteSubgraph.verts E1 #

{V : Type u_1} → {G : SimpleGraph V} → {r t : ℕ} → G.CompleteEquipartiteSubgraph r t → Finset V

The finset of vertices in a complete equipartite subgraph.

theorem SimpleGraph.CompleteEquipartiteSubgraph.verts_eq_disjiUnion E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} (K : G.CompleteEquipartiteSubgraph r t),
  K.verts = K.parts.disjiUnion id ⋯

The vertices of a complete equipartite subgraph, as a disjiUnion of its parts.

theorem SimpleGraph.CompleteEquipartiteSubgraph.verts_eq_biUnion E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} (K : G.CompleteEquipartiteSubgraph r t), K.verts = K.parts.biUnion id

The finset of vertices in a complete equipartite subgraph as a biUnion.

theorem SimpleGraph.CompleteEquipartiteSubgraph.mem_verts E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} (K : G.CompleteEquipartiteSubgraph r t) {v : V},
  v ∈ K.verts ↔ ∃ p ∈ K.parts, v ∈ p

theorem SimpleGraph.CompleteEquipartiteSubgraph.card_filter_verts E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} (K : G.CompleteEquipartiteSubgraph r t) (P : V → Prop)
  [inst : DecidablePred P], {v ∈ K.verts | P v}.card = ∑ p ∈ K.parts, {v ∈ p | P v}.card

Filtering the vertices of a complete equipartite subgraph splits across its parts.

theorem SimpleGraph.CompleteEquipartiteSubgraph.card_verts E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ} (K : G.CompleteEquipartiteSubgraph r t), K.verts.card = r * t

There are r * t vertices in a complete equipartite subgraph with r parts of size t.

def SimpleGraph.CompleteEquipartiteSubgraph.toCopy E1 #

{V : Type u_1} →
  {G : SimpleGraph V} →
    {r t : ℕ} → G.CompleteEquipartiteSubgraph r t → (SimpleGraph.completeEquipartiteGraph r t).Copy G

A complete equipartite subgraph gives rise to a copy of a complete equipartite graph.

def SimpleGraph.CompleteEquipartiteSubgraph.ofCopy E1 #

{V : Type u_1} →
  {G : SimpleGraph V} →
    {r t : ℕ} → (SimpleGraph.completeEquipartiteGraph r t).Copy G → G.CompleteEquipartiteSubgraph r t

A copy of a complete equipartite graph identifies a complete equipartite subgraph.

theorem SimpleGraph.completeEquipartiteGraph_isContained_iff E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ},
  (SimpleGraph.completeEquipartiteGraph r t).IsContained G ↔ Nonempty (G.CompleteEquipartiteSubgraph r t)

Simple graphs contain a copy of a completeEquipartiteGraph r t iff the type G.CompleteEquipartiteSubgraph r t is nonempty.

theorem SimpleGraph.completeEquipartiteGraph_succ_isContained_iff E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {r t : ℕ},
  (SimpleGraph.completeEquipartiteGraph (r + 1) t).IsContained G ↔
    ∃ K s, s.card = t ∧ ∀ p ∈ K.parts, G.IsCompleteBetween ↑p ↑s

Simple graphs contain a copy of a completeEquipartiteGraph (r + 1) t iff there exists s : Finset V of size #s = t and K : G.CompleteEquipartiteSubgraph r t such that the vertices in s are adjacent to the vertices in K.

Deprecated aliases

NameNew nameSince
SimpleGraph.bot_isCompleteMultipartiteSimpleGraph.IsCompleteMultipartite.bot2026-09-07