Skip to content

Commit 741edb4

Browse files
committed
feat(Algebra/Order): maximally varying version of prod_le_prod_of_subset_of_one_le
1 parent 0f33149 commit 741edb4

3 files changed

Lines changed: 48 additions & 23 deletions

File tree

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

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,26 @@ theorem one_le_prod'' [MulLeftMono N] (h : ∀ i : ι, 1 ≤ f i) : 1 ≤ ∏ i
128128
theorem prod_le_one' [MulLeftMono N] (h : ∀ i ∈ s, f i ≤ 1) : ∏ i ∈ s, f i ≤ 1 :=
129129
(prod_le_prod' h).trans_eq (by rw [prod_const_one])
130130

131-
@[to_additive (attr := gcongr) sum_le_sum_of_subset_of_nonneg]
132-
theorem prod_le_prod_of_subset_of_one_le' [MulLeftMono N] (h : s ⊆ t)
133-
(hf : ∀ i ∈ t, i ∉ s → 1f i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, f i := by
131+
@[to_additive (attr := gcongr)]
132+
lemma prod_mono_of_subset_of_one_le [MulLeftMono N] (h : s ⊆ t) (hfg : ∀ i ∈ s, f i ≤ g i)
133+
(hg : ∀ i ∈ t, i ∉ s → 1g i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, g i := by
134134
classical calc
135-
∏ i ∈ s, f i ≤ (∏ i ∈ t \ s, f i) * ∏ i ∈ s, f i :=
136-
le_mul_of_one_le_left' <| one_le_prod' <| by simpa only [mem_sdiff, and_imp]
137-
_ = ∏ i ∈ t \ s ∪ s, f i := (prod_union sdiff_disjoint).symm
138-
_ = ∏ i ∈ t, f i := by rw [sdiff_union_of_subset h]
135+
∏ i ∈ s, f i
136+
_ ≤ ∏ i ∈ s, g i := by gcongr with i hi; exact hfg i hi
137+
_ ≤ (∏ i ∈ t \ s, g i) * ∏ i ∈ s, g i :=
138+
le_mul_of_one_le_left' <| one_le_prod' <| by simpa only [mem_sdiff, and_imp]
139+
_ = ∏ i ∈ t \ s ∪ s, g i := (prod_union sdiff_disjoint).symm
140+
_ = ∏ i ∈ t, g i := by rw [sdiff_union_of_subset h]
141+
142+
@[to_additive]
143+
lemma prod_mono_of_subset_of_le_one [MulLeftMono N] (h : s ⊆ t) (hfg : ∀ i ∈ s, f i ≤ g i)
144+
(hf : ∀ i ∈ t, i ∉ s → f i ≤ 1) : ∏ i ∈ t, f i ≤ ∏ i ∈ s, g i :=
145+
prod_mono_of_subset_of_one_le (N := Nᵒᵈ) h hfg hf
146+
147+
@[to_additive sum_le_sum_of_subset_of_nonneg]
148+
theorem prod_le_prod_of_subset_of_one_le' [MulLeftMono N] (h : s ⊆ t)
149+
(hf : ∀ i ∈ t, i ∉ s → 1 ≤ f i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, f i :=
150+
prod_mono_of_subset_of_one_le h (by simp) hf
139151

140152
@[to_additive]
141153
theorem prod_le_prod_of_subset_of_le_one'

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

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,41 @@ lemma le_prod_max_one {M : Type*} [CommMonoidWithZero M] [LinearOrder M] [ZeroLE
6767
exact this ▸ prod_le_prod (fun _ _ ↦ by grind [zero_le_one]) fun _ _ ↦ by grind
6868

6969
@[gcongr]
70-
theorem prod_le_prod_of_subset_of_one_le (h : s ⊆ t)
71-
(hf0 : ∀ i ∈ s, 0 ≤ f i)
72-
(hf : ∀ i ∈ t, i ∉ s → 1 ≤ f i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, f i := by
70+
lemma prod_mono_of_subset_of_one_le₀ (h : s ⊆ t) (hf₀ : ∀ i ∈ s, 0 ≤ f i) (hfg : ∀ i ∈ s, f i ≤ g i)
71+
(hf : ∀ i ∈ t, i ∉ s → 1 ≤ g i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, g i := by
7372
have := posMulMono_iff_mulPosMono.1 ‹PosMulMono R›
7473
classical
7574
calc
76-
∏ i ∈ s, f i ≤ (∏ i ∈ t \ s, f i) * ∏ i ∈ s, f i :=
77-
le_mul_of_one_le_left (prod_nonneg hf0) <| one_le_prod <| by simpa only [mem_sdiff, and_imp]
78-
_ = ∏ i ∈ t \ s ∪ s, f i := (prod_union sdiff_disjoint).symm
79-
_ = ∏ i ∈ t, f i := by rw [sdiff_union_of_subset h]
80-
81-
theorem prod_le_prod_of_subset_of_le_one (h : s ⊆ t) (hf0 : ∀ i ∈ t, 0 ≤ f i)
82-
(hf : ∀ i ∈ t, i ∉ s → f i ≤ 1) :
83-
∏ i ∈ t, f i ≤ ∏ i ∈ s, f i := by
75+
∏ i ∈ s, f i
76+
_ ≤ ∏ i ∈ s, g i := by gcongr with i hi; exacts [hf₀, hfg i hi]
77+
_ ≤ (∏ i ∈ t \ s, g i) * ∏ i ∈ s, g i :=
78+
le_mul_of_one_le_left (prod_nonneg fun i hi ↦ (hf₀ i hi).trans (hfg i hi)) <|
79+
one_le_prod <| by simpa only [mem_sdiff, and_imp]
80+
_ = ∏ i ∈ t \ s ∪ s, g i := (prod_union sdiff_disjoint).symm
81+
_ = ∏ i ∈ t, g i := by rw [sdiff_union_of_subset h]
82+
83+
lemma prod_mono_of_subset_of_le_one₀ (h : s ⊆ t) (hg₀ : ∀ i ∈ t, 0 ≤ g i) (hgf : ∀ i ∈ s, g i ≤ f i)
84+
(hf : ∀ i ∈ t, i ∉ s → g i ≤ 1) :
85+
∏ i ∈ t, g i ≤ ∏ i ∈ s, f i := by
8486
have := posMulMono_iff_mulPosMono.1 ‹PosMulMono R›
8587
classical
8688
calc
87-
∏ i ∈ t, f i = ∏ i ∈ t \ s ∪ s, f i := by rw [sdiff_union_of_subset h]
88-
_ = (∏ i ∈ t \ s, f i) * ∏ i ∈ s, f i := prod_union sdiff_disjoint
89-
_ ≤ ∏ i ∈ s, f i :=
89+
∏ i ∈ t, g i
90+
_ = ∏ i ∈ t \ s ∪ s, g i := by rw [sdiff_union_of_subset h]
91+
_ = (∏ i ∈ t \ s, g i) * ∏ i ∈ s, g i := prod_union sdiff_disjoint
92+
_ ≤ ∏ i ∈ s, g i :=
9093
mul_le_of_le_one_left (prod_nonneg (by grind)) (prod_le_one (by grind) (by grind))
94+
_ ≤ ∏ i ∈ s, f i := by gcongr with i hi; exacts [fun i hi ↦ hg₀ _ <| h hi, hgf i hi]
95+
96+
@[gcongr]
97+
lemma prod_le_prod_of_subset_of_one_le (h : s ⊆ t) (hf₀ : ∀ i ∈ s, 0 ≤ f i)
98+
(hf : ∀ i ∈ t, i ∉ s → 1 ≤ f i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, f i :=
99+
prod_mono_of_subset_of_one_le₀ h hf₀ (by simp) hf
100+
101+
lemma prod_le_prod_of_subset_of_le_one (h : s ⊆ t) (hf₀ : ∀ i ∈ t, 0 ≤ f i)
102+
(hf : ∀ i ∈ t, i ∉ s → f i ≤ 1) :
103+
∏ i ∈ t, f i ≤ ∏ i ∈ s, f i :=
104+
prod_mono_of_subset_of_le_one₀ h hf₀ (by simp) hf
91105

92106
theorem prod_mono_set_of_one_le (hf : ∀ x, 1 ≤ f x) :
93107
Monotone fun s ↦ ∏ x ∈ s, f x :=

Mathlib/Analysis/Complex/Exponential.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ theorem sum_le_exp_of_nonneg {x : ℝ} (hx : 0 ≤ x) (n : ℕ) : ∑ i ∈ rang
247247
refine le_lim (CauSeq.le_of_exists ⟨n, fun j hj => ?_⟩)
248248
simp only [exp', const_apply, re_sum]
249249
norm_cast
250-
refine sum_le_sum_of_subset_of_nonneg (range_mono hj) fun _ _ _ ↦ ?_
251-
positivity
250+
gcongr
252251
_ = exp x := by rw [exp, Complex.exp, ← cauSeqRe, lim_re]
253252

254253
lemma pow_div_factorial_le_exp (hx : 0 ≤ x) (n : ℕ) : x ^ n / n ! ≤ exp x :=

0 commit comments

Comments
 (0)