The areas / V03. Sets, finite structures and big operators
Mathlib.Data.Fintype.BigOperators
54 declarations. Mathlib docs · Source
theorem Equiv.subtypeEquivRight.congr_simp E1 #
∀ {α : Sort u_1} {p q : α → Prop} (e : ∀ (x : α), p x ↔ q x), Equiv.subtypeEquivRight e = Equiv.subtypeEquivRight e
theorem Fintype.prod_bool E1 #
∀ {α : Type u_1} [inst : CommMonoid α] (f : Bool → α), ∏ b, f b = f true * f false
theorem Fintype.sum_bool E1 #
∀ {α : Type u_1} [inst : AddCommMonoid α] (f : Bool → α), ∑ b, f b = f true + f false
theorem Fintype.card_eq_sum_ones E1 #
∀ {α : Type u_4} [inst : Fintype α], Fintype.card α = ∑ _a, 1
theorem Fintype.prod_extend_by_one E1 #
∀ {α : Type u_1} {ι : Type u_4} [inst : DecidableEq ι] [inst_1 : Fintype ι] [inst_2 : CommMonoid α] (s : Finset ι)
(f : ι → α), (∏ i, if i ∈ s then f i else 1) = ∏ i ∈ s, f i
theorem Fintype.sum_extend_by_zero E1 #
∀ {α : Type u_1} {ι : Type u_4} [inst : DecidableEq ι] [inst_1 : Fintype ι] [inst_2 : AddCommMonoid α] (s : Finset ι)
(f : ι → α), (∑ i, if i ∈ s then f i else 0) = ∑ i ∈ s, f i
theorem Fintype.sum_eq_zero E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : AddCommMonoid M] (f : α → M),
(∀ (a : α), f a = 0) → ∑ a, f a = 0
theorem Fintype.prod_eq_one E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : CommMonoid M] (f : α → M),
(∀ (a : α), f a = 1) → ∏ a, f a = 1
theorem Fintype.sum_congr E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : AddCommMonoid M] (f g : α → M),
(∀ (a : α), f a = g a) → ∑ a, f a = ∑ a, g a
theorem Fintype.prod_congr E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : CommMonoid M] (f g : α → M),
(∀ (a : α), f a = g a) → ∏ a, f a = ∏ a, g a
theorem Fintype.prod_eq_single E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : CommMonoid M] {f : α → M} (a : α),
(∀ (x : α), x ≠ a → f x = 1) → ∏ x, f x = f a
theorem Fintype.sum_eq_single E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : AddCommMonoid M] {f : α → M} (a : α),
(∀ (x : α), x ≠ a → f x = 0) → ∑ x, f x = f a
theorem Fintype.prod_eq_mul E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : CommMonoid M] {f : α → M} (a b : α),
a ≠ b → (∀ (x : α), x ≠ a ∧ x ≠ b → f x = 1) → ∏ x, f x = f a * f b
theorem Fintype.sum_eq_add E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : AddCommMonoid M] {f : α → M} (a b : α),
a ≠ b → (∀ (x : α), x ≠ a ∧ x ≠ b → f x = 0) → ∑ x, f x = f a + f b
theorem Fintype.prod_option E0 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : CommMonoid M] (f : Option α → M),
∏ i, f i = f none * ∏ i, f (some i)
theorem Fintype.sum_option E0 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : AddCommMonoid M] (f : Option α → M),
∑ i, f i = f none + ∑ i, f (some i)
theorem Fintype.sum_eq_add_sum_subtype_ne E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : AddCommMonoid M] [inst_2 : DecidableEq α] (f : α → M)
(a : α), ∑ i, f i = f a + ∑ i, f ↑i
theorem Fintype.prod_eq_mul_prod_subtype_ne E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : Fintype α] [inst_1 : CommMonoid M] [inst_2 : DecidableEq α] (f : α → M) (a : α),
∏ i, f i = f a * ∏ i, f ↑i
theorem Finset.card_pi E0 #
∀ {ι : Type u_4} {α : ι → Type u_6} [inst : DecidableEq ι] (s : Finset ι) (t : (i : ι) → Finset (α i)),
(s.pi t).card = ∏ i ∈ s, (t i).card
theorem Fintype.card_piFinset E0 #
∀ {ι : Type u_4} {α : ι → Type u_6} [inst : DecidableEq ι] [inst_1 : Fintype ι] (s : (i : ι) → Finset (α i)),
(Fintype.piFinset s).card = ∏ i, (s i).card
theorem Fintype.card_piFinset_const E2 #
∀ {α : Type u_7} (s : Finset α) (n : ℕ), (Fintype.piFinset fun x ↦ s).card = s.card ^ n
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.
theorem Fintype.card_pi E0 #
∀ {ι : Type u_4} {α : ι → Type u_6} [inst : DecidableEq ι] [inst_1 : Fintype ι] [inst_2 : (i : ι) → Fintype (α i)],
Fintype.card ((i : ι) → α i) = ∏ i, Fintype.card (α i)
theorem Fintype.card_pi_const E2 #
∀ (α : Type u_7) [inst : Fintype α] (n : ℕ), Fintype.card (Fin n → α) = Fintype.card α ^ n
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.
theorem Fintype.prod_sigma E1 #
∀ {ι : Type u_9} {α : ι → Type u_7} {M : Type u_8} [inst : Fintype ι] [inst_1 : (i : ι) → Fintype (α i)]
[inst_2 : CommMonoid M] (f : Sigma α → M), ∏ x, f x = ∏ x, ∏ y, f ⟨x, y⟩
Product over a sigma type equals the repeated product.
This is a version of Finset.prod_sigma specialized to the case
of multiplication over Finset.univ.
theorem Fintype.sum_sigma E1 #
∀ {ι : Type u_9} {α : ι → Type u_7} {M : Type u_8} [inst : Fintype ι] [inst_1 : (i : ι) → Fintype (α i)]
[inst_2 : AddCommMonoid M] (f : Sigma α → M), ∑ x, f x = ∑ x, ∑ y, f ⟨x, y⟩
Sum over a sigma type equals the repeated sum.
This is a version of Finset.sum_sigma specialized to the case of summation over Finset.univ.
theorem Fintype.prod_sigma' E1 #
∀ {ι : Type u_9} {α : ι → Type u_7} {M : Type u_8} [inst : Fintype ι] [inst_1 : (i : ι) → Fintype (α i)]
[inst_2 : CommMonoid M] (f : (i : ι) → α i → M), ∏ x, f x.fst x.snd = ∏ x, ∏ y, f x y
Product over a sigma type equals the repeated product, curried version. This version is useful to rewrite from right to left.
theorem Fintype.sum_sigma' E1 #
∀ {ι : Type u_9} {α : ι → Type u_7} {M : Type u_8} [inst : Fintype ι] [inst_1 : (i : ι) → Fintype (α i)]
[inst_2 : AddCommMonoid M] (f : (i : ι) → α i → M), ∑ x, f x.fst x.snd = ∑ x, ∑ y, f x y
Sum over a sigma type equals the repeated sum, curried version. This version is useful to rewrite from right to left.
theorem Fintype.card_sigma E0 #
∀ {ι : Type u_8} {α : ι → Type u_7} [inst : Fintype ι] [inst_1 : (i : ι) → Fintype (α i)],
Fintype.card (Sigma α) = ∑ i, Fintype.card (α i)
theorem Fintype.card_filter_piFinset_eq_of_mem E1 #
∀ {ι : Type u_4} {α : ι → Type u_6} [inst : DecidableEq ι] [inst_1 : Fintype ι] [inst_2 : (i : ι) → DecidableEq (α i)]
(s : (i : ι) → Finset (α i)) (i : ι) {a : α i},
a ∈ s i → {f ∈ Fintype.piFinset s | f i = a}.card = ∏ j ∈ Finset.univ.erase i, (s j).card
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).
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.
theorem Fintype.card_filter_piFinset_const_eq_of_mem E1 #
∀ {ι : Type u_4} {κ : Type u_5} [inst : DecidableEq ι] [inst_1 : DecidableEq κ] [inst_2 : Fintype ι] (s : Finset κ)
(i : ι) {x : κ}, x ∈ s → {f ∈ Fintype.piFinset fun x ↦ s | f i = x}.card = s.card ^ (Fintype.card ι - 1)
theorem Fintype.card_filter_piFinset_eq E0 #
∀ {ι : Type u_4} {α : ι → Type u_6} [inst : DecidableEq ι] [inst_1 : Fintype ι] [inst_2 : (i : ι) → DecidableEq (α i)]
(s : (i : ι) → Finset (α i)) (i : ι) (a : α i),
{f ∈ Fintype.piFinset s | f i = a}.card = if a ∈ s i then ∏ b ∈ Finset.univ.erase i, (s b).card else 0
theorem Fintype.card_filter_piFinset_const E1 #
∀ {ι : Type u_4} {κ : Type u_5} [inst : DecidableEq ι] [inst_1 : DecidableEq κ] [inst_2 : Fintype ι] (s : Finset κ)
(i : ι) (j : κ), {f ∈ Fintype.piFinset fun x ↦ s | f i = j}.card = if j ∈ s then s.card ^ (Fintype.card ι - 1) else 0
theorem Fintype.card_fun E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq α] [inst_1 : Fintype α] [inst_2 : Fintype β],
Fintype.card (α → β) = Fintype.card β ^ Fintype.card α
theorem card_vector E0 #
∀ {α : Type u_1} [inst : Fintype α] (n : ℕ), Fintype.card (List.Vector α n) = Fintype.card α ^ n
theorem Finset.card_filter_length_eq_le E1 #
∀ {α : Type u_1} [inst : Fintype α] {T : Finset (List α)} {s : ℕ}, {x ∈ T | x.length = s}.card ≤ Fintype.card α ^ s
The number of strings of length s in any finite set is at most D^s.
theorem Fin.prod_univ_eq_prod_range E1 #
∀ {α : Type u_1} [inst : CommMonoid α] (f : ℕ → α) (n : ℕ), ∏ i, f ↑i = ∏ i ∈ Finset.range n, f i
It is equivalent to compute the product of a function over Fin n or Finset.range n.
theorem Fin.sum_univ_eq_sum_range E1 #
∀ {α : Type u_1} [inst : AddCommMonoid α] (f : ℕ → α) (n : ℕ), ∑ i, f ↑i = ∑ i ∈ Finset.range n, f i
It is equivalent to sum a function over fin n or finset.range n.
theorem Finset.prod_fin_eq_prod_range E1 #
∀ {β : Type u_2} [inst : CommMonoid β] {n : ℕ} (c : Fin n → β),
∏ i, c i = ∏ i ∈ Finset.range n, if h : i < n then c ⟨i, h⟩ else 1
theorem Finset.sum_fin_eq_sum_range E1 #
∀ {β : Type u_2} [inst : AddCommMonoid β] {n : ℕ} (c : Fin n → β),
∑ i, c i = ∑ i ∈ Finset.range n, if h : i < n then c ⟨i, h⟩ else 0
theorem Finset.sum_toFinset_eq_subtype E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : AddCommMonoid M] [inst_1 : Fintype α] (p : α → Prop) [inst_2 : DecidablePred p]
(f : α → M), ∑ a ∈ {x | p x}.toFinset, f a = ∑ a, f ↑a
theorem Finset.prod_toFinset_eq_subtype E1 #
∀ {α : Type u_1} {M : Type u_4} [inst : CommMonoid M] [inst_1 : Fintype α] (p : α → Prop) [inst_2 : DecidablePred p]
(f : α → M), ∏ a ∈ {x | p x}.toFinset, f a = ∏ a, f ↑a
theorem Fintype.prod_dite E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] {p : α → Prop} [inst_1 : DecidablePred p] [inst_2 : CommMonoid β]
(f : (a : α) → p a → β) (g : (a : α) → ¬p a → β), ∏ a, dite (p a) (f a) (g a) = (∏ a, f ↑a ⋯) * ∏ a, g ↑a ⋯
theorem Fintype.prod_sumElim E1 #
∀ {α₁ : Type u_4} {α₂ : Type u_5} {M : Type u_6} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : CommMonoid M]
(f : α₁ → M) (g : α₂ → M), ∏ x, Sum.elim f g x = (∏ a₁, f a₁) * ∏ a₂, g a₂
theorem Fintype.sum_sumElim E1 #
∀ {α₁ : Type u_4} {α₂ : Type u_5} {M : Type u_6} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : AddCommMonoid M]
(f : α₁ → M) (g : α₂ → M), ∑ x, Sum.elim f g x = ∑ a₁, f a₁ + ∑ a₂, g a₂
theorem Fintype.sum_sum_type E0 #
∀ {α₁ : Type u_4} {α₂ : Type u_5} {M : Type u_6} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : AddCommMonoid M]
(f : α₁ ⊕ α₂ → M), ∑ x, f x = ∑ a₁, f (Sum.inl a₁) + ∑ a₂, f (Sum.inr a₂)
theorem Fintype.prod_sum_type E0 #
∀ {α₁ : Type u_4} {α₂ : Type u_5} {M : Type u_6} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : CommMonoid M]
(f : α₁ ⊕ α₂ → M), ∏ x, f x = (∏ a₁, f (Sum.inl a₁)) * ∏ a₂, f (Sum.inr a₂)
theorem Fintype.prod_prod_type E1 #
∀ {γ : Type u_3} {α₁ : Type u_4} {α₂ : Type u_5} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : CommMonoid γ]
(f : α₁ × α₂ → γ), ∏ x, f x = ∏ x, ∏ y, f (x, y)
The product over a product type equals the product of the fiberwise products. For rewriting
in the reverse direction, use Fintype.prod_prod_type'.
theorem Fintype.sum_prod_type E1 #
∀ {γ : Type u_3} {α₁ : Type u_4} {α₂ : Type u_5} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : AddCommMonoid γ]
(f : α₁ × α₂ → γ), ∑ x, f x = ∑ x, ∑ y, f (x, y)
The sum over a product type equals the sum of fiberwise
sums. For rewriting in the reverse direction, use Fintype.sum_prod_type'.
theorem Fintype.prod_prod_type' E1 #
∀ {γ : Type u_3} {α₁ : Type u_4} {α₂ : Type u_5} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : CommMonoid γ]
(f : α₁ → α₂ → γ), ∏ x, f x.1 x.2 = ∏ x, ∏ y, f x y
The product over a product type equals the product of the fiberwise products. For rewriting
in the reverse direction, use Fintype.prod_prod_type.
theorem Fintype.sum_prod_type' E1 #
∀ {γ : Type u_3} {α₁ : Type u_4} {α₂ : Type u_5} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : AddCommMonoid γ]
(f : α₁ → α₂ → γ), ∑ x, f x.1 x.2 = ∑ x, ∑ y, f x y
The sum over a product type equals the sum of fiberwise
sums. For rewriting in the reverse direction, use Fintype.sum_prod_type.
theorem Fintype.prod_prod_type_right E1 #
∀ {γ : Type u_3} {α₁ : Type u_4} {α₂ : Type u_5} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : CommMonoid γ]
(f : α₁ × α₂ → γ), ∏ x, f x = ∏ y, ∏ x, f (x, y)
theorem Fintype.sum_prod_type_right E1 #
∀ {γ : Type u_3} {α₁ : Type u_4} {α₂ : Type u_5} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : AddCommMonoid γ]
(f : α₁ × α₂ → γ), ∑ x, f x = ∑ y, ∑ x, f (x, y)
theorem Fintype.prod_prod_type_right' E1 #
∀ {γ : Type u_3} {α₁ : Type u_4} {α₂ : Type u_5} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : CommMonoid γ]
(f : α₁ → α₂ → γ), ∏ x, f x.1 x.2 = ∏ y, ∏ x, f x y
An uncurried version of Finset.prod_prod_type_right.
theorem Fintype.sum_prod_type_right' E1 #
∀ {γ : Type u_3} {α₁ : Type u_4} {α₂ : Type u_5} [inst : Fintype α₁] [inst_1 : Fintype α₂] [inst_2 : AddCommMonoid γ]
(f : α₁ → α₂ → γ), ∑ x, f x.1 x.2 = ∑ y, ∑ x, f x y
An uncurried version of Finset.sum_prod_type_right