Skip to Content.
Sympa Menu

coq-club - [Coq-Club] termination question

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] termination question


chronological Thread 
  • From: Michael Shulman <viritrilbia AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] termination question
  • Date: Mon, 22 Mar 2010 15:19:32 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=objU8thPrtHNSOrqtGr5xr6tpUFMNmdv94tbZMN9r7ExEHEGyCs3Idts9DAI41NNoc U6IxwYIsw9rN27mPbUkdpcAeTviVA+eQ31LEfTnJBeD62wDaYXWXgHrPe+EmxpC45C8U syTAj0sWyZyovimezYGhIf8bB7dgUlLBEXNeQ=

Hi,

The following code (a simplification) defines a family of list types
indexed by the natural numbers (the index has nothing to do with the
length of the list or anything else).  My attempt to define a function
which decrements the list index is refused by the termination checker.
Why is it confused, and what can I do to persuade it that the function
does terminate?

Thanks!
Mike


Section mylist.

  Parameter A:Type.

  Inductive mylist : nat -> Type :=
  | mynil : forall n:nat, mylist n
  | mycons : forall n:nat, A -> mylist n -> mylist n.

  Fixpoint declabel (n:nat)(xs : mylist (S n)) {struct xs} : mylist n :=
    match xs in mylist Sn return mylist (pred Sn) with
      | mynil _ => mynil _
      | mycons O x xs' => mynil _
      | mycons (S n) x xs' => mycons x (declabel xs')
    end.

End mylist.



Archive powered by MhonArc 2.6.16.

Top of Page