Zulip Chat Archive
Stream: mathlib4
Topic: printing `inferInstance`
Thomas Browning (Nov 17 2022 at 22:42):
I'm working on my first port, and ran into my first problem :D
This fails:
instance [Inhabited α] : Inhabited (Vector3 α n) :=
Pi.inhabited _
because Lean doesn't recognize Pi.inhabited
(it comes from the core of Lean3, so maybe it needs to be ported manually).
But in this case, this works:
instance my_instance [Inhabited α] : Inhabited (Fin2 n → α) :=
inferInstance
But is there any way to figure out the name of the instance that inferInstance
found?
Scott Morrison (Nov 17 2022 at 22:43):
#synth
Mario Carneiro (Nov 17 2022 at 22:44):
I am planning to make #synth [binders] : expr
work, in which case you can easily check whether an instance exists by deleting instance foo
and replace it with #synth
Mario Carneiro (Nov 17 2022 at 22:45):
But I think we can also have a linter for this
Last updated: Dec 20 2023 at 11:08 UTC