src/HOL/Tools/res_atp_provers.ML
author wenzelm
Tue, 10 Jun 2008 19:15:16 +0200
changeset 27123 11fcdd5897dd
parent 23139 aa899bce7c3b
child 28290 4cc2b6046258
permissions -rw-r--r--
case_tac/induct_tac: use same declarations as cases/induct;
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
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
     8
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
     9
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    10
fun seek_line s instr =
23139
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    11
  (case TextIO.inputLine instr of
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    12
    NONE => false
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    13
  | SOME thisLine => thisLine = s orelse 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
    14
19195
e0b483dea2c0 Moved the settings for ATP time limit to res_atp.ML
mengj
parents: 19129
diff changeset
    15
fun location s = warning ("ATP input at: " ^ s);
18726
02b310b1fa10 added some debugging code.
mengj
parents: 18272
diff changeset
    16
23139
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    17
fun call_vampire (file:string, time: int) =
19195
e0b483dea2c0 Moved the settings for ATP time limit to res_atp.ML
mengj
parents: 19129
diff changeset
    18
  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
    19
      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
    20
      val vampire = ResAtp.helper_path "VAMPIRE_HOME" "vampire"
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    21
      val (instr,outstr) = Unix.streamsOf (Unix.execute(vampire, [runtime,"--mode casc",file]))
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    22
  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
    23
  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
    24
19195
e0b483dea2c0 Moved the settings for ATP time limit to res_atp.ML
mengj
parents: 19129
diff changeset
    25
fun call_eprover (file:string, time:int) =
e0b483dea2c0 Moved the settings for ATP time limit to res_atp.ML
mengj
parents: 19129
diff changeset
    26
  let val _ = location file
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    27
      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
    28
      val runtime = "--cpu-limit=" ^ (string_of_int time)
23139
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    29
      val (instr,outstr) = Unix.streamsOf (Unix.execute(eprover,
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    30
                              [runtime,"--tstp-in","-tAutoDev","-xAutoDev",file]))
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    31
  in seek_line "# Proof found!\n" instr
23139
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    32
  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
    33
19723
7602f74c914b A new "spass" method.
mengj
parents: 19479
diff changeset
    34
fun call_spass (file:string, time:int) =
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    35
  let val _ = location file
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    36
      val runtime = "-TimeLimit=" ^ (string_of_int time)
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    37
      val spass = ResAtp.helper_path "SPASS_HOME" "SPASS"
23139
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    38
      val (instr,outstr) = Unix.streamsOf (Unix.execute(spass,
22373
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    39
			      [runtime,"-Splits=0", "-FullRed=0", "-SOS=1",file]))
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    40
  in seek_line "SPASS beiseite: Proof found.\n" instr
c6002b06e63e Updated success string for Vampire.
paulson
parents: 19723
diff changeset
    41
  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
    42
23139
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    43
fun vampire_o _ (file,time) =
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    44
  if call_vampire (file,time)
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    45
  then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const)
19479
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    46
  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
    47
23139
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    48
fun eprover_o _ (file,time) =
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    49
  if call_eprover (file,time)
19479
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    50
  then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const)
caaf68a64ac4 cosmetic changes
paulson
parents: 19195
diff changeset
    51
  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
    52
19723
7602f74c914b A new "spass" method.
mengj
parents: 19479
diff changeset
    53
fun spass_o _ (file,time) =
23139
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    54
  if call_spass (file,time)
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    55
  then (warning file; ResAtp.cond_rm_tmp file; HOLogic.mk_Trueprop HOLogic.false_const)
aa899bce7c3b TextIO.inputLine: use present SML B library version;
wenzelm
parents: 22373
diff changeset
    56
  else (ResAtp.cond_rm_tmp file; raise Fail ("SPASS oracle failed"));
19723
7602f74c914b A new "spass" method.
mengj
parents: 19479
diff changeset
    57
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
    58
end;