1 needs "../formal_lp/hypermap/main/prove_flyspeck_lp.hl";;
3 module Verify_all = struct
9 let cert_dir = ref (flyspeck_dir ^ "/../formal_lp/glpk/binary");;
11 let get_files_with_prefix dir prefix =
12 let files = Array.to_list (Sys.readdir dir) in
13 let n = String.length prefix in
14 let files1 = filter (fun f -> String.length f >= n) files in
15 let files2 = filter (fun f -> String.sub f 0 n = prefix) files1 in
16 map (fun f -> sprintf "%s/%s" dir f) files2;;
18 let get_certificate_files_with_prefix dir prefix =
19 let alt_dir = dir ^ "/lp_certificates" in
20 let files1 = get_files_with_prefix dir prefix in
22 if Sys.file_exists alt_dir then
23 get_files_with_prefix alt_dir prefix
29 let stat = Gc.stat() in
30 let word = float_of_int (Sys.word_size / 8) in
31 let free = float_of_int stat.Gc.free_words *. word /. 1024.0 in
32 let total = float_of_int stat.Gc.heap_words *. word /. 1024.0 in
33 let allocated = total -. free in
34 let str = sprintf "allocated = %f (free = %f; total_size = %f; %f)\n"
35 allocated free total (free /. total) in
40 let counter = ref 0 and
43 Format.print_string s; Format.print_newline(); Format.print_flush() in
44 let process certificate =
45 let _ = counter := !counter + 1 in
46 let _ = report (sprintf "%d/%d" !counter !total) in
47 verify_lp_certificate certificate in
48 let process_all file =
49 let certificates = read_lp_certificates file in
50 let _ = counter := 0 in
51 let _ = total := length certificates in
52 let start = Unix.gettimeofday() in
53 let result = map process certificates in
54 let finish = Unix.gettimeofday() in
55 result, finish -. start in
57 let _ = report (sprintf "Verifying %s" file) in
58 let result, time = process_all file in
59 let _ = Gc.compact() in
66 let _ = Lp_ineqs.find_ineq false 3 "y1_def" in
67 let _ = report "Inequalities are already initialized" in
70 Flyspeck_lp.init_ineqs();;
75 let _ = init_ineqs() in
76 let files = get_certificate_files_with_prefix !cert_dir "easy" in
77 map verify_file files;;
80 let _ = init_ineqs() in
81 let files = get_certificate_files_with_prefix !cert_dir "hard" in
82 map verify_file files;;
85 let result_hard = verify_hard() in
86 let result_easy = verify_easy() in
87 result_hard @ result_easy;;
89 let test_result result =
90 let ths = List.flatten (map fst result) in
91 let time = map snd result in
92 let total = end_itlist (+.) time in
93 let concls = setify (map concl ths) in
94 let hyps = unions (map (fun th -> filter (fun tm -> not (is_binary "iso" tm)) (hyp th)) ths) in