Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Extract Constant from �Module�

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Extract Constant from �Module�


chronological Thread 
  • From: Jianzhou Zhao <jianzhou AT seas.upenn.edu>
  • To: coq-club <coq-club AT inria.fr>
  • Subject: [Coq-Club] Extract Constant from ‘Module’
  • Date: Mon, 23 Aug 2010 20:27:09 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=OinyeJw2yeDtl9DJ81bKr0R3a903HqT1yxxDWftKoBqlsNJickg2gyGioRb+aJepmL MQB6GWvTaYpqz7GxhicxLl0xsKJ7Tx97GX7bFAzrFvsBBJmR4IdwLZw/30zcW2owpluo ncqZl8aqjGDOFKSUZ8ekH4FNIFzi3NsTxhxcM=

Hi,

In 8.2 I was extracting code from Modules. For example:

(* start  test.v *)
Module A.
  Definition INT:=nat.
  Definition test (i:INT) := i.
End A.

Extract Constant A.INT => "int".
Extraction "test" A.test.
(* end  test.v *)

"coqc test.v" generates "test.mli" and "test.ml" as the below.

(* start test.mli *)
type nat =
  | O
  | S of nat

module A :
 sig
  type coq_INT = nat
  val test : coq_INT -> coq_INT
 end
(* end test.mli *)

(* start test.ml *)
type nat =
  | O
  | S of nat

module A =
 struct
  type coq_INT = int

  (** val test : coq_INT -> coq_INT **)
  let test i =
    i
 end
(* end test.ml *)

OCaml cannot compile them because A.coq_INT in test.ml does not match
A.coq_INT in test.mli. Extract Constant A.INT => "int" does not change
A.coq_INT in the module signature. Is this the correct way to do
extractions from modules?

Thanks
-- 
Jianzhou



Archive powered by MhonArc 2.6.16.

Top of Page