Zulip Chat Archive

Stream: Is there code for X?

Topic: opening the square


Alex Kontorovich (Aug 16 2022 at 13:52):

Any idea why this isn't working?... Thanks!

import algebra.group.defs
import data.finset.basic
import algebra.big_operators.ring

universes u v

open_locale big_operators

lemma open_square {α : Type u} {β : Type v} [add_comm_monoid β] [has_mul β] [has_pow β ] [monoid β]
  (s : finset α) (f : α  β) :
( i in s, f i)^2 =  i in s,  j in s, (f i) * (f j) :=
begin
  rw pow_two ( i in s, f i),
  sorry,
end

Yaël Dillies (Aug 16 2022 at 13:54):

Not solving your problem, but I'll let you know about docs#finset.sum_mul_sum

Adam Topaz (Aug 16 2022 at 13:55):

What are your imports?

Adam Topaz (Aug 16 2022 at 13:56):

The issue is probably the rewrite under a binder... try simp_rw instead of rw

Adam Topaz (Aug 16 2022 at 13:58):

Oh maybe not

Alex Kontorovich (Aug 16 2022 at 13:58):

Sorry, added imports

Eric Rodriguez (Aug 16 2022 at 14:03):

oh! why do you give has_pow b nat?

Eric Rodriguez (Aug 16 2022 at 14:03):

there's two instances of has_pow on b, one from that and one from the monoid

Alex Kontorovich (Aug 16 2022 at 14:03):

I thought it wanted that..?

Alex Kontorovich (Aug 16 2022 at 14:03):

Ah, maybe that's my problem...?

Alex Kontorovich (Aug 16 2022 at 14:04):

Yep, that did it. Thanks!

Eric Rodriguez (Aug 16 2022 at 14:05):

(the has_mul instance will also cause you issues - most structures like rings and stuff are bundled, meaning you don't require a pre-existing has_mul/has_add etc instance)

Alex Kontorovich (Aug 16 2022 at 14:06):

I see, thanks; I was adding them in the order that Lean seemed to want them, not knowing which to remove after adding the next...

Adam Topaz (Aug 16 2022 at 17:11):

Probably!


Last updated: Dec 20 2023 at 11:08 UTC