src/HOL/Tools/res_atp.ML
author quigley
Thu Jun 02 15:54:11 2005 +0200 (2005-06-02)
changeset 16185 bb71c91e781e
parent 16172 629ba53a072f
child 16259 aed1a8ae4b23
permissions -rw-r--r--
Added time lime (60 secs) to Spass calls.
paulson@15608
     1
(*  Author: Jia Meng, Cambridge University Computer Laboratory
paulson@15608
     2
    ID: $Id$
paulson@15608
     3
    Copyright 2004 University of Cambridge
paulson@15347
     4
paulson@15347
     5
ATPs with TPTP format input.
paulson@15347
     6
*)
paulson@15452
     7
paulson@15452
     8
(*Jia: changed: isar_atp now processes entire proof context.  fetch thms from delta simpset/claset*)
quigley@15644
     9
(*Claire: changed: added actual watcher calls *)
paulson@15452
    10
quigley@15779
    11
paulson@15347
    12
signature RES_ATP = 
paulson@15347
    13
sig
paulson@15608
    14
val trace_res : bool ref
quigley@15779
    15
val subgoals: Thm.thm list
quigley@15779
    16
val traceflag : bool ref
paulson@15608
    17
val axiom_file : Path.T
paulson@15608
    18
val hyps_file : Path.T
paulson@15608
    19
val isar_atp : ProofContext.context * Thm.thm -> unit
quigley@15657
    20
val prob_file : Path.T;
quigley@15644
    21
(*val atp_ax_tac : Thm.thm list -> int -> Tactical.tactic*)
quigley@15644
    22
(*val atp_tac : int -> Tactical.tactic*)
paulson@15608
    23
val debug: bool ref
quigley@16156
    24
val full_spass: bool ref
paulson@15347
    25
end;
paulson@15347
    26
paulson@15347
    27
structure ResAtp : RES_ATP =
paulson@15608
    28
paulson@15347
    29
struct
paulson@15347
    30
quigley@15779
    31
val subgoals = [];
quigley@15644
    32
quigley@15779
    33
val traceflag = ref true;
paulson@16172
    34
paulson@15608
    35
val debug = ref false;
paulson@15608
    36
fun debug_tac tac = (warning "testing";tac);
paulson@15347
    37
paulson@15608
    38
val trace_res = ref false;
quigley@16156
    39
val full_spass = ref false;
paulson@15347
    40
paulson@15608
    41
val skolem_tac = skolemize_tac;
paulson@15608
    42
quigley@15644
    43
val num_of_clauses = ref 0;
quigley@15644
    44
val clause_arr = Array.array(3500, ("empty", 0));
quigley@15644
    45
paulson@15347
    46
paulson@15608
    47
val atomize_tac =
paulson@15608
    48
    SUBGOAL
paulson@15608
    49
     (fn (prop,_) =>
paulson@15608
    50
	 let val ts = Logic.strip_assums_hyp prop
paulson@15608
    51
	 in EVERY1 
paulson@15608
    52
		[METAHYPS
paulson@15608
    53
		     (fn hyps => (cut_facts_tac (map (ObjectLogic.atomize_thm o forall_intr_vars) hyps) 1)),
paulson@15608
    54
	  REPEAT_DETERM_N (length ts) o (etac thin_rl)]
paulson@15608
    55
     end);
paulson@15347
    56
paulson@15608
    57
(* temporarily use these files, which will be loaded by Vampire *)
quigley@15644
    58
val file_id_num =ref 0;
paulson@15608
    59
quigley@15644
    60
fun new_prob_file () =  (file_id_num := (!file_id_num) + 1;"prob"^(string_of_int (!file_id_num)));
paulson@15608
    61
paulson@15347
    62
quigley@15644
    63
val axiom_file = File.tmp_path (Path.basic "axioms");
quigley@15644
    64
val clasimp_file = File.tmp_path (Path.basic "clasimp");
quigley@15644
    65
val hyps_file = File.tmp_path (Path.basic "hyps");
quigley@15644
    66
val prob_file = File.tmp_path (Path.basic "prob");
quigley@15644
    67
val dummy_tac = PRIMITIVE(fn thm => thm );
quigley@15644
    68
quigley@15644
    69
 
paulson@15347
    70
(**** for Isabelle/ML interface  ****)
paulson@15347
    71
paulson@16172
    72
fun is_proof_char ch = (ch = " ") orelse
paulson@16172
    73
     ((ord"!" <= ord ch) andalso (ord ch <= ord"~") andalso (ch <> "?"))  
paulson@15608
    74
paulson@16172
    75
fun proofstring x = List.filter (is_proof_char) (explode x);
paulson@15608
    76
paulson@15452
    77
quigley@15644
    78
(*
quigley@15644
    79
fun call_atp_tac thms n = (tptp_inputs thms ; dummy_tac);
paulson@15347
    80
quigley@15644
    81
*)
paulson@15347
    82
paulson@15347
    83
(**** For running in Isar ****)
paulson@15347
    84
paulson@15608
    85
(* same function as that in res_axioms.ML *)
paulson@15608
    86
fun repeat_RS thm1 thm2 =
paulson@15608
    87
    let val thm1' =  thm1 RS thm2 handle THM _ => thm1
paulson@15608
    88
    in
paulson@15608
    89
	if eq_thm(thm1,thm1') then thm1' else (repeat_RS thm1' thm2)
paulson@15608
    90
    end;
paulson@15608
    91
paulson@15608
    92
(* a special version of repeat_RS *)
paulson@15608
    93
fun repeat_someI_ex thm = repeat_RS thm someI_ex;
paulson@15608
    94
quigley@15644
    95
(*********************************************************************)
paulson@15608
    96
(* convert clauses from "assume" to conjecture. write to file "hyps" *)
quigley@15644
    97
(* hypotheses of the goal currently being proved                     *)
quigley@15644
    98
(*********************************************************************)
quigley@15644
    99
paulson@15608
   100
fun isar_atp_h thms =
quigley@15644
   101
        
paulson@15608
   102
    let val prems = map (skolemize o make_nnf o ObjectLogic.atomize_thm) thms
quigley@15644
   103
        val prems' = map repeat_someI_ex prems
quigley@15644
   104
        val prems'' = make_clauses prems'
quigley@15644
   105
        val prems''' = ResAxioms.rm_Eps [] prems''
quigley@15644
   106
        val clss = map ResClause.make_conjecture_clause prems'''
paulson@15774
   107
	val (tptp_clss,tfree_litss) = ListPair.unzip (map ResClause.clause2tptp clss) 
paulson@15608
   108
	val tfree_lits = ResLib.flat_noDup tfree_litss
paulson@15608
   109
	val tfree_clss = map ResClause.tfree_clause tfree_lits 
paulson@15608
   110
        val hypsfile = File.sysify_path hyps_file
paulson@15608
   111
	val out = TextIO.openOut(hypsfile)
paulson@15608
   112
    in
paulson@15608
   113
	((ResLib.writeln_strs out (tfree_clss @ tptp_clss); TextIO.closeOut out; if !trace_res then (warning hypsfile) else ());tfree_lits) 
paulson@15608
   114
    end;
paulson@15347
   115
quigley@15644
   116
quigley@15644
   117
(*********************************************************************)
quigley@15644
   118
(* write out a subgoal as tptp clauses to the file "probN"           *)
quigley@15644
   119
(* where N is the number of this subgoal                             *)
quigley@15644
   120
(*********************************************************************)
quigley@15644
   121
paulson@15608
   122
fun tptp_inputs_tfrees thms n tfrees = 
quigley@15657
   123
    let val _ = (warning ("in tptp_inputs_tfrees 0"))
quigley@15657
   124
        val clss = map (ResClause.make_conjecture_clause_thm) thms
quigley@15657
   125
         val _ = (warning ("in tptp_inputs_tfrees 1"))
paulson@15774
   126
	val (tptp_clss,tfree_litss) = ListPair.unzip (map ResClause.clause2tptp clss)
quigley@15657
   127
        val _ = (warning ("in tptp_inputs_tfrees 2"))
paulson@15608
   128
	val tfree_clss = map ResClause.tfree_clause ((ResLib.flat_noDup tfree_litss) \\ tfrees) 
quigley@15657
   129
         val _ = (warning ("in tptp_inputs_tfrees 3"))
paulson@15608
   130
        val probfile = (File.sysify_path prob_file) ^ "_" ^ (string_of_int n)
paulson@15608
   131
	val out = TextIO.openOut(probfile)
paulson@15608
   132
    in
paulson@16172
   133
	(ResLib.writeln_strs out (tfree_clss @ tptp_clss); TextIO.closeOut out;
paulson@16172
   134
	 if !trace_res then (warning probfile) else ())
paulson@15608
   135
    end;
paulson@15452
   136
paulson@15608
   137
quigley@15644
   138
(*********************************************************************)
quigley@15644
   139
(* call SPASS with settings and problem file for the current subgoal *)
quigley@15644
   140
(* should be modified to allow other provers to be called            *)
quigley@15644
   141
(*********************************************************************)
paulson@15608
   142
paulson@16089
   143
fun call_resolve_tac sign thms sg_term (childin, childout,pid) n  =
paulson@16089
   144
    let val thmstring = Meson.concat_with_and (map string_of_thm thms) 
paulson@16089
   145
	val thm_no = length thms
paulson@16089
   146
	val _ = warning ("number of thms is : "^(string_of_int thm_no))
paulson@16089
   147
	val _ = warning ("thmstring in call_res is: "^thmstring)
paulson@16089
   148
   
paulson@16089
   149
	val goalstr = Sign.string_of_term sign sg_term 
paulson@16089
   150
	val goalproofstring = proofstring goalstr
paulson@16089
   151
	val no_returns =List.filter not_newline ( goalproofstring)
paulson@16089
   152
	val goalstring = implode no_returns
paulson@16089
   153
	val _ = warning ("goalstring in call_res is: "^goalstring)
paulson@16089
   154
   
paulson@16089
   155
	(*val prob_file =File.tmp_path (Path.basic newprobfile); *)
paulson@16089
   156
	(*val _ =( warning ("calling make_clauses "))
paulson@16089
   157
	val clauses = make_clauses thms
paulson@16089
   158
	val _ =( warning ("called make_clauses "))*)
paulson@16089
   159
	(*val _ = tptp_inputs clauses prob_file*)
paulson@16089
   160
	val thmstring = Meson.concat_with_and (map string_of_thm thms) 
paulson@16089
   161
      
paulson@16089
   162
	val goalstr = Sign.string_of_term sign sg_term 
paulson@16089
   163
	val goalproofstring = proofstring goalstr
paulson@16089
   164
	val no_returns =List.filter not_newline ( goalproofstring)
paulson@16089
   165
	val goalstring = implode no_returns
paulson@16089
   166
   
paulson@16089
   167
	val thmproofstring = proofstring ( thmstring)
paulson@16089
   168
	val no_returns =List.filter   not_newline ( thmproofstring)
paulson@16089
   169
	val thmstr = implode no_returns
paulson@16089
   170
       
paulson@16089
   171
	val probfile = (File.sysify_path prob_file) ^ "_" ^ (string_of_int n)
paulson@16089
   172
	val axfile = (File.sysify_path axiom_file)
paulson@16089
   173
	val hypsfile = (File.sysify_path hyps_file)
paulson@16089
   174
	val clasimpfile = (File.sysify_path clasimp_file)
paulson@16089
   175
	val outfile = TextIO.openOut(File.sysify_path(File.tmp_path (Path.basic "hellofile")))
paulson@16089
   176
	val _ = TextIO.output(outfile, "prob file path is "^probfile^" thmstring is "^thmstr^" goalstring is "^goalstring);
paulson@16089
   177
	val _ = TextIO.flushOut outfile;
paulson@16089
   178
	val _ =  TextIO.closeOut outfile
paulson@16089
   179
     in
paulson@16089
   180
	(* without paramodulation *)
paulson@16089
   181
	(warning ("goalstring in call_res_tac is: "^goalstring));
paulson@16089
   182
	(warning ("prob file in cal_res_tac is: "^probfile));
paulson@16089
   183
     (* Watcher.callResProvers(childout,
paulson@16089
   184
     [("spass",thmstr,goalstring,*spass_home*,  
paulson@16089
   185
     "-DocProof", 
paulson@16089
   186
     clasimpfile, axfile, hypsfile, probfile)]);*)
quigley@16156
   187
  if !full_spass 
quigley@16156
   188
  then
quigley@16156
   189
   (Watcher.callResProvers(childout,
quigley@16156
   190
	    [("spass", thmstr, goalstring (*,spass_home*), 
quigley@16156
   191
	     getenv "ISABELLE_HOME" ^ "/src/HOL/Tools/ATP/spassshell",  
quigley@16185
   192
	     "-DocProof%-TimeLimit=60", 
quigley@16156
   193
	     clasimpfile, axfile, hypsfile, probfile)]))
quigley@16156
   194
  else	
quigley@16156
   195
   (Watcher.callResProvers(childout,
paulson@16089
   196
	    [("spass", thmstr, goalstring (*,spass_home*), 
paulson@16089
   197
	     getenv "ISABELLE_HOME" ^ "/src/HOL/Tools/ATP/spassshell",  
quigley@16185
   198
	     "-Auto=0%-ISRe%-ISFc%-RTaut%-RFSub%-RBSub%-DocProof%-TimeLimit=60", 
quigley@16156
   199
	     clasimpfile, axfile, hypsfile, probfile)]));
paulson@16089
   200
     
paulson@16089
   201
	(* with paramodulation *)
paulson@16089
   202
	(*Watcher.callResProvers(childout,
paulson@16089
   203
	       [("spass",thmstr,goalstring,spass_home,
paulson@16089
   204
	       "-FullRed=0%-ISPm=1%-Split=0%-PObv=0%-DocProof", 
paulson@16089
   205
		 prob_path)]); *)
paulson@16089
   206
       (* Watcher.callResProvers(childout,
paulson@16089
   207
	[("spass",thmstr,goalstring,spass_home, 
paulson@16089
   208
	"-DocProof",  prob_path)]);*)
paulson@16089
   209
	dummy_tac
paulson@16089
   210
    end
paulson@15452
   211
quigley@15644
   212
(**********************************************************)
quigley@15644
   213
(* write out the current subgoal as a tptp file, probN,   *)
quigley@15644
   214
(* then call dummy_tac - should be call_res_tac           *)
quigley@15644
   215
(**********************************************************)
quigley@15679
   216
quigley@15657
   217
paulson@15697
   218
fun call_atp_tac_tfrees sign thms n tfrees sg_term (childin, childout,pid) = 
paulson@16172
   219
 (
paulson@16172
   220
   warning("in call_atp_tac_tfrees");
paulson@16172
   221
   tptp_inputs_tfrees (make_clauses thms) n tfrees;
paulson@16172
   222
   call_resolve_tac sign thms sg_term (childin, childout, pid) n;
paulson@16172
   223
   dummy_tac);
quigley@15644
   224
paulson@15697
   225
fun atp_tac_tfrees tfrees sg_term (childin, childout,pid)  n st = 
paulson@16172
   226
  let val sign = sign_of_thm st
paulson@16172
   227
      val _ = warning ("in atp_tac_tfrees ")
paulson@16172
   228
      val _ = warning ("sg_term :" ^ (Sign.string_of_term sign sg_term))
paulson@16172
   229
  in  
paulson@16172
   230
    SELECT_GOAL
paulson@16172
   231
      (EVERY1 [rtac ccontr,atomize_tac, skolemize_tac, 
paulson@16172
   232
       METAHYPS(fn negs => (call_atp_tac_tfrees sign negs n tfrees sg_term
paulson@16172
   233
                            (childin, childout,pid) ))]) n st
paulson@16172
   234
  end;
quigley@15679
   235
quigley@15679
   236
quigley@15779
   237
fun isar_atp_g tfrees sg_term (childin, childout, pid) n =       
paulson@16172
   238
  ((warning("in isar_atp_g"));
paulson@16172
   239
   atp_tac_tfrees tfrees sg_term (childin, childout, pid) n);
quigley@15644
   240
quigley@15644
   241
quigley@15644
   242
quigley@15644
   243
(**********************************************)
quigley@15644
   244
(* recursively call atp_tac_g on all subgoals *)
quigley@15644
   245
(* sg_term is the nth subgoal as a term - used*)
quigley@15644
   246
(* in proof reconstruction                    *)
quigley@15644
   247
(**********************************************)
quigley@15644
   248
quigley@15644
   249
fun isar_atp_goal' thm k n tfree_lits  (childin, childout, pid) = 
paulson@16061
   250
      if (k > n) 
paulson@16061
   251
      then () 
paulson@16061
   252
      else 
paulson@16172
   253
	  let val prems = prems_of thm 
paulson@16061
   254
	      val sg_term = ReconOrderClauses.get_nth n prems
paulson@16061
   255
	      val thmstring = string_of_thm thm
paulson@16061
   256
	  in   
paulson@16061
   257
	      (warning("in isar_atp_goal'"));
paulson@16061
   258
	      (warning("thmstring in isar_atp_goal': "^thmstring));
paulson@16061
   259
	       isar_atp_g tfree_lits  sg_term (childin, childout, pid) k thm; 
paulson@16061
   260
	       isar_atp_goal' thm (k+1) n tfree_lits  (childin, childout, pid) 
paulson@16061
   261
	  end;
quigley@15644
   262
quigley@15644
   263
quigley@15779
   264
fun isar_atp_goal thm n_subgoals tfree_lits   (childin, childout, pid) = 
quigley@15779
   265
              (if (!debug) then warning (string_of_thm thm) 
quigley@15779
   266
               else (isar_atp_goal' thm 1 n_subgoals tfree_lits  (childin, childout, pid) ));
quigley@15644
   267
quigley@15644
   268
(**************************************************)
quigley@15644
   269
(* convert clauses from "assume" to conjecture.   *)
quigley@15644
   270
(* i.e. apply make_clauses and then get tptp for  *)
quigley@15679
   271
(* any hypotheses in the goal produced by assume  *)
quigley@15679
   272
(* statements;                                    *)
quigley@15644
   273
(* write to file "hyps"                           *)
quigley@15644
   274
(**************************************************)
quigley@15644
   275
quigley@15644
   276
quigley@15644
   277
fun isar_atp_aux thms thm n_subgoals  (childin, childout, pid) = 
paulson@15608
   278
    let val tfree_lits = isar_atp_h thms 
paulson@16172
   279
    in warning("in isar_atp_aux");
paulson@16172
   280
       isar_atp_goal thm n_subgoals tfree_lits   (childin, childout, pid)
paulson@15608
   281
    end;
quigley@15644
   282
quigley@15644
   283
(******************************************************************)
quigley@15644
   284
(* called in Isar automatically                                   *)
quigley@15644
   285
(* writes out the current clasimpset to a tptp file               *)
quigley@15644
   286
(* passes all subgoals on to isar_atp_aux for further processing  *)
quigley@15644
   287
(* turns off xsymbol at start of function, restoring it at end    *)
quigley@15644
   288
(******************************************************************)
quigley@15779
   289
(*FIX changed to clasimp_file *)
paulson@16172
   290
fun isar_atp' (ctxt, thms, thm) =
paulson@16172
   291
    let val _=  (print_mode := (Library.gen_rems (op =) (! print_mode, ["xsymbols", "symbols"])))
quigley@15644
   292
        val _= (warning ("in isar_atp'"))
quigley@15779
   293
        val prems  = prems_of thm
paulson@15697
   294
        val sign = sign_of_thm thm
quigley@15779
   295
        val thms_string = Meson.concat_with_and (map string_of_thm thms) 
quigley@15644
   296
        val thmstring = string_of_thm thm
quigley@15779
   297
        val prems_string = Meson.concat_with_and (map (Sign.string_of_term sign) prems) 
quigley@15919
   298
        
quigley@15919
   299
	(* set up variables for writing out the clasimps to a tptp file *)
paulson@16172
   300
	val (clause_arr, num_of_clauses) =
paulson@16172
   301
	    ResClasimp.write_out_clasimp (File.sysify_path clasimp_file) 
paulson@16172
   302
	                                 (ProofContext.theory_of ctxt)
paulson@16172
   303
        val _ = warning ("clasimp_file is " ^ File.sysify_path clasimp_file)
quigley@15779
   304
quigley@15644
   305
        (* cq: add write out clasimps to file *)
quigley@16039
   306
quigley@15919
   307
        (* cq:create watcher and pass to isar_atp_aux *)
quigley@15919
   308
        (* tracing *) 
quigley@15919
   309
        (*val tenth_ax = fst( Array.sub(clause_arr, 1))  
quigley@15919
   310
         val tenth_ax_thms = Recon_Transfer.memo_find_clause (tenth_ax, clause_tab)
quigley@15919
   311
         val clause_str = Meson.concat_with_and (map string_of_thm tenth_ax_thms)
quigley@15919
   312
         val _ = (warning ("tenth axiom in array is: "^tenth_ax))         
quigley@15919
   313
         val _ = (warning ("tenth axiom in table is: "^clause_str))         
quigley@15919
   314
                 
quigley@15919
   315
         val _ = (warning ("num_of_clauses is: "^(string_of_int (num_of_clauses))) )     
quigley@15919
   316
         *)             
quigley@15919
   317
        
quigley@15919
   318
        val (childin,childout,pid) = Watcher.createWatcher(thm,clause_arr, num_of_clauses)
quigley@15644
   319
        val pidstring = string_of_int(Word.toInt (Word.fromLargeWord ( Posix.Process.pidToWord pid )))
paulson@15608
   320
    in
quigley@15644
   321
	case prems of [] => () 
quigley@15644
   322
		    | _ => ((warning ("initial thms: "^thms_string)); 
quigley@15644
   323
                           (warning ("initial thm: "^thmstring));
quigley@15644
   324
                           (warning ("subgoals: "^prems_string));
quigley@15644
   325
                           (warning ("pid: "^ pidstring))); 
quigley@15644
   326
                            isar_atp_aux thms thm (length prems) (childin, childout, pid) ;
quigley@15644
   327
                           
quigley@15644
   328
                           print_mode := (["xsymbols", "symbols"] @ ! print_mode)
paulson@15608
   329
    end;
paulson@15608
   330
paulson@15452
   331
paulson@15608
   332
paulson@15608
   333
paulson@15608
   334
local
paulson@15608
   335
paulson@15608
   336
fun get_thms_cs claset =
paulson@15608
   337
    let val clsset = rep_cs claset
paulson@15608
   338
	val safeEs = #safeEs clsset
paulson@15608
   339
	val safeIs = #safeIs clsset
paulson@15608
   340
	val hazEs = #hazEs clsset
paulson@15608
   341
	val hazIs = #hazIs clsset
paulson@15608
   342
    in
paulson@15608
   343
	safeEs @ safeIs @ hazEs @ hazIs
paulson@15608
   344
    end;
paulson@15608
   345
paulson@15608
   346
fun append_name name [] _ = []
paulson@15608
   347
  | append_name name (thm::thms) k = (Thm.name_thm ((name ^ "_" ^ (string_of_int k)),thm)) :: (append_name name thms (k+1));
paulson@15608
   348
paulson@15608
   349
fun append_names (name::names) (thms::thmss) =
paulson@15608
   350
    let val thms' = append_name name thms 0
paulson@15608
   351
    in
paulson@15608
   352
	thms'::(append_names names thmss)
paulson@15608
   353
    end;
paulson@15608
   354
paulson@15608
   355
fun get_thms_ss [] = []
paulson@15608
   356
  | get_thms_ss thms =
paulson@15608
   357
    let val names = map Thm.name_of_thm thms 
paulson@15608
   358
        val thms' = map (mksimps mksimps_pairs) thms
paulson@15608
   359
        val thms'' = append_names names thms'
paulson@15608
   360
    in
paulson@15608
   361
	ResLib.flat_noDup thms''
paulson@15608
   362
    end;
paulson@15608
   363
paulson@15608
   364
in
paulson@15608
   365
paulson@15452
   366
paulson@15608
   367
(* convert locally declared rules to axiom clauses *)
paulson@15608
   368
(* write axiom clauses to ax_file *)
quigley@15644
   369
(* what about clasimpset - it should already be in the ax file - perhaps append to ax file rather than just *)
quigley@15644
   370
(* write out ? Or keep as a separate file and then cat them all together in the watcher, like we do with the *)
quigley@15644
   371
(*claset file and prob file*)
quigley@16039
   372
(* FIX: update to work with clausify_axiom_pairs now in ResAxioms*)
quigley@16039
   373
(*fun isar_local_thms (delta_cs, delta_ss_thms) =
paulson@15608
   374
    let val thms_cs = get_thms_cs delta_cs
paulson@15608
   375
	val thms_ss = get_thms_ss delta_ss_thms
paulson@15608
   376
	val thms_clauses = ResLib.flat_noDup (map ResAxioms.clausify_axiom (thms_cs @ thms_ss))
paulson@15608
   377
	val clauses_strs = ResLib.flat_noDup (map ResClause.tptp_clause thms_clauses) (*string list*)
paulson@15608
   378
	val ax_file = File.sysify_path axiom_file
paulson@15608
   379
	val out = TextIO.openOut ax_file
paulson@15608
   380
    in
quigley@15644
   381
	(ResLib.writeln_strs out clauses_strs; (warning ("axiom file is: "^ax_file));TextIO.closeOut out)
paulson@15608
   382
    end;
quigley@16039
   383
*)
paulson@15608
   384
paulson@15608
   385
paulson@15608
   386
(* called in Isar automatically *)
quigley@15679
   387
paulson@15608
   388
fun isar_atp (ctxt,thm) =
paulson@15608
   389
    let val prems = ProofContext.prems_of ctxt
quigley@15644
   390
        val d_cs = Classical.get_delta_claset ctxt 
quigley@15644
   391
        val d_ss_thms = Simplifier.get_delta_simpset ctxt
quigley@15644
   392
        val thmstring = string_of_thm thm
quigley@15679
   393
        val sg_prems = prems_of thm
paulson@15697
   394
        val sign = sign_of_thm thm
quigley@15679
   395
        val prem_no = length sg_prems
quigley@15779
   396
        val prems_string = Meson.concat_with_and (map (Sign.string_of_term sign) sg_prems) 
paulson@15608
   397
    in
quigley@15644
   398
          (warning ("initial thm in isar_atp: "^thmstring));
quigley@15644
   399
          (warning ("subgoals in isar_atp: "^prems_string));
quigley@15779
   400
    	  (warning ("number of subgoals in isar_atp: "^(string_of_int prem_no)));
quigley@16039
   401
          ((*isar_local_thms (d_cs,d_ss_thms); *)(warning("about to call isar_atp'"));
paulson@16172
   402
           isar_atp' (ctxt, prems, thm))
paulson@15608
   403
    end;
paulson@15347
   404
paulson@15608
   405
end
paulson@15608
   406
paulson@15608
   407
paulson@15347
   408
end;
paulson@15347
   409
paulson@15347
   410
Proof.atp_hook := ResAtp.isar_atp;