src/HOL/Tools/res_atp.ML
changeset 15697 681bcb7f0389
parent 15682 09a7b8909c4d
child 15700 970e0293dfb3
equal deleted inserted replaced
15696:1da4ce092c0b 15697:681bcb7f0389
   144 (*********************************************************************)
   144 (*********************************************************************)
   145 (* call SPASS with settings and problem file for the current subgoal *)
   145 (* call SPASS with settings and problem file for the current subgoal *)
   146 (* should be modified to allow other provers to be called            *)
   146 (* should be modified to allow other provers to be called            *)
   147 (*********************************************************************)
   147 (*********************************************************************)
   148 
   148 
   149 fun call_resolve_tac thms sg_term (childin, childout,pid) n  = let
   149 fun call_resolve_tac sign thms sg_term (childin, childout,pid) n  = let
   150                              val thmstring = concat_with_and (map string_of_thm thms) ""
   150                              val thmstring = concat_with_and (map string_of_thm thms) ""
   151                              val thm_no = length thms
   151                              val thm_no = length thms
   152                              val _ = warning ("number of thms is : "^(string_of_int thm_no))
   152                              val _ = warning ("number of thms is : "^(string_of_int thm_no))
   153                              val _ = warning ("thmstring in call_res is: "^thmstring)
   153                              val _ = warning ("thmstring in call_res is: "^thmstring)
   154 
   154 
   155                              val goalstr = Sign.string_of_term Mainsign sg_term 
   155                              val goalstr = Sign.string_of_term sign sg_term 
   156                              val goalproofstring = proofstring goalstr
   156                              val goalproofstring = proofstring goalstr
   157                              val no_returns =List.filter not_newline ( goalproofstring)
   157                              val no_returns =List.filter not_newline ( goalproofstring)
   158                              val goalstring = implode no_returns
   158                              val goalstring = implode no_returns
   159                              val _ = warning ("goalstring in call_res is: "^goalstring)
   159                              val _ = warning ("goalstring in call_res is: "^goalstring)
   160         
   160         
   163                              val clauses = make_clauses thms
   163                              val clauses = make_clauses thms
   164                              val _ =( warning ("called make_clauses "))*)
   164                              val _ =( warning ("called make_clauses "))*)
   165                              (*val _ = tptp_inputs clauses prob_file*)
   165                              (*val _ = tptp_inputs clauses prob_file*)
   166                              val thmstring = concat_with_and (map string_of_thm thms) ""
   166                              val thmstring = concat_with_and (map string_of_thm thms) ""
   167                            
   167                            
   168                              val goalstr = Sign.string_of_term Mainsign sg_term 
   168                              val goalstr = Sign.string_of_term sign sg_term 
   169                              val goalproofstring = proofstring goalstr
   169                              val goalproofstring = proofstring goalstr
   170                              val no_returns =List.filter not_newline ( goalproofstring)
   170                              val no_returns =List.filter not_newline ( goalproofstring)
   171                              val goalstring = implode no_returns
   171                              val goalstring = implode no_returns
   172 
   172 
   173                              val thmproofstring = proofstring ( thmstring)
   173                              val thmproofstring = proofstring ( thmstring)
   224 (* should call call_res_tac here, not resolve_tac *)
   224 (* should call call_res_tac here, not resolve_tac *)
   225 (* if we take tptpinputs out it gets into call_res_tac then falls over as usual after printing out goalstring. but if we leave it in it falls over here *)
   225 (* if we take tptpinputs out it gets into call_res_tac then falls over as usual after printing out goalstring. but if we leave it in it falls over here *)
   226 
   226 
   227 (* dummy tac vs.  Doesn't call resolve_tac *)
   227 (* dummy tac vs.  Doesn't call resolve_tac *)
   228 
   228 
   229 fun call_atp_tac_tfrees thms n tfrees sg_term (childin, childout,pid) = 
   229 fun call_atp_tac_tfrees sign thms n tfrees sg_term (childin, childout,pid) = 
   230                                          ( (warning("ths for tptp: "^(concat_with_and (map string_of_thm thms) "")));
   230                                          ( warning("ths for tptp: " ^ (concat_with_and (map string_of_thm thms) ""));
   231                                            (warning("in call_atp_tac_tfrees"));
   231                                            warning("in call_atp_tac_tfrees");
   232                                            
   232                                            
   233                                            tptp_inputs_tfrees (make_clauses thms) n tfrees;
   233                                            tptp_inputs_tfrees (make_clauses thms) n tfrees;
   234                                            call_resolve_tac thms sg_term (childin, childout, pid) n;
   234                                            call_resolve_tac sign thms sg_term (childin, childout, pid) n;
   235   					   dummy_tac);
   235   					   dummy_tac);
   236 
   236 
   237 
   237 fun atp_tac_tfrees tfrees sg_term (childin, childout,pid)  n st = 
   238 (*
   238 let val sign = sign_of_thm st
   239 fun atp_tac_tfrees tfrees sg_term (childin, childout,pid)  n  = 
   239     val _ = warning ("in atp_tac_tfrees ")
   240 let val _ = (warning ("in atp_tac_tfrees "))
   240     val _ = warning ("sg_term :" ^ (Sign.string_of_term sign sg_term))
   241    in
       
   242 SELECT_GOAL (EVERY1 [rtac ccontr,atomize_tac,(*skolemize_tac,*) METAHYPS(fn negs => ((warning("calling  call_atp_tac_tfrees with negs"^(concat_with_and (map  string_of_thm negs) "")));(*make_clauses negs;*)dummy_tac)) ])1
       
   243 end;
       
   244 
       
   245 
       
   246 
       
   247 METAHYPS(fn negs => ((warning("calling  call_atp_tac_tfrees with negs"^(concat_with_and (map  string_of_thm negs) ""))));make_clauses negs;dummy_tac)) 1;
       
   248 *)
       
   249 
       
   250 
       
   251 fun atp_tac_tfrees tfrees sg_term (childin, childout,pid)  n  = 
       
   252 let val _ = (warning ("in atp_tac_tfrees "))
       
   253     val _ = (warning ("sg_term :"^((Sign.string_of_term Mainsign) sg_term)))
       
   254    
   241    
   255    in
   242    in
   256 SELECT_GOAL
   243 SELECT_GOAL
   257   (EVERY1 [rtac ccontr,atomize_tac, skolemize_tac, 
   244   (EVERY1 [rtac ccontr,atomize_tac, skolemize_tac, 
   258   METAHYPS(fn negs => ((warning("calling  call_atp_tac_tfrees with negs"^(concat_with_and (map  string_of_thm negs) "")));call_atp_tac_tfrees (negs) n tfrees sg_term (childin, childout,pid) ))]) n
   245   METAHYPS(fn negs => (warning("calling  call_atp_tac_tfrees with negs"
       
   246                                ^ (concat_with_and (map string_of_thm negs) ""));
       
   247            call_atp_tac_tfrees sign negs n tfrees sg_term (childin, childout,pid) ))]) n st
   259 end;
   248 end;
   260 
   249 
   261 
   250 
   262 fun isar_atp_g tfrees sg_term (childin, childout, pid) n = 
   251 fun isar_atp_g tfrees sg_term (childin, childout, pid) n = 
   263                                         
   252                                         
   313 
   302 
   314 fun isar_atp' (thms, thm) =
   303 fun isar_atp' (thms, thm) =
   315     let val _=  (print_mode := (Library.gen_rems (op =) (! print_mode, ["xsymbols", "symbols"])))
   304     let val _=  (print_mode := (Library.gen_rems (op =) (! print_mode, ["xsymbols", "symbols"])))
   316         val _= (warning ("in isar_atp'"))
   305         val _= (warning ("in isar_atp'"))
   317         val prems = prems_of thm
   306         val prems = prems_of thm
       
   307         val sign = sign_of_thm thm
   318         val thms_string =concat_with_and (map  string_of_thm thms) ""
   308         val thms_string =concat_with_and (map  string_of_thm thms) ""
   319         val thmstring = string_of_thm thm
   309         val thmstring = string_of_thm thm
   320         val prems_string = concat_with_and (map (Sign.string_of_term Mainsign) prems) ""
   310         val prems_string = concat_with_and (map (Sign.string_of_term sign) prems) ""
   321         (* set up variables for writing out the clasimps to a tptp file *)
   311         (* set up variables for writing out the clasimps to a tptp file *)
   322         (* val _ = write_out_clasimp (File.sysify_path axiom_file)*)
   312         (* val _ = write_out_clasimp (File.sysify_path axiom_file)*)
   323         (* cq: add write out clasimps to file *)
   313         (* cq: add write out clasimps to file *)
   324         (* cq:create watcher and pass to isar_atp_aux *)                    
   314         (* cq:create watcher and pass to isar_atp_aux *)                    
   325         val (childin,childout,pid) = Watcher.createWatcher()
   315         val (childin,childout,pid) = Watcher.createWatcher()
   403     let val prems = ProofContext.prems_of ctxt
   393     let val prems = ProofContext.prems_of ctxt
   404         val d_cs = Classical.get_delta_claset ctxt 
   394         val d_cs = Classical.get_delta_claset ctxt 
   405         val d_ss_thms = Simplifier.get_delta_simpset ctxt
   395         val d_ss_thms = Simplifier.get_delta_simpset ctxt
   406         val thmstring = string_of_thm thm
   396         val thmstring = string_of_thm thm
   407         val sg_prems = prems_of thm
   397         val sg_prems = prems_of thm
       
   398         val sign = sign_of_thm thm
   408         val prem_no = length sg_prems
   399         val prem_no = length sg_prems
   409         val prems_string =  concat_with_and (map (Sign.string_of_term Mainsign) sg_prems) ""
   400         val prems_string =  concat_with_and (map (Sign.string_of_term sign) sg_prems) ""
   410     in
   401     in
   411          
   402          
   412           (warning ("initial thm in isar_atp: "^thmstring));
   403           (warning ("initial thm in isar_atp: "^thmstring));
   413           (warning ("subgoals in isar_atp: "^prems_string));
   404           (warning ("subgoals in isar_atp: "^prems_string));
   414     	   (warning ("number of subgoals in isar_atp: "^(string_of_int prem_no)));
   405     	   (warning ("number of subgoals in isar_atp: "^(string_of_int prem_no)));