coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jianzhou Zhao <jianzhou AT seas.upenn.edu>
- To: Evgeny Makarov <emakarov AT gmail.com>
- Cc: coq-club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Extracting integers from Coq to OCaml
- Date: Mon, 16 Aug 2010 18:06:25 -0400
- 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:cc:content-type :content-transfer-encoding; b=LIXqQ6ornUkwF+X9ZvbbbG1umyQzTAyWV0BtCjwexpxFe8d26pqhH/gXFXF7xzUwWc ilQo9cYv9Y7wXljhDK1wjL+SF5fN99pLJTNAV7lQ1+zRJT4hmlK6EZPmDxxSzrCl3EEG yIfAmYHbuaSBsbwyCMrBbTp3WGPCAvyMs2Ep8=
On Mon, Aug 16, 2010 at 4:23 PM, Evgeny Makarov
<emakarov AT gmail.com>
wrote:
> Jianzhou,
>
>> I think Coq extraction
>> (http://coq.inria.fr/refman/Reference-Manual027.html#toc139) only
>> allows to realize inductive Coq types into inductive OCaml types. But
>> OCaml's int or big_bit is only primitive.
>
> The Reference Manual section 21.2.4 (at least after trunk 13264) has
> an example of extracting the inductive Coq type nat to OCaml type int.
> The command is "Extract Inductive". You can also probably use "Extract
> Constant" to map functions on a Coq type into built-in OCaml
> functions.
Thanks. This works.
Extract Inductive nat => "int" [ "0" "succ" ].
Extract Constant plus => "fun a b -> a + b ".
Definition _plus (a b:nat) := plus a b.
Extraction "test" _plus.
I had assumed that "Extract Constant" only works for Axioms. The
reference also gives such syntax to extract constant:
Coq < Extract Constant plus "’a" "’b" => " ’a*’b"
What is the symbol before a and b, I tried ' and `, it extracted
let rec plus -> ’a*’b
I might use a wrong symbol.
If the extracted type, say 'big_int', is not in a module opened by
default, can we also specify OCaml dependencies, adding 'open Big_int'
before extracted code?
>
> Evgeny
>
>
--
Jianzhou
- [Coq-Club] Extracting integers from Coq to OCaml, Jianzhou Zhao
- Re: [Coq-Club] Extracting integers from Coq to OCaml,
Evgeny Makarov
- Re: [Coq-Club] Extracting integers from Coq to OCaml, Jianzhou Zhao
- Re: [Coq-Club] Extracting integers from Coq to OCaml, Jianzhou Zhao
- Re: [Coq-Club] Extracting integers from Coq to OCaml,
Pierre Letouzey
- Re: [Coq-Club] Extracting integers from Coq to OCaml, Jianzhou Zhao
- Re: [Coq-Club] Extracting integers from Coq to OCaml, Jianzhou Zhao
- Re: [Coq-Club] Extracting integers from Coq to OCaml,
Evgeny Makarov
Archive powered by MhonArc 2.6.16.