Zulip Chat Archive

Stream: new members

Topic: Unused variable in set constructor


Lars Ericson (Dec 06 2024 at 13:50):

If I say

import Mathlib
def TotalSet := { n: ℕ | True }

I get warning message

unused variable `n`
note: this linter can be disabled with `set_option linter.unusedVariables false`

If I change it to

import Mathlib

def TotalSet := { _: ℕ | True }

I get error message

unexpected syntax
  {_ : ℕ | True}

Is there a way to satisfy the linter without disabling it?

Ruben Van de Velde (Dec 06 2024 at 14:06):

Does _n work?

Lars Ericson (Dec 06 2024 at 14:12):

Yes, thanks.

import Mathlib
def TotalSet := { _n: ℕ | True }

Last updated: Feb 28 2026 at 14:05 UTC