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

feat: export pretty-printed tactic states #702

Merged
merged 7 commits into from Mar 23, 2022

Conversation

dselsam
Copy link
Contributor

@dselsam dselsam commented Mar 17, 2022

This small commit, in combination with the ast parsing in mathport, together make it straightforward to produce high-quality datasets of tactic applications.
@@ -87,6 +88,7 @@ class tactic_log {

private:
mutable std::vector<tactic_invocation> m_invocs;
mutable std::vector<std::string> m_tspps; // tactic state pretty-printeds
using state_map = std::unordered_map<summary, tactic_state_id, summary_hash, summary_eq>;
mutable state_map m_state_map;
mutable std::vector<summary> m_states;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mutable std::vector<summary> m_states;
mutable std::vector<std::pair<summary, std::string>> m_states;

If you push the pp into the state array then you only ever pretty print a state once. Correspondingly, the json export should put the pretty printed state at root.states[i].pp instead of root.tspps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I just added it to the summary object instead.

dselsam added a commit to dselsam/lean3 that referenced this pull request Mar 17, 2022
os << ts.pp();
get_tspps(l).push_back(os.str());
os << s.pp();
pp = optional<std::string>(os.str());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this should not be done in summarize because that is before deduplication. It should either be like I wrote it, separate from the summary so that summarize does not produce it, or else summarize should always produce pp = none, the hash and eq should ignore this field, and it should only be set in get_id when we actually want to push it to get_states.

@PatrickMassot
Copy link
Member

What is the status of this PR?

@gebner
Copy link
Member

gebner commented Mar 23, 2022

Mario had some comments, from my side it looks good.

bors d=digama0

@bors
Copy link

bors bot commented Mar 23, 2022

✌️ digama0 can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@digama0 digama0 merged commit 848cddb into leanprover-community:master Mar 23, 2022
@digama0
Copy link
Member

digama0 commented Mar 23, 2022

Oops, I did squash and merge instead of bors. I assume it's fine?

@gebner
Copy link
Member

gebner commented Mar 23, 2022

The commit message is fugly, but I'm happy as long as it builds.

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

Successfully merging this pull request may close these issues.

None yet

4 participants