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