coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Pierre Boutillier <pierre.boutillier AT pps.jussieu.fr>
- To: Takashi MIYAMOTO <tmiya AT bu.iij4u.or.jp>
- Cc: Coq-Club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Defining the function using refine
- Date: Sat, 7 Jan 2012 11:11:00 +0100
Hi,
The advise is : { z | P z } is an inductive type, (exist _ z (_ : P Z)) is the constructor of type {z | P z}
-8<------
Definition ZHs_of_Zs(zs:list Z)(*H:forall z, In z zs -> (0<=z<Max) %Z*) :list ZH.
refine ((fix f (zs:list Z)(*_:f z, In z zs -> (0<=z<Max)%Z*):list ZH :=
match zs return (list ZH) with
| nil => nil
| cons z zs' => cons (exist _ z _) (f zs')
end) zs).
-8<------
will be better :-)
Pierre Boutillier
Le 7 janv. 12 à 10:26, Takashi MIYAMOTO a écrit :
Dear all,
I am trying to write a mapping function from a list of Z to a list of subset type ZH.
The definition of function ZHs_of_Zs fails. It seems that my usage of refine tactic is wrong.
Could you give an advice how to write functions like this?
---
Require Import ZArith.
Parameter Max:Z.
Parameter HMax:(Max >= 2)%Z.
Definition ZH := {z:Z | (0<=z<Max)%Z}.
Definition ZHs_of_Zs(zs:list Z)(H:forall z, In z zs -> (0<=z<Max) %Z) :list ZH.
refine (fix f (zs:list Z)(_:forall z, In z zs -> (0<=z<Max)%Z):list ZH :=
match zs return (list ZH) with
| nil => nil
| z::zs' => {z|_} :: (f zs' _)
end).
---
Thank you in advance.
===================================
Takashi Miyamoto
Pierre Boutillier
pierre.boutillier AT pps.jussieu.fr
- [Coq-Club] Solving equalities over R, Rcompute fails, Ramon Snir
- Re: [Coq-Club] Solving equalities over R, Rcompute fails,
Laurent Théry
- Re: [Coq-Club] Solving equalities over R, Rcompute fails,
Ramon Snir
- Re: [Coq-Club] Solving equalities over R, Rcompute fails,
Frédéric Besson
- Re: [Coq-Club] Solving equalities over R, Rcompute fails,
Ramon Snir
- Re: [Coq-Club] Solving equalities over R, Rcompute fails, Frédéric Besson
- Re: [Coq-Club] Solving equalities over R, Rcompute fails,
Ramon Snir
- Re: [Coq-Club] Solving equalities over R, Rcompute fails,
Frédéric Besson
- Re: [Coq-Club] Solving equalities over R, Rcompute fails,
Ramon Snir
- [Coq-Club] Defining the function using refine, Takashi MIYAMOTO
- Message not available
- Re: [Coq-Club] Defining the function using refine, Pierre Boutillier
- Re: [Coq-Club] Defining the function using refine, Takashi MIYAMOTO
- Message not available
- Re: [Coq-Club] Defining the function using refine,
Pierre Boutillier
- Re: [Coq-Club] Defining the function using refine, Takashi MIYAMOTO
- Re: [Coq-Club] Defining the function using refine,
AUGER Cédric
- Re: [Coq-Club] Defining the function using refine,
Hugo Herbelin
- Re: [Coq-Club] Defining the function using refine, Takashi MIYAMOTO
- Re: [Coq-Club] Defining the function using refine,
Hugo Herbelin
- Re: [Coq-Club] Defining the function using refine,
Pierre Boutillier
- Re: [Coq-Club] Defining the function using refine, Pierre Boutillier
- Re: [Coq-Club] Solving equalities over R, Rcompute fails,
Laurent Théry
Archive powered by MhonArc 2.6.16.