2 Author: Jia Meng, NICTA |
2 Author: Jia Meng, NICTA |
3 |
3 |
4 Functions used for ATP Oracle. |
4 Functions used for ATP Oracle. |
5 *) |
5 *) |
6 |
6 |
7 |
|
8 structure ResAtpProvers = |
7 structure ResAtpProvers = |
9 |
|
10 struct |
8 struct |
11 |
9 |
12 fun seek_line s instr = |
10 fun seek_line s instr = |
13 let val thisLine = TextIO.inputLine instr |
11 (case TextIO.inputLine instr of |
14 in thisLine <> "" andalso |
12 NONE => false |
15 (thisLine = s orelse seek_line s instr) |
13 | SOME thisLine => thisLine = s orelse seek_line s instr); |
16 end; |
|
17 |
14 |
18 fun location s = warning ("ATP input at: " ^ s); |
15 fun location s = warning ("ATP input at: " ^ s); |
19 |
16 |
20 fun call_vampire (file:string, time: int) = |
17 fun call_vampire (file:string, time: int) = |
21 let val _ = location file |
18 let val _ = location file |
22 val runtime = "-t " ^ (string_of_int time) |
19 val runtime = "-t " ^ (string_of_int time) |
23 val vampire = ResAtp.helper_path "VAMPIRE_HOME" "vampire" |
20 val vampire = ResAtp.helper_path "VAMPIRE_HOME" "vampire" |
24 val (instr,outstr) = Unix.streamsOf (Unix.execute(vampire, [runtime,"--mode casc",file])) |
21 val (instr,outstr) = Unix.streamsOf (Unix.execute(vampire, [runtime,"--mode casc",file])) |
25 in seek_line "--------------------- PROVED ----------------------\n" instr |
22 in seek_line "--------------------- PROVED ----------------------\n" instr |
27 |
24 |
28 fun call_eprover (file:string, time:int) = |
25 fun call_eprover (file:string, time:int) = |
29 let val _ = location file |
26 let val _ = location file |
30 val eprover = ResAtp.helper_path "E_HOME" "eprover" |
27 val eprover = ResAtp.helper_path "E_HOME" "eprover" |
31 val runtime = "--cpu-limit=" ^ (string_of_int time) |
28 val runtime = "--cpu-limit=" ^ (string_of_int time) |
32 val (instr,outstr) = Unix.streamsOf (Unix.execute(eprover, |
29 val (instr,outstr) = Unix.streamsOf (Unix.execute(eprover, |
33 [runtime,"--tstp-in","-tAutoDev","-xAutoDev",file])) |
30 [runtime,"--tstp-in","-tAutoDev","-xAutoDev",file])) |
34 in seek_line "# Proof found!\n" instr |
31 in seek_line "# Proof found!\n" instr |
35 end; |
32 end; |
36 |
33 |
37 fun call_spass (file:string, time:int) = |
34 fun call_spass (file:string, time:int) = |
38 let val _ = location file |
35 let val _ = location file |
39 val runtime = "-TimeLimit=" ^ (string_of_int time) |
36 val runtime = "-TimeLimit=" ^ (string_of_int time) |
40 val spass = ResAtp.helper_path "SPASS_HOME" "SPASS" |
37 val spass = ResAtp.helper_path "SPASS_HOME" "SPASS" |
41 val (instr,outstr) = Unix.streamsOf (Unix.execute(spass, |
38 val (instr,outstr) = Unix.streamsOf (Unix.execute(spass, |
42 [runtime,"-Splits=0", "-FullRed=0", "-SOS=1",file])) |
39 [runtime,"-Splits=0", "-FullRed=0", "-SOS=1",file])) |
43 in seek_line "SPASS beiseite: Proof found.\n" instr |
40 in seek_line "SPASS beiseite: Proof found.\n" instr |
44 end; |
41 end; |
45 |
42 |
46 fun vampire_o _ (file,time) = |
43 fun vampire_o _ (file,time) = |
47 if call_vampire (file,time) |
44 if call_vampire (file,time) |
48 then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const) |
45 then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const) |
49 else (ResAtp.cond_rm_tmp file; raise Fail ("vampire oracle failed")); |
46 else (ResAtp.cond_rm_tmp file; raise Fail ("vampire oracle failed")); |
50 |
47 |
51 fun eprover_o _ (file,time) = |
48 fun eprover_o _ (file,time) = |
52 if call_eprover (file,time) |
49 if call_eprover (file,time) |
53 then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const) |
50 then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const) |
54 else (ResAtp.cond_rm_tmp file; raise Fail ("eprover oracle failed")); |
51 else (ResAtp.cond_rm_tmp file; raise Fail ("eprover oracle failed")); |
55 |
52 |
56 fun spass_o _ (file,time) = |
53 fun spass_o _ (file,time) = |
57 if call_spass (file,time) |
54 if call_spass (file,time) |
58 then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const) |
55 then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const) |
59 else (ResAtp.cond_rm_tmp file; raise Fail ("SPASS oracle failed")); |
56 else (ResAtp.cond_rm_tmp file; raise Fail ("SPASS oracle failed")); |
60 |
|
61 |
57 |
62 end; |
58 end; |
63 |
|