Skip to content

Commit 2ce6783

Browse files
committed
chore(Algebra/Order/BigOperators): move lemmas which don't use addition out of Ring/
1 parent a73790f commit 2ce6783

1 file changed

Lines changed: 1 addition & 60 deletions

File tree

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

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module
88
public import Mathlib.Algebra.BigOperators.Ring.Finset
99
public import Mathlib.Algebra.Order.AbsoluteValue.Basic
1010
public import Mathlib.Algebra.Order.BigOperators.Group.Finset
11+
public import Mathlib.Algebra.Order.BigOperators.GroupWithZero.Finset
1112
public import Mathlib.Algebra.Order.BigOperators.Ring.Multiset
1213
public import Mathlib.Tactic.Ring
1314

@@ -27,66 +28,6 @@ variable {ι R S : Type*}
2728

2829
namespace 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-
9031
section OrderedSemiring
9132

9233
variable [Semiring R] [PartialOrder R] [IsOrderedRing R] {f : ι → R} {s : Finset ι}

0 commit comments

Comments
 (0)