I have a function PolyInterpretation( http://color.inria.fr/doc/CoLoR.PolyInt.APolyInt.html )
Definition PolyInterpretation := forall f : Sig, poly (arity f).
and module signature TPolyInt( http://color.inria.fr/doc/CoLoR.PolyInt.APolyInt_MA.html )
Module Type TPolyInt.
Parameter sig : Signature.
Parameter trsInt : PolyInterpretation sig.
Parameter trsInt_wm : PolyWeakMonotone trsInt.
End TPolyInt.
Module PolyInt (Export PI : TPolyInt).
Then in my file rainbow.vI define a module TPolyInt_impto use the functionPolyInt
Module TPolyInt_imp.
Variable arity : symbol -> nat.
Variable l : list {g : symbol & poly (arity f).
Definition sig := Sig arity.
Definition trsInt f := fun_of_pairs_list f l.
...
End TPolyInt_imp.
Where fun_of_pairs_listhas the type:forall f: Cpf0.symbol, list {g : symbol & poly (arity g)} -> poly (arity f)
Then I define the module P:
Module Export P := PolyInt TPolyInt_imp.
The review assistant Coqaccepted the definition Pabove.
Then I used the extract to extract it in Ocaml.
I am writing it in another file: extraction.v
Extraction Language Ocaml.
Set Extraction Optimize.
Set Extraction AccessOpaque.
Separate Extraction rainbow.P.
It works great.
Here is the code after retrieving
module TPolyInt_imp =
struct
(** val arity : symbol -> int **)
let arity =
failwith "AXIOM TO BE REALIZED"
(** val l : (symbol, poly) sigT list **)
let l =
failwith "AXIOM TO BE REALIZED"
(** val coq_sig : coq_Signature **)
let coq_sig =
coq_Sig arity
(** val trsInt : symbol -> poly **)
let trsInt f =
fun_of_pairs_list arity f l
end
module P = PolyInt(TPolyInt_imp)
TPolyInt_imp Variable failwith AXIOM, , .
Module Type Arity.
Variable arity : symbol -> nat.
Variable l : list {g : symbol & poly (arity g)}.
End Arity.
, (Arity) . TPolyInt_imp (, TPolyInt_imp ).
Module S (Import A: Arity).
Module TPolyInt_imp.
Definition sig := Sig arity.
Definition trsInt f := fun_of_pairs_list f l.
...
End TPolyInt_imp.
Module P := PolyInt TPolyInt_imp.
End S.
, Ocaml.
Extraction Language Ocaml.
Set Extraction Optimize.
Set Extraction AccessOpaque.
Separate Extraction S.
:
Error: Signature mismatch:
...
Values do not match:
val trsInt : Cpf0.symbol -> Polynom.poly
is not included in
val trsInt : APolyInt.coq_PolyInterpretation
File "rainbow.ml", line 534, characters 8-14: Actual declaration
:
module type Arity =
sig
val arity : symbol -> int
val l : (symbol, poly) sigT list
end
module S =
functor (A:Arity) ->
struct
module TPolyInt_imp =
struct
(** val coq_sig : coq_Signature **)
let coq_sig =
coq_Sig A.arity
(** val trsInt : symbol -> poly **)
let trsInt f =
fun_of_pairs_list A.arity f A.l
end
module P = PolyInt(TPolyInt_imp)
? ? , ?
, Arity.
, . .