-
Notifications
You must be signed in to change notification settings - Fork 56
add garbage collection option #83
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
Open
RexWzh
wants to merge
14
commits into
leanprover-community:master
Choose a base branch
from
Lean-zh:gc-option
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4ab23f9
add gc option
RexWzh 8e88e86
add gc option tests
RexWzh cf63ddc
update readme
RexWzh 75643c6
Merge branch 'master' into gc-option
RexWzh bac41b9
@ohyeat: replace loop by tail recursion
RexWzh f867ab2
rename `gc` to `discard`
RexWzh 91abba5
rename discard to record
RexWzh edc5079
record for proof states
RexWzh 4979b94
Merge branch 'master' into gc-option
RexWzh b1cb4e7
rename tests
RexWzh d374f1b
update test scripts
RexWzh 42d2bc7
Merge remote-tracking branch 'origin/master' into gc-option
RexWzh a66d357
Merge branch 'fix-tests' into gc-option
RexWzh 3d71944
fix error test
RexWzh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{"env": 0} | ||
|
||
{"sorries": | ||
[{"proofState": 0, | ||
"pos": {"line": 1, "column": 93}, | ||
"goal": "⊢ (2000 + 2001 + 2002 + 2003 + 2004 + 2005 + 2006) % 7 = 0", | ||
"endPos": {"line": 1, "column": 98}}], | ||
"messages": | ||
[{"severity": "warning", | ||
"pos": {"line": 1, "column": 8}, | ||
"endPos": {"line": 1, "column": 30}, | ||
"data": "declaration uses 'sorry'"}]} | ||
|
||
{"proofStatus": "Completed", "proofState": 1, "goals": []} | ||
|
||
{"sorries": | ||
[{"proofState": 2, | ||
"pos": {"line": 1, "column": 93}, | ||
"goal": "⊢ (2000 + 2001 + 2002 + 2003 + 2004 + 2005 + 2006) % 7 = 0", | ||
"endPos": {"line": 1, "column": 98}}], | ||
"messages": | ||
[{"severity": "warning", | ||
"pos": {"line": 1, "column": 8}, | ||
"endPos": {"line": 1, "column": 30}, | ||
"data": "declaration uses 'sorry'"}], | ||
"env": 1} | ||
|
||
{"proofStatus": "Completed", "proofState": 3, "goals": []} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{"cmd": "import Mathlib"} | ||
|
||
{"cmd": "theorem mathd_numbertheory_345 : (2000 + 2001 + 2002 + 2003 + 2004 + 2005 + 2006) % 7 = 0 := sorry", "env":0, "record": false} | ||
|
||
{"tactic": "norm_num", "proofState": 0} | ||
|
||
{"cmd": "theorem mathd_numbertheory_345 : (2000 + 2001 + 2002 + 2003 + 2004 + 2005 + 2006) % 7 = 0 := sorry", "env":0} | ||
|
||
{"tactic": "norm_num", "proofState": 2} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{"env": 0} | ||
|
||
{"messages": | ||
[{"severity": "info", | ||
"pos": {"line": 1, "column": 0}, | ||
"endPos": {"line": 1, "column": 5}, | ||
"data": "true"}]} | ||
|
||
{"message": "Unknown environment."} | ||
|
||
{"messages": | ||
[{"severity": "info", | ||
"pos": {"line": 1, "column": 0}, | ||
"endPos": {"line": 1, "column": 5}, | ||
"data": "37"}], | ||
"env": 1} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{"cmd": "def f := 37"} | ||
|
||
{"cmd": "#eval true", "record": false} | ||
|
||
{"cmd": "#eval false", "env":1} | ||
|
||
{"cmd": "#eval f", "env":0} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{"messages": | ||
[{"severity": "error", | ||
"pos": {"line": 1, "column": 20}, | ||
"endPos": null, | ||
"data": "unexpected end of input; expected '{'"}, | ||
{"severity": "error", | ||
"pos": {"line": 1, "column": 18}, | ||
"endPos": {"line": 1, "column": 20}, | ||
"data": "unsolved goals\n⊢ 2 = 2"}], | ||
"env": 0} | ||
|
||
{"env": 1} | ||
|
||
{"messages": | ||
[{"severity": "error", | ||
"pos": {"line": 1, "column": 66}, | ||
"endPos": null, | ||
"data": "unexpected end of input; expected '{'"}, | ||
{"severity": "error", | ||
"pos": {"line": 1, "column": 64}, | ||
"endPos": {"line": 1, "column": 66}, | ||
"data": "unsolved goals\nP Q R : Prop\n⊢ (P → Q) → (Q → R) → P → R"}]} | ||
|
||
{"messages": | ||
[{"severity": "error", | ||
"pos": {"line": 1, "column": 64}, | ||
"endPos": {"line": 2, "column": 13}, | ||
"data": "unsolved goals\nP Q R : Prop\nh1 : P → Q\nh2 : Q → R\np : P\n⊢ R"}]} | ||
|
||
{"messages": | ||
[{"severity": "info", | ||
"pos": {"line": 3, "column": 0}, | ||
"endPos": {"line": 3, "column": 6}, | ||
"data": "Try this: exact h2 (h1 p)"}]} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{"cmd": "example : 2=2 := by"} | ||
|
||
{"cmd": "example : 2=2 := by\nrfl"} | ||
|
||
{"cmd": "theorem gc_demo (P Q R : Prop) : (P → Q) → (Q → R) → (P → R) := by", "record": false} | ||
|
||
{"cmd": "theorem gc_demo (P Q R : Prop) : (P → Q) → (Q → R) → (P → R) := by\nintro h1 h2 p", "record": false} | ||
|
||
{"cmd": "theorem gc_demo (P Q R : Prop) : (P → Q) → (Q → R) → (P → R) := by\nintro h1 h2 p\napply?", "record": false} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand here: if we're generating
proofState: 0
here, and it is actually usable, then the environment has been transitively captured, and therecord: false
wasn't really respected.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rex said that you can garbage collect the command that created the proof snapshot without garbage collecting the proof snapshot itself. I'm not sure what the use case for this would be tho. Also I think having each proof snapshot connected to a command would make it easier to garbage collect all the snapshots after you are done with tactic mode for a particular problem.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can check the green(garbage collected) and yellow lines in the diagram above. Here are the relevant commands:
The
ProofSnapshot
is independent of thecmdSnapshot
once created. The structure provides sufficient information for interactions and pickles.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can view it this way: in Cmd mode,
record
is intended for cmdSnapshot-gc, while in Tactic mode, it's for proofSnapshot.And it can be used as default config for tactic-based interactions, as the generated cmdSnapshots are rarely used since they contain
sorry
.If someone wishes to obtain the state while discarding both the cmdSnapshot and proofSnapshot, they can use the File mode like:
And then extract the states from errors.
btw, this feature is beneficial for File-mode-based interactions like itp-interfaces, where most generated cmdStates are wasted due to incomplete errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh so command snapshots are only necessary to create additional command states. Which rarely happens for a single proof. Like usually u would only want to snapshot import headers and stuff