Zulip Chat Archive

Stream: new members

Topic: Unexpected token when deriving instance


Benjamin (May 26 2025 at 17:05):

The following code gives me an error on the final line:

import Lean
import Mathlib.Data.Rat.Init

#check 
deriving instance Lean.ToExpr for 

I get the error unexpected token 'ℚ'; expected identifier.

How can I fix this?

Aaron Liu (May 26 2025 at 17:05):

deriving instance Lean.ToExpr for Rat

Benjamin (May 26 2025 at 17:06):

This gives me an error typeclass instance problem is stuck, it is often due to metavariables.

Aaron Liu (May 26 2025 at 17:07):

Well, then I have run out of ideas, you can still write the instance manually

Notification Bot (May 26 2025 at 18:45):

16 messages were moved from this topic to #Is there code for X? > Lean.ToExpr Rat by Eric Wieser.


Last updated: Dec 20 2025 at 21:32 UTC