-
Notifications
You must be signed in to change notification settings - Fork 337
/
Action.lean
119 lines (84 loc) · 3.96 KB
/
Action.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/-
Copyright (c) 2020 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Algebra.GroupWithZero.Action.Defs
import Mathlib.Data.Finset.Basic
import Mathlib.Data.Multiset.Basic
import Mathlib.Algebra.BigOperators.Finprod
/-!
# Lemmas about group actions on big operators
This file contains results about two kinds of actions:
* sums over `DistribSMul`: `r • ∑ x ∈ s, f x = ∑ x ∈ s, r • f x`
* products over `MulDistribMulAction` (with primed name): `r • ∏ x ∈ s, f x = ∏ x ∈ s, r • f x`
* products over `SMulCommClass` (with unprimed name):
`b ^ s.card • ∏ x in s, f x = ∏ x in s, b • f x`
Note that analogous lemmas for `Module`s like `Finset.sum_smul` appear in other files.
-/
variable {α β γ : Type*}
section
variable [AddMonoid β] [DistribSMul α β]
theorem List.smul_sum {r : α} {l : List β} : r • l.sum = (l.map (r • ·)).sum :=
map_list_sum (DistribSMul.toAddMonoidHom β r) l
end
section
variable [Monoid α] [Monoid β] [MulDistribMulAction α β]
theorem List.smul_prod' {r : α} {l : List β} : r • l.prod = (l.map (r • ·)).prod :=
map_list_prod (MulDistribMulAction.toMonoidHom β r) l
end
section
variable [AddCommMonoid β] [DistribSMul α β]
theorem Multiset.smul_sum {r : α} {s : Multiset β} : r • s.sum = (s.map (r • ·)).sum :=
(DistribSMul.toAddMonoidHom β r).map_multiset_sum s
theorem Finset.smul_sum {r : α} {f : γ → β} {s : Finset γ} :
(r • ∑ x ∈ s, f x) = ∑ x ∈ s, r • f x :=
map_sum (DistribSMul.toAddMonoidHom β r) f s
end
section
variable [Monoid α] [CommMonoid β] [MulDistribMulAction α β]
theorem Multiset.smul_prod' {r : α} {s : Multiset β} : r • s.prod = (s.map (r • ·)).prod :=
(MulDistribMulAction.toMonoidHom β r).map_multiset_prod s
theorem Finset.smul_prod' {r : α} {f : γ → β} {s : Finset γ} :
(r • ∏ x ∈ s, f x) = ∏ x ∈ s, r • f x :=
map_prod (MulDistribMulAction.toMonoidHom β r) f s
theorem smul_finprod' {ι : Sort*} [Finite ι] {f : ι → β} (r : α) :
r • ∏ᶠ x : ι, f x = ∏ᶠ x : ι, r • (f x) := by
cases nonempty_fintype (PLift ι)
simp only [finprod_eq_prod_plift_of_mulSupport_subset (s := Finset.univ) (by simp),
finprod_eq_prod_of_fintype, Finset.smul_prod']
end
namespace List
@[to_additive]
theorem smul_prod [Monoid α] [Monoid β] [MulAction α β] [IsScalarTower α β β] [SMulCommClass α β β]
(l : List β) (m : α) :
m ^ l.length • l.prod = (l.map (m • ·)).prod := by
induction l with
| nil => simp
| cons head tail ih => simp [← ih, smul_mul_smul_comm, pow_succ']
end List
namespace Multiset
@[to_additive]
theorem smul_prod [Monoid α] [CommMonoid β] [MulAction α β] [IsScalarTower α β β]
[SMulCommClass α β β] (s : Multiset β) (b : α) :
b ^ card s • s.prod = (s.map (b • ·)).prod :=
Quot.induction_on s <| by simp [List.smul_prod]
end Multiset
namespace Finset
theorem smul_prod
[CommMonoid β] [Monoid α] [MulAction α β] [IsScalarTower α β β] [SMulCommClass α β β]
(s : Finset β) (b : α) (f : β → β) :
b ^ s.card • ∏ x in s, f x = ∏ x in s, b • f x := by
have : Multiset.map (fun (x : β) ↦ b • f x) s.val =
Multiset.map (fun x ↦ b • x) (Multiset.map (fun x ↦ f x) s.val) := by
simp only [Multiset.map_map, Function.comp_apply]
simp_rw [prod_eq_multiset_prod, card_def, this, ← Multiset.smul_prod _ b, Multiset.card_map]
theorem prod_smul
[CommMonoid β] [CommMonoid α] [MulAction α β] [IsScalarTower α β β] [SMulCommClass α β β]
(s : Finset β) (b : β → α) (f : β → β) :
∏ i in s, b i • f i = (∏ i in s, b i) • ∏ i in s, f i := by
induction s using Finset.cons_induction_on with
| h₁ => simp
| h₂ hj ih => rw [prod_cons, ih, smul_mul_smul_comm, ← prod_cons hj, ← prod_cons hj]
end Finset