Skip to content

[Merged by Bors] - feat(Tactic/ExtractGoal + test/ExtractGoal): port extract_goal tactic#4595

Closed
adomani wants to merge 22 commits intomasterfrom
adomani_extractGoal
Closed

[Merged by Bors] - feat(Tactic/ExtractGoal + test/ExtractGoal): port extract_goal tactic#4595
adomani wants to merge 22 commits intomasterfrom
adomani_extractGoal

Conversation

@adomani
Copy link
Copy Markdown
Contributor

@adomani adomani commented Jun 2, 2023

This is a first PR porting some of the functionality of the extract_goal tactic from mathlib3.


It is my first attempt at porting a tactic, so do not restrain yourself from providing copious comments!

Open in Gitpod

@adomani adomani added awaiting-review modifies-tactic-syntax This PR adds a new interactive tactic or modifies the syntax of an existing tactic. labels Jun 2, 2023
@adomani adomani changed the title feat(Tactic/extractGoal + test/extractGoal): port extractGoal tactic feat(Tactic/extractGoal + test/extractGoal): port extract_goal tactic Jun 2, 2023
@adomani adomani changed the title feat(Tactic/extractGoal + test/extractGoal): port extract_goal tactic feat(Tactic/ExtractGoal + test/ExtractGoal): port extract_goal tactic Jun 2, 2023
@alexjbest alexjbest added the t-meta Tactics, attributes or user commands label Jun 5, 2023
@alexjbest
Copy link
Copy Markdown
Member

I'm sorry I don't have time to make this comment more precise right now (so maybe its just a useless comment), but part of me can't help feeling some of this approach is a bit low-tech somehow? e.g. there is a lot of manual matching on and joining of strings. Although I don't know precisely how to do it immediately I would quite like to see a version of this PR that targets Syntax rather than strings/format, and uses the built in delaborators more somehow.
Of course if it gets good results as is then maybe we shouldn't worry too much right now, and maybe merge this and discuss whether a shorter/cleaner implementation is possible later, but if you were interested I think it would be good to play with a more Syntaxey version (I'd also like to try more seriously, but unfortunately can't this week)

@adomani
Copy link
Copy Markdown
Contributor Author

adomani commented Jun 5, 2023

Alex, I see what you are saying, although I do not really know how to actually put it in practice. I'm all for learning how to work with Syntax, but I am not really sure where to start.

When you have the time, I'd be happy to hear some suggestions! In the meantime, I'll see that I can find!

@kim-em kim-em added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 12, 2023
@kim-em kim-em added merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) and removed merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) labels Jun 27, 2023
@kim-em kim-em removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 12, 2023
@adomani
Copy link
Copy Markdown
Contributor Author

adomani commented Aug 2, 2023

I will add a test that the extracted goal proves the given goal and emit a warning otherwise. However, I do not have time to do it right now!

@adomani
Copy link
Copy Markdown
Contributor Author

adomani commented Aug 2, 2023

I tried and failed. I am unable to get my hands on the output of logInfo msg, in order to parse it again. If I had that, then I would

  • make sure that it parses with no issues, other than the sorry;
  • check that the new declaration actually closes the initial goal.

I have added a couple of examples to the docs-module containing examples that would form good tests, if the above were implemented.

Still, I think that the tactic already works very well as is and these improvements could come later on.

An option would be to add something like extract_goal [...] pp.all to specify that you want the full, round-tripping expression.

@adomani
Copy link
Copy Markdown
Contributor Author

adomani commented Aug 2, 2023

@kmill, CI failed to build the tests, since #guard_msgs complained for the pp.all output. Does CI remove pp-options and hence the test will check against the non-pp.all message?

I am running CI again to test this, but maybe you already know what the issue it!

@kmill
Copy link
Copy Markdown
Contributor

kmill commented Aug 2, 2023

I'm not sure this is a CI issue per se, since it could be a difference between Lean in an editor and Lean on the command line. Maybe the options aren't actually guaranteed to be propagated into the pretty printer at line 135? I can take a look later.

@adomani
Copy link
Copy Markdown
Contributor Author

adomani commented Aug 2, 2023

I looked closer at the diff: the current hypothesis is that

  • my computer displays funs as fun ... ↦ ...,
  • CI displays funs as fun ... => ....

@adomani
Copy link
Copy Markdown
Contributor Author

adomani commented Aug 2, 2023

Yes, it seems to be this: on my local version, #guard_msgs complains that the outputs do not match, because of the fun arrow. On GitHub, though, the PR has passed the tests, so that #guard_msgs liked what it received.

@kmill
Copy link
Copy Markdown
Contributor

kmill commented Aug 2, 2023

Ok, that's a known issue then. Add set_option pp.unicode.fun true to the top of the tests file.

@kmill
Copy link
Copy Markdown
Contributor

kmill commented Aug 2, 2023

Thanks!

bors r+

In a followup PR, feel free to add this to Mathlib.Tactic.Common so that it's readily available.

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Aug 2, 2023
bors bot pushed a commit that referenced this pull request Aug 2, 2023
…ic (#4595)

This is a first PR porting some of the functionality of the `extract_goal` tactic from mathlib3.



Co-authored-by: Alex J Best <alex.j.best@gmail.com>
@bors
Copy link
Copy Markdown

bors bot commented Aug 2, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title feat(Tactic/ExtractGoal + test/ExtractGoal): port extract_goal tactic [Merged by Bors] - feat(Tactic/ExtractGoal + test/ExtractGoal): port extract_goal tactic Aug 2, 2023
@bors bors bot closed this Aug 2, 2023
@bors bors bot deleted the adomani_extractGoal branch August 2, 2023 16:24
kim-em pushed a commit that referenced this pull request Aug 3, 2023
…ic (#4595)

This is a first PR porting some of the functionality of the `extract_goal` tactic from mathlib3.



Co-authored-by: Alex J Best <alex.j.best@gmail.com>
kim-em pushed a commit that referenced this pull request Aug 3, 2023
…ic (#4595)

This is a first PR porting some of the functionality of the `extract_goal` tactic from mathlib3.



Co-authored-by: Alex J Best <alex.j.best@gmail.com>
bors bot pushed a commit that referenced this pull request Aug 6, 2023
As suggested in the now-merged #4595, introducing `extract_goal`, this PR adds `extract_goal` to the list of "Common" tactics.
kim-em pushed a commit that referenced this pull request Aug 14, 2023
…ic (#4595)

This is a first PR porting some of the functionality of the `extract_goal` tactic from mathlib3.



Co-authored-by: Alex J Best <alex.j.best@gmail.com>
kim-em pushed a commit that referenced this pull request Aug 14, 2023
As suggested in the now-merged #4595, introducing `extract_goal`, this PR adds `extract_goal` to the list of "Common" tactics.
bors bot pushed a commit that referenced this pull request Aug 28, 2023
…tract_goal` (#6707)

`extract_goal` has been implemented in #4595. 

Currently `import Mathlib.Mathport.Syntax` (or `import Mathlib`) overwrites this with a placeholder syntax yielding: `tactic 'Mathlib.Tactic.extractGoal' has not been implemented`




Co-authored-by: Kyle Miller <kmill31415@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modifies-tactic-syntax This PR adds a new interactive tactic or modifies the syntax of an existing tactic. ready-to-merge This PR has been sent to bors. t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants