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: display coercions with a type ascription #6119

Merged
merged 4 commits into from
Nov 21, 2024
Merged

Conversation

tonyxty
Copy link
Contributor

@tonyxty tonyxty commented Nov 18, 2024

This PR adds a new delab option pp.coercions.types which, when enabled, will display all coercions with an explicit type ascription.

Link to Zulip discussion

Towards #4315

@tonyxty tonyxty requested a review from kmill as a code owner November 18, 2024 14:08
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Nov 18, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Nov 18, 2024

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 799b2b662825e646609963921f2c68489b2e664a --onto a074bd9a2bd20cc470fbff4f80f2cd7b51ec0d0a. (2024-11-18 14:37:01)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 799b2b662825e646609963921f2c68489b2e664a --onto 5a99cb326c9e9052e135cc63ed02b63371cff6d3. (2024-11-19 01:49:13)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 799b2b662825e646609963921f2c68489b2e664a --onto 4600bb16fcded0356d20ae232e7f8580c56a5955. (2024-11-20 01:03:11)

@kmill kmill added the changelog-pp Pretty printing label Nov 18, 2024
@kmill
Copy link
Collaborator

kmill commented Nov 18, 2024

By the way, I edited the PR description to say "towards" instead of "closes" because I think there are things we can do to pp.analyze once we have the pp config flag from this PR, though I'm not sure we should touch pp.analyze right now.

If it's something you want to try working on, and you are OK with your work potentially being discarded, feel free to go ahead. I just wrote up some ideas for how to do it intelligently, but I deleted them because it's unclear whether it would actually work. Probably the simplest for now would be to make pp.analyze tag all coercions with this new pp.coercions.types flag.

@tonyxty
Copy link
Contributor Author

tonyxty commented Nov 19, 2024

I changed the new option to default to false. It makes sense for two reasons: compatibility with current tests, and looking disruptive in the infoview.

If it's something you want to try working on

It seems to me that it belongs to a separate PR. Shall we discuss how to proceed on Zulip before I start working on pp.analyze?

@kmill
Copy link
Collaborator

kmill commented Nov 19, 2024

Could you please add some tests? How about in tests/lean/run/coeAttr.lean, and use module docstrings like in lean/run/conv_arg.lean to say what each test is trying to accomplish. Two tests, one with the option false and one with the option true, should be sufficient.

@kim-em kim-em added the awaiting-author Waiting for PR author to address issues label Nov 19, 2024
@tonyxty tonyxty requested a review from kmill November 21, 2024 02:56
@tonyxty
Copy link
Contributor Author

tonyxty commented Nov 21, 2024

I've added some very basic tests.

@kmill kmill added this pull request to the merge queue Nov 21, 2024
Merged via the queue into leanprover:master with commit 9903169 Nov 21, 2024
14 checks passed
JovanGerb pushed a commit to JovanGerb/lean4 that referenced this pull request Jan 21, 2025
This PR adds a new delab option `pp.coercions.types` which, when
enabled, will display all coercions with an explicit type ascription.

[Link to Zulip
discussion](https://leanprover.zulipchat.com/#narrow/channel/239415-metaprogramming-.2F-tactics/topic/Roundtripping.20delaboration.20involving.20coercions)

Towards leanprover#4315
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author Waiting for PR author to address issues changelog-pp Pretty printing toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants