author | immler@in.tum.de |
Wed, 14 Jan 2009 20:19:47 +0100 | |
changeset 29588 | 6cccea7c94d4 |
parent 29587 | 96599d8d8268 |
child 29590 | 479a2fce65e6 |
permissions | -rwxr-xr-x |
28573 | 1 |
#!/usr/bin/env perl |
2 |
# |
|
3 |
# Wrapper for custom remote provers on SystemOnTPTP |
|
4 |
# Author: Fabian Immler, TU Muenchen |
|
5 |
# |
|
29587
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
6 |
# Usage: ./remote prover timelimit problemfile |
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
7 |
# |
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
8 |
# where prover should be the name of the System from http://www.cs.miami.edu/~tptp/cgi-bin/SystemOnTPTP |
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
9 |
# tested and working with the standard settings: |
28573 | 10 |
# |
29587
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
11 |
# ./remote Vampire---9.0 timelimit file |
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
12 |
# ./remote SPASS---3.01 timelimit file |
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
13 |
# ./remote EP---1.0 timelimit file |
28573 | 14 |
|
15 |
use warnings; |
|
16 |
use strict; |
|
17 |
||
18 |
use Getopt::Std; |
|
19 |
use HTTP::Request::Common; |
|
20 |
use LWP::UserAgent; |
|
21 |
||
22 |
# address of proof-server |
|
23 |
my $SystemOnTPTPFormReplyURL = "http://www.cs.miami.edu/~tptp/cgi-bin/SystemOnTPTPFormReply"; |
|
24 |
||
29587
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
25 |
if(scalar(@ARGV) != 3) { |
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
26 |
print "usage: "; |
28573 | 27 |
exit -1; |
28 |
} |
|
29 |
my $prover = shift(@ARGV); |
|
29587
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
30 |
my $timelimit = shift(@ARGV); |
28573 | 31 |
my $problem = [shift(@ARGV)]; |
32 |
||
33 |
# fill in form |
|
34 |
my %URLParameters = ( |
|
35 |
"NoHTML" => 1, |
|
36 |
"QuietFlag" => "-q01", |
|
37 |
"X2TPTP" => "-S", |
|
38 |
"SubmitButton" => "RunSelectedSystems", |
|
39 |
"ProblemSource" => "UPLOAD", |
|
40 |
"UPLOADProblem" => $problem, |
|
41 |
"System___$prover" => "$prover", |
|
29587
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
42 |
"TimeLimit___$prover" => "$timelimit", |
28573 | 43 |
); |
44 |
||
45 |
# Query Server |
|
46 |
my $Agent = LWP::UserAgent->new; |
|
47 |
my $Request = POST($SystemOnTPTPFormReplyURL, |
|
48 |
Content_Type => 'form-data',Content => \%URLParameters); |
|
49 |
my $Response = $Agent->request($Request); |
|
50 |
||
51 |
#catch errors, let isabelle/watcher know |
|
52 |
if($Response->is_success && $Response->content !~ /NO SOLUTION OUTPUT BY SYSTEM/ |
|
53 |
&& $Response->content =~ m/%\s*Result\s*:\s*Unsatisfiable.*?\n%\s*Output\s*:\s*.*?Refutation.*?\n/){ |
|
54 |
# convert to isabelle-friendly format |
|
55 |
my @lines = split( /%\s*Result\s*:\s*Unsatisfiable.*?\n%\s*Output\s*:\s*.*?Refutation.*?\n/, $Response->content); |
|
56 |
@lines = split( /\n/, $lines[1]); my $extract = ""; |
|
57 |
my $inproof = 0 > 1; |
|
58 |
my $ende = 0 > 1; |
|
59 |
foreach my $line (@lines){ |
|
60 |
if(! $ende){ |
|
61 |
#ignore comments |
|
62 |
if(! $inproof){ |
|
63 |
if ($line !~ /^%/ && !($line eq "")) { |
|
64 |
$extract .= "$line"; |
|
65 |
$inproof = 1; |
|
66 |
} |
|
67 |
} else { |
|
68 |
if ($line !~ /^%/) { |
|
69 |
$extract .= "$line"; |
|
70 |
} else { |
|
71 |
$ende = 1; |
|
72 |
} |
|
73 |
} |
|
74 |
} |
|
75 |
} |
|
76 |
# insert newlines after '.' |
|
77 |
$extract =~ s/\s//g; |
|
78 |
$extract =~ s/\)\.cnf/\)\.\ncnf/g; |
|
79 |
print "# SZS output start CNFRefutation.\n"; |
|
80 |
print "$extract\n"; |
|
81 |
print "# SZS output end CNFRefutation.\n"; |
|
82 |
} else { |
|
83 |
print "HTTP-Request: " . $Response->message; |
|
29587
96599d8d8268
simplified usage of remote-script; added compatible remote-atps
immler@in.tum.de
parents:
28573
diff
changeset
|
84 |
print "\nResponse: " . $Response->content; |
28573 | 85 |
print "\nCANNOT PROVE: \n"; |
86 |
print $Response->content; |
|
87 |
} |
|
88 |