Zulip Chat Archive
Stream: lean4
Topic: tactic 'cases' failed nested error
David Renshaw (Dec 13 2022 at 20:38):
I'm struggling to understand why the baz
proof does not work here:
import Mathlib.Tactic.CasesM
-- This works:
theorem foo {p q r : Prop} (h : p ∧ q ∨ p ∧ r) : p ∧ p :=
by cases h
· casesm (_ ∧ _)
constructor <;> assumption
· casesm (_ ∧ _)
constructor <;> assumption
variable {p q r : Prop}
variable (h : p ∧ q ∨ p ∧ r)
-- This works too:
theorem bar : p ∧ p :=
by cases h with
| inl h1 => cases h1
constructor <;> assumption
| inr h2 => cases h2
constructor <;> assumption
-- This does not work:
theorem baz : p ∧ p :=
by cases h
· casesm (_ ∧ _)
-- tactic 'cases' failed, nested error:
-- failed to revert baz, it is an auxiliary declaration created to represent recursive definitions
· casesm (_ ∧ _)
-- tactic 'cases' failed, nested error:
-- failed to revert baz, it is an auxiliary declaration created to represent recursive definitions
David Renshaw (Dec 13 2022 at 20:40):
Like, is this a bug in casesm
, or a bug in Lean 4 core, or I am doing something wrong?
Sebastian Ullrich (Dec 13 2022 at 20:43):
Looks like a missing isAuxDecl
check in casesm
David Renshaw (Dec 13 2022 at 20:55):
what should happen if ldecl.isAuxDecl
is true?
Sebastian Ullrich (Dec 13 2022 at 20:56):
It should not try to match that hypothesis as it is merely an internal helper
David Renshaw (Dec 13 2022 at 20:58):
The context at the casesm
call is
case inl
p q r : Prop
h : p ∧ q
⊢ p ∧ p
David Renshaw (Dec 13 2022 at 20:58):
where that h
is italic
David Renshaw (Dec 13 2022 at 20:59):
I'm guessing it considers that h
to be auxiliary? It was generated by the preceding cases h
line.
David Renshaw (Dec 13 2022 at 21:00):
I don't want to ignore that h
, because it's exactly what I need to proceed with the proof.
Sebastian Ullrich (Dec 13 2022 at 21:00):
No, the auxiliary decl is baz
itself for use in recursion. Which I assume you don't want to case on.
David Renshaw (Dec 13 2022 at 21:02):
yep, that seems to fix it. Thanks!
David Renshaw (Dec 13 2022 at 21:02):
I'll submit a PR to fix this in mathlib4.
David Renshaw (Dec 13 2022 at 21:19):
https://github.com/leanprover-community/mathlib4/pull/991
Last updated: Dec 20 2023 at 11:08 UTC