leanprover-community / leanprover-community/repl
Pickling-unpickling an environment makes definitions noncomputable?
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 228
- Forks
- 69
- Avg merge
- 15m
- Merged PRs (30d)
- 4
Description
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!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Reproduce the reported sequence in the REPL: define x, pickle env 0, unpickle it, then define y using x; compare it with the unpickled environment's behavior. Trace the pickling and environment-restoration entry points, and consider the issue done when the restored definition remains computable or the behavior is documented as intended.
Written by the indexing model from the issue text.
Assessment
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100