coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Ruddy Hahn <ruddy.hahn AT gmail.com>
- To: coq-club AT inria.fr
- Subject: [Coq-Club] Lists without repetition of occurrences
- Date: Wed, 24 Mar 2010 11:45:15 -0400
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=v0JsKA7TU1GDVF6sP8w/ivpvLSzYTZLjwuBtyiqOTo/TNLLmlYgbCf5IoVLI2TX4bi v3jyCjIKFw7LfZxMC3dGA1CTRHZJfR7G8AseJKu6sROQQacDxj7d3EU7zBfOrCH1Amns TtIB564sM7YqQnW0CmSrkHFNAGeyRyxE7Xhpw=
Hello,
using inductive types.
Thus
(1) The empty list is a list without repetition of occurrences.
(2) If l is a list without repetition of occurrences, and if (n : nat) does not already
occur in l, then (cons n l) is a list without repetition of occurrences
An attempt at defining snatlist as an inductive type is as follows:
(A snatlist is a list of natural numbers without repetition of occurrences.)
Inductive snatlist : Set :=
| snil : snatlist
| scons : forall (n : nat) (l : snatlist), ~ (occur n l) -> snatlist
with occur (n : nat) (l : snatlist) : Prop :=
| ocHead : forall (n : nat) (l : snatlist) (p : ~ (occur n l)), occur n (scons n l p)
| ocCons : forall (m : nat) (l : snatlist) (p: ~ (occur n l)),
(occur m l) -> occur m (scons n l p)
It does not work and yields error:
(Error: Parameters should be syntactically the same for each inductive type.)
How could one fix that ?
Thanks a lot.
R.
- [Coq-Club] Lists without repetition of occurrences, Ruddy Hahn
- Re: [Coq-Club] Lists without repetition of occurrences, Adam Chlipala
- Re: [Coq-Club] Lists without repetition of occurrences, Martijn Vermaat
- Re: [Coq-Club] Lists without repetition of occurrences, Catalin Hritcu
Archive powered by MhonArc 2.6.16.