lean4-htt/tests/lean/run/issue6550.lean
Joachim Breitner 37dd26966b
fix: rcases: avoid inflating case names with single constructor names (#9918)
This PR prevents `rcases` and `obtain` from creating absurdly long case
tag names when taking single constructor types (like `Exists`) apart.
Fixes #6550

The change does not affect `cases` and `induction`, it seems (where the
user might be surprised to not address the single goal with a name),
because I make the change in Lean/`Meta/Tactic/Induction.lean`, not
`Lean/Elab/Tactic/Induction.lean`. Yes, that's confusing.
2025-08-26 07:56:32 +00:00

104 lines
2 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- This used to have
-- `case intro.intro.intro.intro.intro.intro.intro.inl`
/--
error: unsolved goals
case inl
a b c d e f g : Nat
h : False
⊢ False
case inr
a b c d e f g : Nat
h : False
⊢ False
-/
#guard_msgs in
example (h : ∃ a b c d e f g : Nat, False False) : False := by
obtain ⟨a, b, c, d, e, f, g, h | h⟩ := h
/--
error: unsolved goals
case inl
a b c d e f g : Nat
h : False
⊢ False
case inr
a b c d e f g : Nat
h : False
⊢ False
-/
#guard_msgs in
example (h : ∃ a b c d e f g : Nat, False False) : False := by
rcases h with ⟨a, b, c, d, e, f, g, h | h⟩
/--
error: unsolved goals
case left.inl
a b c d e f g : Nat
h : False
⊢ False
case left.inr
a b c d e f g : Nat
h : False
⊢ False
-/
#guard_msgs in
example (h : ∃ a b c d e f g : Nat, False False) : False ∧ False := by
constructor
· obtain ⟨a, b, c, d, e, f, g, h | h⟩ := h
· sorry
-- We still get case names for `cases`
/--
error: unsolved goals
case intro
w✝ : Nat
h✝ : ∃ b c d e f g, False False
⊢ False
-/
#guard_msgs in
example (h : ∃ a b c d e f g : Nat, False False) : False := by
cases h
/--
error: unsolved goals
case intro.intro.intro.intro.intro.intro.intro
a b c d e f g : Nat
h : False False
⊢ False
-/
#guard_msgs in
example (h : ∃ a b c d e f g : Nat, False False) : False := by
cases h with | _ a h =>
cases h with | _ b h =>
cases h with | _ c h =>
cases h with | _ d h =>
cases h with | _ e h =>
cases h with | intro f h =>
cases h with | _ g h =>
skip
-- And induction
/--
error: unsolved goals
case intro.intro.intro.intro.intro.intro.intro
a b c d e f g : Nat
h : False False
⊢ False
-/
#guard_msgs in
example (h : ∃ a b c d e f g : Nat, False False) : False := by
induction h with | _ a h =>
induction h with | _ b h =>
induction h with | _ c h =>
induction h with | _ d h =>
induction h with | _ e h =>
induction h with | intro f h =>
induction h with | _ g h =>
skip