[Merged by Bors] - feat: add fast_instance% elaborator#11521
[Merged by Bors] - feat: add fast_instance% elaborator#11521eric-wieser wants to merge 12 commits intomasterfrom
fast_instance% elaborator#11521Conversation
|
!bench |
|
Here are the benchmark results for commit 02e5f99. |
|
!bench |
|
Here are the benchmark results for commit f31997b. |
|
Ping me when ready. I think metaprogramming to hide preferred parent and even intermediate structure internals is the future and am glad this got started. |
|
Feel free to push things to this branch to get linting passing, so that we have a benchmark. |
|
!bench |
|
Here are the benchmark results for commit ce19211. |
|
!bench |
|
One comment: I think |
|
!bench |
Sure, that sounds reasonable; though I'll refrain from doing so until I have a benchmark that indicates this actually helps. |
|
Here are the benchmark results for commit 3e91dd1. Benchmark Metric Change
============================================================================
+ ~Mathlib.AlgebraicGeometry.GammaSpecAdjunction instructions -11.0%
+ ~Mathlib.AlgebraicGeometry.Spec instructions -13.0%
+ ~Mathlib.FieldTheory.AbelRuffini instructions -10.3%
+ ~Mathlib.FieldTheory.Adjoin instructions -8.9%
+ ~Mathlib.FieldTheory.PurelyInseparable instructions -13.0%
+ ~Mathlib.FieldTheory.SeparableDegree instructions -20.0%
+ ~Mathlib.FieldTheory.Subfield instructions -14.6%
+ ~Mathlib.FieldTheory.Subfield.Order instructions -76.7%
+ ~Mathlib.NumberTheory.NumberField.CanonicalEmbedding instructions -7.6%
+ ~Mathlib.NumberTheory.NumberField.ClassNumber instructions -17.6%
+ ~Mathlib.NumberTheory.NumberField.Discriminant instructions -8.5%
+ ~Mathlib.NumberTheory.NumberField.FractionalIdeal instructions -20.4%
+ ~Mathlib.NumberTheory.NumberField.Units instructions -6.1%
+ ~Mathlib.RingTheory.Subring.Order instructions -79.3%
+ ~Mathlib.RingTheory.Subsemiring.Order instructions -64.4% |
|
That is pretty good |
|
I think the changes in #11029 should be useful to focus the use of the compactor. There I just make versions of |
|
Huh, I guess the benchmark doesn't care about shake output; so we're going to get a repeat. What this doesn't tell us is which |
|
|
||
| instance strictOrderedSemiring [StrictOrderedSemiring α] : | ||
| StrictOrderedSemiring { x : α // 0 ≤ x } := | ||
| -- fast_instance% -- TODO: fix |
There was a problem hiding this comment.
There's something weird happening with a free variable on this one.
|
Here are the benchmark results for commit 27f7d47. Benchmark Metric Change
============================================================================
+ ~Mathlib.AlgebraicGeometry.GammaSpecAdjunction instructions -11.0%
+ ~Mathlib.AlgebraicGeometry.Spec instructions -13.0%
+ ~Mathlib.FieldTheory.AbelRuffini instructions -10.3%
+ ~Mathlib.FieldTheory.Adjoin instructions -8.9%
+ ~Mathlib.FieldTheory.PurelyInseparable instructions -13.0%
+ ~Mathlib.FieldTheory.SeparableDegree instructions -20.0%
+ ~Mathlib.FieldTheory.Subfield instructions -14.6%
+ ~Mathlib.FieldTheory.Subfield.Order instructions -76.7%
+ ~Mathlib.NumberTheory.NumberField.CanonicalEmbedding instructions -7.6%
+ ~Mathlib.NumberTheory.NumberField.ClassNumber instructions -17.6%
+ ~Mathlib.NumberTheory.NumberField.Discriminant instructions -8.5%
+ ~Mathlib.NumberTheory.NumberField.FractionalIdeal instructions -20.4%
+ ~Mathlib.NumberTheory.NumberField.Units instructions -6.1%
+ ~Mathlib.RingTheory.Subring.Order instructions -79.3%
+ ~Mathlib.RingTheory.Subsemiring.Order instructions -64.4% |
|
!bench |
|
|
|
Here are the benchmark results for commit d633325. Benchmark Metric Change
============================================================================
+ ~Mathlib.AlgebraicGeometry.GammaSpecAdjunction instructions -11.0%
+ ~Mathlib.AlgebraicGeometry.Spec instructions -13.0%
+ ~Mathlib.FieldTheory.AbelRuffini instructions -45.4%
+ ~Mathlib.FieldTheory.Adjoin instructions -9.9%
+ ~Mathlib.FieldTheory.PurelyInseparable instructions -13.1%
+ ~Mathlib.FieldTheory.SeparableDegree instructions -20.4%
+ ~Mathlib.FieldTheory.Subfield instructions -14.6%
+ ~Mathlib.FieldTheory.Subfield.Order instructions -76.7%
+ ~Mathlib.NumberTheory.NumberField.CanonicalEmbedding instructions -7.7%
+ ~Mathlib.NumberTheory.NumberField.ClassNumber instructions -17.6%
+ ~Mathlib.NumberTheory.NumberField.Discriminant instructions -8.5%
+ ~Mathlib.NumberTheory.NumberField.FractionalIdeal instructions -20.4%
+ ~Mathlib.NumberTheory.NumberField.Units instructions -6.1%
+ ~Mathlib.NumberTheory.RamificationInertia instructions -3.9%
+ ~Mathlib.RingTheory.Subring.Order instructions -79.3%
+ ~Mathlib.RingTheory.Subsemiring.Order instructions -64.4% |
PR summary 37b82b8ef1Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
Co-authored-by: grunweg <rothgami@math.hu-berlin.de>
PR summary d0a3b12d12Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
PR summary 8e6f7431b6Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
!bench |
|
Should there also be a test with a measure of some heartbeat count that is smaller with |
Co-authored-by: damiano <adomani@gmail.com>
PR summary 92e327721cImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
Here are the benchmark results for commit 8e6f743. |
|
|
Of course, I forgot that the applications are split off now. |
|
I wonder why the PR summary now posts a new comment, rather than updating the old ones. It seems to be limited to this PR, though. |
PR summary 55bc9b1daaImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
#20993 has the original changes mostly working on a current master. |
PR summary 56ec6a243bImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
Given the effects of #20933, I will merge this in ~3 hours (after classes) unless anyone objects. |
|
bors merge |
Quoting the docstring: `fast_instance% inst` takes an expression for a typeclass instance `inst`, and unfolds it into constructor applications that leverage existing instances. For instance, when used as ```lean instance instSemiring : Semiring X := sorry instance instRing : Ring X := fast_instance% Function.Injective.ring .. ``` this will define `instRing` as a nested constructor application that refers to `instSemiring`. The advantage is then that `instRing.toSemiring` unifies almost immediately with `instSemiring`, rather than having to break it down into smaller pieces. Related to #7432 Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Matthew Robert Ballard <100034030+mattrobball@users.noreply.github.com>
|
Pull request successfully merged into master. Build succeeded: |
fast_instance% elaboratorfast_instance% elaborator
Quoting the docstring:
fast_instance% insttakes an expression for a typeclass instanceinst, and unfolds it intoconstructor applications that leverage existing instances.
For instance, when used as
this will define
instRingas a nested constructor application that refers toinstSemiring.The advantage is then that
instRing.toSemiringunifies almost immediately withinstSemiring,rather than having to break it down into smaller pieces.
Related to #7432