Skip to content

Commit ae1cfd8

Browse files
feat: add List.le_prod_of_submultiplicative and friends (#31016)
1 parent 64694b0 commit ae1cfd8

File tree

9 files changed

+86
-41
lines changed

9 files changed

+86
-41
lines changed

Mathlib/Algebra/BigOperators/Group/List/Defs.lean

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ theorem prod_map_one {l : List ι} :
8383
| nil => rfl
8484
| cons hd tl ih => rw [map_cons, prod_one_cons, ih]
8585

86+
@[to_additive]
87+
lemma prod_induction_nonempty
88+
(p : M → Prop) (hom : ∀ a b, p a → p b → p (a * b)) (hl : l ≠ []) (base : ∀ x ∈ l, p x) :
89+
p l.prod := by
90+
induction l with
91+
| nil => simp at hl
92+
| cons a l ih =>
93+
by_cases hl_empty : l = []
94+
· simp [*]
95+
rw [List.prod_cons]
96+
simp only [mem_cons, forall_eq_or_imp] at base
97+
exact hom _ _ (base.1) (ih hl_empty base.2)
98+
8699
end MulOneClass
87100

88101
section Monoid

Mathlib/Algebra/Order/BigOperators/Group/Finset.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ such that `f 1 = 1` and `f` is submultiplicative on `{x | p x}`, i.e.,
7171
that `∀ i ∈ s, p (g i)`. Then `f (∏ i ∈ s, g i) ≤ ∏ i ∈ s, f (g i)`. -/
7272
@[to_additive le_sum_of_subadditive_on_pred]
7373
theorem le_prod_of_submultiplicative_on_pred [IsOrderedMonoid N] (f : M → N) (p : M → Prop)
74-
(h_one : f 1 = 1) (h_mul : ∀ x y, p x → p y → f (x * y) ≤ f x * f y)
74+
(h_one : f 1 1) (h_mul : ∀ x y, p x → p y → f (x * y) ≤ f x * f y)
7575
(hp_mul : ∀ x y, p x → p y → p (x * y)) (g : ι → M) {s : Finset ι} (hs : ∀ i ∈ s, p (g i)) :
7676
f (∏ i ∈ s, g i) ≤ ∏ i ∈ s, f (g i) := by
7777
rcases eq_empty_or_nonempty s with (rfl | hs_nonempty)
@@ -87,7 +87,7 @@ add_decl_doc le_sum_of_subadditive_on_pred
8787
/-- If `f : M → N` is a submultiplicative function, `f (x * y) ≤ f x * f y`, `f 1 = 1`, and `g i`,
8888
`i ∈ s`, is a finite family of elements of `M`, then `f (∏ i ∈ s, g i) ≤ ∏ i ∈ s, f (g i)`. -/
8989
@[to_additive le_sum_of_subadditive]
90-
theorem le_prod_of_submultiplicative [IsOrderedMonoid N] (f : M → N) (h_one : f 1 = 1)
90+
theorem le_prod_of_submultiplicative [IsOrderedMonoid N] (f : M → N) (h_one : f 1 1)
9191
(h_mul : ∀ x y, f (x * y) ≤ f x * f y) (s : Finset ι) (g : ι → M) :
9292
f (∏ i ∈ s, g i) ≤ ∏ i ∈ s, f (g i) :=
9393
le_trans (Multiset.le_prod_of_submultiplicative f h_one h_mul _) (by simp)
@@ -248,7 +248,7 @@ lemma prod_min_le [CommMonoid M] [LinearOrder M] [IsOrderedMonoid M] {f g : ι
248248

249249
theorem abs_sum_le_sum_abs {G : Type*} [AddCommGroup G] [LinearOrder G] [IsOrderedAddMonoid G]
250250
(f : ι → G) (s : Finset ι) :
251-
|∑ i ∈ s, f i| ≤ ∑ i ∈ s, |f i| := le_sum_of_subadditive _ abs_zero abs_add_le s f
251+
|∑ i ∈ s, f i| ≤ ∑ i ∈ s, |f i| := le_sum_of_subadditive _ abs_zero.le abs_add_le s f
252252

253253
theorem abs_sum_of_nonneg {G : Type*} [AddCommGroup G] [LinearOrder G] [AddLeftMono G]
254254
{f : ι → G} {s : Finset ι}

Mathlib/Algebra/Order/BigOperators/Group/List.lean

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,50 @@ theorem le_prod_of_mem {xs : List M} {x : M} (h₁ : x ∈ xs) : x ≤ xs.prod :
163163

164164
end Monoid
165165

166+
section
167+
variable {α β : Type*} [Monoid α] [CommMonoid β] [PartialOrder β] [IsOrderedMonoid β]
168+
169+
@[to_additive le_sum_of_subadditive_on_pred]
170+
lemma le_prod_of_submultiplicative_on_pred (f : α → β)
171+
(p : α → Prop) (h_one : f 11) (hp_one : p 1)
172+
(h_mul : ∀ a b, p a → p b → f (a * b) ≤ f a * f b) (hp_mul : ∀ a b, p a → p b → p (a * b))
173+
(l : List α) (hpl : ∀ a, a ∈ l → p a) : f l.prod ≤ (l.map f).prod := by
174+
induction l with
175+
| nil => simp [h_one]
176+
| cons a s ih =>
177+
have hpla : ∀ x, x ∈ s → p x := fun x hx => hpl x (mem_cons_of_mem _ hx)
178+
have hp_prod : p s.prod := prod_induction p hp_mul hp_one hpla
179+
grw [prod_cons, map_cons, prod_cons, h_mul a s.prod (hpl _ mem_cons_self) hp_prod, ih hpla]
180+
181+
@[to_additive le_sum_of_subadditive]
182+
lemma le_prod_of_submultiplicative (f : α → β) (h_one : f 11)
183+
(h_mul : ∀ a b, f (a * b) ≤ f a * f b) (l : List α) : f l.prod ≤ (l.map f).prod :=
184+
le_prod_of_submultiplicative_on_pred f (fun _ => True) h_one trivial (fun x y _ _ => h_mul x y)
185+
(by simp) l (by simp)
186+
187+
@[to_additive le_sum_nonempty_of_subadditive_on_pred]
188+
lemma le_prod_nonempty_of_submultiplicative_on_pred (f : α → β) (p : α → Prop)
189+
(h_mul : ∀ a b, p a → p b → f (a * b) ≤ f a * f b) (hp_mul : ∀ a b, p a → p b → p (a * b))
190+
(l : List α) (hl_nonempty : l ≠ []) (hl : ∀ a, a ∈ l → p a) : f l.prod ≤ (l.map f).prod := by
191+
induction l with
192+
| nil => simp at hl_nonempty
193+
| cons a l ih =>
194+
rw [prod_cons, map_cons, prod_cons]
195+
by_cases hl_empty : l = []
196+
· simp [hl_empty]
197+
have hla_restrict : ∀ x, x ∈ l → p x := fun x hx => hl x (mem_cons_of_mem _ hx)
198+
have hp_sup : p l.prod := prod_induction_nonempty p hp_mul hl_empty hla_restrict
199+
have hp_a : p a := hl a mem_cons_self
200+
grw [h_mul a _ hp_a hp_sup, ← ih hl_empty hla_restrict]
201+
202+
@[to_additive le_sum_nonempty_of_subadditive]
203+
lemma le_prod_nonempty_of_submultiplicative (f : α → β) (h_mul : ∀ a b, f (a * b) ≤ f a * f b)
204+
(l : List α) (hs_nonempty : l ≠ ∅) : f l.prod ≤ (l.map f).prod :=
205+
le_prod_nonempty_of_submultiplicative_on_pred f (fun _ => True) (by simp [h_mul]) (by simp) l
206+
hs_nonempty (by simp)
207+
208+
end
209+
166210
-- TODO: develop theory of tropical rings
167211
lemma sum_le_foldr_max [AddZeroClass M] [Zero N] [LinearOrder N] (f : M → N) (h0 : f 00)
168212
(hadd : ∀ x y, f (x + y) ≤ max (f x) (f y)) (l : List M) : f l.sum ≤ (l.map f).foldr max 0 := by

Mathlib/Algebra/Order/BigOperators/Group/Multiset.lean

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -80,45 +80,32 @@ variable [CommMonoid α] [CommMonoid β] [PartialOrder β] [IsOrderedMonoid β]
8080

8181
@[to_additive le_sum_of_subadditive_on_pred]
8282
lemma le_prod_of_submultiplicative_on_pred (f : α → β)
83-
(p : α → Prop) (h_one : f 1 = 1) (hp_one : p 1)
83+
(p : α → Prop) (h_one : f 1 1) (hp_one : p 1)
8484
(h_mul : ∀ a b, p a → p b → f (a * b) ≤ f a * f b) (hp_mul : ∀ a b, p a → p b → p (a * b))
8585
(s : Multiset α) (hps : ∀ a, a ∈ s → p a) : f s.prod ≤ (s.map f).prod := by
86-
revert s
87-
refine Multiset.induction ?_ ?_
88-
· simp [le_of_eq h_one]
89-
intro a s hs hpsa
90-
have hps : ∀ x, x ∈ s → p x := fun x hx => hpsa x (mem_cons_of_mem hx)
91-
have hp_prod : p s.prod := prod_induction p s hp_mul hp_one hps
92-
grw [prod_cons, map_cons, prod_cons, h_mul a s.prod (hpsa a (mem_cons_self a s)) hp_prod,
93-
hs hps]
86+
induction s using Quotient.inductionOn with
87+
| h l => simp [l.le_prod_of_submultiplicative_on_pred f p h_one hp_one h_mul hp_mul (by simpa)]
9488

9589
@[to_additive le_sum_of_subadditive]
96-
lemma le_prod_of_submultiplicative (f : α → β) (h_one : f 1 = 1)
97-
(h_mul : ∀ a b, f (a * b) ≤ f a * f b) (s : Multiset α) : f s.prod ≤ (s.map f).prod :=
98-
le_prod_of_submultiplicative_on_pred f (fun _ => True) h_one trivial (fun x y _ _ => h_mul x y)
99-
(by simp) s (by simp)
90+
lemma le_prod_of_submultiplicative (f : α → β) (h_one : f 1 1)
91+
(h_mul : ∀ a b, f (a * b) ≤ f a * f b) (s : Multiset α) : f s.prod ≤ (s.map f).prod := by
92+
induction s using Quotient.inductionOn with
93+
| h l => simp [l.le_prod_of_submultiplicative f h_one h_mul]
10094

10195
@[to_additive le_sum_nonempty_of_subadditive_on_pred]
10296
lemma le_prod_nonempty_of_submultiplicative_on_pred (f : α → β) (p : α → Prop)
10397
(h_mul : ∀ a b, p a → p b → f (a * b) ≤ f a * f b) (hp_mul : ∀ a b, p a → p b → p (a * b))
10498
(s : Multiset α) (hs_nonempty : s ≠ ∅) (hs : ∀ a, a ∈ s → p a) : f s.prod ≤ (s.map f).prod := by
105-
revert s
106-
refine Multiset.induction ?_ ?_
107-
· simp
108-
rintro a s hs - hsa_prop
109-
rw [prod_cons, map_cons, prod_cons]
110-
by_cases hs_empty : s = ∅
111-
· simp [hs_empty]
112-
have hsa_restrict : ∀ x, x ∈ s → p x := fun x hx => hsa_prop x (mem_cons_of_mem hx)
113-
have hp_sup : p s.prod := prod_induction_nonempty p hp_mul hs_empty hsa_restrict
114-
have hp_a : p a := hsa_prop a (mem_cons_self a s)
115-
grw [h_mul a _ hp_a hp_sup, ← hs hs_empty hsa_restrict]
99+
induction s using Quotient.inductionOn with
100+
| h l =>
101+
simp [l.le_prod_nonempty_of_submultiplicative_on_pred f p h_mul hp_mul
102+
(by simpa using hs_nonempty) (by simpa)]
116103

117104
@[to_additive le_sum_nonempty_of_subadditive]
118105
lemma le_prod_nonempty_of_submultiplicative (f : α → β) (h_mul : ∀ a b, f (a * b) ≤ f a * f b)
119-
(s : Multiset α) (hs_nonempty : s ≠ ∅) : f s.prod ≤ (s.map f).prod :=
120-
le_prod_nonempty_of_submultiplicative_on_pred f (fun _ => True) (by simp [h_mul]) (by simp) s
121-
hs_nonempty (by simp)
106+
(s : Multiset α) (hs_nonempty : s ≠ ∅) : f s.prod ≤ (s.map f).prod := by
107+
induction s using Quotient.inductionOn with
108+
| h l => simp [l.le_prod_nonempty_of_submultiplicative f h_mul (by simpa using hs_nonempty)]
122109

123110
end
124111

@@ -176,6 +163,6 @@ lemma prod_min_le [CommMonoid α] [LinearOrder α] [IsOrderedMonoid α]
176163

177164
lemma abs_sum_le_sum_abs [AddCommGroup α] [LinearOrder α] [IsOrderedAddMonoid α] {s : Multiset α} :
178165
|s.sum| ≤ (s.map abs).sum :=
179-
le_sum_of_subadditive _ abs_zero abs_add_le s
166+
le_sum_of_subadditive _ abs_zero.le abs_add_le s
180167

181168
end Multiset

Mathlib/Algebra/Order/BigOperators/Ring/Finset.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ section AbsoluteValue
232232
lemma AbsoluteValue.sum_le [Semiring R] [Semiring S] [PartialOrder S] [IsOrderedRing S]
233233
(abv : AbsoluteValue R S)
234234
(s : Finset ι) (f : ι → R) : abv (∑ i ∈ s, f i) ≤ ∑ i ∈ s, abv (f i) :=
235-
Finset.le_sum_of_subadditive abv (map_zero _) abv.add_le _ _
235+
Finset.le_sum_of_subadditive abv (map_zero _).le abv.add_le _ _
236236

237237
lemma IsAbsoluteValue.abv_sum [Semiring R] [Semiring S] [PartialOrder S] [IsOrderedRing S]
238238
(abv : R → S) [IsAbsoluteValue abv]

Mathlib/Algebra/Order/Interval/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ theorem length_sub_le : (s - t).length ≤ s.length + t.length := by
647647

648648
theorem length_sum_le (f : ι → Interval α) (s : Finset ι) :
649649
(∑ i ∈ s, f i).length ≤ ∑ i ∈ s, (f i).length :=
650-
Finset.le_sum_of_subadditive _ length_zero length_add_le _ _
650+
Finset.le_sum_of_subadditive _ length_zero.le length_add_le _ _
651651

652652
end Interval
653653

Mathlib/Analysis/Convex/Gauge.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ theorem gauge_add_le (hs : Convex ℝ s) (absorbs : Absorbent ℝ s) (x y : E) :
190190

191191
theorem gauge_sum_le {ι : Type*} (hs : Convex ℝ s) (absorbs : Absorbent ℝ s) (t : Finset ι)
192192
(f : ι → E) : gauge s (∑ i ∈ t, f i) ≤ ∑ i ∈ t, gauge s (f i) :=
193-
Finset.le_sum_of_subadditive _ gauge_zero (gauge_add_le hs absorbs) _ _
193+
Finset.le_sum_of_subadditive _ gauge_zero.le (gauge_add_le hs absorbs) _ _
194194

195195
theorem self_subset_gauge_le_one : s ⊆ { x | gauge s x ≤ 1 } := fun _ => gauge_le_one_of_mem
196196

Mathlib/Analysis/Normed/Group/Basic.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,25 +1152,25 @@ theorem dist_inv (x y : E) : dist x⁻¹ y = dist x y⁻¹ := by
11521152

11531153
theorem norm_multiset_sum_le {E} [SeminormedAddCommGroup E] (m : Multiset E) :
11541154
‖m.sum‖ ≤ (m.map fun x => ‖x‖).sum :=
1155-
m.le_sum_of_subadditive norm norm_zero norm_add_le
1155+
m.le_sum_of_subadditive norm norm_zero.le norm_add_le
11561156

11571157
@[to_additive existing]
11581158
theorem norm_multiset_prod_le (m : Multiset E) : ‖m.prod‖ ≤ (m.map fun x => ‖x‖).sum := by
11591159
rw [← Multiplicative.ofAdd_le, ofAdd_multiset_prod, Multiset.map_map]
11601160
refine Multiset.le_prod_of_submultiplicative (Multiplicative.ofAdd ∘ norm) ?_ (fun x y => ?_) _
1161-
· simp only [comp_apply, norm_one', ofAdd_zero]
1161+
· simp
11621162
· exact norm_mul_le' x y
11631163

11641164
variable {ε : Type*} [TopologicalSpace ε] [ESeminormedAddCommMonoid ε] in
11651165
@[bound]
11661166
theorem enorm_sum_le (s : Finset ι) (f : ι → ε) :
11671167
‖∑ i ∈ s, f i‖ₑ ≤ ∑ i ∈ s, ‖f i‖ₑ :=
1168-
s.le_sum_of_subadditive enorm enorm_zero enorm_add_le f
1168+
s.le_sum_of_subadditive enorm enorm_zero.le enorm_add_le f
11691169

11701170
@[bound]
11711171
theorem norm_sum_le {E} [SeminormedAddCommGroup E] (s : Finset ι) (f : ι → E) :
11721172
‖∑ i ∈ s, f i‖ ≤ ∑ i ∈ s, ‖f i‖ :=
1173-
s.le_sum_of_subadditive norm norm_zero norm_add_le f
1173+
s.le_sum_of_subadditive norm norm_zero.le norm_add_le f
11741174

11751175
@[to_additive existing]
11761176
theorem enorm_prod_le (s : Finset ι) (f : ι → ε) : ‖∏ i ∈ s, f i‖ₑ ≤ ∑ i ∈ s, ‖f i‖ₑ := by
@@ -1183,7 +1183,7 @@ theorem enorm_prod_le (s : Finset ι) (f : ι → ε) : ‖∏ i ∈ s, f i‖
11831183
theorem norm_prod_le (s : Finset ι) (f : ι → E) : ‖∏ i ∈ s, f i‖ ≤ ∑ i ∈ s, ‖f i‖ := by
11841184
rw [← Multiplicative.ofAdd_le, ofAdd_sum]
11851185
refine Finset.le_prod_of_submultiplicative (Multiplicative.ofAdd ∘ norm) ?_ (fun x y => ?_) _ _
1186-
· simp only [comp_apply, norm_one', ofAdd_zero]
1186+
· simp
11871187
· exact norm_mul_le' x y
11881188

11891189
@[to_additive]

Mathlib/MeasureTheory/Function/LpSeminorm/TriangleInequality.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,15 @@ theorem eLpNorm'_sum_le [ContinuousAdd ε'] {ι} {f : ι → α → ε'} {s : Fi
136136
(hfs : ∀ i, i ∈ s → AEStronglyMeasurable (f i) μ) (hq1 : 1 ≤ q) :
137137
eLpNorm' (∑ i ∈ s, f i) q μ ≤ ∑ i ∈ s, eLpNorm' (f i) q μ :=
138138
Finset.le_sum_of_subadditive_on_pred (fun f : α → ε' => eLpNorm' f q μ)
139-
(fun f => AEStronglyMeasurable f μ) (eLpNorm'_zero (zero_lt_one.trans_le hq1))
139+
(fun f => AEStronglyMeasurable f μ) (eLpNorm'_zero (zero_lt_one.trans_le hq1)).le
140140
(fun _f _g hf hg => eLpNorm'_add_le hf hg hq1) (fun _f _g hf hg => hf.add hg) _ hfs
141141

142142
theorem eLpNorm_sum_le [ContinuousAdd ε'] {ι} {f : ι → α → ε'} {s : Finset ι}
143143
(hfs : ∀ i, i ∈ s → AEStronglyMeasurable (f i) μ) (hp1 : 1 ≤ p) :
144144
eLpNorm (∑ i ∈ s, f i) p μ ≤ ∑ i ∈ s, eLpNorm (f i) p μ :=
145145
Finset.le_sum_of_subadditive_on_pred (fun f : α → ε' => eLpNorm f p μ)
146-
(fun f => AEStronglyMeasurable f μ) eLpNorm_zero (fun _f _g hf hg => eLpNorm_add_le hf hg hp1)
146+
(fun f => AEStronglyMeasurable f μ) eLpNorm_zero.le
147+
(fun _f _g hf hg => eLpNorm_add_le hf hg hp1)
147148
(fun _f _g hf hg => hf.add hg) _ hfs
148149

149150
theorem MemLp.add [ContinuousAdd ε] (hf : MemLp f p μ) (hg : MemLp g p μ) : MemLp (f + g) p μ :=

0 commit comments

Comments
 (0)