Skip to content

feat: coercion from Lean.Name to Namespace#483

Open
ayhon wants to merge 1 commit into
leanprover-community:masterfrom
ayhon:feat/specify-namespaces-with-lean-names
Open

feat: coercion from Lean.Name to Namespace#483
ayhon wants to merge 1 commit into
leanprover-community:masterfrom
ayhon:feat/specify-namespaces-with-lean-names

Conversation

@ayhon

@ayhon ayhon commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

There seems to be a quite direct mapping from Lean.Name to Namespace. This PR implements a coercion from the latter to the former, to allow writing Namespace literals using Lean's Name literal syntax.

Before:

def N : Namespace := nroot.@"oneshot"

Now:

def N : Namespace := `oneshot

Checklist

  • My code follows the mathlib naming and code style conventions
  • I have added my name to the authors section of any appropriate files

@ayhon ayhon marked this pull request as ready for review June 23, 2026 22:26
@ayhon ayhon changed the title feat: coercion from Lean.Name to Iris.Namespace feat: coercion from Lean.Name to Namespace Jun 23, 2026
@markusdemedeiros

Copy link
Copy Markdown
Collaborator

This is kind of cool, lol. Out of curiosity, do you think we could eliminate the string version?

@ayhon

ayhon commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

I don't think we can really phase it out, since the rest of the file defines theorems for nroot and ndot which I assume are needed elsewhere. We could make the notation local fo the file though, to encourage people to use the Name coercion

@MackieLoeffel

Copy link
Copy Markdown
Collaborator

People sometimes do something like N.@l where N is a namespace and l is a location. I guess for this we cannot use the fancy new syntax but need the old version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants