Zulip Chat Archive
Stream: general
Topic: trouble defining has_coe instance
Bernd Losert (Dec 17 2021 at 15:36):
For some reason, this doesn't work:
import tactic
import order.filter.partial
noncomputable theory
open set filter classical
open_locale classical filter
open has_sup
variable a : Type*
structure convergence_space (a : Type*) :=
(converges : filter a -> a -> Prop)
attribute [class] convergence_space
open convergence_space
structure kent_convergence_space (a : Type*) extends convergence_space a :=
(kent_converges : forall {x} {l}, converges l x -> converges (sup l (pure x)) x)
attribute [class] kent_convergence_space
open kent_convergence_space
instance has_coe : (kent_convergence_space a) (convergence_space a) := {
coe := fun p, p.to_convergence_space,
}
I can't figure out what I am doing wrong here.
Adam Topaz (Dec 17 2021 at 15:52):
@Bernd Losert Do you know about unicode input? (not really related to your issue)
Bernd Losert (Dec 17 2021 at 15:53):
Yes. I am avoiding it at the moment until I get a better set up.
Adam Topaz (Dec 17 2021 at 15:54):
Ok, just checking.
Adam Topaz (Dec 17 2021 at 15:55):
The issue here is that you did not write has_coe : has_coe _ _
Adam Topaz (Dec 17 2021 at 15:55):
Instead you wrote has_coe : _ _
Adam Topaz (Dec 17 2021 at 15:56):
Also, I think the name has_coe
will cause issues. I suggest replacing the -3 line with
instance : has_coe (kent_convergence_space a) (convergence_space a) := {
and see whether lean is able to automatically generate a good name for you
Bernd Losert (Dec 17 2021 at 15:59):
A crap. It's the colon that is in the wrong spot. Duh!
Bernd Losert (Dec 17 2021 at 15:59):
Thanks for pointing that out.
Adam Topaz (Dec 17 2021 at 16:00):
No problem!
Last updated: Dec 20 2023 at 11:08 UTC