Zulip Chat Archive
Stream: Is there code for X?
Topic: Sum of finite types
Egbert Rijke (May 10 2024 at 08:55):
Hi!
I have a very quick question. Is there a bijection between Sigma types of standard finite types Fin
and the standard finite type with the sum as the number of elements?
I tried to look for it in mathlib, but I couldn't spot it anywhere.
Many thanks!
Markus Himmel (May 10 2024 at 08:56):
@loogle Fin, Sum
Markus Himmel (May 10 2024 at 08:57):
The bot won't answer me, but I think you're looking for docs#finSumFinEquiv
Notification Bot (May 10 2024 at 09:03):
This topic was moved here from #general > Sum of finite types by Mario Carneiro.
Egbert Rijke (May 10 2024 at 09:11):
Thanks! I'm looking for the version of that for Sigma types
Markus Himmel (May 10 2024 at 09:14):
Could you give a Lean statement of the equivalence you're looking for?
Egbert Rijke (May 10 2024 at 09:30):
Hm... the following might not exactly be valid lean syntax, but this is what I am looking for:
theorem foo :
(n : ℕ) (f : Fin n → ℕ) →
(Fin (∑ i < n, f i)) ≃ (∑ i ∈ Fin n, Fin (f i)) := sorry
Yaël Dillies (May 10 2024 at 09:36):
We don't have it, but docs#finPiFinEquiv is very close and you should get inspiration from it
Egbert Rijke (May 10 2024 at 09:45):
Thanks!
Egbert Rijke (May 10 2024 at 09:58):
Is there perhaps another way in which you count elements of Sigma types, or is counting just not something that happens in mathlib?
Floris van Doorn (May 10 2024 at 10:24):
docs#Fintype.card_sigma, docs#Cardinal.mk_sigma, docs#Finset.card_sigma, docs#Finset.card_sigmaLift are some versions, depending on what you want.
Floris van Doorn (May 10 2024 at 10:25):
The first one, together with docs#Fintype.equivFinOfCardEq will also produce the other equivalence you looked for (not computably though).
Eric Wieser (May 10 2024 at 19:03):
docs#FinEnum.instSigma might be another answer to your question, if by "count" you mean "enumerate"
Last updated: May 02 2025 at 03:31 UTC