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

RFC: pretty printing dot notation with CoeFun #6178

Open
edegeltje opened this issue Nov 22, 2024 · 0 comments
Open

RFC: pretty printing dot notation with CoeFun #6178

edegeltje opened this issue Nov 22, 2024 · 0 comments
Labels
RFC Request for comments

Comments

@edegeltje
Copy link

edegeltje commented Nov 22, 2024

Description

In the wake of #1910 , it has become possible to use dot notation with namespaced non-function declarations.
However, pretty printing doesn't show these terms as using dot notation.

adapting the example given for that issue:

structure Equiv (α β : Sort _) where
  toFun : α → β
  invFun : β → α

infixl:25 " ≃ " => Equiv

instance: CoeFun (α ≃ β) fun _ => α → β where
  coe := Equiv.toFun

def Foo := Nat
def Bar := Nat
def Foo.toBar : Foo ≃ Bar := ⟨id, id⟩

variable (f : Foo)

#check f.toBar -- Foo.toBar f : Bar

ideally, the latter #check command should display f.toBar by default.

Just as dot notation improves the experience of writing and reading code, pretty printing this new instance of dot notation will allow users to more clearly see the structure of code by hiding redundant information, i.e. the namespace of the declaration.

Community Feedback

This initiative started because all porting notes referring to #1910 in mathlib came under review, and some of them mentioned that certain uses of the pp_nodot attribute were not useful yet because the dot notation wasn't available for the declarations the porting notes were referring to. See also this discussion on Zulip.

Impact

Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.

@edegeltje edegeltje added the RFC Request for comments label Nov 22, 2024
mathlib-bors bot pushed a commit to leanprover-community/mathlib4 that referenced this issue Nov 23, 2024
…o refer to lean4 issue #6178 instead  (#19385)

These adaptation notes refer to the `pp_nodot` attribute not doing anything on certain declarations, due to their inability to be used with dot notation. However, now that leanprover/lean4#1910 has been fixed, the limiting factor has become the fact that the pretty printer doesn't work for these kinds of dot notation, which leanprover/lean4#6178 is an issue for.

As such, the links to the blocking lean issue have been changed in this PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request for comments
Projects
None yet
Development

No branches or pull requests

1 participant