Zulip Chat Archive

Stream: new members

Topic: Is there a simple way to lift Finset (Fin n) to Finset Nat?


Kevin Cheung (Apr 03 2024 at 14:41):

I have the following:

import Mathlib.Tactic.LibrarySearch
import Mathlib.Data.Fintype.Basic

def set4 : Finset (Fin 4) := {0, 1, 2, 3}
def set4' : Finset  := {0, 1, 2, 3}

I wanted to prove that set4 and set4' are equal. After some experimenting, I came upon the following:

example : set4' = Finset.map Fin.val, Fin.val_injective set4 := rfl

But the statement of the proposition seems a bit verbose. Is there a cleaner way to express that set4 and set4' are equal?

Yaël Dillies (Apr 03 2024 at 14:41):

No, you found the correct spelling

Kevin Cheung (Apr 03 2024 at 14:42):

Thank you.

Jireh Loreaux (Apr 03 2024 at 15:05):

There's no bundling of Fin.val as an embedding?

Jireh Loreaux (Apr 03 2024 at 15:06):

docs#Fin.valEmbedding

Kevin Cheung (Apr 03 2024 at 15:18):

Thank you. So the following works:

example : set4' = Finset.map Fin.valEmbedding set4 := rfl

Are there tricks to finding these things?

Jireh Loreaux (Apr 05 2024 at 20:10):

You can use loogle:

@loogle ⊢ Fin ?n ↪ ℕ

loogle (Apr 05 2024 at 20:10):

:search: Fin.valEmbedding


Last updated: May 02 2025 at 03:31 UTC