Coq から OCaml への抽出を使用しましZ
たN
。positive
int
私はOCamlでそれを抽出するために使用しません。
次に、抽出後のタイプは次のとおりです。
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 type を使用する関数がいくつかある OCaml のプログラムがありstring
ます。
私の OCaml プログラムでは、型を変換するいくつかの関数を書く必要があります: string -> coq_N
, string -> coq_Z
,string -> positive
Coq で関数を書き込もうとして、抽出を使用して OCaml 型を取得しましたが、Coqstring
は 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
convert 関数 :string -> coq_N
とstring -> coq_Z
を書く方法を教えてくださいstring -> positive
。