Zulip Chat Archive

Stream: Is there code for X?

Topic: Converting a Fin n → X to an ℕ →₀ X


Niels Voss (Dec 23 2025 at 23:51):

What is the best way to convert a Fin n → X finvec to a ℕ →₀ X? We have been using

import Mathlib
opaque n : 
opaque f : Fin n  
noncomputable def g :  →₀  := Finsupp.embDomain Fin.valEmbedding (Finsupp.ofSupportFinite f (Set.toFinite _))

but I would like to know if there is a better way.

Yaël Dillies (Dec 24 2025 at 07:35):

That looks okay to me!


Last updated: Feb 28 2026 at 14:05 UTC