Skip to content

Universe notation cannot be combined with dot notation #8743

Closed

Description

@kckennylau

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

In the example code below, x.inv.{u} fails to compile.

def Foo : Type u := sorry
def Foo.inv : Foo -> Foo := sorry

variable (x : Foo.{u})
#check x.inv.{u} -- invalid use of explicit universe parameters, 'x' is a local variable
#check x.inv -- succeeds

Context

Zulip discussion: #lean4 > universe with dot notation

Steps to Reproduce

Lean 4 Web.

Versions

Lean 4.22.0-nightly-2025-06-12
Target: x86_64-unknown-linux-gnu

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Activity

  1. added
    bug
    on Jun 12, 2025
  2. kmill commented on Jun 12, 2025

    @kmill
    Collaborator

    I think it would be reasonable to support universe levels on dot notation. It will take some refactoring of the dot notation resolution code though to keep track of levels.

  3. eric-wieser commented on Jun 12, 2025

    @eric-wieser
    Contributor

    Here's another test-case:

    abbrev Nat.ulift.{u} (n : Nat) : ULift.{u} Nat := ULift.up.{u} n
    
    #check (1 : Nat).ulift.{5}
  4. arthur-adjedj commented on Jun 12, 2025

    @arthur-adjedj
    Contributor

    Note that the swift dot notation also currently does not support universe annotations:

    #check (List.cons.{0} 2 [] : List Nat) --works
    #check (.cons.{0} 2 [] : List Nat) --unexpected token '.{'; expected ')', ',' or ':'
  5. digama0 commented on Jun 16, 2025

    @digama0
    Collaborator

    and if we're mentioning dot notation syntaxes there is also

    abbrev Nat.ulift.{u} (n : Nat) : ULift.{u} Nat := ULift.up.{u} n
    
    #check (1 : Nat) |>.ulift.{5}
  6. added
    P-low
    on Sep 2, 2025
  7. kmill commented on Apr 2, 2026

    @kmill
    Collaborator

    Note that the swift dot notation also currently does not support universe annotations:

    #check (List.cons.{0} 2 [] : List Nat) --works
    #check (.cons.{0} 2 [] : List Nat) --unexpected token '.{'; expected ')', ',' or ':'

    @arthur-adjedj's example is implemented in #13245.

  8. added a commit that references this issue on Apr 9, 2026
    c60f97a
  9. added a commit that references this issue on Apr 10, 2026
    cb57f8d
  10. added a commit that references this issue on Apr 16, 2026
    1deae75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-lowbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions