Zulip Chat Archive

Stream: Is there code for X?

Topic: Scientific literals for Pi types


Eric Wieser (Jan 07 2026 at 15:19):

Am I right in thinking the following is missing? Should we have it?

instance Pi.instOfScientific {ι : Type*} {α : ι  Type*} [ i, OfScientific (α i)] : OfScientific (Π i, α i) where
  ofScientific m s e := fun _ => OfScientific.ofScientific m s e

@[simp]
theorem Pi.ofScientific_apply {ι : Type*} {α : ι  Type*} [ i, OfScientific (α i)] (m : Nat) (s : Bool) (e : Nat) (i : ι) :
    (OfScientific.ofScientific m s e : Π i, α i) i = OfScientific.ofScientific m s e :=
  rfl

Eric Wieser (Jan 07 2026 at 15:21):

With motivation:

-- already works
#check (3 : Fin 3  )
#check (3 : Fin 3  )

-- needs this instance
#check (3.7 : Fin 3  )
#check (3.7 : Fin 3  )

Last updated: Feb 28 2026 at 14:05 UTC