src/HOL/Tools/res_atp.ML
author paulson
Thu May 26 16:50:07 2005 +0200 (2005-05-26)
changeset 16089 9169bdf930f8
parent 16061 8a139c1557bf
child 16156 2f6fc19aba1e
permissions -rw-r--r--
trying to set up portable calling sequences for SPASS and tptp2X
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@16089
   147
fun call_resolve_tac sign thms sg_term (childin, childout,pid) n  =
paulson@16089
   148
    let val thmstring = Meson.concat_with_and (map string_of_thm thms) 
paulson@16089
   149
	val thm_no = length thms
paulson@16089
   150
	val _ = warning ("number of thms is : "^(string_of_int thm_no))
paulson@16089
   151
	val _ = warning ("thmstring in call_res is: "^thmstring)
paulson@16089
   152
   
paulson@16089
   153
	val goalstr = Sign.string_of_term sign sg_term 
paulson@16089
   154
	val goalproofstring = proofstring goalstr
paulson@16089
   155
	val no_returns =List.filter not_newline ( goalproofstring)
paulson@16089
   156
	val goalstring = implode no_returns
paulson@16089
   157
	val _ = warning ("goalstring in call_res is: "^goalstring)
paulson@16089
   158
   
paulson@16089
   159
	(*val prob_file =File.tmp_path (Path.basic newprobfile); *)
paulson@16089
   160
	(*val _ =( warning ("calling make_clauses "))
paulson@16089
   161
	val clauses = make_clauses thms
paulson@16089
   162
	val _ =( warning ("called make_clauses "))*)
paulson@16089
   163
	(*val _ = tptp_inputs clauses prob_file*)
paulson@16089
   164
	val thmstring = Meson.concat_with_and (map string_of_thm thms) 
paulson@16089
   165
      
paulson@16089
   166
	val goalstr = Sign.string_of_term sign sg_term 
paulson@16089
   167
	val goalproofstring = proofstring goalstr
paulson@16089
   168
	val no_returns =List.filter not_newline ( goalproofstring)
paulson@16089
   169
	val goalstring = implode no_returns
paulson@16089
   170
   
paulson@16089
   171
	val thmproofstring = proofstring ( thmstring)
paulson@16089
   172
	val no_returns =List.filter   not_newline ( thmproofstring)
paulson@16089
   173
	val thmstr = implode no_returns
paulson@16089
   174
       
paulson@16089
   175
	val probfile = (File.sysify_path prob_file) ^ "_" ^ (string_of_int n)
paulson@16089
   176
	val axfile = (File.sysify_path axiom_file)
paulson@16089
   177
	val hypsfile = (File.sysify_path hyps_file)
paulson@16089
   178
	val clasimpfile = (File.sysify_path clasimp_file)
paulson@16089
   179
	val outfile = TextIO.openOut(File.sysify_path(File.tmp_path (Path.basic "hellofile")))
paulson@16089
   180
	val _ = TextIO.output(outfile, "prob file path is "^probfile^" thmstring is "^thmstr^" goalstring is "^goalstring);
paulson@16089
   181
	val _ = TextIO.flushOut outfile;
paulson@16089
   182
	val _ =  TextIO.closeOut outfile
paulson@16089
   183
     in
paulson@16089
   184
	(* without paramodulation *)
paulson@16089
   185
	(warning ("goalstring in call_res_tac is: "^goalstring));
paulson@16089
   186
	(warning ("prob file in cal_res_tac is: "^probfile));
paulson@16089
   187
     (* Watcher.callResProvers(childout,
paulson@16089
   188
     [("spass",thmstr,goalstring,*spass_home*,  
paulson@16089
   189
     "-DocProof", 
paulson@16089
   190
     clasimpfile, axfile, hypsfile, probfile)]);*)
paulson@16089
   191
	 Watcher.callResProvers(childout,
paulson@16089
   192
	    [("spass", thmstr, goalstring (*,spass_home*), 
paulson@16089
   193
	     getenv "ISABELLE_HOME" ^ "/src/HOL/Tools/ATP/spassshell",  
paulson@16089
   194
	     "-Auto=0%-ISRe%-ISFc%-RTaut%-RFSub%-RBSub%-DocProof", 
paulson@16089
   195
	     clasimpfile, axfile, hypsfile, probfile)]);
paulson@16089
   196
     
paulson@16089
   197
	(* with paramodulation *)
paulson@16089
   198
	(*Watcher.callResProvers(childout,
paulson@16089
   199
	       [("spass",thmstr,goalstring,spass_home,
paulson@16089
   200
	       "-FullRed=0%-ISPm=1%-Split=0%-PObv=0%-DocProof", 
paulson@16089
   201
		 prob_path)]); *)
paulson@16089
   202
       (* Watcher.callResProvers(childout,
paulson@16089
   203
	[("spass",thmstr,goalstring,spass_home, 
paulson@16089
   204
	"-DocProof",  prob_path)]);*)
paulson@16089
   205
	dummy_tac
paulson@16089
   206
    end
paulson@15452
   207
quigley@15644
   208
(**********************************************************)
quigley@15644
   209
(* write out the current subgoal as a tptp file, probN,   *)
quigley@15644
   210
(* then call dummy_tac - should be call_res_tac           *)
quigley@15644
   211
(**********************************************************)
quigley@15679
   212
quigley@15657
   213
paulson@15697
   214
fun call_atp_tac_tfrees sign thms n tfrees sg_term (childin, childout,pid) = 
quigley@15779
   215
                                         (
paulson@15697
   216
                                           warning("in call_atp_tac_tfrees");
quigley@15679
   217
                                           
quigley@15657
   218
                                           tptp_inputs_tfrees (make_clauses thms) n tfrees;
paulson@15697
   219
                                           call_resolve_tac sign thms sg_term (childin, childout, pid) n;
quigley@15679
   220
  					   dummy_tac);
quigley@15644
   221
paulson@15697
   222
fun atp_tac_tfrees tfrees sg_term (childin, childout,pid)  n st = 
paulson@15697
   223
let val sign = sign_of_thm st
paulson@15697
   224
    val _ = warning ("in atp_tac_tfrees ")
paulson@15697
   225
    val _ = warning ("sg_term :" ^ (Sign.string_of_term sign sg_term))
quigley@15679
   226
   
quigley@15679
   227
   in
quigley@15779
   228
quigley@15679
   229
SELECT_GOAL
paulson@15682
   230
  (EVERY1 [rtac ccontr,atomize_tac, skolemize_tac, 
quigley@15779
   231
  METAHYPS(fn negs => ( call_atp_tac_tfrees sign negs n tfrees sg_term (childin, childout,pid) ))]) n st
quigley@15679
   232
end;
quigley@15679
   233
quigley@15679
   234
quigley@15779
   235
fun isar_atp_g tfrees sg_term (childin, childout, pid) n =       
quigley@15679
   236
((warning("in isar_atp_g"));atp_tac_tfrees tfrees sg_term (childin, childout, pid) n);
quigley@15644
   237
quigley@15644
   238
quigley@15644
   239
quigley@15644
   240
(**********************************************)
quigley@15644
   241
(* recursively call atp_tac_g on all subgoals *)
quigley@15644
   242
(* sg_term is the nth subgoal as a term - used*)
quigley@15644
   243
(* in proof reconstruction                    *)
quigley@15644
   244
(**********************************************)
quigley@15644
   245
quigley@15644
   246
fun isar_atp_goal' thm k n tfree_lits  (childin, childout, pid) = 
paulson@16061
   247
      if (k > n) 
paulson@16061
   248
      then () 
paulson@16061
   249
      else 
paulson@16061
   250
	  let val  prems = prems_of thm 
paulson@16061
   251
	      val sg_term = ReconOrderClauses.get_nth n prems
paulson@16061
   252
	      val thmstring = string_of_thm thm
paulson@16061
   253
	  in   
paulson@16061
   254
	      (warning("in isar_atp_goal'"));
paulson@16061
   255
	      (warning("thmstring in isar_atp_goal': "^thmstring));
paulson@16061
   256
	       isar_atp_g tfree_lits  sg_term (childin, childout, pid) k thm; 
paulson@16061
   257
	       isar_atp_goal' thm (k+1) n tfree_lits  (childin, childout, pid) 
paulson@16061
   258
	  end;
quigley@15644
   259
quigley@15644
   260
quigley@15779
   261
fun isar_atp_goal thm n_subgoals tfree_lits   (childin, childout, pid) = 
quigley@15779
   262
              (if (!debug) then warning (string_of_thm thm) 
quigley@15779
   263
               else (isar_atp_goal' thm 1 n_subgoals tfree_lits  (childin, childout, pid) ));
quigley@15644
   264
quigley@15644
   265
(**************************************************)
quigley@15644
   266
(* convert clauses from "assume" to conjecture.   *)
quigley@15644
   267
(* i.e. apply make_clauses and then get tptp for  *)
quigley@15679
   268
(* any hypotheses in the goal produced by assume  *)
quigley@15679
   269
(* statements;                                    *)
quigley@15644
   270
(* write to file "hyps"                           *)
quigley@15644
   271
(**************************************************)
quigley@15644
   272
quigley@15644
   273
quigley@15644
   274
fun isar_atp_aux thms thm n_subgoals  (childin, childout, pid) = 
paulson@15608
   275
    let val tfree_lits = isar_atp_h thms 
paulson@15608
   276
    in
quigley@15779
   277
	(warning("in isar_atp_aux"));
quigley@15779
   278
         isar_atp_goal thm n_subgoals tfree_lits   (childin, childout, pid)
paulson@15608
   279
    end;
quigley@15644
   280
quigley@15644
   281
(******************************************************************)
quigley@15644
   282
(* called in Isar automatically                                   *)
quigley@15644
   283
(* writes out the current clasimpset to a tptp file               *)
quigley@15644
   284
(* passes all subgoals on to isar_atp_aux for further processing  *)
quigley@15644
   285
(* turns off xsymbol at start of function, restoring it at end    *)
quigley@15644
   286
(******************************************************************)
quigley@15779
   287
(*FIX changed to clasimp_file *)
paulson@15608
   288
fun isar_atp' (thms, thm) =
quigley@15919
   289
    let 
quigley@15919
   290
	val _=  (print_mode := (Library.gen_rems (op =) (! print_mode, ["xsymbols", "symbols"])))
quigley@15644
   291
        val _= (warning ("in isar_atp'"))
quigley@15779
   292
        val prems  = prems_of thm
paulson@15697
   293
        val sign = sign_of_thm thm
quigley@15779
   294
        val thms_string = Meson.concat_with_and (map string_of_thm thms) 
quigley@15644
   295
        val thmstring = string_of_thm thm
quigley@15779
   296
        val prems_string = Meson.concat_with_and (map (Sign.string_of_term sign) prems) 
quigley@15919
   297
        
quigley@15919
   298
	(* set up variables for writing out the clasimps to a tptp file *)
quigley@15919
   299
	val (clause_arr, num_of_clauses) = ResClasimp.write_out_clasimp (File.sysify_path clasimp_file) 
quigley@15919
   300
        val _ = (warning ("clasimp_file is this: "^(File.sysify_path clasimp_file)) )  
quigley@15779
   301
quigley@15644
   302
        (* cq: add write out clasimps to file *)
quigley@16039
   303
quigley@15919
   304
        (* cq:create watcher and pass to isar_atp_aux *)
quigley@15919
   305
        (* tracing *) 
quigley@15919
   306
        (*val tenth_ax = fst( Array.sub(clause_arr, 1))  
quigley@15919
   307
         val tenth_ax_thms = Recon_Transfer.memo_find_clause (tenth_ax, clause_tab)
quigley@15919
   308
         val clause_str = Meson.concat_with_and (map string_of_thm tenth_ax_thms)
quigley@15919
   309
         val _ = (warning ("tenth axiom in array is: "^tenth_ax))         
quigley@15919
   310
         val _ = (warning ("tenth axiom in table is: "^clause_str))         
quigley@15919
   311
                 
quigley@15919
   312
         val _ = (warning ("num_of_clauses is: "^(string_of_int (num_of_clauses))) )     
quigley@15919
   313
         *)             
quigley@15919
   314
        
quigley@15919
   315
        val (childin,childout,pid) = Watcher.createWatcher(thm,clause_arr, num_of_clauses)
quigley@15644
   316
        val pidstring = string_of_int(Word.toInt (Word.fromLargeWord ( Posix.Process.pidToWord pid )))
paulson@15608
   317
    in
quigley@15644
   318
	case prems of [] => () 
quigley@15644
   319
		    | _ => ((warning ("initial thms: "^thms_string)); 
quigley@15644
   320
                           (warning ("initial thm: "^thmstring));
quigley@15644
   321
                           (warning ("subgoals: "^prems_string));
quigley@15644
   322
                           (warning ("pid: "^ pidstring))); 
quigley@15644
   323
                            isar_atp_aux thms thm (length prems) (childin, childout, pid) ;
quigley@15644
   324
                           
quigley@15644
   325
                           print_mode := (["xsymbols", "symbols"] @ ! print_mode)
paulson@15608
   326
    end;
paulson@15608
   327
paulson@15452
   328
paulson@15608
   329
paulson@15608
   330
paulson@15608
   331
local
paulson@15608
   332
paulson@15608
   333
fun get_thms_cs claset =
paulson@15608
   334
    let val clsset = rep_cs claset
paulson@15608
   335
	val safeEs = #safeEs clsset
paulson@15608
   336
	val safeIs = #safeIs clsset
paulson@15608
   337
	val hazEs = #hazEs clsset
paulson@15608
   338
	val hazIs = #hazIs clsset
paulson@15608
   339
    in
paulson@15608
   340
	safeEs @ safeIs @ hazEs @ hazIs
paulson@15608
   341
    end;
paulson@15608
   342
paulson@15608
   343
paulson@15452
   344
paulson@15608
   345
fun append_name name [] _ = []
paulson@15608
   346
  | append_name name (thm::thms) k = (Thm.name_thm ((name ^ "_" ^ (string_of_int k)),thm)) :: (append_name name thms (k+1));
paulson@15608
   347
paulson@15608
   348
fun append_names (name::names) (thms::thmss) =
paulson@15608
   349
    let val thms' = append_name name thms 0
paulson@15608
   350
    in
paulson@15608
   351
	thms'::(append_names names thmss)
paulson@15608
   352
    end;
paulson@15608
   353
paulson@15452
   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@15452
   364
paulson@15608
   365
paulson@15608
   366
paulson@15608
   367
in
paulson@15608
   368
paulson@15452
   369
paulson@15608
   370
(* convert locally declared rules to axiom clauses *)
paulson@15608
   371
(* write axiom clauses to ax_file *)
quigley@15644
   372
(* what about clasimpset - it should already be in the ax file - perhaps append to ax file rather than just *)
quigley@15644
   373
(* write out ? Or keep as a separate file and then cat them all together in the watcher, like we do with the *)
quigley@15644
   374
(*claset file and prob file*)
quigley@16039
   375
(* FIX: update to work with clausify_axiom_pairs now in ResAxioms*)
quigley@16039
   376
(*fun isar_local_thms (delta_cs, delta_ss_thms) =
paulson@15608
   377
    let val thms_cs = get_thms_cs delta_cs
paulson@15608
   378
	val thms_ss = get_thms_ss delta_ss_thms
paulson@15608
   379
	val thms_clauses = ResLib.flat_noDup (map ResAxioms.clausify_axiom (thms_cs @ thms_ss))
paulson@15608
   380
	val clauses_strs = ResLib.flat_noDup (map ResClause.tptp_clause thms_clauses) (*string list*)
paulson@15608
   381
	val ax_file = File.sysify_path axiom_file
paulson@15608
   382
	val out = TextIO.openOut ax_file
paulson@15608
   383
    in
quigley@15644
   384
	(ResLib.writeln_strs out clauses_strs; (warning ("axiom file is: "^ax_file));TextIO.closeOut out)
paulson@15608
   385
    end;
quigley@16039
   386
*)
paulson@15608
   387
paulson@15608
   388
paulson@15608
   389
paulson@15347
   390
paulson@15608
   391
(* called in Isar automatically *)
quigley@15679
   392
paulson@15608
   393
fun isar_atp (ctxt,thm) =
paulson@15608
   394
    let val prems = ProofContext.prems_of ctxt
quigley@15644
   395
        val d_cs = Classical.get_delta_claset ctxt 
quigley@15644
   396
        val d_ss_thms = Simplifier.get_delta_simpset ctxt
quigley@15644
   397
        val thmstring = string_of_thm thm
quigley@15679
   398
        val sg_prems = prems_of thm
paulson@15697
   399
        val sign = sign_of_thm thm
quigley@15679
   400
        val prem_no = length sg_prems
quigley@15779
   401
        val prems_string = Meson.concat_with_and (map (Sign.string_of_term sign) sg_prems) 
paulson@15608
   402
    in
quigley@15644
   403
          (warning ("initial thm in isar_atp: "^thmstring));
quigley@15644
   404
          (warning ("subgoals in isar_atp: "^prems_string));
quigley@15779
   405
    	  (warning ("number of subgoals in isar_atp: "^(string_of_int prem_no)));
quigley@16039
   406
          ((*isar_local_thms (d_cs,d_ss_thms); *)(warning("about to call isar_atp'"));
quigley@15644
   407
           isar_atp' (prems, thm))
paulson@15608
   408
    end;
paulson@15347
   409
paulson@15608
   410
end
paulson@15608
   411
paulson@15608
   412
paulson@15608
   413
paulson@15452
   414
paulson@15347
   415
end;
paulson@15347
   416
paulson@15347
   417
Proof.atp_hook := ResAtp.isar_atp;