Zulip Chat Archive
Stream: lean4
Topic: higher order unification failure
Kevin Buzzard (Nov 08 2022 at 23:40):
In Lean 3 this worked:
example (α β : Type) (a a' : α) (b : β) (rβ : β → β → Prop) (f : α → β) (he: f a' = b)
(h : rβ b (f a)) : rβ (f a') (f a) :=
he.substr h
In Lean 4 I seem to need to tell Lean the motive:
example (α β : Type) (a a' : α) (b : β) (rβ : β → β → Prop) (f : α → β) (he: f a' = b)
(h : rβ b (f a)) : rβ (f a') (f a) :=
--he.substr h -- higher unification gets confused
he.substr (p := λ x => rβ x (f a)) h -- tell it the motive and it's fine
I know this is higher order unification and one can't expect miracles, this post is mainly to check that behaviour like this is expected (e.g. the unification algorithm has changed). This came up when porting logic.relation
.
Gabriel Ebner (Nov 08 2022 at 23:46):
https://github.com/leanprover/lean4/issues/1806
Kevin Buzzard (Nov 09 2022 at 00:01):
@David Renshaw are you also porting logic.relation? I don't want to duplicate work. I had claimed it on the wiki but you're welcome to have it (I had got up to line 190). I am on a long train journey from Bonn to London starting in 8 hours and it would be great to know whether I should start on another file.
David Renshaw (Nov 09 2022 at 00:02):
I started on it, but then saw that we need the mk_iff
attribute. So I'm working on mk_iff
now.
David Renshaw (Nov 09 2022 at 00:04):
(Status of mk_iff
is that currently I can generate the correct theorems, but their proofs are sorried.)
Kevin Buzzard (Nov 09 2022 at 00:04):
Yeah, I'd just got to that point. I decided that I would just make the iffs manually :-)
Kevin Buzzard (Nov 09 2022 at 00:04):
So do you want to keep going on mk_iff
and I'll spend the train journey tomorrow doing the rest of logic.relation
? Are you much further ahead than me? Or shall I just get out of your hair, change the wiki to you, and do another file?
David Renshaw (Nov 09 2022 at 00:05):
You're probably exactly where I got to, and I don't intend to continue in the immediate future.
Kevin Buzzard (Nov 09 2022 at 00:06):
OK great, I'll keep going. I am exactly at the first mk_iff
. I won't make the iff! (I might add that I am in no position to make attributes but can just about port mathlib files)
David Renshaw (Nov 09 2022 at 00:09):
In case you want to test out the attribute:
https://github.com/leanprover-community/mathlib4/pull/561.
It should work, but the proofs are sorried and there are still a bunch of verbose dbg_trace
statements.
David Renshaw (Nov 09 2022 at 22:01):
I think I have a complete implementation of mk_iff
now: https://github.com/leanprover-community/mathlib4/pull/561
Kevin Buzzard (Nov 09 2022 at 22:27):
Thanks! I'll try and find the time tomorrow to put everything together but it's my first day back at work after a week of travelling so who knows.
Kevin Buzzard (Nov 09 2022 at 22:28):
I should say that I have a branch with logic.relation ported apart from the last few lemmas
Last updated: Dec 20 2023 at 11:08 UTC