Zulip Chat Archive

Stream: lean4

Topic: Induction alternative name when using Quot.ind?


François G. Dorais (Aug 26 2021 at 17:46):

What is the induction alternative name when using Quot.ind? Leaving it blank works fine as in this snippet:

by induction q using Quot.ind with
| _ x => sorry

What should that blank be? mk doesn't work...

Kyle Miller (Aug 26 2021 at 18:10):

I believe the alternative names for the induction tactic come from the names of the arguments for the recursor. Quot.ind doesn't name the induction hypothesis however:

Quot.ind :  {α : Sort u_1} {r : α  α  Prop} {β : Quot r  Prop}, ( (a : α), β (Quot.mk r a))   (q : Quot r), β q

Judging by the case a heading for the tactic state at the sorry, it seems that Lean has decided to give it the name a (I wasn't able to figure out where this happens in the induction tactic though). So, this works:

induction q using Quot.ind with
| a x => exact sorry

Kyle Miller (Aug 26 2021 at 18:12):

Indeed:

def Quot.ind' {r : α  α  Prop} {β : Quot r  Prop}
  (mk :  (a : α), β (Quot.mk r a)) :  (q : Quot r), β q := Quot.ind mk

example (r : α  α  Prop) (q : Quot r) : q  q :=
  by induction q using Quot.ind' with
  | mk x => exact sorry

Last updated: Dec 20 2023 at 11:08 UTC