Zulip Chat Archive

Stream: Is there code for X?

Topic: Restriction of a sum ignoring zeros


Adam Topaz (Aug 03 2022 at 20:11):

Does anyone know of an efficient way to prove the following?

import algebra.big_operators

open_locale big_operators

example {ι M : Type*}
  [add_comm_monoid M] [fintype ι] (m : ι → M)
  (S : finset ι) (hS : ∀ i, i ∉ S → m i = 0) :
  (∑ i, m i) = (∑ i in S, m i) := sorry

Eric Wieser (Aug 03 2022 at 20:13):

docs#finset.sum_subset should get you most of the way there

Adam Topaz (Aug 03 2022 at 20:13):

Ah perfect, thanks!

Eric Wieser (Aug 03 2022 at 20:13):

You just have to eliminate the \mem univ it produces

Adam Topaz (Aug 03 2022 at 20:14):

right, yeah that lemma is exactly what I need

Junyan Xu (Aug 03 2022 at 20:17):

I found docs#finset.sum_add_sum_compl and docs#finset.sum_eq_zero but that seems less direct.


Last updated: Feb 28 2026 at 14:05 UTC