Zulip Chat Archive
Stream: general
Topic: Sorry of wrong type!
Moses Schönfinkel (Mar 21 2018 at 10:34):
Heh...
type mismatch at field 'le_refl' sorry has type ∀ (a : α), ?m_1 a a but is expected to have type ∀ (a : α), a ≤ a
Mario Carneiro (Mar 21 2018 at 10:35):
did you put sorry
for the definition of le
as well?
Mario Carneiro (Mar 21 2018 at 10:36):
le := _, le_refl := sorry
will error
Moses Schönfinkel (Mar 21 2018 at 10:36):
Yes :). I just sorried everything to build it incrementally, I know I don' goof'd, it's just amusing that sorry can actually fail to typecheck.
Moses Schönfinkel (Mar 21 2018 at 10:36):
Indeed! :)
Moses Schönfinkel (Mar 21 2018 at 10:37):
It's the first time I've seen sorry
being red-squiggled in Lean
Mario Carneiro (Mar 21 2018 at 10:38):
I think it is having difficulty unifying the types, this would happen also if you tried to use something of type \forall {x : Type*}. x
Moses Schönfinkel (Mar 21 2018 at 10:43):
So I guess sorry first needs to know the type and then gives you a bogus term thereof, rather than just "closing the goal" as if by magic? Would the latter behaviour lead to weirdness in scenarios where something depends on a (presumably temporary) sorry?
Mario Carneiro (Mar 21 2018 at 10:44):
I think the problem has to do with unresolved metavariables in the type
Mario Carneiro (Mar 21 2018 at 10:46):
You should always be able to sorry everything, but you have to work from the beginning, from the nondependent sorry
s to the dependent ones
Moses Schönfinkel (Mar 21 2018 at 10:48):
Right. It's just interesting that sorry cares about anything at all :)! So for example, { le := sorry, le_refl := sorry ... }
would work but { le := _, le_refl := sorry ... }
would not.
Kevin Buzzard (Mar 21 2018 at 11:04):
I got sorry red-squiggled about 2 weeks ago, for probably the first time. I awarded myself an achievement.
Mario Carneiro (Mar 21 2018 at 11:06):
It's like the dual problem of proving an inconsistency :)
Kevin Buzzard (Mar 21 2018 at 11:23):
Last updated: Dec 20 2023 at 11:08 UTC