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