Zulip Chat Archive
Stream: metaprogramming / tactics
Topic: is_Type
Patrick Massot (Aug 31 2022 at 08:44):
In Lean 3, how to test whether an element of the local context has type Type ?
?
Yaël Dillies (Aug 31 2022 at 08:45):
I think you can use infer_type your_variable
to get an expr
and then match for docs#expr.sort.
Gabriel Ebner (Aug 31 2022 at 08:46):
Or in short, expr.is_sort <$> infer_type hyp
.
Patrick Massot (Aug 31 2022 at 08:47):
Silly me, I looked for expr.is_type
but not expr.is_sort
Patrick Massot (Aug 31 2022 at 08:47):
Thanks!
Patrick Massot (Aug 31 2022 at 08:49):
Except that Lean pretends expr.is_sort
doesn't exist
Gabriel Ebner (Aug 31 2022 at 08:50):
It's in mathlib. docs#expr.is_sort
Patrick Massot (Aug 31 2022 at 08:50):
I was missing an import
Last updated: Dec 20 2023 at 11:08 UTC