Zulip Chat Archive

Stream: new members

Topic: Minus sign not working, replaced by Neg.neg for now


Ilmārs Cīrulis (Dec 07 2024 at 11:02):

import Mathlib.Data.Real.Basic

def test (x: ):  :=
  let another_x := x
  Neg.neg x

This works, but the following doesn't (causes error unexpected end of input:

import Mathlib.Data.Real.Basic

def test (x: ):  :=
  let another_x := x
  - x

Ilmārs Cīrulis (Dec 07 2024 at 11:02):

What am I doing wrong?

Ruben Van de Velde (Dec 07 2024 at 11:04):

Huh. Try (-x)

Daniel Weber (Dec 07 2024 at 11:16):

The second gets parsed as x - x:

import Mathlib.Data.Real.Basic

def test (x: ):  :=
  let another_x := x
  - x
  1

#print test

Eric Wieser (Dec 07 2024 at 15:02):

I would guess that using a ; after the first x also fixes it

Eric Wieser (Dec 07 2024 at 15:03):

I think this is worth opening an issue upstream, to track the existence of this foot gun


Last updated: May 02 2025 at 03:31 UTC