Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Destructing a "nat" into 0, 1, 2, 3, ..., k-1 and ">= k"

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Destructing a "nat" into 0, 1, 2, 3, ..., k-1 and ">= k"


Chronological Thread 
  • From: Yucheng Zhang <yczhang89 AT gmail.com>
  • To: Math Prover <mathprover AT gmail.com>
  • Cc: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Destructing a "nat" into 0, 1, 2, 3, ..., k-1 and ">= k"
  • Date: Sat, 1 Jun 2013 14:39:59 +0800

On Jun 1, 2013, at 12:56 PM, Math Prover
<mathprover AT gmail.com>
wrote:
> Now, I want to tactic "magic", s.t. "magic n k" gives me the cases: n=0,
> n=1, ..., n=k-1, and n>=k.

I've got a "magic" that's close to your need.

Ltac magic n k :=
match k with
| O => idtac
| S ?k' => destruct n; [ | magic n k' ]
end.

(* An example *)
Parameter P : nat -> Prop.

Goal forall n:nat, P n.
Proof.
intro.
magic n 10.
Abort.


Archive powered by MHonArc 2.6.18.

Top of Page