src/HOL/Tools/SMT/lib/scripts/remote_smt
author blanchet
Tue, 17 Jan 2012 18:25:36 +0100
changeset 46241 1a0b8f529b96
parent 41432 3214c39777ab
permissions -rwxr-xr-x
allow use of proxy for remote SMT solver invocations, just like in the "remote_atp" script
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36898
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     1
#!/usr/bin/env perl
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     2
#
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     3
# Author: Sascha Boehme, TU Muenchen
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     4
#
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     5
# Invoke remote SMT solvers.
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     6
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     7
use strict;
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     8
use warnings;
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
     9
use LWP;
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    10
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    11
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    12
# arguments
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    13
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    14
my $solver = $ARGV[0];
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    15
my @options = @ARGV[1 .. ($#ARGV - 1)];
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    16
my $problem_file = $ARGV[-1];
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    17
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    18
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    19
# call solver
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    20
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    21
my $agent = LWP::UserAgent->new;
46241
1a0b8f529b96 allow use of proxy for remote SMT solver invocations, just like in the "remote_atp" script
blanchet
parents: 41432
diff changeset
    22
$agent->env_proxy;
36898
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    23
$agent->agent("SMT-Request");
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    24
$agent->timeout(180);
41432
3214c39777ab differentiate between local and remote SMT solvers (e.g., "z3" vs. "remote_z3");
boehmes
parents: 40684
diff changeset
    25
my $response = $agent->post($ENV{"ISABELLE_SMT_REMOTE_URL"}, [
36898
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    26
  "Solver" => $solver,
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    27
  "Options" => join(" ", @options),
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    28
  "Problem" => [$problem_file] ],
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    29
  "Content_Type" => "form-data");
40684
c7ba327eb58c more precise error handling in Sledgehammer/SMT for Z3 and remote SMT provers
blanchet
parents: 36898
diff changeset
    30
if (not $response->is_success) { die "HTTP error: " . $response->message; }
36898
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    31
else { print $response->content; }
8e55aa1306c5 integrated SMT into the HOL image
boehmes
parents:
diff changeset
    32