Zulip Chat Archive

Stream: new members

Topic: Baffling error: unknown identifier


Kevin Cheung (Jan 23 2024 at 13:00):

Why does Lean complain that ℕ is an unknown identifier in the second line but not the first line?
Screenshot-2024-01-23-at-7.59.54AM.png

Damiano Testa (Jan 23 2024 at 13:01):

I think that the notation for Nat is defined in Mathlib: try importing (almost) anything from Mathlib and it should work.

Kevin Cheung (Jan 23 2024 at 13:02):

Thank you. It worked.

Kevin Cheung (Jan 23 2024 at 13:05):

The reason it doesn't complain about the first line is because it treats ℕ as an arbitrary type? (i.e. it could have been some other letter, say Q?)

Ruben Van de Velde (Jan 23 2024 at 13:06):

Yeah, I think so. Try #check f

Damiano Testa (Jan 23 2024 at 13:06):

That has to do with autoImplicits. If you add set_option autoImplicit false at the beginning of the file, it will error earlier.

Kevin Cheung (Jan 23 2024 at 13:07):

Thanks to both of you. This is very helpful.


Last updated: May 02 2025 at 03:31 UTC