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

[Merged by Bors] - feat: add commutative diagram widget #3583

Closed
wants to merge 31 commits into from

Conversation

Vtec234
Copy link
Contributor

@Vtec234 Vtec234 commented Apr 21, 2023

Adds a widget for displaying goals in the language of category theory as commutative diagrams. Examples are found in test/CommDiag.lean. The set of diagram shapes which can be visualized is extensible via the @[expr_presenter] attribute. The widget is triggered in a tactic proof using the with_panel_widgets [GoalTypePanel] tactic combinator. Support for globally enabling the widget in a given file is planned for another PR.

Continued from #363, please see there for more discussion.

@kim-em
Copy link
Contributor

kim-em commented Apr 24, 2023

This looks promising to me, and works out of the box.

From a UI perspective:

  • even when I click into examples, it took me a while to work out I needed to click on the word "default" to find the other display options. More aggressively showing the options, or indeed more aggressively just rendering a non-default option, would be preferable.
  • withPanelWidgets [SelectionPanel] is too "low-level" an incantation for someone trying to prove an actual theorem about categories to use in practice. How could be make it more user friendly to invoke?

@kim-em kim-em added WIP Work in progress awaiting-review t-meta Tactics, attributes or user commands labels Apr 24, 2023
@kim-em
Copy link
Contributor

kim-em commented Apr 28, 2023

@Vtec234, should this have the WIP label still? Do you want to do anything about my comments above (not necessary; up to you).

@eric-wieser eric-wieser added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review labels May 29, 2023
@Vtec234
Copy link
Contributor Author

Vtec234 commented May 31, 2023

Okay, it's ready! @semorrison / @eric-wieser could you check that it still works, please?

More aggressively showing the options, or indeed more aggressively just rendering a non-default option, would be preferable.

We always show a widget version over non-widget ones now, and a system for user-defined precedences between different widgets is planned.

Sometimes the nodes displayed aren't big enough for the text:

I rewrote the rendering code to be much more robust. If it ever shows an inconsistent state, it will be during loading, and the widget is grayed out then.

Can the colors be made to reflect the color scheme somehow?

They do now.

The idea would be to put show_panel_widgets [CommDiagWidget] at the top of the file, and from then on it would show up in every proof.

This is the only outstanding item left. I'd like to do it in another PR as changes to core are required.

@Vtec234 Vtec234 added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels May 31, 2023
@kim-em
Copy link
Contributor

kim-em commented Jun 7, 2023

Still works for me!

@kim-em kim-em removed the WIP Work in progress label Jun 7, 2023
@kim-em
Copy link
Contributor

kim-em commented Jun 7, 2023

bors merge

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Jun 7, 2023
bors bot pushed a commit that referenced this pull request Jun 7, 2023
Adds a widget for displaying goals in the language of category theory as commutative diagrams. Examples are found in `test/CommDiag.lean`. The set of diagram shapes which can be visualized is extensible via the `@[expr_presenter]` attribute. The widget is triggered in a tactic proof using the `with_panel_widgets [GoalTypePanel]` tactic combinator. Support for globally enabling the widget in a given file is planned for another PR.

Continued from #363, please see there for more discussion.

Co-authored-by: Wojciech Nawrocki <wjnawrocki@protonmail.com>
@bors
Copy link

bors bot commented Jun 7, 2023

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Jun 7, 2023
Adds a widget for displaying goals in the language of category theory as commutative diagrams. Examples are found in `test/CommDiag.lean`. The set of diagram shapes which can be visualized is extensible via the `@[expr_presenter]` attribute. The widget is triggered in a tactic proof using the `with_panel_widgets [GoalTypePanel]` tactic combinator. Support for globally enabling the widget in a given file is planned for another PR.

Continued from #363, please see there for more discussion.

Co-authored-by: Wojciech Nawrocki <wjnawrocki@protonmail.com>
@bors
Copy link

bors bot commented Jun 7, 2023

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Jun 7, 2023
Adds a widget for displaying goals in the language of category theory as commutative diagrams. Examples are found in `test/CommDiag.lean`. The set of diagram shapes which can be visualized is extensible via the `@[expr_presenter]` attribute. The widget is triggered in a tactic proof using the `with_panel_widgets [GoalTypePanel]` tactic combinator. Support for globally enabling the widget in a given file is planned for another PR.

Continued from #363, please see there for more discussion.

Co-authored-by: Wojciech Nawrocki <wjnawrocki@protonmail.com>
@bors
Copy link

bors bot commented Jun 7, 2023

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Jun 7, 2023
Adds a widget for displaying goals in the language of category theory as commutative diagrams. Examples are found in `test/CommDiag.lean`. The set of diagram shapes which can be visualized is extensible via the `@[expr_presenter]` attribute. The widget is triggered in a tactic proof using the `with_panel_widgets [GoalTypePanel]` tactic combinator. Support for globally enabling the widget in a given file is planned for another PR.

Continued from #363, please see there for more discussion.

Co-authored-by: Wojciech Nawrocki <wjnawrocki@protonmail.com>
@bors
Copy link

bors bot commented Jun 7, 2023

Build failed:

@jcommelin
Copy link
Member

Thanks 🎉

bors merge

bors bot pushed a commit that referenced this pull request Jun 7, 2023
Adds a widget for displaying goals in the language of category theory as commutative diagrams. Examples are found in `test/CommDiag.lean`. The set of diagram shapes which can be visualized is extensible via the `@[expr_presenter]` attribute. The widget is triggered in a tactic proof using the `with_panel_widgets [GoalTypePanel]` tactic combinator. Support for globally enabling the widget in a given file is planned for another PR.

Continued from #363, please see there for more discussion.

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>
Co-authored-by: Wojciech Nawrocki <wjnawrocki@protonmail.com>
@bors
Copy link

bors bot commented Jun 7, 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: add commutative diagram widget [Merged by Bors] - feat: add commutative diagram widget Jun 7, 2023
@bors bors bot closed this Jun 7, 2023
@bors bors bot deleted the comm-diag-widget branch June 7, 2023 10:11
j-loreaux pushed a commit that referenced this pull request Jun 7, 2023
Adds a widget for displaying goals in the language of category theory as commutative diagrams. Examples are found in `test/CommDiag.lean`. The set of diagram shapes which can be visualized is extensible via the `@[expr_presenter]` attribute. The widget is triggered in a tactic proof using the `with_panel_widgets [GoalTypePanel]` tactic combinator. Support for globally enabling the widget in a given file is planned for another PR.

Continued from #363, please see there for more discussion.

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>
Co-authored-by: Wojciech Nawrocki <wjnawrocki@protonmail.com>
qawbecrdtey pushed a commit to qawbecrdtey/greedoid-mathlib4 that referenced this pull request Jun 12, 2023
Adds a widget for displaying goals in the language of category theory as commutative diagrams. Examples are found in `test/CommDiag.lean`. The set of diagram shapes which can be visualized is extensible via the `@[expr_presenter]` attribute. The widget is triggered in a tactic proof using the `with_panel_widgets [GoalTypePanel]` tactic combinator. Support for globally enabling the widget in a given file is planned for another PR.

Continued from leanprover-community#363, please see there for more discussion.

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>
Co-authored-by: Wojciech Nawrocki <wjnawrocki@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

6 participants