File: Mathlib/Combinatorics/Additive/Energy.lean

full_name: Finset.mulEnergy
code: /-- The multiplicative energy `Eₘ[s, t]` of two finsets `s` and `t` in a group is the number of
quadruples `(a₁, a₂, b₁, b₂) ∈ s × s × t × t` such that `a₁ * b₁ = a₂ * b₂`.

The notation `Eₘ[s, t]` is available in scope `Combinatorics.Additive`. -/
@[to_additive "The additive energy `E[s, t]` of two finsets `s` and `t` in a group is the number of
quadruples `(a₁, a₂, b₁, b₂) ∈ s × s × t × t` such that `a₁ + b₁ = a₂ + b₂`.

The notation `E[s, t]` is available in scope `Combinatorics.Additive`."]
def mulEnergy (s t : Finset α) : ℕ 
goal: ℕ

full_name: Finset.addEnergy
code: /-- The multiplicative energy `Eₘ[s, t]` of two finsets `s` and `t` in a group is the number of
quadruples `(a₁, a₂, b₁, b₂) ∈ s × s × t × t` such that `a₁ * b₁ = a₂ * b₂`.

The notation `Eₘ[s, t]` is available in scope `Combinatorics.Additive`. -/
@[to_additive "The additive energy `E[s, t]` of two finsets `s` and `t` in a group is the number of
quadruples `(a₁, a₂, b₁, b₂) ∈ s × s × t × t` such that `a₁ + b₁ = a₂ + b₂`.

The notation `E[s, t]` is available in scope `Combinatorics.Additive`."]
def mulEnergy (s t : Finset α) : ℕ 
goal: ℕ

full_name: Combinatorics.Additive.«_aux_Mathlib_Combinatorics_Additive_Energy___macroRules_Combinatorics_Additive_termEₘ[_,_]_1»
code: /-- The multiplicative energy of two finsets `s` and `t` in a group is the number of quadruples
`(a₁, a₂, b₁, b₂) ∈ s × s × t × t` such that `a₁ * b₁ = a₂ * b₂`. -/
scoped[Combinatorics.Additive] notation3:max "Eₘ[" s ", " t "]" => Finset.mulEnergy s t
goal: Lean.Macro

full_name: Combinatorics.Additive.«_aux_Mathlib_Combinatorics_Additive_Energy___macroRules_Combinatorics_Additive_termE[_,_]_1»
code: /-- The additive energy of two finsets `s` and `t` in a group is the number of quadruples
`(a₁, a₂, b₁, b₂) ∈ s × s × t × t` such that `a₁ + b₁ = a₂ + b₂`.-/
scoped[Combinatorics.Additive] notation3:max "E[" s ", " t "]" => Finset.addEnergy s t
goal: Lean.Macro

full_name: Combinatorics.Additive.«_aux_Mathlib_Combinatorics_Additive_Energy___macroRules_Combinatorics_Additive_termEₘ[_]_1»
code: /-- The multiplicative energy of a finset `s` in a group is the number of quadruples
`(a₁, a₂, b₁, b₂) ∈ s × s × s × s` such that `a₁ * b₁ = a₂ * b₂`. -/
scoped[Combinatorics.Additive] notation3:max "Eₘ[" s "]" => Finset.mulEnergy s s
goal: Lean.Macro

full_name: Combinatorics.Additive.«_aux_Mathlib_Combinatorics_Additive_Energy___macroRules_Combinatorics_Additive_termE[_]_1»
code: /-- The additive energy of a finset `s` in a group is the number of quadruples
`(a₁, a₂, b₁, b₂) ∈ s × s × s × s` such that `a₁ + b₁ = a₂ + b₂`. -/
scoped[Combinatorics.Additive] notation3:max "E[" s "]" => Finset.addEnergy s s
goal: Lean.Macro

full_name: Finset.mulEnergy_mono
code: @[to_additive (attr := gcongr)]
lemma mulEnergy_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : Eₘ[s₁, t₁] ≤ Eₘ[s₂, t₂] 
goal: s₁.mulEnergy t₁ ≤ s₂.mulEnergy t₂

full_name: Finset.addEnergy_mono
code: @[to_additive (attr := gcongr)]
lemma mulEnergy_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : Eₘ[s₁, t₁] ≤ Eₘ[s₂, t₂] 
goal: s₁.addEnergy t₁ ≤ s₂.addEnergy t₂

full_name: Finset.addEnergy_mono_left
code: @[to_additive] lemma mulEnergy_mono_left (hs : s₁ ⊆ s₂) : Eₘ[s₁, t] ≤ Eₘ[s₂, t] 
goal: s₁.addEnergy t ≤ s₂.addEnergy t

full_name: Finset.mulEnergy_mono_left
code: @[to_additive] lemma mulEnergy_mono_left (hs : s₁ ⊆ s₂) : Eₘ[s₁, t] ≤ Eₘ[s₂, t] 
goal: s₁.mulEnergy t ≤ s₂.mulEnergy t

full_name: Finset.addEnergy_mono_right
code: @[to_additive] lemma mulEnergy_mono_right (ht : t₁ ⊆ t₂) : Eₘ[s, t₁] ≤ Eₘ[s, t₂] 
goal: s.addEnergy t₁ ≤ s.addEnergy t₂

full_name: Finset.mulEnergy_mono_right
code: @[to_additive] lemma mulEnergy_mono_right (ht : t₁ ⊆ t₂) : Eₘ[s, t₁] ≤ Eₘ[s, t₂] 
goal: s.mulEnergy t₁ ≤ s.mulEnergy t₂

full_name: Finset.le_mulEnergy
code: @[to_additive] lemma le_mulEnergy : s.card * t.card ≤ Eₘ[s, t] 
goal: s.card * t.card ≤ s.mulEnergy t

full_name: Finset.le_addEnergy
code: @[to_additive] lemma le_mulEnergy : s.card * t.card ≤ Eₘ[s, t] 
goal: s.card * t.card ≤ s.addEnergy t

full_name: Finset.addEnergy_pos
code: @[to_additive] lemma mulEnergy_pos (hs : s.Nonempty) (ht : t.Nonempty) : 0 < Eₘ[s, t] 
goal: 0 < s.addEnergy t

full_name: Finset.mulEnergy_pos
code: @[to_additive] lemma mulEnergy_pos (hs : s.Nonempty) (ht : t.Nonempty) : 0 < Eₘ[s, t] 
goal: 0 < s.mulEnergy t

full_name: Finset.addEnergy_empty_left
code: @[to_additive (attr := simp)] lemma mulEnergy_empty_left : Eₘ[∅, t] = 0 
goal: ∅.addEnergy t = 0

full_name: Finset.mulEnergy_empty_left
code: @[to_additive (attr := simp)] lemma mulEnergy_empty_left : Eₘ[∅, t] = 0 
goal: ∅.mulEnergy t = 0

full_name: Finset.mulEnergy_empty_right
code: @[to_additive (attr := simp)] lemma mulEnergy_empty_right : Eₘ[s, ∅] = 0 
goal: s.mulEnergy ∅ = 0

full_name: Finset.addEnergy_empty_right
code: @[to_additive (attr := simp)] lemma mulEnergy_empty_right : Eₘ[s, ∅] = 0 
goal: s.addEnergy ∅ = 0

full_name: Finset.mulEnergy_pos_iff
code: @[to_additive (attr := simp)] lemma mulEnergy_pos_iff : 0 < Eₘ[s, t] ↔ s.Nonempty ∧ t.Nonempty 
goal: 0 < s.mulEnergy t ↔ s.Nonempty ∧ t.Nonempty

full_name: Finset.addEnergy_pos_iff
code: @[to_additive (attr := simp)] lemma mulEnergy_pos_iff : 0 < Eₘ[s, t] ↔ s.Nonempty ∧ t.Nonempty 
goal: 0 < s.addEnergy t ↔ s.Nonempty ∧ t.Nonempty

full_name: Finset.addEnergy_eq_zero_iff
code: @[to_additive (attr := simp)] lemma mulEnergy_eq_zero_iff : Eₘ[s, t] = 0 ↔ s = ∅ ∨ t = ∅ 
goal: s.addEnergy t = 0 ↔ s = ∅ ∨ t = ∅

full_name: Finset.mulEnergy_eq_zero_iff
code: @[to_additive (attr := simp)] lemma mulEnergy_eq_zero_iff : Eₘ[s, t] = 0 ↔ s = ∅ ∨ t = ∅ 
goal: s.mulEnergy t = 0 ↔ s = ∅ ∨ t = ∅

full_name: Finset.addEnergy_eq_card_filter
code: @[to_additive] lemma mulEnergy_eq_card_filter (s t : Finset α) :
    Eₘ[s, t] = (((s ×ˢ t) ×ˢ s ×ˢ t).filter fun ((a, b), c, d) ↦ a * b = c * d).card 
goal: s.addEnergy t =
  (Finset.filter (fun x => Finset.addEnergy_eq_card_filter.match_1 (fun x => Prop) x fun a b c d => a + b = c + d)
      ((s ×ˢ t) ×ˢ s ×ˢ t)).card

full_name: Finset.mulEnergy_eq_card_filter
code: @[to_additive] lemma mulEnergy_eq_card_filter (s t : Finset α) :
    Eₘ[s, t] = (((s ×ˢ t) ×ˢ s ×ˢ t).filter fun ((a, b), c, d) ↦ a * b = c * d).card 
goal: s.mulEnergy t =
  (Finset.filter
      (fun x =>
        match x with
        | ((a, b), c, d) => a * b = c * d)
      ((s ×ˢ t) ×ˢ s ×ˢ t)).card

full_name: Finset.addEnergy_eq_sum_sq'
code: @[to_additive] lemma mulEnergy_eq_sum_sq' (s t : Finset α) :
    Eₘ[s, t] = ∑ a ∈ s * t, ((s ×ˢ t).filter fun (x, y) ↦ x * y = a).card ^ 2 
goal: s.addEnergy t =
  ∑ a ∈ s + t,
    (Finset.filter (fun x => Finset.addEnergy_eq_sum_sq'.match_1 (fun x => Prop) x fun x y => x + y = a)
          (s ×ˢ t)).card ^
      2

full_name: Finset.mulEnergy_eq_sum_sq'
code: @[to_additive] lemma mulEnergy_eq_sum_sq' (s t : Finset α) :
    Eₘ[s, t] = ∑ a ∈ s * t, ((s ×ˢ t).filter fun (x, y) ↦ x * y = a).card ^ 2 
goal: s.mulEnergy t =
  ∑ a ∈ s * t,
    (Finset.filter
          (fun x =>
            match x with
            | (x, y) => x * y = a)
          (s ×ˢ t)).card ^
      2

full_name: Finset.mulEnergy_eq_sum_sq
code: @[to_additive] lemma mulEnergy_eq_sum_sq [Fintype α] (s t : Finset α) :
    Eₘ[s, t] = ∑ a, ((s ×ˢ t).filter fun (x, y) ↦ x * y = a).card ^ 2 
goal: s.mulEnergy t =
  ∑ a : α,
    (Finset.filter
          (fun x =>
            match x with
            | (x, y) => x * y = a)
          (s ×ˢ t)).card ^
      2

full_name: Finset.addEnergy_eq_sum_sq
code: @[to_additive] lemma mulEnergy_eq_sum_sq [Fintype α] (s t : Finset α) :
    Eₘ[s, t] = ∑ a, ((s ×ˢ t).filter fun (x, y) ↦ x * y = a).card ^ 2 
goal: s.addEnergy t =
  ∑ a : α,
    (Finset.filter (fun x => Finset.addEnergy_eq_sum_sq'.match_1 (fun x => Prop) x fun x y => x + y = a)
          (s ×ˢ t)).card ^
      2

full_name: Finset.card_sq_le_card_mul_mulEnergy
code: @[to_additive card_sq_le_card_mul_addEnergy]
lemma card_sq_le_card_mul_mulEnergy (s t u : Finset α) :
    ((s ×ˢ t).filter fun (a, b) ↦ a * b ∈ u).card ^ 2 ≤ u.card * Eₘ[s, t] 
goal: (Finset.filter
        (fun x =>
          match x with
          | (a, b) => a * b ∈ u)
        (s ×ˢ t)).card ^
    2 ≤
  u.card * s.mulEnergy t

full_name: Finset.card_sq_le_card_mul_addEnergy
code: @[to_additive card_sq_le_card_mul_addEnergy]
lemma card_sq_le_card_mul_mulEnergy (s t u : Finset α) :
    ((s ×ˢ t).filter fun (a, b) ↦ a * b ∈ u).card ^ 2 ≤ u.card * Eₘ[s, t] 
goal: (Finset.filter (fun x => Finset.addEnergy_eq_sum_sq'.match_1 (fun x => Prop) x fun a b => a + b ∈ u) (s ×ˢ t)).card ^
    2 ≤
  u.card * s.addEnergy t

full_name: Finset.le_card_add_mul_addEnergy
code: @[to_additive le_card_add_mul_addEnergy] lemma le_card_add_mul_mulEnergy (s t : Finset α) :
    s.card ^ 2 * t.card ^ 2 ≤ (s * t).card * Eₘ[s, t] 
goal: s.card ^ 2 * t.card ^ 2 ≤ (s + t).card * s.addEnergy t

full_name: Finset.le_card_add_mul_mulEnergy
code: @[to_additive le_card_add_mul_addEnergy] lemma le_card_add_mul_mulEnergy (s t : Finset α) :
    s.card ^ 2 * t.card ^ 2 ≤ (s * t).card * Eₘ[s, t] 
goal: s.card ^ 2 * t.card ^ 2 ≤ (s * t).card * s.mulEnergy t

full_name: Finset.mulEnergy_comm
code: @[to_additive] lemma mulEnergy_comm (s t : Finset α) : Eₘ[s, t] = Eₘ[t, s] 
goal: s.mulEnergy t = t.mulEnergy s

full_name: Finset.addEnergy_comm
code: @[to_additive] lemma mulEnergy_comm (s t : Finset α) : Eₘ[s, t] = Eₘ[t, s] 
goal: s.addEnergy t = t.addEnergy s

full_name: Finset.mulEnergy_univ_left
code: @[to_additive (attr := simp)]
lemma mulEnergy_univ_left : Eₘ[univ, t] = Fintype.card α * t.card ^ 2 
goal: Finset.univ.mulEnergy t = Fintype.card α * t.card ^ 2

full_name: Finset.addEnergy_univ_left
code: @[to_additive (attr := simp)]
lemma mulEnergy_univ_left : Eₘ[univ, t] = Fintype.card α * t.card ^ 2 
goal: Finset.univ.addEnergy t = Fintype.card α * t.card ^ 2

full_name: Finset.addEnergy_univ_right
code: @[to_additive (attr := simp)]
lemma mulEnergy_univ_right : Eₘ[s, univ] = Fintype.card α * s.card ^ 2 
goal: s.addEnergy Finset.univ = Fintype.card α * s.card ^ 2

full_name: Finset.mulEnergy_univ_right
code: @[to_additive (attr := simp)]
lemma mulEnergy_univ_right : Eₘ[s, univ] = Fintype.card α * s.card ^ 2 
goal: s.mulEnergy Finset.univ = Fintype.card α * s.card ^ 2