Module docstring
{"# Big operators for Pi Types
This file contains theorems relevant to big operators in binary and arbitrary product of monoids and groups "}
{"# Big operators for Pi Types
This file contains theorems relevant to big operators in binary and arbitrary product of monoids and groups "}
Pi.list_prod_apply
theorem
{α : Type*} {β : α → Type*} [∀ a, Monoid (β a)] (a : α) (l : List (∀ a, β a)) :
l.prod a = (l.map fun f : ∀ a, β a ↦ f a).prod
@[to_additive]
theorem list_prod_apply {α : Type*} {β : α → Type*} [∀ a, Monoid (β a)] (a : α)
(l : List (∀ a, β a)) : l.prod a = (l.map fun f : ∀ a, β a ↦ f a).prod :=
map_list_prod (evalMonoidHom β a) _
Pi.multiset_prod_apply
theorem
{α : Type*} {β : α → Type*} [∀ a, CommMonoid (β a)] (a : α) (s : Multiset (∀ a, β a)) :
s.prod a = (s.map fun f : ∀ a, β a ↦ f a).prod
@[to_additive]
theorem multiset_prod_apply {α : Type*} {β : α → Type*} [∀ a, CommMonoid (β a)] (a : α)
(s : Multiset (∀ a, β a)) : s.prod a = (s.map fun f : ∀ a, β a ↦ f a).prod :=
(evalMonoidHom β a).map_multiset_prod _
Finset.prod_apply
theorem
{α : Type*} {β : α → Type*} {γ} [∀ a, CommMonoid (β a)] (a : α) (s : Finset γ) (g : γ → ∀ a, β a) :
(∏ c ∈ s, g c) a = ∏ c ∈ s, g c a
@[to_additive (attr := simp)]
theorem Finset.prod_apply {α : Type*} {β : α → Type*} {γ} [∀ a, CommMonoid (β a)] (a : α)
(s : Finset γ) (g : γ → ∀ a, β a) : (∏ c ∈ s, g c) a = ∏ c ∈ s, g c a :=
map_prod (Pi.evalMonoidHom β a) _ _
Finset.prod_fn
theorem
{α : Type*} {β : α → Type*} {γ} [∀ a, CommMonoid (β a)] (s : Finset γ) (g : γ → ∀ a, β a) :
∏ c ∈ s, g c = fun a ↦ ∏ c ∈ s, g c a
/-- An 'unapplied' analogue of `Finset.prod_apply`. -/
@[to_additive "An 'unapplied' analogue of `Finset.sum_apply`."]
theorem Finset.prod_fn {α : Type*} {β : α → Type*} {γ} [∀ a, CommMonoid (β a)] (s : Finset γ)
(g : γ → ∀ a, β a) : ∏ c ∈ s, g c = fun a ↦ ∏ c ∈ s, g c a :=
funext fun _ ↦ Finset.prod_apply _ _ _
Fintype.prod_apply
theorem
{α : Type*} {β : α → Type*} {γ : Type*} [Fintype γ] [∀ a, CommMonoid (β a)] (a : α) (g : γ → ∀ a, β a) :
(∏ c, g c) a = ∏ c, g c a
@[to_additive]
theorem Fintype.prod_apply {α : Type*} {β : α → Type*} {γ : Type*} [Fintype γ]
[∀ a, CommMonoid (β a)] (a : α) (g : γ → ∀ a, β a) : (∏ c, g c) a = ∏ c, g c a :=
Finset.prod_apply a Finset.univ g
prod_mk_prod
theorem
{α β γ : Type*} [CommMonoid α] [CommMonoid β] (s : Finset γ) (f : γ → α) (g : γ → β) :
(∏ x ∈ s, f x, ∏ x ∈ s, g x) = ∏ x ∈ s, (f x, g x)
@[to_additive prod_mk_sum]
theorem prod_mk_prod {α β γ : Type*} [CommMonoid α] [CommMonoid β] (s : Finset γ) (f : γ → α)
(g : γ → β) : (∏ x ∈ s, f x, ∏ x ∈ s, g x) = ∏ x ∈ s, (f x, g x) :=
haveI := Classical.decEq γ
Finset.induction_on s rfl (by simp +contextual [Prod.ext_iff])
pi_eq_sum_univ
theorem
{ι : Type*} [Fintype ι] [DecidableEq ι] {R : Type*} [NonAssocSemiring R] (x : ι → R) :
x = ∑ i, (x i) • fun j => if i = j then (1 : R) else 0
/-- decomposing `x : ι → R` as a sum along the canonical basis -/
theorem pi_eq_sum_univ {ι : Type*} [Fintype ι] [DecidableEq ι] {R : Type*} [NonAssocSemiring R]
(x : ι → R) : x = ∑ i, (x i) • fun j => if i = j then (1 : R) else 0 := by
ext
simp
prod_indicator_apply
theorem
(s : Finset ι) (f : ι → Set κ) (g : ι → κ → α) (j : κ) :
∏ i ∈ s, (f i).indicator (g i) j = (⋂ x ∈ s, f x).indicator (∏ i ∈ s, g i) j
lemma prod_indicator_apply (s : Finset ι) (f : ι → Set κ) (g : ι → κ → α) (j : κ) :
∏ i ∈ s, (f i).indicator (g i) j = (⋂ x ∈ s, f x).indicator (∏ i ∈ s, g i) j := by
rw [Set.indicator]
split_ifs with hj
· rw [Finset.prod_apply]
congr! 1 with i hi
simp only [Finset.inf_set_eq_iInter, Set.mem_iInter] at hj
exact Set.indicator_of_mem (hj _ hi) _
· obtain ⟨i, hi, hj⟩ := by simpa using hj
exact Finset.prod_eq_zero hi <| Set.indicator_of_not_mem hj _
prod_indicator
theorem
(s : Finset ι) (f : ι → Set κ) (g : ι → κ → α) :
∏ i ∈ s, (f i).indicator (g i) = (⋂ x ∈ s, f x).indicator (∏ i ∈ s, g i)
lemma prod_indicator (s : Finset ι) (f : ι → Set κ) (g : ι → κ → α) :
∏ i ∈ s, (f i).indicator (g i) = (⋂ x ∈ s, f x).indicator (∏ i ∈ s, g i) := by
ext a; simpa using prod_indicator_apply ..
prod_indicator_const_apply
theorem
(s : Finset ι) (f : ι → Set κ) (g : κ → α) (j : κ) : ∏ i ∈ s, (f i).indicator g j = (⋂ x ∈ s, f x).indicator (g ^ #s) j
lemma prod_indicator_const_apply (s : Finset ι) (f : ι → Set κ) (g : κ → α) (j : κ) :
∏ i ∈ s, (f i).indicator g j = (⋂ x ∈ s, f x).indicator (g ^ #s) j := by
simp [prod_indicator_apply]
prod_indicator_const
theorem
(s : Finset ι) (f : ι → Set κ) (g : κ → α) : ∏ i ∈ s, (f i).indicator g = (⋂ x ∈ s, f x).indicator (g ^ #s)
lemma prod_indicator_const (s : Finset ι) (f : ι → Set κ) (g : κ → α) :
∏ i ∈ s, (f i).indicator g = (⋂ x ∈ s, f x).indicator (g ^ #s) := by simp [prod_indicator]
Finset.univ_prod_mulSingle
theorem
[Fintype I] (f : ∀ i, Z i) : (∏ i, Pi.mulSingle i (f i)) = f
@[to_additive]
theorem Finset.univ_prod_mulSingle [Fintype I] (f : ∀ i, Z i) :
(∏ i, Pi.mulSingle i (f i)) = f := by
ext a
simp
MonoidHom.functions_ext
theorem
[Finite I] (G : Type*) [CommMonoid G] (g h : (∀ i, Z i) →* G)
(H : ∀ i x, g (Pi.mulSingle i x) = h (Pi.mulSingle i x)) : g = h
@[to_additive]
theorem MonoidHom.functions_ext [Finite I] (G : Type*) [CommMonoid G] (g h : (∀ i, Z i) →* G)
(H : ∀ i x, g (Pi.mulSingle i x) = h (Pi.mulSingle i x)) : g = h := by
cases nonempty_fintype I
ext k
rw [← Finset.univ_prod_mulSingle k, map_prod, map_prod]
simp only [H]
MonoidHom.functions_ext'
theorem
[Finite I] (M : Type*) [CommMonoid M] (g h : (∀ i, Z i) →* M)
(H : ∀ i, g.comp (MonoidHom.mulSingle Z i) = h.comp (MonoidHom.mulSingle Z i)) : g = h
/-- This is used as the ext lemma instead of `MonoidHom.functions_ext` for reasons explained in
note [partially-applied ext lemmas]. -/
@[to_additive (attr := ext)
"\nThis is used as the ext lemma instead of `AddMonoidHom.functions_ext` for reasons
explained in note [partially-applied ext lemmas]."]
theorem MonoidHom.functions_ext' [Finite I] (M : Type*) [CommMonoid M] (g h : (∀ i, Z i) →* M)
(H : ∀ i, g.comp (MonoidHom.mulSingle Z i) = h.comp (MonoidHom.mulSingle Z i)) : g = h :=
g.functions_ext M h fun i => DFunLike.congr_fun (H i)
RingHom.functions_ext
theorem
[Finite I] (G : Type*) [NonAssocSemiring G] (g h : (∀ i, f i) →+* G)
(H : ∀ (i : I) (x : f i), g (single i x) = h (single i x)) : g = h
@[ext]
theorem RingHom.functions_ext [Finite I] (G : Type*) [NonAssocSemiring G] (g h : (∀ i, f i) →+* G)
(H : ∀ (i : I) (x : f i), g (single i x) = h (single i x)) : g = h :=
RingHom.coe_addMonoidHom_injective <|
@AddMonoidHom.functions_ext I _ f _ _ G _ (g : (∀ i, f i) →+ G) h H
Prod.fst_prod
theorem
: (∏ c ∈ s, f c).1 = ∏ c ∈ s, (f c).1
@[to_additive]
theorem fst_prod : (∏ c ∈ s, f c).1 = ∏ c ∈ s, (f c).1 :=
map_prod (MonoidHom.fst α β) f s
Prod.snd_prod
theorem
: (∏ c ∈ s, f c).2 = ∏ c ∈ s, (f c).2
@[to_additive]
theorem snd_prod : (∏ c ∈ s, f c).2 = ∏ c ∈ s, (f c).2 :=
map_prod (MonoidHom.snd α β) f s
Pi.monoidHomMulEquiv
definition
{ι : Type*} [Fintype ι] [DecidableEq ι] (M : ι → Type*) [(i : ι) → CommMonoid (M i)] (M' : Type*) [CommMonoid M'] :
(((i : ι) → M i) →* M') ≃* ((i : ι) → (M i →* M'))
/-- The canonical isomorphism between the monoid of homomorphisms from a finite product of
commutative monoids to another commutative monoid and the product of the homomorphism monoids. -/
@[to_additive "The canonical isomorphism between the additive monoid of homomorphisms from
a finite product of additive commutative monoids to another additive commutative monoid and
the product of the homomorphism monoids."]
def Pi.monoidHomMulEquiv {ι : Type*} [Fintype ι] [DecidableEq ι] (M : ι → Type*)
[(i : ι) → CommMonoid (M i)] (M' : Type*) [CommMonoid M'] :
(((i : ι) → M i) →* M') ≃* ((i : ι) → (M i →* M')) where
toFun φ i := φ.comp <| MonoidHom.mulSingle M i
invFun φ := ∏ (i : ι), (φ i).comp (Pi.evalMonoidHom M i)
left_inv φ := by
ext
simp only [MonoidHom.finset_prod_apply, MonoidHom.coe_comp, Function.comp_apply,
evalMonoidHom_apply, MonoidHom.mulSingle_apply, ← map_prod]
refine congrArg _ <| funext fun _ ↦ ?_
rw [Fintype.prod_apply]
exact Fintype.prod_pi_mulSingle ..
right_inv φ := by
ext i m
simp only [MonoidHom.coe_comp, Function.comp_apply, MonoidHom.mulSingle_apply,
MonoidHom.finset_prod_apply, evalMonoidHom_apply, ]
let φ' i : M i → M' := ⇑(φ i)
conv =>
enter [1, 2, j]
rw [show φ j = φ' j from rfl, Pi.apply_mulSingle φ' (fun i ↦ map_one (φ i))]
rw [show φ' i = φ i from rfl]
exact Fintype.prod_pi_mulSingle' ..
map_mul' φ ψ := by
ext
simp only [MonoidHom.coe_comp, Function.comp_apply, MonoidHom.mulSingle_apply,
MonoidHom.mul_apply, mul_apply]
Pi.single_induction
theorem
[AddCommMonoid M] (p : (ι → M) → Prop) (f : ι → M) (zero : p 0) (add : ∀ f g, p f → p g → p (f + g))
(single : ∀ i m, p (Pi.single i m)) : p f
lemma Pi.single_induction [AddCommMonoid M] (p : (ι → M) → Prop) (f : ι → M)
(zero : p 0) (add : ∀ f g, p f → p g → p (f + g))
(single : ∀ i m, p (Pi.single i m)) : p f := by
cases nonempty_fintype ι
rw [← Finset.univ_sum_single f]
exact Finset.sum_induction _ _ add zero (by simp [single])
Pi.mulSingle_induction
theorem
[CommMonoid M] (p : (ι → M) → Prop) (f : ι → M) (one : p 1) (mul : ∀ f g, p f → p g → p (f * g))
(mulSingle : ∀ i m, p (Pi.mulSingle i m)) : p f
@[to_additive existing (attr := elab_as_elim)]
lemma Pi.mulSingle_induction [CommMonoid M] (p : (ι → M) → Prop) (f : ι → M)
(one : p 1) (mul : ∀ f g, p f → p g → p (f * g))
(mulSingle : ∀ i m, p (Pi.mulSingle i m)) : p f := by
cases nonempty_fintype ι
rw [← Finset.univ_prod_mulSingle f]
exact Finset.prod_induction _ _ mul one (by simp [mulSingle])