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

58 declarations. Mathlib docs · Source

Edge density

This file defines the number and density of edges of a relation/graph.

Main declarations

Between two finsets of vertices,

  • Rel.interedges: Finset of edges of a relation.
  • Rel.edgeDensity: Edge density of a relation.
  • SimpleGraph.interedges: Finset of edges of a graph.
  • SimpleGraph.edgeDensity: Edge density of a graph.

Density of a relation

Density of a graph

theorem Rel.interedges.congr_simp E1 #

∀ {α : Type u_4} {β : Type u_5} (r r_1 : α → β → Prop),
  r = r_1 →
    ∀ {inst : (a : α) → DecidablePred (r a)} [inst_1 : (a : α) → DecidablePred (r_1 a)] (s s_1 : Finset α),
      s = s_1 → ∀ (t t_1 : Finset β), t = t_1 → Rel.interedges r s t = Rel.interedges r_1 s_1 t_1

theorem SimpleGraph.interedges.congr_simp E1 #

∀ {α : Type u_4} (G G_1 : SimpleGraph α),
  G = G_1 →
    ∀ {inst : DecidableRel G.Adj} [inst_1 : DecidableRel G_1.Adj] (s s_1 : Finset α),
      s = s_1 → ∀ (t t_1 : Finset α), t = t_1 → G.interedges s t = G_1.interedges s_1 t_1

theorem Rel.edgeDensity.congr_simp E1 #

∀ {α : Type u_4} {β : Type u_5} (r r_1 : α → β → Prop),
  r = r_1 →
    ∀ {inst : (a : α) → DecidablePred (r a)} [inst_1 : (a : α) → DecidablePred (r_1 a)] (s s_1 : Finset α),
      s = s_1 → ∀ (t t_1 : Finset β), t = t_1 → Rel.edgeDensity r s t = Rel.edgeDensity r_1 s_1 t_1

def Rel.interedges E3 #

{α : Type u_4} →
  {β : Type u_5} → (r : α → β → Prop) → [(a : α) → DecidablePred (r a)] → Finset α → Finset β → Finset (α × β)

Finset of edges of a relation between two finsets of vertices.

def Rel.edgeDensity E3 #

{α : Type u_4} → {β : Type u_5} → (r : α → β → Prop) → [(a : α) → DecidablePred (r a)] → Finset α → Finset β → ℚ

Edge density of a relation between two finsets of vertices.

theorem Rel.mem_interedges_iff E0 #

∀ {α : Type u_4} {β : Type u_5} {r : α → β → Prop} [inst : (a : α) → DecidablePred (r a)] {s : Finset α} {t : Finset β}
  {x : α × β}, x ∈ Rel.interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2

theorem Rel.mk_mem_interedges_iff E0 #

∀ {α : Type u_4} {β : Type u_5} {r : α → β → Prop} [inst : (a : α) → DecidablePred (r a)] {s : Finset α} {t : Finset β}
  {a : α} {b : β}, (a, b) ∈ Rel.interedges r s t ↔ a ∈ s ∧ b ∈ t ∧ r a b

theorem Rel.interedges_empty_left E0 #

∀ {α : Type u_4} {β : Type u_5} {r : α → β → Prop} [inst : (a : α) → DecidablePred (r a)] (t : Finset β),
  Rel.interedges r ∅ t = ∅

theorem Rel.interedges_mono E1 #

∀ {α : Type u_4} {β : Type u_5} {r : α → β → Prop} [inst : (a : α) → DecidablePred (r a)] {s₁ s₂ : Finset α}
  {t₁ t₂ : Finset β}, s₂ ⊆ s₁ → t₂ ⊆ t₁ → Rel.interedges r s₂ t₂ ⊆ Rel.interedges r s₁ t₁

theorem Rel.card_interedges_add_card_interedges_compl E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] (s : Finset α) (t : Finset β),
  (Rel.interedges r s t).card + (Rel.interedges (fun x y ↦ ¬r x y) s t).card = s.card * t.card

theorem Rel.interedges_disjoint_left E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] {s s' : Finset α},
  Disjoint s s' → ∀ (t : Finset β), Disjoint (Rel.interedges r s t) (Rel.interedges r s' t)

theorem Rel.interedges_disjoint_right E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] (s : Finset α)
  {t t' : Finset β}, Disjoint t t' → Disjoint (Rel.interedges r s t) (Rel.interedges r s t')

theorem Rel.interedges_eq_biUnion E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] {s : Finset α} {t : Finset β}
  [inst_1 : DecidableEq α] [inst_2 : DecidableEq β],
  Rel.interedges r s t = s.biUnion fun x ↦ Finset.map { toFun := fun x_1 ↦ (x, x_1), inj' := ⋯ } ({y ∈ t | r x y})

theorem Rel.interedges_biUnion_left E1 #

∀ {ι : Type u_2} {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)]
  [inst_1 : DecidableEq α] [inst_2 : DecidableEq β] (s : Finset ι) (t : Finset β) (f : ι → Finset α),
  Rel.interedges r (s.biUnion f) t = s.biUnion fun a ↦ Rel.interedges r (f a) t

theorem Rel.interedges_biUnion_right E1 #

∀ {ι : Type u_2} {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)]
  [inst_1 : DecidableEq α] [inst_2 : DecidableEq β] (s : Finset α) (t : Finset ι) (f : ι → Finset β),
  Rel.interedges r s (t.biUnion f) = t.biUnion fun b ↦ Rel.interedges r s (f b)

theorem Rel.interedges_biUnion E1 #

∀ {ι : Type u_2} {κ : Type u_3} {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)]
  [inst_1 : DecidableEq α] [inst_2 : DecidableEq β] (s : Finset ι) (t : Finset κ) (f : ι → Finset α) (g : κ → Finset β),
  Rel.interedges r (s.biUnion f) (t.biUnion g) = (s ×ˢ t).biUnion fun ab ↦ Rel.interedges r (f ab.1) (g ab.2)

theorem Rel.card_interedges_le_mul E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] (s : Finset α) (t : Finset β),
  (Rel.interedges r s t).card ≤ s.card * t.card

theorem Rel.edgeDensity_nonneg E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] (s : Finset α) (t : Finset β),
  0 ≤ Rel.edgeDensity r s t

theorem Rel.edgeDensity_le_one E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] (s : Finset α) (t : Finset β),
  Rel.edgeDensity r s t ≤ 1

theorem Rel.edgeDensity_add_edgeDensity_compl E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] {s : Finset α} {t : Finset β},
  s.Nonempty → t.Nonempty → Rel.edgeDensity r s t + Rel.edgeDensity (fun x y ↦ ¬r x y) s t = 1

theorem Rel.edgeDensity_empty_left E0 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] (t : Finset β),
  Rel.edgeDensity r ∅ t = 0

theorem Rel.edgeDensity_empty_right E0 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] (s : Finset α),
  Rel.edgeDensity r s ∅ = 0

theorem Rel.card_interedges_finpartition_left E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] {s : Finset α}
  [inst_1 : DecidableEq α] (P : Finpartition s) (t : Finset β),
  (Rel.interedges r s t).card = ∑ a ∈ P.parts, (Rel.interedges r a t).card

theorem Rel.card_interedges_finpartition_right E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] {t : Finset β}
  [inst_1 : DecidableEq β] (s : Finset α) (P : Finpartition t),
  (Rel.interedges r s t).card = ∑ b ∈ P.parts, (Rel.interedges r s b).card

theorem Rel.card_interedges_finpartition E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] {s : Finset α} {t : Finset β}
  [inst_1 : DecidableEq α] [inst_2 : DecidableEq β] (P : Finpartition s) (Q : Finpartition t),
  (Rel.interedges r s t).card = ∑ ab ∈ P.parts ×ˢ Q.parts, (Rel.interedges r ab.1 ab.2).card

theorem Rel.mul_edgeDensity_le_edgeDensity E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] {s₁ s₂ : Finset α}
  {t₁ t₂ : Finset β},
  s₂ ⊆ s₁ →
    t₂ ⊆ t₁ →
      s₂.Nonempty →
        t₂.Nonempty → ↑s₂.card / ↑s₁.card * (↑t₂.card / ↑t₁.card) * Rel.edgeDensity r s₂ t₂ ≤ Rel.edgeDensity r s₁ t₁

theorem Rel.edgeDensity_sub_edgeDensity_le_one_sub_mul E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] {s₁ s₂ : Finset α}
  {t₁ t₂ : Finset β},
  s₂ ⊆ s₁ →
    t₂ ⊆ t₁ →
      s₂.Nonempty →
        t₂.Nonempty →
          Rel.edgeDensity r s₂ t₂ - Rel.edgeDensity r s₁ t₁ ≤ 1 - ↑s₂.card / ↑s₁.card * (↑t₂.card / ↑t₁.card)

theorem Rel.abs_edgeDensity_sub_edgeDensity_le_one_sub_mul E1 #

∀ {α : Type u_4} {β : Type u_5} (r : α → β → Prop) [inst : (a : α) → DecidablePred (r a)] {s₁ s₂ : Finset α}
  {t₁ t₂ : Finset β},
  s₂ ⊆ s₁ →
    t₂ ⊆ t₁ →
      s₂.Nonempty →
        t₂.Nonempty →
          |Rel.edgeDensity r s₂ t₂ - Rel.edgeDensity r s₁ t₁| ≤ 1 - ↑s₂.card / ↑s₁.card * (↑t₂.card / ↑t₁.card)

theorem Rel.abs_edgeDensity_sub_edgeDensity_le_two_mul_sub_sq E1 #

∀ {𝕜 : Type u_1} {α : Type u_4} {β : Type u_5} [inst : Field 𝕜] [inst_1 : LinearOrder 𝕜] [IsStrictOrderedRing 𝕜]
  (r : α → β → Prop) [inst_3 : (a : α) → DecidablePred (r a)] {s₁ s₂ : Finset α} {t₁ t₂ : Finset β} {δ : 𝕜},
  s₂ ⊆ s₁ →
    t₂ ⊆ t₁ →
      0 ≤ δ →
        δ < 1 →
          (1 - δ) * ↑s₁.card ≤ ↑s₂.card →
            (1 - δ) * ↑t₁.card ≤ ↑t₂.card → |↑(Rel.edgeDensity r s₂ t₂) - ↑(Rel.edgeDensity r s₁ t₁)| ≤ 2 * δ - δ ^ 2

theorem Rel.abs_edgeDensity_sub_edgeDensity_le_two_mul E1 #

∀ {𝕜 : Type u_1} {α : Type u_4} {β : Type u_5} [inst : Field 𝕜] [inst_1 : LinearOrder 𝕜] [IsStrictOrderedRing 𝕜]
  (r : α → β → Prop) [inst_3 : (a : α) → DecidablePred (r a)] {s₁ s₂ : Finset α} {t₁ t₂ : Finset β} {δ : 𝕜},
  s₂ ⊆ s₁ →
    t₂ ⊆ t₁ →
      0 ≤ δ →
        (1 - δ) * ↑s₁.card ≤ ↑s₂.card →
          (1 - δ) * ↑t₁.card ≤ ↑t₂.card → |↑(Rel.edgeDensity r s₂ t₂) - ↑(Rel.edgeDensity r s₁ t₁)| ≤ 2 * δ

If s₂ ⊆ s₁, t₂ ⊆ t₁ and they take up all but a δ-proportion, then the difference in edge densities is at most 2 * δ.

theorem Rel.swap_mem_interedges_iff E0 #

∀ {α : Type u_4} {r : α → α → Prop} [inst : DecidableRel r] {s t : Finset α} [Std.Symm r] {x : α × α},
  x.swap ∈ Rel.interedges r s t ↔ x ∈ Rel.interedges r t s

theorem Rel.mk_mem_interedges_comm E1 #

∀ {α : Type u_4} {r : α → α → Prop} [inst : DecidableRel r] {s t : Finset α} {a b : α} [Std.Symm r],
  (a, b) ∈ Rel.interedges r s t ↔ (b, a) ∈ Rel.interedges r t s

theorem Rel.card_interedges_comm E1 #

∀ {α : Type u_4} {r : α → α → Prop} [inst : DecidableRel r] [Std.Symm r] (s t : Finset α),
  (Rel.interedges r s t).card = (Rel.interedges r t s).card

theorem Rel.edgeDensity_comm E1 #

∀ {α : Type u_4} {r : α → α → Prop} [inst : DecidableRel r] [Std.Symm r] (s t : Finset α),
  Rel.edgeDensity r s t = Rel.edgeDensity r t s

def SimpleGraph.interedges E3 #

{α : Type u_4} → (G : SimpleGraph α) → [DecidableRel G.Adj] → Finset α → Finset α → Finset (α × α)

Finset of edges of a relation between two finsets of vertices.

def SimpleGraph.edgeDensity E3 #

{α : Type u_4} → (G : SimpleGraph α) → [DecidableRel G.Adj] → Finset α → Finset α → ℚ

Density of edges of a graph between two finsets of vertices.

theorem SimpleGraph.interedges_def E0 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] (s t : Finset α),
  G.interedges s t = {e ∈ s ×ˢ t | G.Adj e.1 e.2}

theorem SimpleGraph.edgeDensity_def E0 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] (s t : Finset α),
  G.edgeDensity s t = ↑(G.interedges s t).card / (↑s.card * ↑t.card)

theorem SimpleGraph.card_interedges_div_card E1 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] (s t : Finset α),
  ↑(G.interedges s t).card / (↑s.card * ↑t.card) = G.edgeDensity s t

theorem SimpleGraph.mem_interedges_iff E0 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] {s t : Finset α} {x : α × α},
  x ∈ G.interedges s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ G.Adj x.1 x.2

theorem SimpleGraph.mk_mem_interedges_iff E0 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] {s t : Finset α} {a b : α},
  (a, b) ∈ G.interedges s t ↔ a ∈ s ∧ b ∈ t ∧ G.Adj a b

theorem SimpleGraph.interedges_empty_left E0 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] (t : Finset α), G.interedges ∅ t = ∅

theorem SimpleGraph.interedges_mono E1 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] {s₁ s₂ t₁ t₂ : Finset α},
  s₂ ⊆ s₁ → t₂ ⊆ t₁ → G.interedges s₂ t₂ ⊆ G.interedges s₁ t₁

theorem SimpleGraph.interedges_disjoint_left E1 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] {s₁ s₂ : Finset α},
  Disjoint s₁ s₂ → ∀ (t : Finset α), Disjoint (G.interedges s₁ t) (G.interedges s₂ t)

theorem SimpleGraph.interedges_disjoint_right E1 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] {t₁ t₂ : Finset α} (s : Finset α),
  Disjoint t₁ t₂ → Disjoint (G.interedges s t₁) (G.interedges s t₂)

theorem SimpleGraph.interedges_biUnion_left E1 #

∀ {ι : Type u_2} {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq α] (s : Finset ι)
  (t : Finset α) (f : ι → Finset α), G.interedges (s.biUnion f) t = s.biUnion fun a ↦ G.interedges (f a) t

theorem SimpleGraph.interedges_biUnion_right E1 #

∀ {ι : Type u_2} {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq α] (s : Finset α)
  (t : Finset ι) (f : ι → Finset α), G.interedges s (t.biUnion f) = t.biUnion fun b ↦ G.interedges s (f b)

theorem SimpleGraph.interedges_biUnion E1 #

∀ {ι : Type u_2} {κ : Type u_3} {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq α]
  (s : Finset ι) (t : Finset κ) (f : ι → Finset α) (g : κ → Finset α),
  G.interedges (s.biUnion f) (t.biUnion g) = (s ×ˢ t).biUnion fun ab ↦ G.interedges (f ab.1) (g ab.2)

theorem SimpleGraph.card_interedges_add_card_interedges_compl E1 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] {s t : Finset α} [inst_1 : DecidableEq α],
  Disjoint s t → (G.interedges s t).card + (Gᶜ.interedges s t).card = s.card * t.card

theorem SimpleGraph.edgeDensity_add_edgeDensity_compl E1 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] {s t : Finset α} [inst_1 : DecidableEq α],
  s.Nonempty → t.Nonempty → Disjoint s t → G.edgeDensity s t + Gᶜ.edgeDensity s t = 1

theorem SimpleGraph.card_interedges_le_mul E1 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] (s t : Finset α),
  (G.interedges s t).card ≤ s.card * t.card

theorem SimpleGraph.edgeDensity_nonneg E1 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] (s t : Finset α), 0 ≤ G.edgeDensity s t

theorem SimpleGraph.edgeDensity_le_one E1 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] (s t : Finset α), G.edgeDensity s t ≤ 1

theorem SimpleGraph.edgeDensity_empty_left E0 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] (t : Finset α), G.edgeDensity ∅ t = 0

theorem SimpleGraph.edgeDensity_empty_right E0 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] (s : Finset α), G.edgeDensity s ∅ = 0

theorem SimpleGraph.swap_mem_interedges_iff E0 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] {s t : Finset α} {x : α × α},
  x.swap ∈ G.interedges s t ↔ x ∈ G.interedges t s

theorem SimpleGraph.mk_mem_interedges_comm E1 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] {s t : Finset α} {a b : α},
  (a, b) ∈ G.interedges s t ↔ (b, a) ∈ G.interedges t s

theorem SimpleGraph.edgeDensity_comm E1 #

∀ {α : Type u_4} (G : SimpleGraph α) [inst : DecidableRel G.Adj] (s t : Finset α), G.edgeDensity s t = G.edgeDensity t s