Zulip Chat Archive

Stream: new members

Topic: finset.univ.sum


Tianchen Zhao (Aug 17 2021 at 10:19):

I am trying to prove this statement about finset.univ.sum which should be easy but I have no ideas how to do this in Lean. I tried unfolding some defitions but it looked even more complicated. Is there a tactic or lemma I can use?

import data.real.basic

example (f : (fin 2)  ) :
finset.univ.sum (λ (x : fin 2), f x) = f 0 + f 1 :=
begin
  sorry,
end

Eric Wieser (Aug 17 2021 at 10:25):

docs#fin.sum_univ_succ

Scott Morrison (Aug 17 2021 at 10:26):

It would be nice to have a tactic to handle this, along the lines of fin_cases: explode of sum over a finite set.

Eric Wieser (Aug 17 2021 at 10:41):

What order would it expand the sum into?

Eric Wieser (Aug 17 2021 at 10:42):

Maybe that doesn't matter; I suppose meta code has docs#quot.unquot to pick an arbitrary order

Scott Morrison (Aug 17 2021 at 10:46):

I guess whatever order fin_cases hands you the cases in!

Eric Wieser (Aug 17 2021 at 10:47):

Well, fin_cases only works on fin; I thought you meant for any finite type

Scott Morrison (Aug 17 2021 at 10:47):

Really? I remember it working more generally. tactic#fin_cases

Eric Wieser (Aug 17 2021 at 10:48):

Oh, I didn't know that

Scott Morrison (Aug 17 2021 at 10:48):

No, it works on anything where fintype is available.

Eric Wieser (Aug 17 2021 at 10:52):

The tests are insightful: https://github.com/leanprover-community/mathlib/blob/0591c276d560de91873adabc939a656bf9d0b827/test/fin_cases.lean


Last updated: Dec 20 2023 at 11:08 UTC