Skip to content

feat: unexpand Vector.mk #[...] _ to #v[...] #8391

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
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Rob23oba
Copy link
Contributor

@Rob23oba Rob23oba commented May 18, 2025

This PR adds an unexpander for Vector.mk that unexpands Vector.mk #[...] _ to #v[...].

-- previously:
#check #v[1, 2, 3] -- { toArray := #[1, 2, 3], size_toArray := ⋯ } : Vector Nat 3
-- now:
#check #v[1, 2, 3] -- #v[1, 2, 3] : Vector Nat 3

@Rob23oba Rob23oba requested a review from kim-em as a code owner May 18, 2025 09:38
@github-actions github-actions bot added the changelog-pp Pretty printing label May 18, 2025
@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 May 18, 2025
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 528fe0b0ed673accd37d986d80a7c49f876a3087 --onto c8290bd94221f41ae49899f0f7de71b52724ad7e. You can force Mathlib CI using the force-mathlib-ci label. (2025-05-18 10:21:32)

@@ -50,6 +50,11 @@ open Lean in
macro_rules
| `(#v[ $elems,* ]) => `(Vector.mk (n := $(quote elems.getElems.size)) #[$elems,*] rfl)

@[app_unexpander Vector.mk]
def _root_.unexpandVectorMk : Lean.PrettyPrinter.Unexpander
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for this to be in the root namespace?

Suggested change
def _root_.unexpandVectorMk : Lean.PrettyPrinter.Unexpander
def unexpandMk : Lean.PrettyPrinter.Unexpander

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because all the other ones are (e.g. unexpandListCons is not in the List namespace)

@leanprover-bot leanprover-bot added the P-medium We may work on this issue if we find the time label May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-pp Pretty printing P-medium We may work on this issue if we find the time 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