Zulip Chat Archive

Stream: Is there code for X?

Topic: (∑ i ∈ s, f i) / (∑ i ∈ s, g i) ≤ max i ∈ s, (f i / g i)


Snir Broshi (Dec 28 2025 at 22:33):

A sum over a sum (with the same number of terms) is bounded between the minimum and maximum ratio.
The proof is to start with f j / g j ≤ max i ∈ s, (f i / g i), multiply by the g j, sum the inequality over all j, then take the max out of the sum and divide by the sum of gs. Similarly for min.

Snir Broshi (Dec 28 2025 at 22:33):

import Mathlib

theorem foo_le_max {ι : Type*} {s : Finset ι} (f : ι  ) (g : ι  )
    (hs : s.Nonempty) (hf :  i  s, 0  f i) (hg :  i  s, 0 < g i) :
    (s.sum f / s.sum g :)  (s.image <| f / g).max' (hs.image _) := by
  classical
  have i, hi := hs
  apply div_le_of_le_mul₀ (Finset.sum_pos hg hs).le <|
    div_nonneg (hf i hi) (hg i hi |>.le) |>.trans <|
      Finset.le_max' _ _ <| Finset.mem_image_of_mem (f / g) hi
  rw [Finset.mul_sum]
  refine Finset.sum_le_sum fun i hi  div_le_iff₀ (hg i hi) |>.mp ?_
  exact Finset.le_max' _ _ <| Finset.mem_image_of_mem (f / g) hi

Snir Broshi (Dec 28 2025 at 22:33):

What's the most generality possible here? I tried abstracting reals away and using [Field M] [LinearOrder M] but it didn't work so great. I wonder if a version for Rings is possible by somehow avoiding division.

Snir Broshi (Dec 28 2025 at 22:35):

Also, this is equivalent to a (more familiar?) weighted average version:
(∑ i ∈ s, w i * x i) / (∑ i ∈ s, w i) ≤ max i ∈ s, x i

Aaron Liu (Dec 28 2025 at 22:37):

but surely this isn't specific to division?

Aaron Liu (Dec 28 2025 at 22:39):

this feels like some sort of jensen's inequality

Snir Broshi (Dec 28 2025 at 22:42):

Jensen can prove the weighted version where the sum of the weights is 1

Snir Broshi (Dec 28 2025 at 22:42):

No actually it might be just normal inequalities, I don't see any convex function we can define here

Aaron Liu (Dec 28 2025 at 22:43):

the convex function is division

Aaron Liu (Dec 28 2025 at 22:44):

I think that's convex?

Snir Broshi (Dec 28 2025 at 22:44):

Division by a constant?

Aaron Liu (Dec 28 2025 at 22:46):

division as a function of two variables

Aaron Liu (Dec 28 2025 at 22:46):

I think it's convex on the first quadrant

Snir Broshi (Dec 28 2025 at 22:47):

Oh that makes sense

Snir Broshi (Dec 28 2025 at 22:47):

Though the proof above is easier probably

Aaron Liu (Dec 28 2025 at 22:48):

I don't see a theorem saying division is convex

Aaron Liu (Dec 28 2025 at 22:48):

I'll try proving it for the real numbers

Aaron Liu (Dec 28 2025 at 22:52):

ahh, division isn't convex

Aaron Liu (Dec 28 2025 at 22:54):

I guess I sort of expected it, since simpson's paradox is a thing

Snir Broshi (Dec 28 2025 at 22:55):

Simpsons paradox is that division isn't convex?

Snir Broshi (Dec 28 2025 at 22:55):

Something something Bayes?

Aaron Liu (Dec 28 2025 at 22:56):

maybe???

Aaron Liu (Dec 28 2025 at 22:56):

idk if they're actually related it just felt similar

Snir Broshi (Dec 28 2025 at 22:58):

hmm I agree

Snir Broshi (Dec 28 2025 at 23:00):

So since division isn't convex, Jensen's isn't a generalization of this lemma. What is?

Aaron Liu (Dec 28 2025 at 23:05):

well although division isn't convex as a function of two variables, it becomes convex if you fix either one of the arguments

Aaron Liu (Dec 28 2025 at 23:05):

so maybe we can still get something here?

Artie Khovanov (Dec 28 2025 at 23:28):

Snir Broshi said:

What's the most generality possible here? I tried abstracting reals away and using [Field M] [LinearOrder M] but it didn't work so great. I wonder if a version for Rings is possible by somehow avoiding division.

If you want an ordered field, you want [Field M] [LinearOrder M] [IsStrictOrderedRing M]

Yaël Dillies (Dec 29 2025 at 06:11):

Snir Broshi said:

So since division isn't convex, Jensen's isn't a generalization of this lemma. What is?

fgL1fL1gL\|fg\|_{L^1} \le \|f\|_{L^1}\|g\|_{L^\infty}

Snir Broshi (Dec 29 2025 at 09:03):

Interesting, this might work for Finsupp, and maybe continuous functions on a compact domain. Is this a known inequality? It looks similar to Hölder

Yaël Dillies (Dec 29 2025 at 09:31):

This is as general as I wrote it: It works for any L^1 function f and L^infty function g. It is technically Hölder for L^1-L^infty, but at least in additive combinatorics it is usually referred to as "taking g out".

Snir Broshi (Dec 29 2025 at 09:45):

IIUC since it's for all functions, the norms would be EReal rather than reals?
Is it in Mathlib?

Yaël Dillies (Dec 29 2025 at 09:48):

The inequality I stated above is an informal one. There are many formal versions one could write

J. J. Issai (project started by GRP) (Dec 29 2025 at 18:21):

Snir Broshi said:

A sum over a sum (with the same number of terms) is bounded between the minimum and maximum ratio.
The proof is to start with f j / g j ≤ max i ∈ s, (f i / g i), multiply by the g j, sum the inequality over all j, then take the max out of the sum and divide by the sum of gs. Similarly for min.

Note that this is a mild generalization of 'mediant sum': for positive reals (elements of an ordered ring where one can construct a domain of fractions) a,b,c,d with ad <= bc ( so a/c <= b/d ) one has a(c+d) <= c(a+b) (so a/c <= (a+b)/(c+d) ) and analogously for b/d. For finite sums I think an inductive proof on the number of summands is easier to understand and program. Also, by rearranging the terms in the numerator, one can try crafting tighter bounds on the end result. I would be interested in knowing whether this approach is better in terms of performance than Snir's approach above.~~

(I suspect this may apply to lattice ordered rings, but I don't know if one can make a 'nicely ordered' field of fractions out of such a ring.)~~

Ilmārs Cīrulis (Dec 29 2025 at 23:05):

fgL1fL1gL\|fg\|_{L^1} \le \|f\|_{L^1}\|g\|_{L^\infty} - is there any chance for this to be true, if one replaces \infty with bounded real number 1p1 \le p?

Or, after getting rid of root, this:

import Mathlib

lemma T {ι : Type*} (s : Finset ι) {f g : ι  } {p : } (hp : 1  p) (hf :  i, 0  f i) (hg :  i, 0  g i) :
    s.sum (fun i => f i * g i) ^ p  (s.sum f) ^ p * s.sum (fun i => g i ^ p) := by
  sorry

Apologies for the disturbance. If there's a counterexample to such statement, I would be very grateful. :pray:

Aaron Liu (Dec 29 2025 at 23:20):

holder inequality (says fgL1fLpgLq\|fg\|_{L^1} \le \|f\|_{L^p} \|g\|_{L^q} whenever 1/p+1/q=11/p + 1/q = 1) is tight when fp|f|^p and gq|g|^q are linearly dependent

Ilmārs Cīrulis (Dec 30 2025 at 05:33):

Ilmārs Cīrulis said:

import Mathlib

lemma T {ι : Type*} (s : Finset ι) {f g : ι  } {p : } (hp : 1  p) (hf :  i, 0  f i) (hg :  i, 0  g i) :
    s.sum (fun i => f i * g i) ^ p  (s.sum f) ^ p * s.sum (fun i => g i ^ p) := by
  sorry

I managed to prove it. That's good too.

Yaël Dillies (Dec 30 2025 at 07:22):

Aaron Liu said:

holder inequality (says fgL1fLpgLq\|fg\|_{L^1} \le \|f\|_{L^p} \|g\|_{L^q} whenever 1/p+1/q=11/p + 1/q = 1) is tight when fp|f|^p and gq|g|^q are linearly dependent

Tightness only holds when p,q<p, q < \infty


Last updated: Feb 28 2026 at 14:05 UTC