File: Mathlib/Data/Fintype/BigOperators.lean

full_name: Fintype.sum_bool
code: @[to_additive]
theorem prod_bool [CommMonoid α] (f : Bool → α) : ∏ b, f b = f true * f false 
goal: ∑ b : Bool, f b = f true + f false

full_name: Fintype.prod_bool
code: @[to_additive]
theorem prod_bool [CommMonoid α] (f : Bool → α) : ∏ b, f b = f true * f false 
goal: ∏ b : Bool, f b = f true * f false

full_name: Fintype.card_eq_sum_ones
code: theorem card_eq_sum_ones {α} [Fintype α] : Fintype.card α = ∑ _a : α, 1 
goal: Fintype.card α = ∑ _a : α, 1

full_name: Fintype.sum_extend_by_zero
code: @[to_additive]
theorem prod_extend_by_one [CommMonoid α] (s : Finset ι) (f : ι → α) :
    ∏ i, (if i ∈ s then f i else 1) = ∏ i ∈ s, f i 
goal: (∑ i : ι, if i ∈ s then f i else 0) = ∑ i ∈ s, f i

full_name: Fintype.prod_extend_by_one
code: @[to_additive]
theorem prod_extend_by_one [CommMonoid α] (s : Finset ι) (f : ι → α) :
    ∏ i, (if i ∈ s then f i else 1) = ∏ i ∈ s, f i 
goal: (∏ i : ι, if i ∈ s then f i else 1) = ∏ i ∈ s, f i

full_name: Fintype.sum_eq_zero
code: @[to_additive]
theorem prod_eq_one (f : α → M) (h : ∀ a, f a = 1) : ∏ a, f a = 1 
goal: ∑ a : α, f a = 0

full_name: Fintype.prod_eq_one
code: @[to_additive]
theorem prod_eq_one (f : α → M) (h : ∀ a, f a = 1) : ∏ a, f a = 1 
goal: ∏ a : α, f a = 1

full_name: Fintype.prod_congr
code: @[to_additive]
theorem prod_congr (f g : α → M) (h : ∀ a, f a = g a) : ∏ a, f a = ∏ a, g a 
goal: ∏ a : α, f a = ∏ a : α, g a

full_name: Fintype.sum_congr
code: @[to_additive]
theorem prod_congr (f g : α → M) (h : ∀ a, f a = g a) : ∏ a, f a = ∏ a, g a 
goal: ∑ a : α, f a = ∑ a : α, g a

full_name: Fintype.sum_eq_single
code: @[to_additive]
theorem prod_eq_single {f : α → M} (a : α) (h : ∀ x ≠ a, f x = 1) : ∏ x, f x = f a 
goal: ∑ x : α, f x = f a

full_name: Fintype.prod_eq_single
code: @[to_additive]
theorem prod_eq_single {f : α → M} (a : α) (h : ∀ x ≠ a, f x = 1) : ∏ x, f x = f a 
goal: ∏ x : α, f x = f a

full_name: Fintype.sum_eq_add
code: @[to_additive]
theorem prod_eq_mul {f : α → M} (a b : α) (h₁ : a ≠ b) (h₂ : ∀ x, x ≠ a ∧ x ≠ b → f x = 1) :
    ∏ x, f x = f a * f b 
goal: ∑ x : α, f x = f a + f b

full_name: Fintype.prod_eq_mul
code: @[to_additive]
theorem prod_eq_mul {f : α → M} (a b : α) (h₁ : a ≠ b) (h₂ : ∀ x, x ≠ a ∧ x ≠ b → f x = 1) :
    ∏ x, f x = f a * f b 
goal: ∏ x : α, f x = f a * f b

full_name: Fintype.eq_of_subsingleton_of_sum_eq
code: /-- If a product of a `Finset` of a subsingleton type has a given
value, so do the terms in that product. -/
@[to_additive "If a sum of a `Finset` of a subsingleton type has a given
  value, so do the terms in that sum."]
theorem eq_of_subsingleton_of_prod_eq {ι : Type*} [Subsingleton ι] {s : Finset ι} {f : ι → M}
    {b : M} (h : ∏ i ∈ s, f i = b) : ∀ i ∈ s, f i = b 
goal: i ∈ s → f i = b

full_name: Fintype.eq_of_subsingleton_of_prod_eq
code: /-- If a product of a `Finset` of a subsingleton type has a given
value, so do the terms in that product. -/
@[to_additive "If a sum of a `Finset` of a subsingleton type has a given
  value, so do the terms in that sum."]
theorem eq_of_subsingleton_of_prod_eq {ι : Type*} [Subsingleton ι] {s : Finset ι} {f : ι → M}
    {b : M} (h : ∏ i ∈ s, f i = b) : ∀ i ∈ s, f i = b 
goal: i ∈ s → f i = b

full_name: Fintype.sum_option
code: @[to_additive (attr := simp)]
theorem Fintype.prod_option (f : Option α → M) : ∏ i, f i = f none * ∏ i, f (some i) 
goal: ∑ i : Option α, f i = f none + ∑ i : α, f (some i)

full_name: Fintype.prod_option
code: @[to_additive (attr := simp)]
theorem Fintype.prod_option (f : Option α → M) : ∏ i, f i = f none * ∏ i, f (some i) 
goal: ∏ i : Option α, f i = f none * ∏ i : α, f (some i)

full_name: Finset.card_pi
code: @[simp] lemma Finset.card_pi (s : Finset ι) (t : ∀ i, Finset (α i)) :
    (s.pi t).card = ∏ i ∈ s, card (t i) 
goal: (s.pi t).card = ∏ i ∈ s, (t i).card

full_name: Fintype.card_piFinset
code: @[simp] lemma card_piFinset (s : ∀ i, Finset (α i)) :
    (piFinset s).card = ∏ i, (s i).card 
goal: (Fintype.piFinset s).card = ∏ i : ι, (s i).card

full_name: Fintype.card_piFinset_const
code: /-- This lemma is specifically designed to be used backwards, whence the specialisation to `Fin n`
as the indexing type doesn't matter in practice. The more general forward direction lemma here is
`Fintype.card_piFinset`. -/
lemma card_piFinset_const {α : Type*} (s : Finset α) (n : ℕ) :
    (piFinset fun _ : Fin n ↦ s).card = s.card ^ n 
goal: (Fintype.piFinset fun x => s).card = s.card ^ n

full_name: Fintype.card_pi
code: @[simp] lemma card_pi [DecidableEq ι] [∀ i, Fintype (α i)] : card (∀ i, α i) = ∏ i, card (α i) 
goal: Fintype.card ((i : ι) → α i) = ∏ i : ι, Fintype.card (α i)

full_name: Fintype.card_pi_const
code: /-- This lemma is specifically designed to be used backwards, whence the specialisation to `Fin n`
as the indexing type doesn't matter in practice. The more general forward direction lemma here is
`Fintype.card_pi`. -/
lemma card_pi_const (α : Type*) [Fintype α] (n : ℕ) : card (Fin n → α) = card α ^ n 
goal: Fintype.card (Fin n → α) = Fintype.card α ^ n

full_name: Fintype.card_sigma
code: @[simp] nonrec lemma card_sigma [Fintype ι] [∀ i, Fintype (α i)] :
    card (Sigma α) = ∑ i, card (α i) 
goal: Fintype.card (Sigma α) = ∑ i : ι, Fintype.card (α i)

full_name: Fintype.card_filter_piFinset_eq_of_mem
code: /-- The number of dependent maps `f : Π j, s j` for which the `i` component is `a` is the product
over all `j ≠ i` of `(s j).card`.

Note that this is just a composition of easier lemmas, but there's some glue missing to make that
smooth enough not to need this lemma. -/
lemma card_filter_piFinset_eq_of_mem (s : ∀ i, Finset (α i)) (i : ι) {a : α i} (ha : a ∈ s i) :
    ((piFinset s).filter fun f ↦ f i = a).card = ∏ j ∈ univ.erase i, (s j).card 
goal: (Finset.filter (fun f => f i = a) (Fintype.piFinset s)).card = ∏ j ∈ Finset.univ.erase i, (s j).card

full_name: Fintype.card_filter_piFinset_const_eq_of_mem
code: lemma card_filter_piFinset_const_eq_of_mem (s : Finset κ) (i : ι) {x : κ} (hx : x ∈ s) :
    ((piFinset fun _ ↦ s).filter fun f ↦ f i = x).card = s.card ^ (card ι - 1) 
goal: (Finset.filter (fun f => f i = x) (Fintype.piFinset fun x => s)).card = s.card ^ (Fintype.card ι - 1)

full_name: Fintype.card_filter_piFinset_eq
code: lemma card_filter_piFinset_eq (s : ∀ i, Finset (α i)) (i : ι) (a : α i) :
    ((piFinset s).filter fun f ↦ f i = a).card =
      if a ∈ s i then ∏ b ∈ univ.erase i, (s b).card else 0 
goal: (Finset.filter (fun f => f i = a) (Fintype.piFinset s)).card =
  if a ∈ s i then ∏ b ∈ Finset.univ.erase i, (s b).card else 0

full_name: Fintype.card_filter_piFinset_const
code: lemma card_filter_piFinset_const (s : Finset κ) (i : ι) (j : κ) :
    ((piFinset fun _ ↦ s).filter fun f ↦ f i = j).card =
      if j ∈ s then s.card ^ (card ι - 1) else 0 
goal: (Finset.filter (fun f => f i = j) (Fintype.piFinset fun x => s)).card =
  if j ∈ s then s.card ^ (Fintype.card ι - 1) else 0

full_name: Fintype.card_fun
code: theorem Fintype.card_fun [DecidableEq α] [Fintype α] [Fintype β] :
    Fintype.card (α → β) = Fintype.card β ^ Fintype.card α 
goal: Fintype.card (α → β) = Fintype.card β ^ Fintype.card α

full_name: card_vector
code: @[simp]
theorem card_vector [Fintype α] (n : ℕ) : Fintype.card (Vector α n) = Fintype.card α ^ n 
goal: Fintype.card (Mathlib.Vector α n) = Fintype.card α ^ n

full_name: Fin.sum_univ_eq_sum_range
code: /-- It is equivalent to compute the product of a function over `Fin n` or `Finset.range n`. -/
@[to_additive "It is equivalent to sum a function over `fin n` or `finset.range n`."]
theorem Fin.prod_univ_eq_prod_range [CommMonoid α] (f : ℕ → α) (n : ℕ) :
    ∏ i : Fin n, f i = ∏ i ∈ range n, f i 
goal: ∑ i : Fin n, f ↑i = ∑ i ∈ Finset.range n, f i

full_name: Fin.prod_univ_eq_prod_range
code: /-- It is equivalent to compute the product of a function over `Fin n` or `Finset.range n`. -/
@[to_additive "It is equivalent to sum a function over `fin n` or `finset.range n`."]
theorem Fin.prod_univ_eq_prod_range [CommMonoid α] (f : ℕ → α) (n : ℕ) :
    ∏ i : Fin n, f i = ∏ i ∈ range n, f i 
goal: ∏ i : Fin n, f ↑i = ∏ i ∈ Finset.range n, f i

full_name: Finset.sum_fin_eq_sum_range
code: @[to_additive]
theorem Finset.prod_fin_eq_prod_range [CommMonoid β] {n : ℕ} (c : Fin n → β) :
    ∏ i, c i = ∏ i ∈ Finset.range n, if h : i < n then c ⟨i, h⟩ else 1 
goal: ∑ i : Fin n, c i = ∑ i ∈ Finset.range n, if h : i < n then c ⟨i, h⟩ else 0

full_name: Finset.prod_fin_eq_prod_range
code: @[to_additive]
theorem Finset.prod_fin_eq_prod_range [CommMonoid β] {n : ℕ} (c : Fin n → β) :
    ∏ i, c i = ∏ i ∈ Finset.range n, if h : i < n then c ⟨i, h⟩ else 1 
goal: ∏ i : Fin n, c i = ∏ i ∈ Finset.range n, if h : i < n then c ⟨i, h⟩ else 1

full_name: Finset.prod_toFinset_eq_subtype
code: @[to_additive]
theorem Finset.prod_toFinset_eq_subtype {M : Type*} [CommMonoid M] [Fintype α] (p : α → Prop)
    [DecidablePred p] (f : α → M) : ∏ a ∈ { x | p x }.toFinset, f a = ∏ a : Subtype p, f a 
goal: ∏ a ∈ {x | p x}.toFinset, f a = ∏ a : Subtype p, f ↑a

full_name: Finset.sum_toFinset_eq_subtype
code: @[to_additive]
theorem Finset.prod_toFinset_eq_subtype {M : Type*} [CommMonoid M] [Fintype α] (p : α → Prop)
    [DecidablePred p] (f : α → M) : ∏ a ∈ { x | p x }.toFinset, f a = ∏ a : Subtype p, f a 
goal: ∑ a ∈ {x | p x}.toFinset, f a = ∑ a : Subtype p, f ↑a

full_name: Fintype.prod_dite
code: nonrec theorem Fintype.prod_dite [Fintype α] {p : α → Prop} [DecidablePred p] [CommMonoid β]
    (f : ∀ a, p a → β) (g : ∀ a, ¬p a → β) :
    (∏ a, dite (p a) (f a) (g a)) =
    (∏ a : { a // p a }, f a a.2) * ∏ a : { a // ¬p a }, g a a.2 
goal: ∏ a : α, dite (p a) (f a) (g a) = (∏ a : { a // p a }, f ↑a ⋯) * ∏ a : { a // ¬p a }, g ↑a ⋯

full_name: Fintype.prod_sum_elim
code: @[to_additive]
theorem Fintype.prod_sum_elim (f : α₁ → M) (g : α₂ → M) :
    ∏ x, Sum.elim f g x = (∏ a₁, f a₁) * ∏ a₂, g a₂ 
goal: ∏ x : α₁ ⊕ α₂, Sum.elim f g x = (∏ a₁ : α₁, f a₁) * ∏ a₂ : α₂, g a₂

full_name: Fintype.sum_sum_elim
code: @[to_additive]
theorem Fintype.prod_sum_elim (f : α₁ → M) (g : α₂ → M) :
    ∏ x, Sum.elim f g x = (∏ a₁, f a₁) * ∏ a₂, g a₂ 
goal: ∑ x : α₁ ⊕ α₂, Sum.elim f g x = ∑ a₁ : α₁, f a₁ + ∑ a₂ : α₂, g a₂

full_name: Fintype.prod_sum_type
code: @[to_additive (attr := simp)]
theorem Fintype.prod_sum_type (f : α₁ ⊕ α₂ → M) :
    ∏ x, f x = (∏ a₁, f (Sum.inl a₁)) * ∏ a₂, f (Sum.inr a₂) 
goal: ∏ x : α₁ ⊕ α₂, f x = (∏ a₁ : α₁, f (Sum.inl a₁)) * ∏ a₂ : α₂, f (Sum.inr a₂)

full_name: Fintype.sum_sum_type
code: @[to_additive (attr := simp)]
theorem Fintype.prod_sum_type (f : α₁ ⊕ α₂ → M) :
    ∏ x, f x = (∏ a₁, f (Sum.inl a₁)) * ∏ a₂, f (Sum.inr a₂) 
goal: ∑ x : α₁ ⊕ α₂, f x = ∑ a₁ : α₁, f (Sum.inl a₁) + ∑ a₂ : α₂, f (Sum.inr a₂)

full_name: Fintype.prod_prod_type
code: @[to_additive (attr := simp) Fintype.sum_prod_type]
theorem Fintype.prod_prod_type [CommMonoid γ] {f : α₁ × α₂ → γ} :
    ∏ x, f x = ∏ x, ∏ y, f (x, y) 
goal: ∏ x : α₁ × α₂, f x = ∏ x : α₁, ∏ y : α₂, f (x, y)

full_name: Fintype.sum_prod_type
code: @[to_additive (attr := simp) Fintype.sum_prod_type]
theorem Fintype.prod_prod_type [CommMonoid γ] {f : α₁ × α₂ → γ} :
    ∏ x, f x = ∏ x, ∏ y, f (x, y) 
goal: ∑ x : α₁ × α₂, f x = ∑ x : α₁, ∑ y : α₂, f (x, y)

full_name: Fintype.sum_prod_type'
code: /-- An uncurried version of `Finset.prod_prod_type`. -/
@[to_additive Fintype.sum_prod_type' "An uncurried version of `Finset.sum_prod_type`"]
theorem Fintype.prod_prod_type' [CommMonoid γ] {f : α₁ → α₂ → γ} :
    ∏ x : α₁ × α₂, f x.1 x.2 = ∏ x, ∏ y, f x y 
goal: ∑ x : α₁ × α₂, f x.1 x.2 = ∑ x : α₁, ∑ y : α₂, f x y

full_name: Fintype.prod_prod_type'
code: /-- An uncurried version of `Finset.prod_prod_type`. -/
@[to_additive Fintype.sum_prod_type' "An uncurried version of `Finset.sum_prod_type`"]
theorem Fintype.prod_prod_type' [CommMonoid γ] {f : α₁ → α₂ → γ} :
    ∏ x : α₁ × α₂, f x.1 x.2 = ∏ x, ∏ y, f x y 
goal: ∏ x : α₁ × α₂, f x.1 x.2 = ∏ x : α₁, ∏ y : α₂, f x y

full_name: Fintype.prod_prod_type_right
code: @[to_additive Fintype.sum_prod_type_right]
theorem Fintype.prod_prod_type_right [CommMonoid γ] {f : α₁ × α₂ → γ} :
    ∏ x, f x = ∏ y, ∏ x, f (x, y) 
goal: ∏ x : α₁ × α₂, f x = ∏ y : α₂, ∏ x : α₁, f (x, y)

full_name: Fintype.sum_prod_type_right
code: @[to_additive Fintype.sum_prod_type_right]
theorem Fintype.prod_prod_type_right [CommMonoid γ] {f : α₁ × α₂ → γ} :
    ∏ x, f x = ∏ y, ∏ x, f (x, y) 
goal: ∑ x : α₁ × α₂, f x = ∑ y : α₂, ∑ x : α₁, f (x, y)

full_name: Fintype.prod_prod_type_right'
code: /-- An uncurried version of `Finset.prod_prod_type_right`. -/
@[to_additive Fintype.sum_prod_type_right' "An uncurried version of `Finset.sum_prod_type_right`"]
theorem Fintype.prod_prod_type_right' [CommMonoid γ] {f : α₁ → α₂ → γ} :
    ∏ x : α₁ × α₂, f x.1 x.2 = ∏ y, ∏ x, f x y 
goal: ∏ x : α₁ × α₂, f x.1 x.2 = ∏ y : α₂, ∏ x : α₁, f x y

full_name: Fintype.sum_prod_type_right'
code: /-- An uncurried version of `Finset.prod_prod_type_right`. -/
@[to_additive Fintype.sum_prod_type_right' "An uncurried version of `Finset.sum_prod_type_right`"]
theorem Fintype.prod_prod_type_right' [CommMonoid γ] {f : α₁ → α₂ → γ} :
    ∏ x : α₁ × α₂, f x.1 x.2 = ∏ y, ∏ x, f x y 
goal: ∑ x : α₁ × α₂, f x.1 x.2 = ∑ y : α₂, ∑ x : α₁, f x y