Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 31d28c6

Browse files
committed
fix(src/algebra/big_operators/multiset): unify prod_le_pow_card and prod_le_of_forall_le (#12589)
using the name `prod_le_pow_card` as per https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/duplicate.20lemmas but use the phrasing of prod_le_of_forall_le with non-implicit `multiset`, as that is how it is used.
1 parent 2241588 commit 31d28c6

File tree

6 files changed

+18
-22
lines changed

6 files changed

+18
-22
lines changed

src/algebra/big_operators/multiset.lean

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,11 @@ quotient.induction_on s $ λ l hl, by simpa using list.one_le_prod_of_one_le hl
267267
lemma single_le_prod : (∀ x ∈ s, (1 : α) ≤ x) → ∀ x ∈ s, x ≤ s.prod :=
268268
quotient.induction_on s $ λ l hl x hx, by simpa using list.single_le_prod hl x hx
269269

270-
@[to_additive]
271-
lemma prod_le_of_forall_le (s : multiset α) (n : α) (h : ∀ x ∈ s, x ≤ n) : s.prod ≤ n ^ s.card :=
270+
@[to_additive sum_le_card_nsmul]
271+
lemma prod_le_pow_card (s : multiset α) (n : α) (h : ∀ x ∈ s, x ≤ n) : s.prod ≤ n ^ s.card :=
272272
begin
273273
induction s using quotient.induction_on,
274-
simpa using list.prod_le_of_forall_le _ _ h,
274+
simpa using list.prod_le_pow_card _ _ h,
275275
end
276276

277277
@[to_additive all_zero_of_le_zero_le_of_sum_eq_zero]
@@ -304,10 +304,6 @@ lemma prod_le_sum_prod (f : α → α) (h : ∀ x, x ∈ s → x ≤ f x) : s.pr
304304
lemma pow_card_le_prod (h : ∀ x ∈ s, a ≤ x) : a ^ s.card ≤ s.prod :=
305305
by { rw [←multiset.prod_repeat, ←multiset.map_const], exact prod_map_le_prod _ h }
306306

307-
@[to_additive sum_le_card_nsmul]
308-
lemma prod_le_pow_card (h : ∀ x ∈ s, x ≤ a) : s.prod ≤ a ^ s.card :=
309-
@pow_card_le_prod (order_dual α) _ _ _ h
310-
311307
end ordered_comm_monoid
312308

313309
lemma prod_nonneg [ordered_comm_semiring α] {m : multiset α} (h : ∀ a ∈ m, (0 : α) ≤ a) :

src/algebra/big_operators/order.lean

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,24 +169,24 @@ calc f a = ∏ i in {a}, f i : prod_singleton.symm
169169
... ≤ ∏ i in s, f i :
170170
prod_le_prod_of_subset_of_one_le' (singleton_subset_iff.2 h) $ λ i hi _, hf i hi
171171

172-
@[to_additive]
173-
lemma prod_le_of_forall_le (s : finset ι) (f : ι → N) (n : N) (h : ∀ x ∈ s, f x ≤ n) :
172+
@[to_additive sum_le_card_nsmul]
173+
lemma prod_le_pow_card (s : finset ι) (f : ι → N) (n : N) (h : ∀ x ∈ s, f x ≤ n) :
174174
s.prod f ≤ n ^ s.card :=
175175
begin
176-
refine (multiset.prod_le_of_forall_le (s.val.map f) n _).trans _,
176+
refine (multiset.prod_le_pow_card (s.val.map f) n _).trans _,
177177
{ simpa using h },
178178
{ simpa }
179179
end
180180

181-
@[to_additive]
182-
lemma le_prod_of_forall_le (s : finset ι) (f : ι → N) (n : N) (h : ∀ x ∈ s, n ≤ f x) :
181+
@[to_additive card_nsmul_le_sum]
182+
lemma pow_card_le_prod (s : finset ι) (f : ι → N) (n : N) (h : ∀ x ∈ s, n ≤ f x) :
183183
n ^ s.card ≤ s.prod f :=
184-
@finset.prod_le_of_forall_le _ (order_dual N) _ _ _ _ h
184+
@finset.prod_le_pow_card _ (order_dual N) _ _ _ _ h
185185

186186
lemma card_bUnion_le_card_mul [decidable_eq β] (s : finset ι) (f : ι → finset β) (n : ℕ)
187187
(h : ∀ a ∈ s, (f a).card ≤ n) :
188188
(s.bUnion f).card ≤ s.card * n :=
189-
card_bUnion_le.trans $ sum_le_of_forall_le _ _ _ h
189+
card_bUnion_le.trans $ sum_le_card_nsmul _ _ _ h
190190

191191
variables {ι' : Type*} [decidable_eq ι']
192192

@@ -264,7 +264,7 @@ times how many they are. -/
264264
lemma sum_card_inter_le (h : ∀ a ∈ s, (B.filter $ (∈) a).card ≤ n) :
265265
∑ t in B, (s ∩ t).card ≤ s.card * n :=
266266
begin
267-
refine le_trans _ (s.sum_le_of_forall_le _ _ h),
267+
refine le_trans _ (s.sum_le_card_nsmul _ _ h),
268268
simp_rw [←filter_mem_eq_inter, card_eq_sum_ones, sum_filter],
269269
exact sum_comm.le,
270270
end
@@ -281,7 +281,7 @@ times how many they are. -/
281281
lemma le_sum_card_inter (h : ∀ a ∈ s, n ≤ (B.filter $ (∈) a).card) :
282282
s.card * n ≤ ∑ t in B, (s ∩ t).card :=
283283
begin
284-
apply (s.le_sum_of_forall_le _ _ h).trans,
284+
apply (s.card_nsmul_le_sum _ _ h).trans,
285285
simp_rw [←filter_mem_eq_inter, card_eq_sum_ones, sum_filter],
286286
exact sum_comm.le,
287287
end

src/algebra/polynomial/big_operators.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ begin
9696
have h : nat_degree tl.prod ≤ n * tl.length,
9797
{ refine (nat_degree_list_prod_le _).trans _,
9898
rw [←tl.length_map nat_degree, mul_comm],
99-
refine list.sum_le_of_forall_le _ _ _,
99+
refine list.sum_le_card_nsmul _ _ _,
100100
simpa using hl' },
101101
have hdn : nat_degree hd ≤ n := hl _ (list.mem_cons_self _ _),
102102
rcases hdn.eq_or_lt with rfl|hdn',

src/combinatorics/double_counting.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ lemma card_mul_le_card_mul [Π a b, decidable (r a b)]
6161
(hn : ∀ b ∈ t, (s.bipartite_below r b).card ≤ n) :
6262
s.card * m ≤ t.card * n :=
6363
calc
64-
_ ≤ ∑ a in s, (t.bipartite_above r a).card : s.le_sum_of_forall_le _ _ hm
64+
_ ≤ ∑ a in s, (t.bipartite_above r a).card : s.card_nsmul_le_sum _ _ hm
6565
... = ∑ b in t, (s.bipartite_below r b).card
6666
: sum_card_bipartite_above_eq_sum_card_bipartite_below _
67-
... ≤ _ : t.sum_le_of_forall_le _ _ hn
67+
... ≤ _ : t.sum_le_card_nsmul _ _ hn
6868

6969
lemma card_mul_le_card_mul' [Π a b, decidable (r a b)]
7070
(hn : ∀ b ∈ t, n ≤ (s.bipartite_below r b).card)

src/data/list/prod_monoid.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ begin
3535
exact list.eq_repeat.mpr ⟨rfl, h⟩,
3636
end
3737

38-
@[to_additive]
39-
lemma prod_le_of_forall_le [ordered_comm_monoid α] (l : list α) (n : α) (h : ∀ (x ∈ l), x ≤ n) :
38+
@[to_additive sum_le_card_nsmul]
39+
lemma prod_le_pow_card [ordered_comm_monoid α] (l : list α) (n : α) (h : ∀ (x ∈ l), x ≤ n) :
4040
l.prod ≤ n ^ l.length :=
4141
begin
4242
induction l with y l IH,

src/linear_algebra/matrix/polynomial.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ begin
4949
{ rw [sg, units.neg_smul, one_smul, nat_degree_neg] } }
5050
... ≤ ∑ (i : n), nat_degree (((X : α[X]) • A.map C + B.map C) (g i) i) :
5151
nat_degree_prod_le (finset.univ : finset n) (λ (i : n), (X • A.map C + B.map C) (g i) i)
52-
... ≤ finset.univ.card • 1 : finset.sum_le_of_forall_le _ _ 1 (λ (i : n) _, _)
52+
... ≤ finset.univ.card • 1 : finset.sum_le_card_nsmul _ _ 1 (λ (i : n) _, _)
5353
... ≤ fintype.card n : by simpa,
5454
calc nat_degree (((X : α[X]) • A.map C + B.map C) (g i) i)
5555
= nat_degree ((X : α[X]) * C (A (g i) i) + C (B (g i) i)) : by simp

0 commit comments

Comments
 (0)