-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract_ocaml.v
41 lines (31 loc) · 1.32 KB
/
extract_ocaml.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(** NOTES:
Some problems related to type extraction:
- Types like bool, list and prod have straight forward representations
in Ocaml. nat by other hand, is extracted and represented in a naive
way, that might not be efficient for certain applications.
Also, if we extract it as an ocaml int, we would lose consistency
with w.r.t. to the proven theorems.
Ways of addressing this problem are avaiable here:
https://softwarefoundations.cis.upenn.edu/vfa-current/Extract.html
Currently, no fancy nat extraction might be enough.
TODO:
- Extract option
- Extract nat into an efficient type.
- Extract bbv library Word into an efficient type. *)
From Coq Require Import Strings.String.
Require Import List.
Import ListNotations.
Require Import FORVES2.parser.
Import Parser.
From Coq Require Import extraction.ExtrOcamlString.
Import ExtrOcamlString.
(** Type Extractions **)
Extract Inductive bool => "bool" [ "true" "false" ].
Extract Inductive list => "list" [ "[]" "(::)" ].
Extract Inductive prod => "( * )" [ "( , )" ].
(** Program Extractions **)
(* Examples from example.v are extracted and directly tested.
After running the next line, use "make run" in order to compile and
run the test_examples.ml file. *)
Extraction Parser.
Extraction "ocaml_interface/checker.ml" Parser.