src/HOL/Tools/res_atp.ML
author paulson
Mon Jun 20 15:55:44 2005 +0200 (2005-06-20)
changeset 16475 8f3ba52a7937
parent 16357 f1275d2a1dee
child 16478 d0a1f6231e2f
permissions -rw-r--r--
using TPTP2X_HOME; indentation, etc
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;
quigley@16357
    34
(* used for debug *)
quigley@16357
    35
val debug = ref false;
paulson@16172
    36
paulson@15608
    37
fun debug_tac tac = (warning "testing";tac);
quigley@16357
    38
(* default value is false *)
quigley@16357
    39
val full_spass = ref false;
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@16357
    73
fun is_proof_char ch = ((33 <= (ord ch)) andalso ((ord ch ) <= 126) andalso (not ((ord ch ) = 63))) orelse (ch = " ")
paulson@15608
    74
quigley@16357
    75
fun proofstring x = let val exp = explode x 
quigley@16357
    76
                    in
quigley@16357
    77
                        List.filter (is_proof_char ) exp
quigley@16357
    78
                    end
quigley@16357
    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 
wenzelm@16259
   114
        val hypsfile = File.platform_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"))
wenzelm@16259
   134
        val probfile = (File.platform_path prob_file) ^ "_" ^ (string_of_int n)
paulson@15608
   135
	val out = TextIO.openOut(probfile)
paulson@15608
   136
    in
quigley@16357
   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
quigley@16357
   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
(*********************************************************************)
quigley@16357
   146
(* now passing in list of skolemized thms and list of sgterms to go with them *)
quigley@16357
   147
fun call_resolve_tac  (thms: Thm.thm list list)  sign (sg_terms:  Term.term list) (childin, childout,pid) n  = let
quigley@16357
   148
   val axfile = (File.platform_path axiom_file)
paulson@16475
   149
   val hypsfile = (File.platform_path hyps_file)
paulson@16475
   150
   val clasimpfile = (File.platform_path clasimp_file)
paulson@16475
   151
   val spass_home = getenv "SPASS_HOME"
paulson@16475
   152
   val spass = spass_home ^ "/SPASS"
paulson@16475
   153
   val _ = if File.exists (File.unpack_platform_path spass) then () 
paulson@16475
   154
	   else error ("Could not find the file " ^ spass)
quigley@16357
   155
     
paulson@16475
   156
   fun make_atp_list [] sign n = []
paulson@16475
   157
   |   make_atp_list ((sko_thm, sg_term)::xs) sign  n = 
paulson@16475
   158
   let 
quigley@16357
   159
	val skothmstr = Meson.concat_with_and (map string_of_thm sko_thm) 
quigley@16357
   160
	val thmproofstr = proofstring ( skothmstr)
quigley@16357
   161
	val no_returns =List.filter   not_newline ( thmproofstr)
quigley@16357
   162
	val thmstr = implode no_returns
quigley@16357
   163
	val _ = warning ("thmstring in make_atp_lists is: "^thmstr)
paulson@15608
   164
quigley@16357
   165
	val sgstr = Sign.string_of_term sign sg_term 
quigley@16357
   166
	val goalproofstring = proofstring sgstr
paulson@16089
   167
	val no_returns =List.filter not_newline ( goalproofstring)
paulson@16089
   168
	val goalstring = implode no_returns
quigley@16357
   169
	val _ = warning ("goalstring in make_atp_lists is: "^goalstring)
quigley@16357
   170
wenzelm@16259
   171
	val probfile = (File.platform_path prob_file) ^ "_" ^ (string_of_int n)
quigley@16357
   172
	val _ = (warning ("prob file in cal_res_tac is: "^probfile))                                                                           
quigley@16357
   173
in
quigley@16357
   174
 	if !full_spass 
quigley@16357
   175
  	then
quigley@16357
   176
   		([("spass", thmstr, goalstring (*,spass_home*), 
quigley@16357
   177
	    	 getenv "ISABELLE_HOME" ^ "/src/HOL/Tools/ATP/spassshell"(*( getenv "SPASS_HOME")^"/SPASS"*),  
quigley@16357
   178
	     	"-DocProof%-TimeLimit=60", 
quigley@16357
   179
	     	clasimpfile, axfile, hypsfile, probfile)]@(make_atp_list xs sign (n+1)))
quigley@16357
   180
  	else	
quigley@16357
   181
   		([("spass", thmstr, goalstring (*,spass_home*), 
quigley@16357
   182
	     	getenv "ISABELLE_HOME" ^"/src/HOL/Tools/ATP/spassshell"(* (getenv "SPASS_HOME")^"/SPASS"*),  
quigley@16357
   183
	     	"-Auto=0%-ISRe%-ISFc%-RTaut%-RFSub%-RBSub%-DocProof%-TimeLimit=60", 
quigley@16357
   184
	     	clasimpfile, axfile, hypsfile, probfile)]@(make_atp_list xs sign (n+1)))
quigley@16357
   185
end
paulson@15452
   186
quigley@16357
   187
val thms_goals = ListPair.zip( thms, sg_terms) 
quigley@16357
   188
val atp_list = make_atp_list  thms_goals sign 1
quigley@16357
   189
in
quigley@16357
   190
	Watcher.callResProvers(childout,atp_list);
quigley@16357
   191
        warning("Sent commands to watcher!");
quigley@16357
   192
  	dummy_tac
quigley@16357
   193
 end
quigley@16357
   194
(*
quigley@16357
   195
  val axfile = (File.platform_path axiom_file)
quigley@16357
   196
    val hypsfile = (File.platform_path hyps_file)
quigley@16357
   197
     val clasimpfile = (File.platform_path  clasimp_file)
quigley@16357
   198
    val spass_home = getenv "SPASS_HOME"
quigley@16357
   199
 val probfile = (File.platform_path prob_file) ^ "_" ^ (string_of_int 1)
quigley@16357
   200
    
quigley@16357
   201
 val (clause_arr, num_of_clauses) = ResClasimp.write_out_clasimp_small (File.platform_path clasimp_file) ;
quigley@16357
   202
 val (childin,childout,pid) = Watcher.createWatcher(mp, clause_arr, num_of_clauses);
quigley@16357
   203
Watcher.callResProvers(childout, [("spass", "thmstring", "goalstr", spass_home,  "-DocProof", clasimpfile, axfile, hypsfile,probfile)]);
quigley@16357
   204
quigley@16357
   205
Watcher.callResProvers(childout, [("spass", "thmstring", "goalstr", "/homes/clq20/spassshell",  "", clasimpfile, axfile, hypsfile,probfile)]);
quigley@16357
   206
quigley@16357
   207
quigley@16357
   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
quigley@16357
   215
fun get_sko_thms tfrees sign sg_terms (childin, childout,pid)  thm n sko_thms  =
quigley@16357
   216
                       if (equal n 0) then 
quigley@16357
   217
				(call_resolve_tac  (rev sko_thms) sign  sg_terms (childin, childout, pid) (List.length sg_terms);dummy_tac thm)
quigley@16357
   218
			else
quigley@16357
   219
                           
quigley@16357
   220
               		( SELECT_GOAL
quigley@16357
   221
  				(EVERY1 [rtac ccontr,atomize_tac, skolemize_tac, 
quigley@16357
   222
  				 METAHYPS(fn negs => (tptp_inputs_tfrees (make_clauses negs) n tfrees;
quigley@16357
   223
                                                    get_sko_thms  tfrees sign sg_terms (childin, childout, pid) thm  (n -1) (negs::sko_thms);dummy_tac))]) n thm )
quigley@15644
   224
quigley@15644
   225
quigley@15644
   226
quigley@15644
   227
(**********************************************)
quigley@15644
   228
(* recursively call atp_tac_g on all subgoals *)
quigley@15644
   229
(* sg_term is the nth subgoal as a term - used*)
quigley@15644
   230
(* in proof reconstruction                    *)
quigley@15644
   231
(**********************************************)
quigley@15644
   232
quigley@16357
   233
fun isar_atp_goal' thm n tfree_lits  (childin, childout, pid) = 
quigley@16357
   234
                  
quigley@16357
   235
                           (let val  prems = prems_of thm 
quigley@16357
   236
                              (*val sg_term = get_nth k prems*)
quigley@16357
   237
                                val sign = sign_of_thm thm
quigley@16357
   238
                                val thmstring = string_of_thm thm
quigley@16357
   239
                            in   
quigley@16357
   240
                                 
quigley@16357
   241
                		(warning("in isar_atp_goal'"));
quigley@16357
   242
                                (warning("thmstring in isar_atp_goal': "^thmstring));
quigley@16357
   243
 				(* go and call callResProvers with this subgoal *)
quigley@16357
   244
 				(* isar_atp_g tfree_lits  sg_term (childin, childout, pid) k thm; *)
quigley@16357
   245
 				(* recursive call to pick up the remaining subgoals *)
quigley@16357
   246
                                (* isar_atp_goal' thm (k+1) n tfree_lits  (childin, childout, pid) *)
quigley@16357
   247
                                get_sko_thms tfree_lits sign  prems (childin, childout, pid) thm n []
quigley@16357
   248
                            end);
quigley@15644
   249
quigley@16357
   250
(*fun isar_atp_goal thm n_subgoals tfree_lits   (childin, childout, pid) = 
quigley@15779
   251
              (if (!debug) then warning (string_of_thm thm) 
quigley@16357
   252
               else (isar_atp_goal' thm n_subgoals tfree_lits  (childin, childout, pid) ));*)
quigley@15644
   253
quigley@15644
   254
(**************************************************)
quigley@15644
   255
(* convert clauses from "assume" to conjecture.   *)
quigley@15644
   256
(* i.e. apply make_clauses and then get tptp for  *)
quigley@15679
   257
(* any hypotheses in the goal produced by assume  *)
quigley@15679
   258
(* statements;                                    *)
quigley@15644
   259
(* write to file "hyps"                           *)
quigley@15644
   260
(**************************************************)
quigley@15644
   261
quigley@15644
   262
quigley@15644
   263
fun isar_atp_aux thms thm n_subgoals  (childin, childout, pid) = 
paulson@15608
   264
    let val tfree_lits = isar_atp_h thms 
quigley@16357
   265
    in
quigley@16357
   266
	(warning("in isar_atp_aux"));
quigley@16357
   267
         isar_atp_goal' thm n_subgoals tfree_lits   (childin, childout, pid)
paulson@15608
   268
    end;
quigley@15644
   269
quigley@15644
   270
(******************************************************************)
quigley@15644
   271
(* called in Isar automatically                                   *)
quigley@15644
   272
(* writes out the current clasimpset to a tptp file               *)
quigley@15644
   273
(* passes all subgoals on to isar_atp_aux for further processing  *)
quigley@15644
   274
(* turns off xsymbol at start of function, restoring it at end    *)
quigley@15644
   275
(******************************************************************)
quigley@15779
   276
(*FIX changed to clasimp_file *)
quigley@16357
   277
fun isar_atp' (ctxt,thms, thm) =
quigley@16357
   278
    let 
quigley@16357
   279
	val _=  (print_mode := (Library.gen_rems (op =) (! print_mode, ["xsymbols", "symbols"])))
quigley@15644
   280
        val _= (warning ("in isar_atp'"))
quigley@15779
   281
        val prems  = prems_of thm
paulson@15697
   282
        val sign = sign_of_thm thm
quigley@15779
   283
        val thms_string = Meson.concat_with_and (map string_of_thm thms) 
quigley@15644
   284
        val thmstring = string_of_thm thm
quigley@15779
   285
        val prems_string = Meson.concat_with_and (map (Sign.string_of_term sign) prems) 
quigley@15919
   286
        
quigley@15919
   287
	(* set up variables for writing out the clasimps to a tptp file *)
paulson@16172
   288
	val (clause_arr, num_of_clauses) =
quigley@16357
   289
	    ResClasimp.write_out_clasimp(*_small*) (File.platform_path clasimp_file) 
paulson@16172
   290
	                                 (ProofContext.theory_of ctxt)
quigley@16357
   291
        val _ = (warning ("clasimp_file is this: "^(File.platform_path clasimp_file)) )  
quigley@15779
   292
quigley@15644
   293
        (* cq: add write out clasimps to file *)
quigley@15919
   294
        (* cq:create watcher and pass to isar_atp_aux *)
quigley@15919
   295
        (* tracing *) 
quigley@15919
   296
        (*val tenth_ax = fst( Array.sub(clause_arr, 1))  
quigley@15919
   297
         val tenth_ax_thms = Recon_Transfer.memo_find_clause (tenth_ax, clause_tab)
quigley@15919
   298
         val clause_str = Meson.concat_with_and (map string_of_thm tenth_ax_thms)
quigley@15919
   299
         val _ = (warning ("tenth axiom in array is: "^tenth_ax))         
quigley@15919
   300
         val _ = (warning ("tenth axiom in table is: "^clause_str))         
quigley@15919
   301
                 
quigley@15919
   302
         val _ = (warning ("num_of_clauses is: "^(string_of_int (num_of_clauses))) )     
quigley@15919
   303
         *)             
quigley@15919
   304
        
quigley@15919
   305
        val (childin,childout,pid) = Watcher.createWatcher(thm,clause_arr, num_of_clauses)
quigley@15644
   306
        val pidstring = string_of_int(Word.toInt (Word.fromLargeWord ( Posix.Process.pidToWord pid )))
paulson@15608
   307
    in
quigley@15644
   308
	case prems of [] => () 
quigley@15644
   309
		    | _ => ((warning ("initial thms: "^thms_string)); 
quigley@15644
   310
                           (warning ("initial thm: "^thmstring));
quigley@15644
   311
                           (warning ("subgoals: "^prems_string));
quigley@15644
   312
                           (warning ("pid: "^ pidstring))); 
quigley@15644
   313
                            isar_atp_aux thms thm (length prems) (childin, childout, pid) ;
quigley@16357
   314
                           (warning("turning xsymbol back on!"));
quigley@15644
   315
                           print_mode := (["xsymbols", "symbols"] @ ! print_mode)
paulson@15608
   316
    end;
paulson@15608
   317
paulson@15452
   318
paulson@15608
   319
paulson@15608
   320
paulson@15608
   321
local
paulson@15608
   322
paulson@15608
   323
fun get_thms_cs claset =
paulson@15608
   324
    let val clsset = rep_cs claset
paulson@15608
   325
	val safeEs = #safeEs clsset
paulson@15608
   326
	val safeIs = #safeIs clsset
paulson@15608
   327
	val hazEs = #hazEs clsset
paulson@15608
   328
	val hazIs = #hazIs clsset
paulson@15608
   329
    in
paulson@15608
   330
	safeEs @ safeIs @ hazEs @ hazIs
paulson@15608
   331
    end;
paulson@15608
   332
quigley@16357
   333
quigley@16357
   334
paulson@15608
   335
fun append_name name [] _ = []
paulson@15608
   336
  | append_name name (thm::thms) k = (Thm.name_thm ((name ^ "_" ^ (string_of_int k)),thm)) :: (append_name name thms (k+1));
paulson@15608
   337
paulson@15608
   338
fun append_names (name::names) (thms::thmss) =
paulson@15608
   339
    let val thms' = append_name name thms 0
paulson@15608
   340
    in
paulson@15608
   341
	thms'::(append_names names thmss)
paulson@15608
   342
    end;
paulson@15608
   343
quigley@16357
   344
paulson@15608
   345
fun get_thms_ss [] = []
paulson@15608
   346
  | get_thms_ss thms =
paulson@15608
   347
    let val names = map Thm.name_of_thm thms 
paulson@15608
   348
        val thms' = map (mksimps mksimps_pairs) thms
paulson@15608
   349
        val thms'' = append_names names thms'
paulson@15608
   350
    in
paulson@15608
   351
	ResLib.flat_noDup thms''
paulson@15608
   352
    end;
paulson@15608
   353
quigley@16357
   354
quigley@16357
   355
quigley@16357
   356
paulson@15608
   357
in
paulson@15608
   358
paulson@15452
   359
paulson@15608
   360
(* convert locally declared rules to axiom clauses *)
paulson@15608
   361
(* write axiom clauses to ax_file *)
quigley@15644
   362
(* what about clasimpset - it should already be in the ax file - perhaps append to ax file rather than just *)
quigley@15644
   363
(* write out ? Or keep as a separate file and then cat them all together in the watcher, like we do with the *)
quigley@15644
   364
(*claset file and prob file*)
quigley@16357
   365
(* FIX*)
quigley@16039
   366
(*fun isar_local_thms (delta_cs, delta_ss_thms) =
paulson@15608
   367
    let val thms_cs = get_thms_cs delta_cs
paulson@15608
   368
	val thms_ss = get_thms_ss delta_ss_thms
paulson@15608
   369
	val thms_clauses = ResLib.flat_noDup (map ResAxioms.clausify_axiom (thms_cs @ thms_ss))
paulson@15608
   370
	val clauses_strs = ResLib.flat_noDup (map ResClause.tptp_clause thms_clauses) (*string list*)
wenzelm@16259
   371
	val ax_file = File.platform_path axiom_file
paulson@15608
   372
	val out = TextIO.openOut ax_file
paulson@15608
   373
    in
quigley@15644
   374
	(ResLib.writeln_strs out clauses_strs; (warning ("axiom file is: "^ax_file));TextIO.closeOut out)
paulson@15608
   375
    end;
quigley@16039
   376
*)
paulson@15608
   377
paulson@15608
   378
quigley@16357
   379
quigley@16357
   380
paulson@15608
   381
(* called in Isar automatically *)
quigley@15679
   382
paulson@15608
   383
fun isar_atp (ctxt,thm) =
paulson@15608
   384
    let val prems = ProofContext.prems_of ctxt
quigley@15644
   385
        val d_cs = Classical.get_delta_claset ctxt 
quigley@15644
   386
        val d_ss_thms = Simplifier.get_delta_simpset ctxt
quigley@15644
   387
        val thmstring = string_of_thm thm
quigley@15679
   388
        val sg_prems = prems_of thm
paulson@15697
   389
        val sign = sign_of_thm thm
quigley@15679
   390
        val prem_no = length sg_prems
quigley@15779
   391
        val prems_string = Meson.concat_with_and (map (Sign.string_of_term sign) sg_prems) 
paulson@15608
   392
    in
quigley@15644
   393
          (warning ("initial thm in isar_atp: "^thmstring));
quigley@15644
   394
          (warning ("subgoals in isar_atp: "^prems_string));
quigley@15779
   395
    	  (warning ("number of subgoals in isar_atp: "^(string_of_int prem_no)));
quigley@16357
   396
          (*isar_local_thms (d_cs,d_ss_thms);*)
quigley@16357
   397
           isar_atp' (ctxt,prems, thm)
paulson@15608
   398
    end;
paulson@15347
   399
paulson@15608
   400
end
paulson@15608
   401
paulson@15608
   402
quigley@16357
   403
quigley@16357
   404
paulson@15347
   405
end;
paulson@15347
   406
paulson@15347
   407
Proof.atp_hook := ResAtp.isar_atp;