leanprover-community / leanprover-community/mathlib4

Int.cast_negSucc makes norm_cast introduce Int.negSucc

Open
#11,573 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lean
Stars
4.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Lean reproducer and inspect how the [norm_cast] attribute on Int.cast_negSucc affects the norm_cast output. The fix is complete when the example no longer introduces Int.negSucc and instead produces the expected cast of (-1 : ℤ).

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.