feat: use supplied structure fields left to right and eta reduce terms in structure instance elaboration#2478
Conversation
|
Thanks for your contribution! Please make sure to follow our Commit Convention. |
0c0c9d4 to
89ea1d4
Compare
|
awaiting-review |
|
awaiting-author |
|
Thanks for the comments. Hopefully, they are addressed with these changes. awaiting-review |
|
awaiting-author |
|
awaiting-review |
|
Can you please rebase on master so we get a mathlib-compatible release to try out? |
|
@mattrobball You appear to have accidently committed |
|
There's no associated mathlib PR for this at the moment, right? |
eric-wieser
left a comment
There was a problem hiding this comment.
Whoops, I never submitted these suggestions:
|
awaiting-review |
|
Note the substantial speedup to mathlib which comes with this PR. |
kmill
left a comment
There was a problem hiding this comment.
Thanks for all the work getting this to this point! I'm looking forward to seeing this merged.
It looks good to me. I see it's not rebased onto the most current nightly, so please do that to be sure the CI goes through.
tests/lean/run/463.lean
Outdated
|
|
||
| def foo (s : C) : B := {s with} -- works in lean 4, works in lean 3 | ||
| def bar (s : D) : B := {s with} -- works in lean 4, fails in lean 3 | ||
| -- def bar (s : D) : B := {s with} -- works in lean 4, fails in lean 3 |
There was a problem hiding this comment.
Correct me if I'm wrong, you don't need to comment this out, right?
You can add a comment that this is not necessarily meant to succeed.
There was a problem hiding this comment.
Doesn’t it fail a test because this errors?
There was a problem hiding this comment.
Added a comment referencing the PR number
Modifies the structure instance elaborator to
{a, b with}, sometimes the elaboratorwould ignore
aeven if bothaandbprovided the same field, depending on what subobject fields they had.Currently, a field cannot be filled directly by a source itself resulting in the term being eta expanded.
This change avoids this unnecessary and surprisingly costly extra eta expansion.
Adds two new tests to illustrate the performance benefit (one courtesy @semorrison). These are currently failing on master and succeed on this branch.
There is one additional test to exercise the changes to the elaboration of structure instances.
Changes to make mathlib build are in leanprover-community/mathlib4#9843
Closes #2451