Theorem: SimpleGraph.regularityReduced_edges_card_aux
File: Mathlib/Combinatorics/SimpleGraph/Triangle/Removal.lean

tactic: let A := (P.nonUniforms G (ε/8)).biUnion fun (U, V) ↦ U ×ˢ V
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
⊢ 2 * (↑G.edgeFinset.card - ↑(regularityReduced P G (ε / 8) (ε / 4)).edgeFinset.card) < 2 * ε * ↑(Fintype.card α ^ 2)
state_after: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
⊢ 2 * (↑G.edgeFinset.card - ↑(regularityReduced P G (ε / 8) (ε / 4)).edgeFinset.card) < 2 * ε * ↑(Fintype.card α ^ 2)

tactic: let B := P.parts.biUnion offDiag
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
⊢ 2 * (↑G.edgeFinset.card - ↑(regularityReduced P G (ε / 8) (ε / 4)).edgeFinset.card) < 2 * ε * ↑(Fintype.card α ^ 2)
state_after: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
⊢ 2 * (↑G.edgeFinset.card - ↑(regularityReduced P G (ε / 8) (ε / 4)).edgeFinset.card) < 2 * ε * ↑(Fintype.card α ^ 2)

tactic: let C := (P.sparsePairs G (ε/4)).biUnion fun (U, V) ↦ G.interedges U V
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
⊢ 2 * (↑G.edgeFinset.card - ↑(regularityReduced P G (ε / 8) (ε / 4)).edgeFinset.card) < 2 * ε * ↑(Fintype.card α ^ 2)
state_after: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ 2 * (↑G.edgeFinset.card - ↑(regularityReduced P G (ε / 8) (ε / 4)).edgeFinset.card) < 2 * ε * ↑(Fintype.card α ^ 2)

tactic: rw [univ_product_univ, mul_sub, filter_and_not, cast_card_sdiff]
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ 2 * (↑G.edgeFinset.card - ↑(regularityReduced P G (ε / 8) (ε / 4)).edgeFinset.card) =
    ↑(filter
          (fun x =>
            match x with
            | (x, y) => G.Adj x y ∧ ¬(regularityReduced P G (ε / 8) (ε / 4)).Adj x y)
          (univ ×ˢ univ)).card
state_after: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ 2 * ↑G.edgeFinset.card - 2 * ↑(regularityReduced P G (ε / 8) (ε / 4)).edgeFinset.card =
    ↑(filter (fun x => G.Adj x.1 x.2) univ).card -
      ↑(filter (fun x => (regularityReduced P G (ε / 8) (ε / 4)).Adj x.1 x.2) univ).card

α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ filter (fun x => (regularityReduced P G (ε / 8) (ε / 4)).Adj x.1 x.2) univ ⊆ filter (fun x => G.Adj x.1 x.2) univ

tactic: norm_cast
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ 2 * ↑G.edgeFinset.card - 2 * ↑(regularityReduced P G (ε / 8) (ε / 4)).edgeFinset.card =
    ↑(filter (fun x => G.Adj x.1 x.2) univ).card -
      ↑(filter (fun x => (regularityReduced P G (ε / 8) (ε / 4)).Adj x.1 x.2) univ).card
state_after: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ Int.subNatNat (2 * G.edgeFinset.card) (2 * (regularityReduced P G (ε / 8) (ε / 4)).edgeFinset.card) =
    Int.subNatNat (filter (fun x => G.Adj x.1 x.2) univ).card
      (filter (fun x => (regularityReduced P G (ε / 8) (ε / 4)).Adj x.1 x.2) univ).card

tactic: rw [two_mul_card_edgeFinset, two_mul_card_edgeFinset]
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ Int.subNatNat (2 * G.edgeFinset.card) (2 * (regularityReduced P G (ε / 8) (ε / 4)).edgeFinset.card) =
    Int.subNatNat (filter (fun x => G.Adj x.1 x.2) univ).card
      (filter (fun x => (regularityReduced P G (ε / 8) (ε / 4)).Adj x.1 x.2) univ).card
state_after: no goals

tactic: exact monotone_filter_right _ fun xy hxy ↦ regularityReduced_le hxy
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ filter (fun x => (regularityReduced P G (ε / 8) (ε / 4)).Adj x.1 x.2) univ ⊆ filter (fun x => G.Adj x.1 x.2) univ
state_after: no goals

tactic: gcongr
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ ↑(filter
          (fun x =>
            match x with
            | (x, y) => G.Adj x y ∧ ¬(regularityReduced P G (ε / 8) (ε / 4)).Adj x y)
          (univ ×ˢ univ)).card ≤
    ↑(A ∪ B ∪ C).card
state_after: case h.a
α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ filter
      (fun x =>
        match x with
        | (x, y) => G.Adj x y ∧ ¬(regularityReduced P G (ε / 8) (ε / 4)).Adj x y)
      (univ ×ˢ univ) ⊆
    A ∪ B ∪ C

tactic: exact unreduced_edges_subset
state_before: case h.a
α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ filter
      (fun x =>
        match x with
        | (x, y) => G.Adj x y ∧ ¬(regularityReduced P G (ε / 8) (ε / 4)).Adj x y)
      (univ ×ˢ univ) ⊆
    A ∪ B ∪ C
state_after: no goals

tactic: gcongr
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ ↑(A ∪ B).card + ↑C.card ≤ ↑A.card + ↑B.card + ↑C.card
state_after: case bc
α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ ↑(A ∪ B).card ≤ ↑A.card + ↑B.card

tactic: exact mod_cast card_union_le _ _
state_before: case bc
α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ ↑(A ∪ B).card ≤ ↑A.card + ↑B.card
state_after: no goals

tactic: gcongr
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ ↑A.card + ↑B.card + ↑C.card < 4 * (ε / 8) * ↑(Fintype.card α) ^ 2 + ?m.295093 + ?m.295096
state_after: case bc.bc
α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ ↑A.card < 4 * (ε / 8) * ↑(Fintype.card α) ^ 2

tactic: exact hP.sum_nonUniforms_lt univ_nonempty (by positivity) hPε
state_before: case bc.bc
α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ ↑A.card < 4 * (ε / 8) * ↑(Fintype.card α) ^ 2
state_after: no goals

tactic: positivity
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ 0 < ε / 8
state_after: no goals

tactic: gcongr
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ 4 * (ε / 8) * ↑(Fintype.card α) ^ 2 + ↑B.card + ↑C.card ≤
    ?m.295669 + ε / 2 * ↑(Fintype.card α) ^ 2 + 4 * (ε / 4) * ↑(Fintype.card α) ^ 2
state_after: case h₁.bc
α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ ↑B.card ≤ ε / 2 * ↑(Fintype.card α) ^ 2

case h₂
α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ ↑C.card ≤ 4 * (ε / 4) * ↑(Fintype.card α) ^ 2

tactic: exact hP.card_biUnion_offDiag_le hε hP'
state_before: case h₁.bc
α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ ↑B.card ≤ ε / 2 * ↑(Fintype.card α) ^ 2
state_after: no goals

tactic: exact hP.card_interedges_sparsePairs_le (G := G) (ε := ε / 4) (by positivity)
state_before: case h₂
α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ ↑C.card ≤ 4 * (ε / 4) * ↑(Fintype.card α) ^ 2
state_after: no goals

tactic: positivity
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ 0 ≤ ε / 4
state_after: no goals

tactic: norm_cast
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ 4 * (ε / 8) * ↑(Fintype.card α) ^ 2 + ε / 2 * ↑(Fintype.card α) ^ 2 + 4 * (ε / 4) * ↑(Fintype.card α) ^ 2 =
    2 * ε * ↑(Fintype.card α ^ 2)
state_after: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ 4 * (ε / 8) * ↑(Fintype.card α ^ 2) + ε / 2 * ↑(Fintype.card α ^ 2) + 4 * (ε / 4) * ↑(Fintype.card α ^ 2) =
    2 * ε * ↑(Fintype.card α ^ 2)

tactic: ring
state_before: α : Type u_1
inst✝³ : DecidableEq α
inst✝² : Fintype α
G : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
s t : Finset α
P : Finpartition univ
ε : ℝ
inst✝ : Nonempty α
hε : 0 < ε
hP : P.IsEquipartition
hPε : P.IsUniform G (ε / 8)
hP' : 4 / ε ≤ ↑P.parts.card
A : Finset (α × α) :=
  (P.nonUniforms G (ε / 8)).biUnion fun x =>
    match x with
    | (U, V) => U ×ˢ V
B : Finset (α × α) := P.parts.biUnion offDiag
C : Finset (α × α) :=
  (P.sparsePairs G (ε / 4)).biUnion fun x =>
    match x with
    | (U, V) => G.interedges U V
⊢ 4 * (ε / 8) * ↑(Fintype.card α ^ 2) + ε / 2 * ↑(Fintype.card α ^ 2) + 4 * (ε / 4) * ↑(Fintype.card α ^ 2) =
    2 * ε * ↑(Fintype.card α ^ 2)
state_after: no goals