Zulip Chat Archive

Stream: Is there code for X?

Topic: Finset.sum_sub_distrib for `Nat`s


Daniel Weber (Sep 21 2024 at 07:57):

Do we have the following theorem?

import Mathlib

example {ι : Type*} (s : Finset ι) (f : ι  ) (g : ι  ) (hfg : g  f) :
     x  s, (f x - g x) =  x  s, f x -  x  s, g x := by
  sorry

Note that this isn't docs#Finset.sum_sub_distrib because the naturals aren't a subtraction monoid

Yaël Dillies (Sep 21 2024 at 08:23):

It was already discussed before here. Maybe @Bhavik Mehta remembers

Yaël Dillies (Sep 21 2024 at 08:23):

Btw it would be called Finset.sum_tsub_distrib

Bhavik Mehta (Sep 21 2024 at 17:09):

Yaël Dillies said:

It was already discussed before here. Maybe Bhavik Mehta remembers

I have definitely wanted this at least twice before - found a version here: https://github.com/b-mehta/ExponentialRamsey/blob/7e17b629a915a082869f494c8afa56a3e1c7a88d/ExponentialRamsey/Prereq/Mathlib/Algebra/BigOperators/Ring.lean#L17 I'm pretty sure this worked on Lean 4 at the time, hopefully it's not too hard to adjust to current Lean 4. Something like this should _definitely_ be in mathlib. Feel free to upstream this file with credit!

Daniel Weber (Sep 25 2024 at 11:48):

#17130


Last updated: May 02 2025 at 03:31 UTC