3 # eproof - run E and translate its output into TSTP format
5 # Author: Sascha Boehme, TU Muenchen
7 # This script is a port of a Bash script with the same name coming with
8 # E 1.0-004 (written by Stephan Schulz).
12 use File::Basename qw/ dirname /;
13 use File::Temp qw/ tempfile /;
19 my $edir = dirname($0);
20 my $eprover = "$edir/eprover";
21 my $epclextract = "$edir/epclextract";
24 # build E command from given commandline arguments
27 my $timelimit = 2000000000; # effectively unlimited
29 my $eprover_cmd = "'$eprover'";
31 if (m/--cpu-limit=([0-9]+)/) {
39 $eprover_cmd = "$eprover_cmd '$_'";
42 $eprover_cmd = "$eprover_cmd -l4 -R -o- --pcl-terms-compressed --pcl-compact";
45 # run E, redirecting output into a temporary file
47 my ($fh, $filename) = tempfile(UNLINK => 1);
48 my $r = system "$eprover_cmd > '$filename'";
49 exit ($r >> 8) if $r != 0;
55 my $content = join "", @lines[-60 .. -1];
56 # Note: Like the original eproof, we only look at the last 60 lines.
58 if ($content =~ m/Total time\s*:\s*([0-9]+\.[0-9]+)/) {
59 $timelimit = int($timelimit - $1 - 1);
61 if ($content =~ m/No proof found!/) {
62 print "# Problem is satisfiable (or invalid), " .
63 "generating saturation derivation\n";
65 elsif ($content =~ m/Proof found!/) {
66 print "# Problem is unsatisfiable (or provable), " .
67 "constructing proof object\n";
69 elsif ($content =~ m/Watchlist is empty!/) {
70 print "# All watchlist clauses generated, constructing derivation\n";
73 print "# Cannot determine problem status\n";
78 print "# Cannot determine problem status within resource limit\n";
86 print if (m/# SZS status/ or m/"# Failure"/);
88 $r = system ("exec bash -c \"ulimit -S -t $timelimit; " .
89 "'$epclextract' $format -f --competition-framing '$filename'\"");
90 # Note: Setting the user time is not supported on Cygwin, i.e., ulimit fails
91 # and prints and error message. How could we then limit the execution time?