Admin/E/eproof
changeset 32675 5fe601aff9be
parent 32595 2953c3917e21
equal deleted inserted replaced
32674:b629fbcc5313 32675:5fe601aff9be
     9 #
     9 #
    10 
    10 
    11 
    11 
    12 use File::Basename qw/ dirname /;
    12 use File::Basename qw/ dirname /;
    13 use File::Temp qw/ tempfile /;
    13 use File::Temp qw/ tempfile /;
       
    14 use English;
    14 
    15 
    15 
    16 
    16 # E executables
    17 # E executables
    17 
    18 
    18 my $edir = dirname($0);
    19 my $edir = dirname($0);
    42 
    43 
    43 
    44 
    44 # run E, redirecting output into a temporary file
    45 # run E, redirecting output into a temporary file
    45 
    46 
    46 my ($fh, $filename) = tempfile(UNLINK => 1);
    47 my ($fh, $filename) = tempfile(UNLINK => 1);
    47 my $r = system "$eprover_cmd > $filename";
    48 my $r = system "$eprover_cmd > '$filename'";
    48 exit ($r >> 8) if $r != 0;
    49 exit ($r >> 8) if $r != 0;
    49 
    50 
    50 
    51 
    51 # analyze E output
    52 # analyze E output
    52 
    53 
    53 my @lines = <$fh>;
    54 my @lines = <$fh>;
    54 my $content = join "", @lines[-60 .. -1];
    55 my $content = join "", @lines[-60 .. -1];
    55   # Note: Like the original eproof, we only look at the last 60 lines.
    56   # Note: Like the original eproof, we only look at the last 60 lines.
    56 
    57 
    57 if ($content =~ m/Total time\s*:\s*([0-9]+\.[0-9]+)/) {
    58 if ($content =~ m/Total time\s*:\s*([0-9]+\.[0-9]+)/) {
    58   $timelimit = $timelimit - $1 - 1;
    59   $timelimit = int($timelimit - $1 - 1);
    59 
    60 
    60   if ($content =~ m/No proof found!/) {
    61   if ($content =~ m/No proof found!/) {
    61     print "# Problem is satisfiable (or invalid), " .
    62     print "# Problem is satisfiable (or invalid), " .
    62       "generating saturation derivation\n";
    63       "generating saturation derivation\n";
    63   }
    64   }
    83 
    84 
    84 foreach (@lines) {
    85 foreach (@lines) {
    85   print if (m/# SZS status/ or m/"# Failure"/);
    86   print if (m/# SZS status/ or m/"# Failure"/);
    86 }
    87 }
    87 $r = system ("exec bash -c \"ulimit -S -t $timelimit; " .
    88 $r = system ("exec bash -c \"ulimit -S -t $timelimit; " .
    88   "'$epclextract' $format -f --competition-framing $filename\"");
    89   "'$epclextract' $format -f --competition-framing '$filename'\"");
    89   # Note: Setting the user time is not supported on Cygwin, i.e., ulimit fails
    90   # Note: Setting the user time is not supported on Cygwin, i.e., ulimit fails
    90   # and prints and error message. How could we then limit the execution time?
    91   # and prints and error message. How could we then limit the execution time?
    91 exit ($r >> 8);
    92 exit ($r >> 8);
    92 
    93