Theorem: SimpleGraph.good_vertices_triangle_card
File: Mathlib/Combinatorics/SimpleGraph/Triangle/Counting.lean

tactic: simp only [mem_sdiff, badVertices, mem_union, not_or, mem_filter, not_and_or, not_lt] at hx
state_before: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hx : x ∈ s \ (SimpleGraph.badVertices G ε s t ∪ SimpleGraph.badVertices G ε s u)
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card
state_after: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hx :
  x ∈ s ∧
    (x ∉ s ∨ (↑(G.edgeDensity s t) - ε) * ↑t.card ≤ ↑(filter (G.Adj x) t).card) ∧
      (x ∉ s ∨ (↑(G.edgeDensity s u) - ε) * ↑u.card ≤ ↑(filter (G.Adj x) u).card)
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card

tactic: rw [← or_and_left, and_or_left] at hx
state_before: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hx :
  x ∈ s ∧
    (x ∉ s ∨ (↑(G.edgeDensity s t) - ε) * ↑t.card ≤ ↑(filter (G.Adj x) t).card) ∧
      (x ∉ s ∨ (↑(G.edgeDensity s u) - ε) * ↑u.card ≤ ↑(filter (G.Adj x) u).card)
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card
state_after: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hx :
  x ∈ s ∧ x ∉ s ∨
    x ∈ s ∧
      (↑(G.edgeDensity s t) - ε) * ↑t.card ≤ ↑(filter (G.Adj x) t).card ∧
        (↑(G.edgeDensity s u) - ε) * ↑u.card ≤ ↑(filter (G.Adj x) u).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card

tactic: simp only [false_or, and_not_self, mul_comm (_ - _)] at hx
state_before: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hx :
  x ∈ s ∧ x ∉ s ∨
    x ∈ s ∧
      (↑(G.edgeDensity s t) - ε) * ↑t.card ≤ ↑(filter (G.Adj x) t).card ∧
        (↑(G.edgeDensity s u) - ε) * ↑u.card ≤ ↑(filter (G.Adj x) u).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card
state_after: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hx :
  x ∈ s ∧
    ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card ∧
      ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card

tactic: obtain ⟨-, hxY, hsu⟩ := hx
state_before: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hx :
  x ∈ s ∧
    ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card ∧
      ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card
state_after: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card

tactic: have hY : t.card * ε ≤ (filter (G.Adj x) t).card :=
  (mul_le_mul_of_nonneg_left (by linarith) (Nat.cast_nonneg _)).trans hxY
state_before: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card
state_after: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card

tactic: have hZ : u.card * ε ≤ (filter (G.Adj x) u).card :=
  (mul_le_mul_of_nonneg_left (by linarith) (Nat.cast_nonneg _)).trans hsu
state_before: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card
state_after: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card

tactic: rw [card_image_of_injective _ (Prod.mk.inj_left _)]
state_before: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(image (fun x_1 => (x, x_1))
          (filter
            (fun x =>
              match x with
              | (y, z) => G.Adj y z)
            (filter (G.Adj x) t ×ˢ filter (G.Adj x) u))).card
state_after: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card

tactic: have := utu (filter_subset (G.Adj x) _) (filter_subset (G.Adj x) _) hY hZ
state_before: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card
state_after: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card

tactic: have : ε ≤ G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u) := by
  rw [abs_sub_lt_iff] at this; linarith
state_before: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card
state_after: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this : ε ≤ ↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u))
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card

tactic: rw [edgeDensity_def] at this
state_before: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this : ε ≤ ↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u))
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card
state_after: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
        (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card))
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card

tactic: push_cast at this
state_before: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
        (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card))
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card
state_after: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
      (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card

tactic: have hε := utu.pos.le
state_before: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
      (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card
state_after: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
      (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
hε : 0 ≤ ε
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card

tactic: refine le_trans ?_ (mul_le_of_nonneg_of_le_div (Nat.cast_nonneg _) (by positivity) this)
state_before: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
      (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
hε : 0 ≤ ε
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤
    ↑(filter
          (fun x =>
            match x with
            | (y, z) => G.Adj y z)
          (filter (G.Adj x) t ×ˢ filter (G.Adj x) u)).card
state_after: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
      (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
hε : 0 ≤ ε
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤ ε * (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)

tactic: refine Eq.trans_le ?_
  (mul_le_mul_of_nonneg_left (mul_le_mul hY hZ (by positivity) (by positivity)) hε)
state_before: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
      (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
hε : 0 ≤ ε
⊢ ε ^ 3 * ↑t.card * ↑u.card ≤ ε * (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
state_after: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
      (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
hε : 0 ≤ ε
⊢ ε ^ 3 * ↑t.card * ↑u.card = ε * (↑t.card * ε * (↑u.card * ε))

tactic: ring
state_before: case intro.intro
α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
      (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
hε : 0 ≤ ε
⊢ ε ^ 3 * ↑t.card * ↑u.card = ε * (↑t.card * ε * (↑u.card * ε))
state_after: no goals

tactic: linarith
state_before: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
⊢ ε ≤ ↑(G.edgeDensity s t) - ε
state_after: no goals

tactic: linarith
state_before: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
⊢ ε ≤ ↑(G.edgeDensity s u) - ε
state_after: no goals

tactic: rw [abs_sub_lt_iff] at this
state_before: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
⊢ ε ≤ ↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u))
state_after: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this :
  ↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u) < ε ∧
    ↑(G.edgeDensity t u) - ↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) < ε
⊢ ε ≤ ↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u))

tactic: linarith
state_before: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this :
  ↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u) < ε ∧
    ↑(G.edgeDensity t u) - ↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) < ε
⊢ ε ≤ ↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u))
state_after: no goals

tactic: positivity
state_before: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
      (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
hε : 0 ≤ ε
⊢ 0 ≤ ↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card
state_after: no goals

tactic: positivity
state_before: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
      (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
hε : 0 ≤ ε
⊢ 0 ≤ ↑u.card * ε
state_after: no goals

tactic: positivity
state_before: α : Type u_1
G G' : SimpleGraph α
inst✝¹ : DecidableRel G.Adj
ε : ℝ
s t u : Finset α
inst✝ : DecidableEq α
dst : 2 * ε ≤ ↑(G.edgeDensity s t)
dsu : 2 * ε ≤ ↑(G.edgeDensity s u)
dtu : 2 * ε ≤ ↑(G.edgeDensity t u)
utu : G.IsUniform ε t u
x : α
hxY : ↑t.card * (↑(G.edgeDensity s t) - ε) ≤ ↑(filter (G.Adj x) t).card
hsu : ↑u.card * (↑(G.edgeDensity s u) - ε) ≤ ↑(filter (G.Adj x) u).card
hY : ↑t.card * ε ≤ ↑(filter (G.Adj x) t).card
hZ : ↑u.card * ε ≤ ↑(filter (G.Adj x) u).card
this✝ : |↑(G.edgeDensity (filter (G.Adj x) t) (filter (G.Adj x) u)) - ↑(G.edgeDensity t u)| < ε
this :
  ε ≤
    ↑(G.interedges (filter (G.Adj x) t) (filter (G.Adj x) u)).card /
      (↑(filter (G.Adj x) t).card * ↑(filter (G.Adj x) u).card)
hε : 0 ≤ ε
⊢ 0 ≤ ↑(filter (G.Adj x) t).card
state_after: no goals