leanprover-community / leanprover-community/mathlib4

`casesm` changed behaviour, does not deconstruct inductive types

Open
#2,018 1 comment 0 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

In lean 3:

inductive two_points
  | zero
  | one

namespace two_points
theorem mwe : ∀ (x : two_points), x = zero ∨ x = one := λ x, by casesm _; simp -- works
end two_points

In lean 4:

import Mathlib.Tactic.CasesM

inductive twoPoints
  | zero
  | one

namespace twoPoints
theorem mwe : ∀ (x : twoPoints), x = zero ∨ x = one := fun x ↦ by casesm _ <;> simp -- no match
end twoPoints

Not sure if this was intended behavior, but it was definitely used in mathlib3, e.g. data.sign, so some proofs break now.
Related Zulip thread: here.

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 Mathlib.Tactic.CasesM entry point and reproduce the two_points example from the issue. Compare the Lean 4 behavior with the Lean 3 example and check the data.sign reference for affected usage. Done means casesm deconstructs the inductive type as expected and the relevant proof examples work.

Written by the indexing model from the issue text.

Assessment

Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.