coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gyesik Lee <gslee AT ropas.snu.ac.kr>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Positive occurrences below a "match"
- Date: Tue, 19 Jan 2010 15:26:35 +0900
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=QneLXucLvrRMV8oT02EmOvxr+XSeqh+70IZz4LnwaTbW+QQv2kAvFoQnRk6+m5XX32 Jri70OQrT7uPTn3Qc5I1m4doCe0gB+nw3PTD6M+2neMT7J7cHhgqZeKelXnpSDmNjdkO UDTdN6R/412mBtlnQKvT0WuCZ9BiqqeasUyCc=
Dear Vladimir and Matthieu,
thank you for the explanation. I think I have understood the way
although I fear that I might have posted a too simplified example.
Gyesik
2010/1/18 Matthieu Sozeau
<mattam AT mattam.org>:
> Le 18 janv. 10 à 11:48, Gyesik Lee a écrit :
>
>> Dear coq-users,
>>
>> I have encountered a problem with positivity condition when I was
>> trying to define an inductive type.
>> Here is a simplified version:
>>
>> ===============
>>
>> Fixpoint toto (n : nat) (X : Type) : Type :=
>> match n with
>> | 0 => X
>> | S n => nat -> toto n X
>> end.
>>
>> Inductive tata (n : nat) : Type :=
>> sem : toto n (tata n) -> tata n.
>>
>> Error: Non strictly positive occurrence of "tata" in
>> "toto n (tata n) -> tata n".
>>
>> ================
>>
>> You can easily see that the positivity condition is satisfied.
>>
>> Is this a Coq restriction? If yes, is there a way to get around it?
>
> Dear Gyesik,
>
> Coq is not able to analyse [toto] to see that [X] occurs only in positive
> positions. You can use currying to get around it in that case:
>
> =============
>
> Fixpoint totoc (n : nat) : Type :=
> match n with
> | 0 => unit
> | S n => nat * totoc n
> end%type.
>
> Inductive tata (n : nat) : Type :=
> semc : (totoc n -> tata n) -> tata n.
>
> Fixpoint toto (n : nat) (X : Type) : Type :=
> match n with
> | 0 => X
> | S n => nat -> toto n X
> end%type.
>
>
> Fixpoint toto_totoc n X : toto n X -> totoc n -> X :=
> match n with
> | 0 => fun f tt => f
> | S n' => fun f tup =>
> let (hd, tl) := tup in
> toto_totoc n' X (f hd) tl
> end.
>
> Definition sem n (f : toto n (tata n)) : tata n :=
> semc n (toto_totoc n (tata n) f).
>
> ===============
>
> -- Matthieu
>
>
>
- [Coq-Club] Positive occurrences below a "match", Gyesik Lee
- Re: [Coq-Club] Positive occurrences below a "match", Vladimir Voevodsky
- Re: [Coq-Club] Positive occurrences below a "match",
Matthieu Sozeau
- Re: [Coq-Club] Positive occurrences below a "match", Gyesik Lee
Archive powered by MhonArc 2.6.16.