我用从Coq的至OCaml的,其中I有Z
类型,N
提取,positive
OCaml的串和串Coq的(提取Coq的至OCaml的)
我不使用,以提取它OCaml中的int
。
然后我提取后具有的类型是:
type positive =
| Coq_xI of positive
| Coq_xO of positive
| Coq_xH
type coq_N =
| N0
| Npos of positive
type coq_Z =
| Z0
| Zpos of positive
| Zneg of positive
我在OCaml的一个程序,其中使用的OCaml型string
某些功能。
在我的OCaml程序,我需要写一些函数转换类型:string -> coq_N
,string -> coq_Z
,string -> positive
我试着写在勒柯克的功能,然后用于提取得到OCaml的类型,但勒柯克string
是不同于OCaml string
。
例如:
open Ascii
open BinNums
open Datatypes
type string =
| EmptyString
| String of ascii * string
let string_of_coqN (s: string): coq_N =
match s with
| EmptyString -> N0
| String (a, _) -> (coq_N_of_ascii a);;
coq_N_of_ascii
其中从coq
N_of_ascii
函数提取。
当我申请的功能string_of_coqN
,例如:
let test (x: string) = string_of_N x;;
我得到的抱怨
Error: This expression has type string but an expression was expected of type
String0.string
能否请你帮我找到一种方法写的转换功能:string -> coq_N
, string -> coq_Z
和string -> positive
?