-
Notifications
You must be signed in to change notification settings - Fork 0
/
needs_skip_proofs.ml
27 lines (23 loc) · 1.05 KB
/
needs_skip_proofs.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(* ------------------------------------------------------------------------- *)
(* Equivalent to 'needs', but skips checking all proofs using CHEAT_TAC. *)
(* This must be used very carefully. Please call this function at the *)
(* beginning of REPL (or a file) only when you are sure that all theorems in *)
(* the loaded file are proven to be correct in the past. *)
(* ------------------------------------------------------------------------- *)
let needs_skip_proofs s =
let preamble_temp_ml = Filename.temp_file "" ".ml" in
let oc = open_out preamble_temp_ml in
Printf.fprintf oc "let prove_backup = prove;;\n";
Printf.fprintf oc "let prove (t,ttac) = prove_backup (t, CHEAT_TAC);;\n";
close_out oc;
let postamble_temp_ml = Filename.temp_file "" ".ml" in
let oc = open_out postamble_temp_ml in
Printf.fprintf oc "let prove (t,ttac) = prove_backup (t,ttac);;\n";
close_out oc;
use_file preamble_temp_ml;
(try
needs s;
with f ->
use_file postamble_temp_ml;
raise f);
use_file postamble_temp_ml;;