author | paulson |
Fri, 16 Sep 2005 11:39:09 +0200 | |
changeset 17435 | 0eed5a1c00c1 |
parent 17422 | 3b237822985d |
permissions | -rw-r--r-- |
16478 | 1 |
(* Title: VampCommunication.ml |
2 |
ID: $Id$ |
|
3 |
Author: Claire Quigley |
|
4 |
Copyright 2004 University of Cambridge |
|
5 |
*) |
|
6 |
||
7 |
(***************************************************************************) |
|
17305
6cef3aedd661
axioms now included in tptp files, no /bin/cat and various tidying
paulson
parents:
16675
diff
changeset
|
8 |
(* Code to deal with the transfer of proofs from a Vampire process *) |
16478 | 9 |
(***************************************************************************) |
10 |
signature VAMP_COMM = |
|
11 |
sig |
|
17422 | 12 |
val getEInput : TextIO.instream -> string * string |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
13 |
val checkEProofFound: |
17422 | 14 |
TextIO.instream * TextIO.outstream * Posix.Process.pid * |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
15 |
string * string * thm * int * (ResClause.clause * thm) Array.array * int -> bool |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
16 |
|
17422 | 17 |
val getVampInput : TextIO.instream -> string * string |
17305
6cef3aedd661
axioms now included in tptp files, no /bin/cat and various tidying
paulson
parents:
16675
diff
changeset
|
18 |
val checkVampProofFound: |
17422 | 19 |
TextIO.instream * TextIO.outstream * Posix.Process.pid * |
17305
6cef3aedd661
axioms now included in tptp files, no /bin/cat and various tidying
paulson
parents:
16675
diff
changeset
|
20 |
string * string * thm * int * (ResClause.clause * thm) Array.array * int -> bool |
16478 | 21 |
end; |
22 |
||
17305
6cef3aedd661
axioms now included in tptp files, no /bin/cat and various tidying
paulson
parents:
16675
diff
changeset
|
23 |
structure VampComm : VAMP_COMM = |
16478 | 24 |
struct |
25 |
||
17306 | 26 |
exception EOF; |
16478 | 27 |
|
28 |
(**********************************************************************) |
|
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
29 |
(* Reconstruct the Vampire/E proof w.r.t. thmstring (string version of *) |
16478 | 30 |
(* Isabelle goal to be proved), then transfer the reconstruction *) |
31 |
(* steps as a string to the input pipe of the main Isabelle process *) |
|
32 |
(**********************************************************************) |
|
33 |
||
17422 | 34 |
fun reconstruct_tac proofextract goalstring toParent ppid sg_num |
17305
6cef3aedd661
axioms now included in tptp files, no /bin/cat and various tidying
paulson
parents:
16675
diff
changeset
|
35 |
clause_arr num_of_clauses = |
16480 | 36 |
SELECT_GOAL |
17305
6cef3aedd661
axioms now included in tptp files, no /bin/cat and various tidying
paulson
parents:
16675
diff
changeset
|
37 |
(EVERY1 |
6cef3aedd661
axioms now included in tptp files, no /bin/cat and various tidying
paulson
parents:
16675
diff
changeset
|
38 |
[rtac ccontr, ResLib.atomize_tac, skolemize_tac, |
6cef3aedd661
axioms now included in tptp files, no /bin/cat and various tidying
paulson
parents:
16675
diff
changeset
|
39 |
METAHYPS(fn negs => |
17422 | 40 |
(Recon_Transfer.proverString_to_lemmaString proofextract |
17312 | 41 |
goalstring toParent ppid negs clause_arr num_of_clauses))]) sg_num |
16478 | 42 |
|
43 |
||
44 |
(*********************************************************************************) |
|
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
45 |
(* Inspect the output of an ATP process to see if it has found a proof, *) |
16478 | 46 |
(* and if so, transfer output to the input pipe of the main Isabelle process *) |
47 |
(*********************************************************************************) |
|
48 |
||
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
49 |
fun startTransfer (startS,endS) |
17422 | 50 |
(fromChild, toParent, ppid, goalstring,childCmd, |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
51 |
thm, sg_num,clause_arr, num_of_clauses) = |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
52 |
let val thisLine = TextIO.inputLine fromChild |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
53 |
fun transferInput currentString = |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
54 |
let val thisLine = TextIO.inputLine fromChild |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
55 |
in |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
56 |
if thisLine = "" (*end of file?*) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
57 |
then (File.write (File.tmp_path (Path.basic"extraction_failed")) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
58 |
("start bracket: " ^ startS ^ |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
59 |
"\nend bracket: " ^ endS ^ |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
60 |
"\naccumulated text: " ^ currentString); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
61 |
raise EOF) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
62 |
else if String.isPrefix endS thisLine |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
63 |
then let val proofextract = Recon_Parse.extract_proof (currentString^thisLine) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
64 |
in |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
65 |
File.write (File.tmp_path (Path.basic"extracted_prf")) proofextract; |
17422 | 66 |
reconstruct_tac proofextract goalstring toParent ppid sg_num |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
67 |
clause_arr num_of_clauses thm |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
68 |
end |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
69 |
else transferInput (currentString^thisLine) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
70 |
end |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
71 |
in |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
72 |
if thisLine = "" then false |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
73 |
else if String.isPrefix startS thisLine |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
74 |
then |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
75 |
(File.append (File.tmp_path (Path.basic "transfer_start")) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
76 |
("about to transfer proof, thm is: " ^ string_of_thm thm); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
77 |
transferInput thisLine; |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
78 |
true) handle EOF => false |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
79 |
else |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
80 |
startTransfer (startS,endS) |
17422 | 81 |
(fromChild, toParent, ppid, goalstring, |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
82 |
childCmd, thm, sg_num,clause_arr, num_of_clauses) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
83 |
end |
16478 | 84 |
|
16480 | 85 |
|
17422 | 86 |
fun checkVampProofFound (fromChild, toParent, ppid, goalstring, childCmd, |
17306 | 87 |
thm, sg_num, clause_arr, num_of_clauses) = |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
88 |
let val proof_file = TextIO.openAppend |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
89 |
(File.platform_path(File.tmp_path (Path.basic "atp_proof"))) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
90 |
val _ = File.write (File.tmp_path (Path.basic "atp_checking_prf")) |
17306 | 91 |
("checking if proof found, thm is: " ^ string_of_thm thm) |
92 |
val thisLine = TextIO.inputLine fromChild |
|
93 |
in |
|
94 |
if thisLine = "" |
|
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
95 |
then (TextIO.output (proof_file, "No proof output seen \n"); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
96 |
TextIO.closeOut proof_file; |
17306 | 97 |
false) |
17435 | 98 |
else if String.isPrefix "Refutation found. Thanks to Tanya" thisLine |
17306 | 99 |
then |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
100 |
(File.write (File.tmp_path (Path.basic "atp_response")) thisLine; |
17435 | 101 |
startTransfer (Recon_Parse.start_V8, Recon_Parse.end_V8) |
17422 | 102 |
(fromChild, toParent, ppid, goalstring, |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
103 |
childCmd, thm, sg_num, clause_arr, num_of_clauses)) |
17435 | 104 |
else if (String.isPrefix "Satisfiability detected" thisLine) orelse |
105 |
(String.isPrefix "Refutation not found" thisLine) |
|
17306 | 106 |
then |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
107 |
(File.write (File.tmp_path (Path.basic "atp_response")) thisLine; |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
108 |
TextIO.output (toParent,childCmd^"\n"); |
17306 | 109 |
TextIO.flushOut toParent; |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
110 |
TextIO.output (proof_file, thisLine); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
111 |
TextIO.closeOut proof_file; |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
112 |
|
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
113 |
TextIO.output (toParent, thisLine^"\n"); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
114 |
TextIO.output (toParent, goalstring^"\n"); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
115 |
TextIO.flushOut toParent; |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
116 |
Posix.Process.kill(Posix.Process.K_PROC ppid, Posix.Signal.usr2); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
117 |
(* Attempt to prevent several signals from turning up simultaneously *) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
118 |
Posix.Process.sleep(Time.fromSeconds 1); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
119 |
true) |
17306 | 120 |
else |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
121 |
(TextIO.output (proof_file, thisLine); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
122 |
TextIO.flushOut proof_file; |
17422 | 123 |
checkVampProofFound (fromChild, toParent, ppid, |
17306 | 124 |
goalstring,childCmd, thm, sg_num, clause_arr, num_of_clauses)) |
125 |
end |
|
126 |
||
127 |
||
17422 | 128 |
fun checkEProofFound (fromChild, toParent, ppid,goalstring, childCmd, |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
129 |
thm, sg_num, clause_arr, num_of_clauses) = |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
130 |
let val E_proof_file = TextIO.openAppend |
17422 | 131 |
(File.platform_path(File.tmp_path (Path.basic "atp_proof"))) |
132 |
val _ = File.write (File.tmp_path (Path.basic "atp_checking_prf")) |
|
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
133 |
("checking if proof found, thm is: " ^ string_of_thm thm) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
134 |
val thisLine = TextIO.inputLine fromChild |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
135 |
in |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
136 |
if thisLine = "" |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
137 |
then (TextIO.output (E_proof_file, ("No proof output seen \n")); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
138 |
TextIO.closeOut E_proof_file; |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
139 |
false) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
140 |
else if thisLine = "# TSTP exit status: Unsatisfiable\n" |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
141 |
then |
17422 | 142 |
(File.write (File.tmp_path (Path.basic "atp_response")) thisLine; |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
143 |
startTransfer (Recon_Parse.start_E, Recon_Parse.end_E) |
17422 | 144 |
(fromChild, toParent, ppid, goalstring, |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
145 |
childCmd, thm, sg_num, clause_arr, num_of_clauses)) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
146 |
else if thisLine= "# Problem is satisfiable (or invalid), generating saturation derivation\n" |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
147 |
then |
17422 | 148 |
(File.write (File.tmp_path (Path.basic "atp_response")) thisLine; |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
149 |
TextIO.output (toParent,childCmd^"\n" ); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
150 |
TextIO.flushOut toParent; |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
151 |
TextIO.output (E_proof_file, thisLine); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
152 |
TextIO.closeOut E_proof_file; |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
153 |
|
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
154 |
TextIO.output (toParent, thisLine^"\n"); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
155 |
TextIO.output (toParent, goalstring^"\n"); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
156 |
TextIO.flushOut toParent; |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
157 |
Posix.Process.kill(Posix.Process.K_PROC ppid, Posix.Signal.usr2); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
158 |
(* Attempt to prevent several signals from turning up simultaneously *) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
159 |
Posix.Process.sleep(Time.fromSeconds 1); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
160 |
true) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
161 |
else if thisLine = "# Failure: Resource limit exceeded (time)\n" |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
162 |
then |
17422 | 163 |
(File.write (File.tmp_path (Path.basic "atp_response")) thisLine; |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
164 |
TextIO.output (toParent, thisLine^"\n"); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
165 |
TextIO.output (toParent, goalstring^"\n"); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
166 |
TextIO.flushOut toParent; |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
167 |
Posix.Process.kill(Posix.Process.K_PROC ppid, Posix.Signal.usr2); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
168 |
TextIO.output (E_proof_file, "signalled parent\n"); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
169 |
TextIO.closeOut E_proof_file; |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
170 |
(* Attempt to prevent several signals from turning up simultaneously *) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
171 |
Posix.Process.sleep(Time.fromSeconds 1); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
172 |
true) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
173 |
else if thisLine = "# Failure: Resource limit exceeded (memory)\n" |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
174 |
then |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
175 |
(Posix.Process.kill(Posix.Process.K_PROC ppid, Posix.Signal.usr2); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
176 |
TextIO.output (toParent,childCmd^"\n" ); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
177 |
TextIO.output (toParent, thisLine); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
178 |
TextIO.flushOut toParent; |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
179 |
true) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
180 |
else |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
181 |
(TextIO.output (E_proof_file, thisLine); |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
182 |
TextIO.flushOut E_proof_file; |
17422 | 183 |
checkEProofFound (fromChild, toParent, ppid, goalstring, |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
184 |
childCmd, thm, sg_num, clause_arr, num_of_clauses)) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
185 |
end |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
186 |
|
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
187 |
|
16478 | 188 |
(***********************************************************************) |
17306 | 189 |
(* Function used by the Isabelle process to read in a Vampire proof *) |
16478 | 190 |
(***********************************************************************) |
191 |
||
16480 | 192 |
fun getVampInput instr = |
17306 | 193 |
let val thisLine = TextIO.inputLine instr |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
194 |
val _ = File.write (File.tmp_path (Path.basic "atp_line")) thisLine |
17306 | 195 |
in (* reconstructed proof string *) |
17422 | 196 |
if thisLine = "" then ("No output from reconstruction process.\n","") |
17435 | 197 |
else if String.sub (thisLine, 0) = #"[" orelse (*FIXME: for SPASS?*) |
198 |
String.isPrefix "Satisfiability detected" thisLine orelse |
|
199 |
String.isPrefix "Refutation not found" thisLine orelse |
|
17306 | 200 |
String.isPrefix "Rules from" thisLine |
201 |
then |
|
17422 | 202 |
let val goalstring = TextIO.inputLine instr |
203 |
in (thisLine, goalstring) end |
|
17306 | 204 |
else if thisLine = "Proof found but translation failed!" |
205 |
then |
|
17422 | 206 |
let val goalstring = TextIO.inputLine instr |
17306 | 207 |
val _ = debug "getVampInput: translation of proof failed" |
17422 | 208 |
in (thisLine, goalstring) end |
17306 | 209 |
else getVampInput instr |
210 |
end |
|
16478 | 211 |
|
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
212 |
|
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
213 |
(***********************************************************************) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
214 |
(* Function used by the Isabelle process to read in an E proof *) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
215 |
(***********************************************************************) |
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
216 |
|
17376 | 217 |
fun getEInput instr = |
218 |
let val thisLine = TextIO.inputLine instr |
|
219 |
val _ = File.write (File.tmp_path (Path.basic "atp_line")) thisLine |
|
220 |
in (* reconstructed proof string *) |
|
17422 | 221 |
if thisLine = "" then ("No output from reconstruction process.\n","") |
17376 | 222 |
else if String.isPrefix "# Problem is satisfiable" thisLine orelse |
223 |
String.isPrefix "# Cannot determine problem status" thisLine orelse |
|
224 |
String.isPrefix "# Failure:" thisLine |
|
225 |
then |
|
17422 | 226 |
let val goalstring = TextIO.inputLine instr |
227 |
in (thisLine, goalstring) end |
|
17376 | 228 |
else if thisLine = "Proof found but translation failed!" |
229 |
then |
|
17422 | 230 |
let val goalstring = TextIO.inputLine instr |
17376 | 231 |
val _ = debug "getEInput: translation of proof failed" |
17422 | 232 |
in (thisLine, goalstring) end |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
233 |
else getEInput instr |
17376 | 234 |
end |
17315
5bf0e0aacc24
consolidation of duplicate code in Isabelle-ATP linkup
paulson
parents:
17312
diff
changeset
|
235 |
|
16478 | 236 |
end; |