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

Prohibitively long elaboration times for inductive types with many constructors #654

Closed
1 task done
cpehle opened this issue Sep 5, 2021 · 1 comment
Closed
1 task done

Comments

@cpehle
Copy link
Contributor

cpehle commented Sep 5, 2021

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

Elaboration of simple inductive datatypes with >200 constructors takes a long time, this is a problem if one wants to generate code for C++ enums (libclang in this example).

Steps to Reproduce

Invoke lean out.lean --profile --c=out.c on the supplied file.

Expected behavior: Elaboration finishes in a reasonable amount of time.

Actual behavior:

elaboration took 1.07e+03s
out.lean:1:0: error: (deterministic) timeout at 'whnf', maximum number of heartbeats (50000) has been reached (use 'set_option maxHeartbeats <num>' to set the limit)
cumulative profiling times:
	elaboration 1.07e+03s
	import 15.1ms
	initialization 15.2ms
	interpretation 0.878ms
	parsing 2.21ms

out.lean.zip

Reproduces how often: 100%

@leodemoura
Copy link
Member

The commit above adds the command enum for declaring big enumeration types.
See example in the commit.

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

No branches or pull requests

2 participants