Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inexplicably slow type class inference #398

Closed
1 task
robertylewis opened this issue Jul 20, 2020 · 0 comments
Closed
1 task

inexplicably slow type class inference #398

robertylewis opened this issue Jul 20, 2020 · 0 comments

Comments

@robertylewis
Copy link
Member

To add yet another problem to @gebner 's plate:

import data.mv_polynomial

universes u v w

section
variables {σ : Type u} (R : Type v) [cr : comm_ring R]
include cr
noncomputable def p : semiring (mv_polynomial σ R) := infer_instance

#check (infer_instance :
@algebra R (@ mv_polynomial σ R (@comm_ring.to_comm_semiring _ cr))
           (@comm_ring.to_comm_semiring _ cr) (@p σ R cr))

The infer_instance is quite slow on my laptop (~2 sec) even though it succeeds with the first instance it tries. Changing infer_instance to by apply_instance, or rephrasing it to appear after the := of an example, makes the inference instant. This suggests it might have something to do with an unfrozen cache.

I really don't know where this is coming from so I'm not sure how to un-mathlib it.

Possibly related to #397

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

[Description of the issue]

Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [and so on...]

Expected behavior: [What you expect to happen]

Actual behavior: [What actually happens]

Reproduces how often: [What percentage of the time does it reproduce?]

Versions

You can get this information from copy and pasting the output of lean --version,
please include the OS and what version of the OS you're running.

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant