leanprover-community / mathlib4

The math library of Lean 4

Home Page:https://leanprover-community.github.io/mathlib4_docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Int.cast_negSucc makes norm_cast introduce Int.negSucc

Ruben-VandeVelde opened this issue · comments

import Mathlib.Data.Int.Cast.Defs

variable {R : Type _} [AddGroupWithOne R]

namespace Int

@[norm_cast] -- Removing this attribute fixes the issue
theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) :=
  AddGroupWithOne.intCast_negSucc n

end Int

example (k : ℤ) : (-1 : R) = k := by
  show_term norm_cast
  -- ⊢ ((Int.negSucc 0) : R) = (k : R)
  -- should be
  -- ⊢ ((-1 : ℤ) : R) = (k : R)
  sorry

This had been fixed once already, see this thread on Zulip.
The solution back then was to add squash to the norm_cast attribute of cast_negSucc. It looks like this no longer has an effect.