src/HOL/Tools/res_atp_provers.ML
author haftmann
Sat, 19 May 2007 11:33:30 +0200
changeset 23024 70435ffe077d
parent 22373 c6002b06e63e
child 23139 aa899bce7c3b
permissions -rw-r--r--
fixed text
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
     1
(*  ID:         $Id$
17907
c20e4bddcb11 *** empty log message ***
mengj
parents: 17905
diff changeset
     2
    Author:     Jia Meng, NICTA
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
     3
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
     4
Functions used for ATP Oracle.
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
     5
*)
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
     6
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
     7
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
     8
structure ResAtpProvers =
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
     9
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    10
struct
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    11
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    12
fun seek_line s instr =
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    13
  let val thisLine = TextIO.inputLine instr
19479
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    14
  in thisLine <> "" andalso 
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    15
     (thisLine = s orelse seek_line s instr) 
19479
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    16
  end;
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    17
19195
e0b483dea2c0 Moved the settings for ATP time limit to res_atp.ML
mengj
parents: 19129
diff changeset
    18
fun location s = warning ("ATP input at: " ^ s);
18726
02b310b1fa10 added some debugging code.
mengj
parents: 18272
diff changeset
    19
19195
e0b483dea2c0 Moved the settings for ATP time limit to res_atp.ML
mengj
parents: 19129
diff changeset
    20
fun call_vampire (file:string, time: int) = 
e0b483dea2c0 Moved the settings for ATP time limit to res_atp.ML
mengj
parents: 19129
diff changeset
    21
  let val _ = location file
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    22
      val runtime = "-t " ^ (string_of_int time)
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    23
      val vampire = ResAtp.helper_path "VAMPIRE_HOME" "vampire"
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    24
      val (instr,outstr) = Unix.streamsOf (Unix.execute(vampire, [runtime,"--mode casc",file]))
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    25
  in seek_line "--------------------- PROVED ----------------------\n" instr
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    26
  end;
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    27
19195
e0b483dea2c0 Moved the settings for ATP time limit to res_atp.ML
mengj
parents: 19129
diff changeset
    28
fun call_eprover (file:string, time:int) =
e0b483dea2c0 Moved the settings for ATP time limit to res_atp.ML
mengj
parents: 19129
diff changeset
    29
  let val _ = location file
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    30
      val eprover = ResAtp.helper_path "E_HOME" "eprover"
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    31
      val runtime = "--cpu-limit=" ^ (string_of_int time)
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    32
      val (instr,outstr) = Unix.streamsOf (Unix.execute(eprover, 
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    33
                              [runtime,"--tstp-in","-tAutoDev","-xAutoDev",file]))
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    34
  in seek_line "# Proof found!\n" instr
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    35
  end; 
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    36
19723
7602f74c914b A new "spass" method.
mengj
parents: 19479
diff changeset
    37
fun call_spass (file:string, time:int) =
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    38
  let val _ = location file
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    39
      val runtime = "-TimeLimit=" ^ (string_of_int time)
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    40
      val spass = ResAtp.helper_path "SPASS_HOME" "SPASS"
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    41
      val (instr,outstr) = Unix.streamsOf (Unix.execute(spass, 
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    42
			      [runtime,"-Splits=0", "-FullRed=0", "-SOS=1",file]))
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    43
  in seek_line "SPASS beiseite: Proof found.\n" instr
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    44
  end;
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    45
19479
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    46
fun vampire_o _ (file,time) = 
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    47
  if call_vampire (file,time) 
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    48
  then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const)  
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    49
  else (ResAtp.cond_rm_tmp file; raise Fail ("vampire oracle failed"));
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    50
19479
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    51
fun eprover_o _ (file,time) = 
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    52
  if call_eprover (file,time) 
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    53
  then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const)
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    54
  else (ResAtp.cond_rm_tmp file; raise Fail ("eprover oracle failed"));
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    55
19723
7602f74c914b A new "spass" method.
mengj
parents: 19479
diff changeset
    56
fun spass_o _ (file,time) =
7602f74c914b A new "spass" method.
mengj
parents: 19479
diff changeset
    57
    if call_spass (file,time)
7602f74c914b A new "spass" method.
mengj
parents: 19479
diff changeset
    58
    then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const)
7602f74c914b A new "spass" method.
mengj
parents: 19479
diff changeset
    59
    else (ResAtp.cond_rm_tmp file; raise Fail ("SPASS oracle failed"));
7602f74c914b A new "spass" method.
mengj
parents: 19479
diff changeset
    60
7602f74c914b A new "spass" method.
mengj
parents: 19479
diff changeset
    61
17905
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    62
end;
1574533861b1 Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff changeset
    63