Zulip Chat Archive

Stream: lean4

Topic: induction


Chenyi Li (Aug 27 2023 at 06:23):

I wonder how to what is the code to do induction on k of the type k:N+k : \mathbb{N}+. In mathematics, we prove for k=1k=1, and assume the result holds for k=jk = j and prove k=j+1k=j+1. Thank you very much!

Scott Morrison (Aug 27 2023 at 06:32):

There is src#PNat.recOn.

Chenyi Li (Aug 27 2023 at 06:33):

Thank you very much! I would try this!

Scott Morrison (Aug 27 2023 at 06:33):

It is marked as @[elab_as_elim], so I think you can just write induction k in tactic mode.

Alex J. Best (Aug 27 2023 at 13:14):

It needs to be tagged as @[eliminator] for that to work, elab as elim just changes the elaboration order.
Fortunately you can just add attribute [eliminator] PNat.recOn in your own file and it works fine.
Last I checked mathlib didn't have too many theorems (defs) tagged as eliminator. I'd be happy to see some more!


Last updated: Dec 20 2023 at 11:08 UTC