File: Mathlib/Combinatorics/SimpleGraph/Regularity/Uniform.lean

full_name: SimpleGraph.IsUniform
code: /-- A pair of finsets of vertices is `ε`-uniform (aka `ε`-regular) iff their edge density is close
to the density of any big enough pair of subsets. Intuitively, the edges between them are
random-like. -/
def IsUniform (s t : Finset α) : Prop 
goal: Prop

full_name: SimpleGraph.IsUniform.instDecidableRel
code: instance IsUniform.instDecidableRel : DecidableRel (G.IsUniform ε) 
goal: DecidableRel (G.IsUniform ε)

full_name: SimpleGraph.IsUniform.mono
code: theorem IsUniform.mono {ε' : 𝕜} (h : ε ≤ ε') (hε : IsUniform G ε s t) : IsUniform G ε' s t 
goal: G.IsUniform ε' s t

full_name: SimpleGraph.IsUniform.symm
code: theorem IsUniform.symm : Symmetric (IsUniform G ε) 
goal: Symmetric (G.IsUniform ε)

full_name: SimpleGraph.isUniform_comm
code: theorem isUniform_comm : IsUniform G ε s t ↔ IsUniform G ε t s 
goal: G.IsUniform ε s t ↔ G.IsUniform ε t s

full_name: SimpleGraph.isUniform_one
code: lemma isUniform_one : G.IsUniform (1 : 𝕜) s t 
goal: G.IsUniform 1 s t

full_name: SimpleGraph.IsUniform.pos
code: lemma IsUniform.pos (hG : G.IsUniform ε s t) : 0 < ε 
goal: 0 < ε

full_name: SimpleGraph.isUniform_singleton
code: @[simp] lemma isUniform_singleton : G.IsUniform ε {a} {b} ↔ 0 < ε 
goal: G.IsUniform ε {a} {b} ↔ 0 < ε

full_name: SimpleGraph.not_isUniform_zero
code: theorem not_isUniform_zero : ¬G.IsUniform (0 : 𝕜) s t 
goal: ¬G.IsUniform 0 s t

full_name: SimpleGraph.not_isUniform_iff
code: theorem not_isUniform_iff :
    ¬G.IsUniform ε s t ↔ ∃ s', s' ⊆ s ∧ ∃ t', t' ⊆ t ∧ ↑s.card * ε ≤ s'.card ∧
      ↑t.card * ε ≤ t'.card ∧ ε ≤ |G.edgeDensity s' t' - G.edgeDensity s t| 
goal: ¬G.IsUniform ε s t ↔
  ∃ s' ⊆ s, ∃ t' ⊆ t, ↑s.card * ε ≤ ↑s'.card ∧ ↑t.card * ε ≤ ↑t'.card ∧ ε ≤ ↑|G.edgeDensity s' t' - G.edgeDensity s t|

full_name: SimpleGraph.nonuniformWitnesses
code: /-- An arbitrary pair of subsets witnessing the non-uniformity of `(s, t)`. If `(s, t)` is uniform,
returns `(s, t)`. Witnesses for `(s, t)` and `(t, s)` don't necessarily match. See
`SimpleGraph.nonuniformWitness`. -/
noncomputable def nonuniformWitnesses (ε : 𝕜) (s t : Finset α) : Finset α × Finset α 
goal: Finset α × Finset α

full_name: SimpleGraph.left_nonuniformWitnesses_subset
code: theorem left_nonuniformWitnesses_subset (h : ¬G.IsUniform ε s t) :
    (G.nonuniformWitnesses ε s t).1 ⊆ s 
goal: (G.nonuniformWitnesses ε s t).1 ⊆ s

full_name: SimpleGraph.left_nonuniformWitnesses_card
code: theorem left_nonuniformWitnesses_card (h : ¬G.IsUniform ε s t) :
    (s.card : 𝕜) * ε ≤ (G.nonuniformWitnesses ε s t).1.card 
goal: ↑s.card * ε ≤ ↑(G.nonuniformWitnesses ε s t).1.card

full_name: SimpleGraph.right_nonuniformWitnesses_subset
code: theorem right_nonuniformWitnesses_subset (h : ¬G.IsUniform ε s t) :
    (G.nonuniformWitnesses ε s t).2 ⊆ t 
goal: (G.nonuniformWitnesses ε s t).2 ⊆ t

full_name: SimpleGraph.right_nonuniformWitnesses_card
code: theorem right_nonuniformWitnesses_card (h : ¬G.IsUniform ε s t) :
    (t.card : 𝕜) * ε ≤ (G.nonuniformWitnesses ε s t).2.card 
goal: ↑t.card * ε ≤ ↑(G.nonuniformWitnesses ε s t).2.card

full_name: SimpleGraph.nonuniformWitnesses_spec
code: theorem nonuniformWitnesses_spec (h : ¬G.IsUniform ε s t) :
    ε ≤
      |G.edgeDensity (G.nonuniformWitnesses ε s t).1 (G.nonuniformWitnesses ε s t).2 -
          G.edgeDensity s t| 
goal: ε ≤ ↑|G.edgeDensity (G.nonuniformWitnesses ε s t).1 (G.nonuniformWitnesses ε s t).2 - G.edgeDensity s t|

full_name: SimpleGraph.nonuniformWitness
code: /-- Arbitrary witness of non-uniformity. `G.nonuniformWitness ε s t` and
`G.nonuniformWitness ε t s` form a pair of subsets witnessing the non-uniformity of `(s, t)`. If
`(s, t)` is uniform, returns `s`. -/
noncomputable def nonuniformWitness (ε : 𝕜) (s t : Finset α) : Finset α 
goal: Finset α

full_name: SimpleGraph.nonuniformWitness_subset
code: theorem nonuniformWitness_subset (h : ¬G.IsUniform ε s t) : G.nonuniformWitness ε s t ⊆ s 
goal: G.nonuniformWitness ε s t ⊆ s

full_name: SimpleGraph.le_card_nonuniformWitness
code: theorem le_card_nonuniformWitness (h : ¬G.IsUniform ε s t) :
    (s.card : 𝕜) * ε ≤ (G.nonuniformWitness ε s t).card 
goal: ↑s.card * ε ≤ ↑(G.nonuniformWitness ε s t).card

full_name: SimpleGraph.nonuniformWitness_spec
code: theorem nonuniformWitness_spec (h₁ : s ≠ t) (h₂ : ¬G.IsUniform ε s t) : ε ≤ |G.edgeDensity
    (G.nonuniformWitness ε s t) (G.nonuniformWitness ε t s) - G.edgeDensity s t| 
goal: ε ≤ ↑|G.edgeDensity (G.nonuniformWitness ε s t) (G.nonuniformWitness ε t s) - G.edgeDensity s t|

full_name: Finpartition.sparsePairs
code: /-- The pairs of parts of a partition `P` which are not `ε`-dense in a graph `G`. Note that we
dismiss the diagonal. We do not care whether `s` is `ε`-dense with itself. -/
def sparsePairs (ε : 𝕜) : Finset (Finset α × Finset α) 
goal: Finset (Finset α × Finset α)

full_name: Finpartition.mk_mem_sparsePairs
code: @[simp]
lemma mk_mem_sparsePairs (u v : Finset α) (ε : 𝕜) :
    (u, v) ∈ P.sparsePairs G ε ↔ u ∈ P.parts ∧ v ∈ P.parts ∧ u ≠ v ∧ G.edgeDensity u v < ε 
goal: (u, v) ∈ P.sparsePairs G ε ↔ u ∈ P.parts ∧ v ∈ P.parts ∧ u ≠ v ∧ ↑(G.edgeDensity u v) < ε

full_name: Finpartition.sparsePairs_mono
code: lemma sparsePairs_mono {ε ε' : 𝕜} (h : ε ≤ ε') : P.sparsePairs G ε ⊆ P.sparsePairs G ε' 
goal: P.sparsePairs G ε ⊆ P.sparsePairs G ε'

full_name: Finpartition.nonUniforms
code: /-- The pairs of parts of a partition `P` which are not `ε`-uniform in a graph `G`. Note that we
dismiss the diagonal. We do not care whether `s` is `ε`-uniform with itself. -/
def nonUniforms (ε : 𝕜) : Finset (Finset α × Finset α) 
goal: Finset (Finset α × Finset α)

full_name: Finpartition.mk_mem_nonUniforms
code: @[simp] lemma mk_mem_nonUniforms :
    (u, v) ∈ P.nonUniforms G ε ↔ u ∈ P.parts ∧ v ∈ P.parts ∧ u ≠ v ∧ ¬G.IsUniform ε u v 
goal: (u, v) ∈ P.nonUniforms G ε ↔ u ∈ P.parts ∧ v ∈ P.parts ∧ u ≠ v ∧ ¬G.IsUniform ε u v

full_name: Finpartition.nonUniforms_mono
code: theorem nonUniforms_mono {ε ε' : 𝕜} (h : ε ≤ ε') : P.nonUniforms G ε' ⊆ P.nonUniforms G ε 
goal: P.nonUniforms G ε' ⊆ P.nonUniforms G ε

full_name: Finpartition.nonUniforms_bot
code: theorem nonUniforms_bot (hε : 0 < ε) : (⊥ : Finpartition A).nonUniforms G ε = ∅ 
goal: ⊥.nonUniforms G ε = ∅

full_name: Finpartition.IsUniform
code: /-- A finpartition of a graph's vertex set is `ε`-uniform (aka `ε`-regular) iff the proportion of
its pairs of parts that are not `ε`-uniform is at most `ε`. -/
def IsUniform (ε : 𝕜) : Prop 
goal: Prop

full_name: Finpartition.bot_isUniform
code: lemma bot_isUniform (hε : 0 < ε) : (⊥ : Finpartition A).IsUniform G ε 
goal: ⊥.IsUniform G ε

full_name: Finpartition.isUniform_one
code: lemma isUniform_one : P.IsUniform G (1 : 𝕜) 
goal: P.IsUniform G 1

full_name: Finpartition.IsUniform.mono
code: theorem IsUniform.mono {ε ε' : 𝕜} (hP : P.IsUniform G ε) (h : ε ≤ ε') : P.IsUniform G ε' 
goal: P.IsUniform G ε'

full_name: Finpartition.isUniformOfEmpty
code: theorem isUniformOfEmpty (hP : P.parts = ∅) : P.IsUniform G ε 
goal: P.IsUniform G ε

full_name: Finpartition.nonempty_of_not_uniform
code: theorem nonempty_of_not_uniform (h : ¬P.IsUniform G ε) : P.parts.Nonempty 
goal: P.parts.Nonempty

full_name: Finpartition.nonuniformWitnesses
code: /-- A choice of witnesses of non-uniformity among the parts of a finpartition. -/
noncomputable def nonuniformWitnesses : Finset (Finset α) 
goal: Finset (Finset α)

full_name: Finpartition.nonuniformWitness_mem_nonuniformWitnesses
code: theorem nonuniformWitness_mem_nonuniformWitnesses (h : ¬G.IsUniform ε s t) (ht : t ∈ P.parts)
    (hst : s ≠ t) : G.nonuniformWitness ε s t ∈ P.nonuniformWitnesses G ε s 
goal: G.nonuniformWitness ε s t ∈ P.nonuniformWitnesses G ε s

full_name: Finpartition.IsEquipartition.card_interedges_sparsePairs_le'
code: lemma IsEquipartition.card_interedges_sparsePairs_le' (hP : P.IsEquipartition)
    (hε : 0 ≤ ε) :
    ((P.sparsePairs G ε).biUnion fun (U, V) ↦ G.interedges U V).card ≤
      ε * (A.card + P.parts.card) ^ 2 
goal: ↑((P.sparsePairs G ε).biUnion fun x =>
        match x with
        | (U, V) => G.interedges U V).card ≤
  ε * (↑A.card + ↑P.parts.card) ^ 2

full_name: Finpartition.IsEquipartition.card_interedges_sparsePairs_le
code: lemma IsEquipartition.card_interedges_sparsePairs_le (hP : P.IsEquipartition) (hε : 0 ≤ ε) :
    ((P.sparsePairs G ε).biUnion fun (U, V) ↦ G.interedges U V).card ≤ 4 * ε * A.card ^ 2 
goal: ↑((P.sparsePairs G ε).biUnion fun x =>
        match x with
        | (U, V) => G.interedges U V).card ≤
  4 * ε * ↑A.card ^ 2

full_name: _private.Mathlib.Combinatorics.SimpleGraph.Regularity.Uniform.0.Finpartition.aux
code: private lemma aux {i j : ℕ} (hj : 0 < j) : j * (j - 1) * (i / j + 1) ^ 2 < (i + j) ^ 2 
goal: j * (j - 1) * (i / j + 1) ^ 2 < (i + j) ^ 2

full_name: Finpartition.IsEquipartition.card_biUnion_offDiag_le'
code: lemma IsEquipartition.card_biUnion_offDiag_le' (hP : P.IsEquipartition) :
    ((P.parts.biUnion offDiag).card : 𝕜) ≤ A.card * (A.card + P.parts.card) / P.parts.card 
goal: ↑(P.parts.biUnion Finset.offDiag).card ≤ ↑A.card * (↑A.card + ↑P.parts.card) / ↑P.parts.card

full_name: Finpartition.IsEquipartition.card_biUnion_offDiag_le
code: lemma IsEquipartition.card_biUnion_offDiag_le (hε : 0 < ε) (hP : P.IsEquipartition)
    (hP' : 4 / ε ≤ P.parts.card) : (P.parts.biUnion offDiag).card ≤ ε / 2 * A.card ^ 2 
goal: ↑(P.parts.biUnion Finset.offDiag).card ≤ ε / 2 * ↑A.card ^ 2

full_name: Finpartition.IsEquipartition.sum_nonUniforms_lt'
code: lemma IsEquipartition.sum_nonUniforms_lt' (hA : A.Nonempty) (hε : 0 < ε) (hP : P.IsEquipartition)
    (hG : P.IsUniform G ε) :
    ∑ i ∈ P.nonUniforms G ε, (i.1.card * i.2.card : 𝕜) < ε * (A.card + P.parts.card) ^ 2 
goal: ∑ i ∈ P.nonUniforms G ε, ↑i.1.card * ↑i.2.card < ε * (↑A.card + ↑P.parts.card) ^ 2

full_name: Finpartition.IsEquipartition.sum_nonUniforms_lt
code: lemma IsEquipartition.sum_nonUniforms_lt (hA : A.Nonempty) (hε : 0 < ε) (hP : P.IsEquipartition)
    (hG : P.IsUniform G ε) :
    ((P.nonUniforms G ε).biUnion fun (U, V) ↦ U ×ˢ V).card < 4 * ε * A.card ^ 2 
goal: ↑((P.nonUniforms G ε).biUnion fun x =>
        match x with
        | (U, V) => U ×ˢ V).card <
  4 * ε * ↑A.card ^ 2

full_name: SimpleGraph.regularityReduced_adj
code: /-- The reduction of the graph `G` along partition `P` has edges between `ε`-uniform pairs of parts
that have edge density at least `δ`. -/
@[simps] def regularityReduced (ε δ : 𝕜) : SimpleGraph α 
goal: (SimpleGraph.regularityReduced P G ε δ).Adj a b =
  (G.Adj a b ∧ ∃ U ∈ P.parts, ∃ V ∈ P.parts, a ∈ U ∧ b ∈ V ∧ U ≠ V ∧ G.IsUniform ε U V ∧ δ ≤ ↑(G.edgeDensity U V))

full_name: SimpleGraph.regularityReduced
code: /-- The reduction of the graph `G` along partition `P` has edges between `ε`-uniform pairs of parts
that have edge density at least `δ`. -/
@[simps] def regularityReduced (ε δ : 𝕜) : SimpleGraph α 
goal: SimpleGraph α

full_name: SimpleGraph.regularityReduced.instDecidableRel_adj
code: instance regularityReduced.instDecidableRel_adj : DecidableRel (G.regularityReduced P ε δ).Adj 
goal: DecidableRel (SimpleGraph.regularityReduced P G ε δ).Adj

full_name: SimpleGraph.regularityReduced_le
code: lemma regularityReduced_le : G.regularityReduced P ε δ ≤ G 
goal: SimpleGraph.regularityReduced P G ε δ ≤ G

full_name: SimpleGraph.regularityReduced_mono
code: lemma regularityReduced_mono {ε₁ ε₂ : 𝕜} (hε : ε₁ ≤ ε₂) :
    G.regularityReduced P ε₁ δ ≤ G.regularityReduced P ε₂ δ 
goal: SimpleGraph.regularityReduced P G ε₁ δ ≤ SimpleGraph.regularityReduced P G ε₂ δ

full_name: SimpleGraph.regularityReduced_anti
code: lemma regularityReduced_anti {δ₁ δ₂ : 𝕜} (hδ : δ₁ ≤ δ₂) :
    G.regularityReduced P ε δ₂ ≤ G.regularityReduced P ε δ₁ 
goal: SimpleGraph.regularityReduced P G ε δ₂ ≤ SimpleGraph.regularityReduced P G ε δ₁

full_name: SimpleGraph.unreduced_edges_subset
code: lemma unreduced_edges_subset :
    (A ×ˢ A).filter (fun (x, y) ↦ G.Adj x y ∧ ¬ (G.regularityReduced P (ε/8) (ε/4)).Adj x y) ⊆
      (P.nonUniforms G (ε/8)).biUnion (fun (U, V) ↦ U ×ˢ V) ∪ P.parts.biUnion offDiag ∪
        (P.sparsePairs G (ε/4)).biUnion fun (U, V) ↦ G.interedges U V 
goal: Finset.filter
    (fun x =>
      match x with
      | (x, y) => G.Adj x y ∧ ¬(SimpleGraph.regularityReduced P G (ε / 8) (ε / 4)).Adj x y)
    (A ×ˢ A) ⊆
  ((P.nonUniforms G (ε / 8)).biUnion fun x =>
        match x with
        | (U, V) => U ×ˢ V) ∪
      P.parts.biUnion Finset.offDiag ∪
    (P.sparsePairs G (ε / 4)).biUnion fun x =>
      match x with
      | (U, V) => G.interedges U V