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

70 declarations. Mathlib docs · Source

Bipartite graphs

This file proves results about bipartite simple graphs, including several double-counting arguments.

Main definitions

  • SimpleGraph.IsBipartiteWith G s t is the condition that a simple graph G is bipartite in sets s, t, that is, s and t are disjoint and vertices v, w being adjacent in G implies that v ∈ s and w ∈ t, or v ∈ t and w ∈ s.

    Note that in this implementation, if G.IsBipartiteWith s t, s ∪ t need not cover the vertices of G, instead s ∪ t is only required to cover the support of G, that is, the vertices that form edges in G. This definition is equivalent to the expected definition. If s and t do not cover all the vertices, one recovers a covering of all the vertices by unioning the missing vertices (s ∪ t)ᶜ to either s or t.

  • SimpleGraph.IsBipartite: Predicate for a simple graph to be bipartite. G.IsBipartite is defined as an abbreviation for G.Colorable 2.

  • SimpleGraph.isBipartite_iff_exists_isBipartiteWith is the proof that G.IsBipartite iff G.IsBipartiteWith s t.

  • SimpleGraph.isBipartiteWith_sum_degrees_eq is the proof that if G.IsBipartiteWith s t, then the sum of the degrees of the vertices in s is equal to the sum of the degrees of the vertices in t.

  • SimpleGraph.isBipartiteWith_sum_degrees_eq_card_edges is the proof that if G.IsBipartiteWith s t, then sum of the degrees of the vertices in s is equal to the number of edges in G.

    See SimpleGraph.sum_degrees_eq_twice_card_edges for the general version, and SimpleGraph.isBipartiteWith_sum_degrees_eq_card_edges' for the version from the "right".

  • SimpleGraph.completeBipartiteGraph_isContained_iff is the proof that simple graphs contain a copy of a completeBipartiteGraph α β iff there exists a "left" subset of card α vertices and a "right" subset of card β vertices such that every vertex in the "left" subset is adjacent to every vertex in the "right" subset.

  • SimpleGraph.between; the simple graph G.between s t is the subgraph of G containing edges that connect a vertex in the set s to a vertex in the set t.

  • SimpleGraph.bipartiteDoubleCover; the simple graph G.bipartiteDoubleCover has two vertices inl v and inr v for each vertex v in G such that inl v (inr v) is adjacent to inr w (inl w) iff v is adjacent to w in G.

Implementation notes

For the formulation of double-counting arguments where a bipartite graph is considered as a relation r : α → β → Prop, see Mathlib/Combinatorics/Enumerative/DoubleCounting.lean.

TODO

  • Prove that G.IsBipartite iff G does not contain an odd cycle. I.e., G.IsBipartite ↔ ∀ n, (cycleGraph (2*n+1)).Free G.

theorem SimpleGraph.bipartiteDoubleCover.match_1.congr_eq_2 E1 #

∀ {V : Type u_1} (motive : V ⊕ V → V ⊕ V → Sort u_2) (x x_1 : V ⊕ V)
  (h_1 : (v' w' : V) → motive (Sum.inl v') (Sum.inr w')) (h_2 : (v' w' : V) → motive (Sum.inr v') (Sum.inl w'))
  (h_3 : (x x_2 : V ⊕ V) → motive x x_2) (v' w' : V),
  x = Sum.inr v' →
    x_1 = Sum.inl w' →
      (match x, x_1 with
        | Sum.inl v', Sum.inr w' => h_1 v' w'
        | Sum.inr v', Sum.inl w' => h_2 v' w'
        | x, x_2 => h_3 x x_2) ≍
        h_2 v' w'

theorem SimpleGraph.bipartiteDoubleCover.match_1.congr_eq_1 E1 #

∀ {V : Type u_1} (motive : V ⊕ V → V ⊕ V → Sort u_2) (x x_1 : V ⊕ V)
  (h_1 : (v' w' : V) → motive (Sum.inl v') (Sum.inr w')) (h_2 : (v' w' : V) → motive (Sum.inr v') (Sum.inl w'))
  (h_3 : (x x_2 : V ⊕ V) → motive x x_2) (v' w' : V),
  x = Sum.inl v' →
    x_1 = Sum.inr w' →
      (match x, x_1 with
        | Sum.inl v', Sum.inr w' => h_1 v' w'
        | Sum.inr v', Sum.inl w' => h_2 v' w'
        | x, x_2 => h_3 x x_2) ≍
        h_1 v' w'

theorem SimpleGraph.bipartiteDoubleCover.match_1.congr_eq_3 E1 #

∀ {V : Type u_1} (motive : V ⊕ V → V ⊕ V → Sort u_2) (x x_1 : V ⊕ V)
  (h_1 : (v' w' : V) → motive (Sum.inl v') (Sum.inr w')) (h_2 : (v' w' : V) → motive (Sum.inr v') (Sum.inl w'))
  (h_3 : (x x_2 : V ⊕ V) → motive x x_2) (x_2 x_3 : V ⊕ V),
  x = x_2 →
    x_1 = x_3 →
      (∀ (v' w' : V), x_2 = Sum.inl v' → x_3 = Sum.inr w' → False) →
        (∀ (v' w' : V), x_2 = Sum.inr v' → x_3 = Sum.inl w' → False) →
          (match x, x_1 with
            | Sum.inl v', Sum.inr w' => h_1 v' w'
            | Sum.inr v', Sum.inl w' => h_2 v' w'
            | x, x_6 => h_3 x x_6) ≍
            h_3 x_2 x_3

structure SimpleGraph.IsBipartiteWith E1 #

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

G is bipartite in sets s and t iff s and t are disjoint and if vertices v and w are adjacent in G then v ∈ s and w ∈ t, or v ∈ t and w ∈ s.

ctor SimpleGraph.IsBipartiteWith.mk E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V},
  Disjoint s t → (∀ ⦃v w : V⦄, G.Adj v w → v ∈ s ∧ w ∈ t ∨ v ∈ t ∧ w ∈ s) → G.IsBipartiteWith s t

theorem SimpleGraph.IsBipartiteWith.disjoint E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t → Disjoint s t

theorem SimpleGraph.IsBipartiteWith.mem_of_adj E0 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V},
  G.IsBipartiteWith s t → ∀ ⦃v w : V⦄, G.Adj v w → v ∈ s ∧ w ∈ t ∨ v ∈ t ∧ w ∈ s

theorem SimpleGraph.IsBipartiteWith.symm E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t → G.IsBipartiteWith t s

theorem SimpleGraph.isBipartiteWith_comm E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t ↔ G.IsBipartiteWith t s

theorem SimpleGraph.IsBipartiteWith.mem_of_mem_adj E0 #

∀ {V : Type u_1} {v w : V} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t → v ∈ s → G.Adj v w → w ∈ t

If G.IsBipartiteWith s t and v ∈ s, then if v is adjacent to w in G then w ∈ t.

theorem SimpleGraph.isBipartiteWith_neighborSet E1 #

∀ {V : Type u_1} {v : V} {G : SimpleGraph V} {s t : Set V},
  G.IsBipartiteWith s t → v ∈ s → G.neighborSet v = {w | w ∈ t ∧ G.Adj v w}

If G.IsBipartiteWith s t and v ∈ s, then the neighbor set of v is the set of vertices in t adjacent to v in G.

theorem SimpleGraph.isBipartiteWith_neighborSet_subset E1 #

∀ {V : Type u_1} {v : V} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t → v ∈ s → G.neighborSet v ⊆ t

If G.IsBipartiteWith s t and v ∈ s, then the neighbor set of v is a subset of t.

theorem SimpleGraph.isBipartiteWith_neighborSet_disjoint E1 #

∀ {V : Type u_1} {v : V} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t → v ∈ s → Disjoint (G.neighborSet v) s

If G.IsBipartiteWith s t and v ∈ s, then the neighbor set of v is disjoint to s.

theorem SimpleGraph.IsBipartiteWith.mem_of_mem_adj' E0 #

∀ {V : Type u_1} {v w : V} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t → w ∈ t → G.Adj v w → v ∈ s

If G.IsBipartiteWith s t and w ∈ t, then if v is adjacent to w in G then v ∈ s.

theorem SimpleGraph.isBipartiteWith_neighborSet' E1 #

∀ {V : Type u_1} {w : V} {G : SimpleGraph V} {s t : Set V},
  G.IsBipartiteWith s t → w ∈ t → G.neighborSet w = {v | v ∈ s ∧ G.Adj v w}

If G.IsBipartiteWith s t and w ∈ t, then the neighbor set of w is the set of vertices in s adjacent to w in G.

theorem SimpleGraph.isBipartiteWith_neighborSet_subset' E1 #

∀ {V : Type u_1} {w : V} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t → w ∈ t → G.neighborSet w ⊆ s

If G.IsBipartiteWith s t and w ∈ t, then the neighbor set of w is a subset of s.

theorem SimpleGraph.isBipartiteWith_support_subset E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t → G.support ⊆ s ∪ t

If G.IsBipartiteWith s t, then the support of G is a subset of s ∪ t.

theorem SimpleGraph.isBipartiteWith_neighborSet_disjoint' E1 #

∀ {V : Type u_1} {w : V} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t → w ∈ t → Disjoint (G.neighborSet w) t

If G.IsBipartiteWith s t and w ∈ t, then the neighbor set of w is disjoint to t.

theorem SimpleGraph.isBipartiteWith_neighborFinset E1 #

∀ {V : Type u_1} {v : V} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype ↑(G.neighborSet v)]
  [inst_1 : DecidableRel G.Adj], G.IsBipartiteWith ↑s ↑t → v ∈ s → G.neighborFinset v = {w ∈ t | G.Adj v w}

If G.IsBipartiteWith s t and v ∈ s, then the neighbor finset of v is the set of vertices in s adjacent to v in G.

theorem SimpleGraph.isBipartiteWith_neighborFinset' E1 #

∀ {V : Type u_1} {w : V} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype ↑(G.neighborSet w)]
  [inst_1 : DecidableRel G.Adj], G.IsBipartiteWith ↑s ↑t → w ∈ t → G.neighborFinset w = {v ∈ s | G.Adj v w}

If G.IsBipartiteWith s t and w ∈ t, then the neighbor finset of w is the set of vertices in s adjacent to w in G.

theorem SimpleGraph.isBipartiteWith_bipartiteAbove E1 #

∀ {V : Type u_1} {v : V} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype ↑(G.neighborSet v)]
  [inst_1 : DecidableRel G.Adj], G.IsBipartiteWith ↑s ↑t → v ∈ s → G.neighborFinset v = Finset.bipartiteAbove G.Adj t v

If G.IsBipartiteWith s t and v ∈ s, then the neighbor finset of v is the set of vertices "above" v according to the adjacency relation of G.

theorem SimpleGraph.isBipartiteWith_bipartiteBelow E1 #

∀ {V : Type u_1} {w : V} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype ↑(G.neighborSet w)]
  [inst_1 : DecidableRel G.Adj], G.IsBipartiteWith ↑s ↑t → w ∈ t → G.neighborFinset w = Finset.bipartiteBelow G.Adj s w

If G.IsBipartiteWith s t and w ∈ t, then the neighbor finset of w is the set of vertices "below" w according to the adjacency relation of G.

theorem SimpleGraph.isBipartiteWith_neighborFinset_subset E1 #

∀ {V : Type u_1} {v : V} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype ↑(G.neighborSet v)],
  G.IsBipartiteWith ↑s ↑t → v ∈ s → G.neighborFinset v ⊆ t

If G.IsBipartiteWith s t and v ∈ s, then the neighbor finset of v is a subset of s.

theorem SimpleGraph.isBipartiteWith_neighborFinset_disjoint E1 #

∀ {V : Type u_1} {v : V} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype ↑(G.neighborSet v)],
  G.IsBipartiteWith ↑s ↑t → v ∈ s → Disjoint (G.neighborFinset v) s

If G.IsBipartiteWith s t and v ∈ s, then the neighbor finset of v is disjoint to s.

theorem SimpleGraph.isBipartiteWith_degree_le E1 #

∀ {V : Type u_1} {v : V} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype ↑(G.neighborSet v)],
  G.IsBipartiteWith ↑s ↑t → v ∈ s → G.degree v ≤ t.card

If G.IsBipartiteWith s t and v ∈ s, then the degree of v in G is at most the size of t.

theorem SimpleGraph.isBipartiteWith_neighborFinset_subset' E1 #

∀ {V : Type u_1} {w : V} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype ↑(G.neighborSet w)],
  G.IsBipartiteWith ↑s ↑t → w ∈ t → G.neighborFinset w ⊆ s

If G.IsBipartiteWith s t and w ∈ t, then the neighbor finset of w is a subset of s.

theorem SimpleGraph.isBipartiteWith_neighborFinset_disjoint' E1 #

∀ {V : Type u_1} {w : V} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype ↑(G.neighborSet w)],
  G.IsBipartiteWith ↑s ↑t → w ∈ t → Disjoint (G.neighborFinset w) t

If G.IsBipartiteWith s t and w ∈ t, then the neighbor finset of w is disjoint to t.

theorem SimpleGraph.isBipartiteWith_degree_le' E1 #

∀ {V : Type u_1} {w : V} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype ↑(G.neighborSet w)],
  G.IsBipartiteWith ↑s ↑t → w ∈ t → G.degree w ≤ s.card

If G.IsBipartiteWith s t and w ∈ t, then the degree of w in G is at most the size of s.

theorem SimpleGraph.isBipartiteWith_sum_degrees_eq E3 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Finset V} [inst : G.LocallyFinite],
  G.IsBipartiteWith ↑s ↑t → ∑ v ∈ s, G.degree v = ∑ w ∈ t, G.degree w

If G.IsBipartiteWith s t, then the sum of the degrees of vertices in s is equal to the sum of the degrees of vertices in t.

See Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow.

theorem SimpleGraph.IsBipartiteWith.completeBipartiteGraph E1 #

∀ (V : Type u_2) (W : Type u_3), (completeBipartiteGraph V W).IsBipartiteWith (Set.range Sum.inl) (Set.range Sum.inr)

theorem SimpleGraph.isBipartiteWith_sum_degrees_eq_twice_card_edges E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype V] [inst_1 : DecidableRel G.Adj]
  [inst_2 : DecidableEq V], G.IsBipartiteWith ↑s ↑t → ∑ v ∈ s ∪ t, G.degree v = 2 * G.edgeFinset.card

theorem SimpleGraph.isBipartiteWith_sum_degrees_eq_card_edges E3 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype V] [inst_1 : DecidableRel G.Adj],
  G.IsBipartiteWith ↑s ↑t → ∑ v ∈ s, G.degree v = G.edgeFinset.card

The degree-sum formula for bipartite graphs, summing over the "left" part.

See SimpleGraph.sum_degrees_eq_twice_card_edges for the general version, and SimpleGraph.isBipartiteWith_sum_degrees_eq_card_edges' for the version from the "right".

theorem SimpleGraph.isBipartiteWith_sum_degrees_eq_card_edges' E3 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Finset V} [inst : Fintype V] [inst_1 : DecidableRel G.Adj],
  G.IsBipartiteWith ↑s ↑t → ∑ v ∈ t, G.degree v = G.edgeFinset.card

The degree-sum formula for bipartite graphs, summing over the "right" part.

See SimpleGraph.sum_degrees_eq_twice_card_edges for the general version, and SimpleGraph.isBipartiteWith_sum_degrees_eq_card_edges for the version from the "left".

abbrev SimpleGraph.IsBipartite E3 #

{V : Type u_1} → SimpleGraph V → Prop

The predicate for a simple graph to be bipartite.

theorem SimpleGraph.IsBipartite.exists_isBipartiteWith E1 #

∀ {V : Type u_1} {G : SimpleGraph V}, G.IsBipartite → ∃ s t, G.IsBipartiteWith s t

If a simple graph G is bipartite, then there exist disjoint sets s and t such that all edges in G connect a vertex in s to a vertex in t.

theorem SimpleGraph.IsBipartiteWith.isBipartite E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t → G.IsBipartite

If a simple graph G has a bipartition, then it is bipartite.

theorem SimpleGraph.isBipartite_iff_exists_isBipartiteWith E3 #

∀ {V : Type u_1} {G : SimpleGraph V}, G.IsBipartite ↔ ∃ s t, G.IsBipartiteWith s t

G.IsBipartite if and only if G.IsBipartiteWith s t.

theorem SimpleGraph.chromaticNumber_le_two_iff_isBipartite E1 #

∀ {V : Type u_1} {G : SimpleGraph V}, G.chromaticNumber ≤ 2 ↔ G.IsBipartite

theorem SimpleGraph.chromaticNumber_eq_two_iff E0 #

∀ {V : Type u_1} {G : SimpleGraph V}, G.chromaticNumber = 2 ↔ G.IsBipartite ∧ G ≠ ⊥

theorem SimpleGraph.IsBipartite.bot E1 #

∀ (V : Type u_1), ⊥.IsBipartite

theorem SimpleGraph.IsBipartite.completeBipartiteGraph E1 #

∀ (V : Type u_2) (W : Type u_3), (completeBipartiteGraph V W).IsBipartite

def SimpleGraph.Copy.completeBipartiteGraph E1 #

{V : Type u_1} →
  {G : SimpleGraph V} →
    {α : Type u_2} →
      {β : Type u_3} →
        [inst : Fintype α] →
          [inst_1 : Fintype β] →
            (left right : Finset V) →
              left.card = Fintype.card α →
                right.card = Fintype.card β → G.IsCompleteBetween ↑left ↑right → (completeBipartiteGraph α β).Copy G

A "left" subset of card α vertices and a "right" subset of card β vertices such that every vertex in the "left" subset is adjacent to every vertex in the "right" subset gives rise to a copy of a complete bipartite graph.

theorem SimpleGraph.completeBipartiteGraph_isContained_iff E3 #

∀ {V : Type u_1} {G : SimpleGraph V} {α : Type u_2} {β : Type u_3} [inst : Fintype α] [inst_1 : Fintype β],
  (completeBipartiteGraph α β).IsContained G ↔
    ∃ left right, left.card = Fintype.card α ∧ right.card = Fintype.card β ∧ G.IsCompleteBetween ↑left ↑right

Simple graphs contain a copy of a completeBipartiteGraph α β iff there exists a "left" subset of card α vertices and a "right" subset of card β vertices such that every vertex in the "left" subset is adjacent to every vertex in the "right" subset.

theorem SimpleGraph.IsBipartiteWith.subgraph E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V},
  G.IsBipartiteWith s t → ∀ (H : G.Subgraph), H.coe.IsBipartiteWith {x | ↑x ∈ s} {x | ↑x ∈ t}

theorem SimpleGraph.IsBipartite.subgraph E1 #

∀ {V : Type u_1} {G : SimpleGraph V}, G.IsBipartite → ∀ (H : G.Subgraph), H.coe.IsBipartite

def SimpleGraph.between E3 #

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

The subgraph of G containing edges that connect a vertex in the set s to a vertex in the set t.

theorem SimpleGraph.between_adj E1 #

∀ {V : Type u_1} {v w : V} {G : SimpleGraph V} {s t : Set V},
  (SimpleGraph.between s t G).Adj v w ↔ G.Adj v w ∧ (v ∈ s ∧ w ∈ t ∨ v ∈ t ∧ w ∈ s)

theorem SimpleGraph.between_le E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V}, SimpleGraph.between s t G ≤ G

theorem SimpleGraph.between_comm E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V}, SimpleGraph.between s t G = SimpleGraph.between t s G

instance SimpleGraph.instDecidableRelAdjBetweenOfDecidablePredMemSet E0 #

{V : Type u_1} →
  {G : SimpleGraph V} →
    {s t : Set V} →
      [DecidableRel G.Adj] →
        [DecidablePred fun x ↦ x ∈ s] → [DecidablePred fun x ↦ x ∈ t] → DecidableRel (SimpleGraph.between s t G).Adj

theorem SimpleGraph.between_isBipartiteWith E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V}, Disjoint s t → (SimpleGraph.between s t G).IsBipartiteWith s t

G.between s t is bipartite if the sets s and t are disjoint.

theorem SimpleGraph.between_isBipartite E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V}, Disjoint s t → (SimpleGraph.between s t G).IsBipartite

G.between s t is bipartite if the sets s and t are disjoint.

theorem SimpleGraph.neighborSet_subset_between_union E1 #

∀ {V : Type u_1} {v : V} {G : SimpleGraph V} {s : Set V},
  v ∈ s → G.neighborSet v ⊆ (SimpleGraph.between s sᶜ G).neighborSet v ∪ s

The neighbor set of v ∈ s in G.between s sᶜ excludes the vertices in s adjacent to v in G.

theorem SimpleGraph.neighborSet_subset_between_union_compl E1 #

∀ {V : Type u_1} {w : V} {G : SimpleGraph V} {s : Set V},
  w ∈ sᶜ → G.neighborSet w ⊆ (SimpleGraph.between s sᶜ G).neighborSet w ∪ sᶜ

The neighbor set of w ∈ sᶜ in G.between s sᶜ excludes the vertices in sᶜ adjacent to w in G.

theorem SimpleGraph.neighborFinset_subset_between_union E1 #

∀ {V : Type u_1} {v : V} {G : SimpleGraph V} [inst : DecidableEq V] [inst_1 : Fintype V] {s : Finset V}
  [inst_2 : DecidableRel G.Adj], v ∈ s → G.neighborFinset v ⊆ (SimpleGraph.between (↑s) (↑s)ᶜ G).neighborFinset v ∪ s

The neighbor finset of v ∈ s in G.between s sᶜ excludes the vertices in s adjacent to v in G.

theorem SimpleGraph.degree_le_between_add E1 #

∀ {V : Type u_1} {v : V} {G : SimpleGraph V} [inst : DecidableEq V] [inst_1 : Fintype V] {s : Finset V}
  [inst_2 : DecidableRel G.Adj], v ∈ s → G.degree v ≤ (SimpleGraph.between (↑s) (↑s)ᶜ G).degree v + s.card

The degree of v ∈ s in G is at most the degree in G.between s sᶜ plus the excluded vertices from s.

theorem SimpleGraph.neighborFinset_subset_between_union_compl E1 #

∀ {V : Type u_1} {w : V} {G : SimpleGraph V} [inst : DecidableEq V] [inst_1 : Fintype V] {s : Finset V}
  [inst_2 : DecidableRel G.Adj], w ∈ sᶜ → G.neighborFinset w ⊆ (SimpleGraph.between (↑s) (↑s)ᶜ G).neighborFinset w ∪ sᶜ

The neighbor finset of w ∈ sᶜ in G.between s sᶜ excludes the vertices in sᶜ adjacent to w in G.

theorem SimpleGraph.degree_le_between_add_compl E1 #

∀ {V : Type u_1} {w : V} {G : SimpleGraph V} [inst : DecidableEq V] [inst_1 : Fintype V] {s : Finset V}
  [inst_2 : DecidableRel G.Adj], w ∈ sᶜ → G.degree w ≤ (SimpleGraph.between (↑s) (↑s)ᶜ G).degree w + sᶜ.card

The degree of w ∈ sᶜ in G is at most the degree in G.between s sᶜ plus the excluded vertices from sᶜ.

theorem SimpleGraph.edgeSet_completeBipartiteGraph E1 #

∀ {W₁ : Type u_2} {W₂ : Type u_3},
  (completeBipartiteGraph W₁ W₂).edgeSet = Set.range fun x ↦ s(Sum.inl x.1, Sum.inr x.2)

theorem SimpleGraph.encard_edgeSet_completeBipartiteGraph E1 #

∀ {W₁ : Type u_2} {W₂ : Type u_3}, (completeBipartiteGraph W₁ W₂).edgeSet.encard = ENat.card W₁ * ENat.card W₂

def SimpleGraph.IsBipartiteWith.edgeSetEmbeddingCompleteBipartiteGraph E1 #

{V : Type u_1} →
  {G : SimpleGraph V} →
    {s t : Set V} →
      [DecidableRel fun x1 x2 ↦ x1 ∈ x2] → G.IsBipartiteWith s t → ↑G.edgeSet ↪ ↑(completeBipartiteGraph ↑s ↑t).edgeSet

An embedding of the edges of a bipartite graph into the edges of the complete bipartite graph

theorem SimpleGraph.IsBipartiteWith.encard_edgeSet_le E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {s t : Set V}, G.IsBipartiteWith s t → G.edgeSet.encard ≤ s.encard * t.encard

The cardinality of the edge set of a bipartite graph is upper bounded by the product of the cardinality of the two partitions.

theorem SimpleGraph.IsBipartite.four_mul_encard_edgeSet_le E1 #

∀ {V : Type u_1} {G : SimpleGraph V}, G.IsBipartite → 4 * G.edgeSet.encard ≤ ENat.card V ^ 2

def SimpleGraph.bipartiteDoubleCover E3 #

{V : Type u_1} → SimpleGraph V → SimpleGraph (V ⊕ V)

bipartiteDoubleCover G has two vertices inl v and inr v for each vertex v in G such that inl v (inr v) is adjacent to inr w (inl w) iff v is adjacent to w in G.

instance SimpleGraph.instDecidableRelSumAdjBipartiteDoubleCover E0 #

{V : Type u_1} → {G : SimpleGraph V} → [h : DecidableRel G.Adj] → DecidableRel G.bipartiteDoubleCover.Adj

theorem SimpleGraph.bipartiteDoubleCover_le E1 #

∀ {V : Type u_1} {G : SimpleGraph V}, G.bipartiteDoubleCover ≤ completeBipartiteGraph V V

The bipartite double cover of G is contained in the corresponding complete bipartite graph, that is, the bipartite double cover of G is bipartite.

theorem SimpleGraph.card_edgeFinset_bipartiteDoubleCover E1 #

∀ {V : Type u_1} {G : SimpleGraph V} [inst : Fintype V] [inst_1 : DecidableRel G.Adj],
  G.bipartiteDoubleCover.edgeFinset.card = 2 * G.edgeFinset.card

The bipartite double cover of G has twice the number of edges as G.

theorem SimpleGraph.completeBipartiteGraph_isContained_bipartiteDoubleCover E1 #

∀ {V : Type u_1} {G : SimpleGraph V} {α : Type u_2} {β : Type u_3} [Finite α] [Finite β] [Nonempty α] [Nonempty β],
  (completeBipartiteGraph α β).IsContained G.bipartiteDoubleCover ↔ (completeBipartiteGraph α β).IsContained G

If the double cover of G contains completeBipartiteGraph α β, then G also contains completeBipartiteGraph α β.

theorem SimpleGraph.isBipartiteWith_bipartiteDoubleCover E1 #

∀ {V : Type u_1} {G : SimpleGraph V},
  G.bipartiteDoubleCover.IsBipartiteWith {v | v.isLeft = true} {w | w.isRight = true}

theorem SimpleGraph.isBipartite_bipartiteDoubleCover E1 #

∀ {V : Type u_1} {G : SimpleGraph V}, G.bipartiteDoubleCover.IsBipartite