Zulip Chat Archive
Stream: new members
Topic: fintype.prod_dite
Alex Zhang (Jul 15 2021 at 19:31):
Why doesn't fintype.prod_dite
has the label to_additive
? I need to use the sum version of this. :cry:
Alex Zhang (Jul 15 2021 at 19:34):
and an ite
version also seems missing
Alex Zhang (Jul 15 2021 at 19:50):
Not very familiar with this part, I would be grateful if anyone can do the poof!
@[to_additive]
lemma fintype.prod_ite [fintype α] {p : α → Prop} [decidable_pred p]
[comm_monoid β] (f g : α → β) :
(∏ a, ite (p a) (f a) (g a)) = (∏ a : {a // p a}, f a) * (∏ a : {a // ¬p a}, g a) :=
begin
simp only [finset.prod_ite, finset.attach_eq_univ],
congr' 1,
{ library_search},
{ sorry }
end
Yakov Pechersky (Jul 15 2021 at 19:58):
Please, #mwe with imports and variables
Yakov Pechersky (Jul 15 2021 at 19:59):
You have that already, and for us to try to explore the issue, we'd have to rewrite it ourselves. It's almost surely easier for you to just copy+paste the extra few lines
Alex Zhang (Jul 15 2021 at 20:05):
import algebra.big_operators
open_locale big_operators
variables {α β : Type*}
@[to_additive]
lemma fintype.prod_ite [fintype α] {p : α → Prop} [decidable_pred p]
[comm_monoid β] (f g : α → β) :
(∏ a, ite (p a) (f a) (g a)) = (∏ a : {a // p a}, f a) * (∏ a : {a // ¬p a}, g a) :=
begin
simp only [finset.prod_ite, finset.attach_eq_univ],
congr' 1,
{ sorry},
{ sorry}
end
Alex Zhang (Jul 15 2021 at 20:05):
I wrote the imports.
Yakov Pechersky (Jul 15 2021 at 20:10):
I tagged fintype.prod_dite
at @{to_additive]
in data.fintype.card
and then the following works:
import data.fintype.card
open_locale big_operators
variables {α β : Type*}
@[to_additive]
lemma fintype.prod_ite [fintype α] {p : α → Prop} [decidable_pred p]
[comm_monoid β] (f g : α → β) :
(∏ a, ite (p a) (f a) (g a)) = (∏ a : {a // p a}, f a) * (∏ a : {a // ¬p a}, g a) :=
fintype.prod_dite _ _
#check fintype.sum_ite
Alex Zhang (Jul 15 2021 at 20:22):
I think this can make a PR.
Yakov Pechersky (Jul 15 2021 at 20:22):
Feel free to!
Alex Zhang (Jul 15 2021 at 20:28):
Can this be made more general? @Yakov Pechersky
Yakov Pechersky (Jul 15 2021 at 20:29):
Well the dite
version is the more general one, no? What additional generality would you want?
Yakov Pechersky (Jul 15 2021 at 20:32):
By the way, in the {prod,sum}_ite
lemma, p
should be an explicit variable.
Alex Zhang (Jul 15 2021 at 20:35):
I am not sure if there could be any generalization. I was just asking. This lemma now is enough for my own use.
Last updated: Dec 20 2023 at 11:08 UTC