Zulip Chat Archive

Stream: new members

Topic: n-fold triangle inequality


Luigi Massacci (Mar 05 2024 at 15:54):

Is there a nice way to one line something like this:

|a₁ + a₂ + ... + aₙ|  |a₁| + |a₂| + ... + |aₙ| := by sorry

In my case n = 4 and it's only two calc lines manually, but maybe there's some tactic voodo to do that in one go.

Ruben Van de Velde (Mar 05 2024 at 16:01):

Does gcongr do it?

Damiano Testa (Mar 05 2024 at 16:02):

Not at a computer, but I would guess that something like repeat apply (abs_add_le ..).trans might work?

Luigi Massacci (Mar 05 2024 at 16:12):

Ruben Van de Velde said:

Does gcongr do it?

Assuming you do not mean something more sophisticated than this:

example (a b c d : ) : |a + b + c + d|  |a| + |b| + |c| + |d| := by
  gcongr

then the answer is gcongr did not make progress

@Damiano Testa repeat apply (abs_add ..).trans has the same effect as doing it once

Damiano Testa (Mar 05 2024 at 16:32):

Well, combining Ruben's suggestion with mine, you can do it as follows:

example (a b c d : ) : |a + b + c + d|  |a| + |b| + |c| + |d| := by
  repeat apply (abs_add_le ..).trans; gcongr; try exact abs_add a b

Eric Wieser (Mar 05 2024 at 16:34):

This works:

import Mathlib

open BigOperators
example (a b c d : ) : |a + b + c + d|  |a| + |b| + |c| + |d| := by
  simpa [Fin.sum_univ_succ, add_assoc] using Finset.abs_sum_le_sum_abs ![a, b, c, d] Finset.univ

Luigi Massacci (Mar 05 2024 at 16:35):

Damiano Testa said:

Well, combining Ruben's suggestion with mine, you can do it as follows:

example (a b c d : ) : |a + b + c + d|  |a| + |b| + |c| + |d| := by
  repeat apply (abs_add_le ..).trans; gcongr; try exact abs_add a b

And everyone lived happily ever after. Also thank you to @Eric Wieser


Last updated: May 02 2025 at 03:31 UTC