Theorem: Finset.pluennecke_petridis_inequality_add
File: Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean

Proof steps:
state_before: α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ C : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
⊢ (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
state_after: case empty
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
⊢ (A * B * ∅).card * A.card ≤ (A * B).card * (A * ∅).card

case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
⊢ (A * B * insert x C).card * A.card ≤ (A * B).card * (A * insert x C).card
tactic: induction' C using Finset.induction_on with x C _ ih
state_before: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
⊢ (A * B * insert x C).card * A.card ≤ (A * B).card * (A * insert x C).card
state_after: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
⊢ (A * B * insert x C).card * A.card ≤ (A * B).card * (A * insert x C).card
tactic: set A' := A ∩ (A * C / {x}) with hA'
state_before: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
⊢ (A * B * insert x C).card * A.card ≤ (A * B).card * (A * insert x C).card
state_after: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
⊢ (A * B * C').card * A.card ≤ (A * B).card * (A * C').card
tactic: set C' := insert x C with hC'
state_before: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
⊢ (A * B * C').card * A.card ≤ (A * B).card * (A * C').card
state_after: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
⊢ (A * B * C').card * A.card ≤ (A * B).card * (A * C').card
tactic: have h₀ : A' * {x} = A * {x} ∩ (A * C) := by
    rw [hA', inter_mul_singleton, (isUnit_singleton x).div_mul_cancel]
state_before: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
⊢ (A * B * C').card * A.card ≤ (A * B).card * (A * C').card
state_after: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
⊢ (A * B * C').card * A.card ≤ (A * B).card * (A * C').card
tactic: have h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x}) := by
    rw [hC', insert_eq, union_comm, mul_union]
    refine (sup_sdiff_eq_sup ?_).symm
    rw [mul_right_comm, mul_right_comm A, h₀]
    exact mul_subset_mul_right inter_subset_right
state_before: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
⊢ (A * B * C').card * A.card ≤ (A * B).card * (A * C').card
state_after: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
h₂ : A' * B * {x} ⊆ A * B * {x}
⊢ (A * B * C').card * A.card ≤ (A * B).card * (A * C').card
tactic: have h₂ : A' * B * {x} ⊆ A * B * {x} :=
    mul_subset_mul_right (mul_subset_mul_right inter_subset_left)
state_before: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
h₂ : A' * B * {x} ⊆ A * B * {x}
⊢ (A * B * C').card * A.card ≤ (A * B).card * (A * C').card
state_after: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
h₂ : A' * B * {x} ⊆ A * B * {x}
h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card
⊢ (A * B * C').card * A.card ≤ (A * B).card * (A * C').card
tactic: have h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card := by
    rw [h₁]
    refine (card_union_le _ _).trans_eq ?_
    rw [card_sdiff h₂, ← add_tsub_assoc_of_le (card_le_card h₂), card_mul_singleton,
      card_mul_singleton]
state_before: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
h₂ : A' * B * {x} ⊆ A * B * {x}
h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card
⊢ (A * B * C').card * A.card ≤ (A * B).card * (A * C').card
state_after: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
h₂ : A' * B * {x} ⊆ A * B * {x}
h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card
⊢ ((A * B * C).card + (A * B).card - (A' * B).card) * A.card ≤ (A * B).card * (A * C').card
tactic: refine (mul_le_mul_right' h₃ _).trans ?_
state_before: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
h₂ : A' * B * {x} ⊆ A * B * {x}
h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card
⊢ ((A * B * C).card + (A * B).card - (A' * B).card) * A.card ≤ (A * B).card * (A * C').card
state_after: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
h₂ : A' * B * {x} ⊆ A * B * {x}
h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card
⊢ (A * B * C).card * A.card + (A * B).card * A.card - (A' * B).card * A.card ≤ (A * B).card * (A * C').card
tactic: rw [tsub_mul, add_mul]
state_before: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
h₂ : A' * B * {x} ⊆ A * B * {x}
h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card
⊢ (A * B * C).card * A.card + (A * B).card * A.card - (A' * B).card * A.card ≤ (A * B).card * (A * C').card
state_after: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
h₂ : A' * B * {x} ⊆ A * B * {x}
h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card
⊢ (A * B).card * (A * C).card + (A * B).card * A.card - (A * B).card * (A ∩ (A * C / {x})).card =
    (A * B).card * (A * C').card
tactic: refine (tsub_le_tsub (add_le_add_right ih _) <| hA _ inter_subset_left).trans_eq ?_
state_before: case insert
α : Type u_1
inst✝¹ : CommGroup α
inst✝ : DecidableEq α
A B C✝ : Finset α
hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card
x : α
C : Finset α
a✝ : x ∉ C
ih : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card
A' : Finset α := A ∩ (A * C / {x})
hA' : A' = A ∩ (A * C / {x})
C' : Finset α := insert x C
hC' : C' = insert x C
h₀ : A' * {x} = A * {x} ∩ (A * C)
h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x})
h₂ : A' * B * {x} ⊆ A * B * {x}
h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card
⊢ (A * B).card * (A * C).card + (A * B).card * A.card - (A * B).card * (A ∩ (A * C / {x})).card =
    (A * B).card * (A * C').card
state_after: no goals
tactic: rw [← mul_add, ← mul_tsub, ← hA', hC', insert_eq, mul_union, ← card_mul_singleton A x, ←
    card_mul_singleton A' x, add_comm (card _), h₀,
    eq_tsub_of_add_eq (card_union_add_card_inter _ _)]