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

Pickling-unpickling an environment makes definitions noncomputable? #62

Open
augustepoiroux opened this issue Dec 15, 2024 · 0 comments

Comments

@augustepoiroux
Copy link

augustepoiroux commented Dec 15, 2024

Hello!

I was playing with the pickling / unpickling feature of the REPL and I got the following result:
If I run def x := 1 then def y := x + 1, I get the following output:

{"cmd": "def x := 1"}

{"env": 0}

{"cmd": "def y := x + 1", "env": 0}

{"env": 1}

However, if I instead pickle and unpickle env 0, I get this:

{"cmd": "def x := 1"}

{"env": 0}

{"pickleTo": "def_test.olean", "env": 0}

{"env": 0}

{"unpickleEnvFrom": "def_test.olean"}

{"env": 1}

{"cmd": "def y := x + 1", "env": 1}

{"messages":
 [{"severity": "error",
   "pos": {"line": 1, "column": 4},
   "endPos": {"line": 1, "column": 5},
   "data":
   "failed to compile definition, consider marking it as 'noncomputable' because it depends on 'x', and it does not have executable code"}],
 "env": 2}

Which seems to indicate that x is now noncomputable. We can define y as noncomputable as well to make the command valid:

{"cmd": "noncomputable def y := x + 1", "env": 1}

{"env": 3}

I tested on the revisions v4.14.0 and v4.7.0.
Based on my understanding of Lean, this behavior seems unexpected. However, if I'm overlooking something, please let me know ^^

Thanks!

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

1 participant