88public import Mathlib.Algebra.BigOperators.Ring.Finset
99public import Mathlib.Algebra.Order.AbsoluteValue.Basic
1010public import Mathlib.Algebra.Order.BigOperators.Group.Finset
11+ public import Mathlib.Algebra.Order.BigOperators.GroupWithZero.Finset
1112public import Mathlib.Algebra.Order.BigOperators.Ring.Multiset
1213public import Mathlib.Tactic.Ring
1314
@@ -27,66 +28,6 @@ variable {ι R S : Type*}
2728
2829namespace Finset
2930
30- section CommMonoidWithZero
31- variable [CommMonoidWithZero R] [PartialOrder R] [ZeroLEOneClass R]
32-
33- section PosMulMono
34- variable [PosMulMono R] {f g : ι → R} {s t : Finset ι}
35-
36- lemma prod_nonneg (h0 : ∀ i ∈ s, 0 ≤ f i) : 0 ≤ ∏ i ∈ s, f i :=
37- prod_induction f (fun i ↦ 0 ≤ i) (fun _ _ ha hb ↦ mul_nonneg ha hb) zero_le_one h0
38-
39- /-- If all `f i`, `i ∈ s`, are nonnegative and each `f i` is less than or equal to `g i`, then the
40- product of `f i` is less than or equal to the product of `g i`. See also `Finset.prod_le_prod'` for
41- the case of an ordered commutative multiplicative monoid. -/
42- @[gcongr]
43- lemma prod_le_prod (h0 : ∀ i ∈ s, 0 ≤ f i) (h1 : ∀ i ∈ s, f i ≤ g i) :
44- ∏ i ∈ s, f i ≤ ∏ i ∈ s, g i := by
45- induction s using Finset.cons_induction with
46- | empty => simp
47- | cons a s has ih =>
48- simp only [prod_cons, forall_mem_cons] at h0 h1 ⊢
49- have := posMulMono_iff_mulPosMono.1 ‹PosMulMono R›
50- gcongr
51- exacts [prod_nonneg h0.2 , h0.1 .trans h1.1 , h1.1 , ih h0.2 h1.2 ]
52-
53- /-- If each `f i`, `i ∈ s` belongs to `[0, 1]`, then their product is less than or equal to one.
54- See also `Finset.prod_le_one'` for the case of an ordered commutative multiplicative monoid. -/
55- lemma prod_le_one (h0 : ∀ i ∈ s, 0 ≤ f i) (h1 : ∀ i ∈ s, f i ≤ 1 ) : ∏ i ∈ s, f i ≤ 1 := by
56- convert ← prod_le_prod h0 h1
57- exact Finset.prod_const_one
58-
59- end PosMulMono
60-
61- section PosMulStrictMono
62- variable [PosMulStrictMono R] [Nontrivial R] {f g : ι → R} {s t : Finset ι}
63-
64- lemma prod_pos (h0 : ∀ i ∈ s, 0 < f i) : 0 < ∏ i ∈ s, f i :=
65- prod_induction f (fun x ↦ 0 < x) (fun _ _ ha hb ↦ mul_pos ha hb) zero_lt_one h0
66-
67- lemma prod_lt_prod (hf : ∀ i ∈ s, 0 < f i) (hfg : ∀ i ∈ s, f i ≤ g i)
68- (hlt : ∃ i ∈ s, f i < g i) :
69- ∏ i ∈ s, f i < ∏ i ∈ s, g i := by
70- classical
71- obtain ⟨i, hi, hilt⟩ := hlt
72- rw [← insert_erase hi, prod_insert (notMem_erase _ _), prod_insert (notMem_erase _ _)]
73- have := posMulStrictMono_iff_mulPosStrictMono.1 ‹PosMulStrictMono R›
74- refine mul_lt_mul_of_pos_of_nonneg' hilt ?_ ?_ ?_
75- · exact prod_le_prod (fun j hj => le_of_lt (hf j (mem_of_mem_erase hj)))
76- (fun _ hj ↦ hfg _ <| mem_of_mem_erase hj)
77- · exact prod_pos fun j hj => hf j (mem_of_mem_erase hj)
78- · exact (hf i hi).le.trans hilt.le
79-
80- lemma prod_lt_prod_of_nonempty (hf : ∀ i ∈ s, 0 < f i) (hfg : ∀ i ∈ s, f i < g i)
81- (h_ne : s.Nonempty) :
82- ∏ i ∈ s, f i < ∏ i ∈ s, g i := by
83- apply prod_lt_prod hf fun i hi => le_of_lt (hfg i hi)
84- obtain ⟨i, hi⟩ := h_ne
85- exact ⟨i, hi, hfg i hi⟩
86-
87- end PosMulStrictMono
88- end CommMonoidWithZero
89-
9031section OrderedSemiring
9132
9233variable [Semiring R] [PartialOrder R] [IsOrderedRing R] {f : ι → R} {s : Finset ι}
0 commit comments