Zulip Chat Archive

Stream: general

Topic: cases unfolding stuff


Reid Barton (Aug 24 2020 at 15:35):

Is there any way to get cases to not do this kind of unfolding?

inductive P : set   Prop
| z : P {0}

example (s : set ) (h : P s) : true :=
begin
  cases h,
/-
h : P (λ (b : ℕ), b = 0)
⊢ true
-/
end

Reid Barton (Aug 24 2020 at 15:36):

I guess I could apply the recursor directly

Reid Barton (Aug 24 2020 at 15:36):

I suppose another question is whether this is a bug or a feature

Reid Barton (Aug 24 2020 at 15:44):

aha, is it unfolding in order to check if the case might be impossible somehow?

Reid Barton (Aug 24 2020 at 15:51):

In any case, applying the recursor by hand was easy enough :checkbox:

Jannis Limperg (Aug 24 2020 at 15:53):

Reid Barton said:

aha, is it unfolding in order to check if the case might be impossible somehow?

Yeah exactly. cases could be more careful to preserve the original expression when it does this.

Reid Barton (Aug 24 2020 at 16:44):

Would that be difficult? I'm not familiar with the implementation of cases

Floris van Doorn (Aug 24 2020 at 17:09):

If you just want to apply the recursor, use induction instead.

cases will do more than just applying the recursor when working with inductive families. For example:

  • cases v where v : dvector \a 0 will change v to nil (dvector is the type of vectors as an inductive family)
  • cases h where h : succ n = succ m will change h to rfl (or at least remove the applications of succ.

Floris van Doorn (Aug 24 2020 at 17:10):

(that said, maybe we can improve cases so that it reverts any unfolding if it didn't make (enough) progress).

Reid Barton (Aug 24 2020 at 19:33):

Thanks, induction is much nicer!


Last updated: Dec 20 2023 at 11:08 UTC