src/HOL/Tools/ATP/watcher.ML
changeset 16091 3683f0486a11
parent 16089 9169bdf930f8
child 16100 f80fc4bff933
equal deleted inserted replaced
16090:fbb5ae140535 16091:3683f0486a11
   162 				(File.tmp_path (Path.basic"thmstring_in_watcher")));                                                                         
   162 				(File.tmp_path (Path.basic"thmstring_in_watcher")));                                                                         
   163 	  val _ = TextIO.output (outfile, 
   163 	  val _ = TextIO.output (outfile, 
   164 			(thmstring^"\n goals_watched"^(string_of_int(!goals_being_watched))^"\n"))
   164 			(thmstring^"\n goals_watched"^(string_of_int(!goals_being_watched))^"\n"))
   165 	  val _ =  TextIO.closeOut outfile
   165 	  val _ =  TextIO.closeOut outfile
   166 	 (*** want to cat clasimp ax hyps prob, then send the resulting file to tptp2x ***)
   166 	 (*** want to cat clasimp ax hyps prob, then send the resulting file to tptp2x ***)
   167 	 val probID = ReconOrderClauses.last(explode probfile)
   167 	  val probID = ReconOrderClauses.last(explode probfile)
   168 	  val wholefile = File.tmp_path (Path.basic ("ax_prob_"^probID))
   168 	  val wholefile = File.tmp_path (Path.basic ("ax_prob_"^probID))
   169 	  (*** only include problem and clasimp for the moment, not sure how to refer to ***)
   169 	  (*** only include problem and clasimp for the moment, not sure how to refer to ***)
   170 	  (*** hyps/local axioms just now                                                ***)
   170 	  (*** hyps/local axioms just now                                                ***)
   171 	  val whole_prob_file = Unix.execute("/bin/cat", [clasimpfile,(*,axfile, hypsfile,*)probfile,  ">", (File.sysify_path wholefile)])
   171 	  val whole_prob_file = Unix.execute("/bin/cat", [clasimpfile,(*,axfile, hypsfile,*)probfile,  ">", (File.sysify_path wholefile)])
   172 	  val dfg_create = if File.exists dfg_dir 
   172 	  val dfg_create = if File.exists dfg_dir 
   173 			   then warning("dfg dir exists")
   173 			   then warning("dfg dir exists")
   174 			   else File.mkdir dfg_dir; 
   174 			   else File.mkdir dfg_dir; 
   175 	  
   175 	  
   176 	  val dfg_path = File.sysify_path dfg_dir;
   176 	  val dfg_path = File.sysify_path dfg_dir;
       
   177 	  val tptp2x_args = ["-fdfg", "-d " ^ dfg_path, File.sysify_path wholefile]
   177 	  val exec_tptp2x = 
   178 	  val exec_tptp2x = 
   178 	        Unix.execute(getenv "TPTP2X_HOME" ^ "/tptp2X",  
   179  	      Unix.execute(getenv "TPTP2X_HOME" ^ "/tptp2X", tptp2x_args)
   179 	                     ["-fdfg", "-d " ^ dfg_path, File.sysify_path wholefile])
       
   180 	(*val _ = Posix.Process.wait ()*)
   180 	(*val _ = Posix.Process.wait ()*)
   181 	(*val _ =Unix.reap exec_tptp2x*)
   181 	(*val _ =Unix.reap exec_tptp2x*)
   182 	  val newfile = dfg_path^"/ax_prob"^"_"^(probID)^".dfg"
   182 	  val newfile = dfg_path^"/ax_prob"^"_"^(probID)^".dfg"
   183  
   183  
   184        in   
   184        in   
   185 	  goals_being_watched := (!goals_being_watched) + 1;
   185 	  goals_being_watched := (!goals_being_watched) + 1;
   186 	  Posix.Process.sleep(Time.fromSeconds 1); 
   186 	  Posix.Process.sleep(Time.fromSeconds 4); 
   187 	  (warning ("probfile is: "^probfile));
   187 	  (warning ("probfile is: "^probfile));
   188 	  (warning("dfg file is: "^newfile));
   188 	  (warning("dfg file is: "^newfile));
   189 	  (warning ("wholefile is: "^(File.sysify_path wholefile)));
   189 	  (warning ("wholefile is: "^(File.sysify_path wholefile)));
   190 	  sendOutput (toWatcherStr,
   190 	  sendOutput (toWatcherStr,
   191 	       prover ^ "*" ^ thmstring ^ "*" ^ goalstring ^ "*" ^ proverCmd ^ 
   191 	       prover ^ "*" ^ thmstring ^ "*" ^ goalstring ^ "*" ^ proverCmd ^ 
   194 	  TextIO.flushOut toWatcherStr;
   194 	  TextIO.flushOut toWatcherStr;
   195 	  Unix.reap exec_tptp2x;
   195 	  Unix.reap exec_tptp2x;
   196 	  if File.exists
   196 	  if File.exists
   197 	        (Path.append dfg_dir (Path.basic ("ax_prob"^"_" ^ probID ^ ".dfg")))
   197 	        (Path.append dfg_dir (Path.basic ("ax_prob"^"_" ^ probID ^ ".dfg")))
   198 	  then callResProvers (toWatcherStr, args)
   198 	  then callResProvers (toWatcherStr, args)
   199 	  else error ("tptp2X failed: " ^ getenv "TPTP2X_HOME" ^ "/tptp2X" ^
   199 	  else error ("tptp2X failed: " ^ getenv "TPTP2X_HOME" ^ "/tptp2X " ^
   200 	              " -fdfg " ^ File.sysify_path wholefile ^ " -d " ^ dfg_path)
   200 	              space_implode " " tptp2x_args)
   201       end
   201       end
   202 (*
   202 (*
   203 fun callResProversStr (toWatcherStr,  []) =  "End of calls\n" 
   203 fun callResProversStr (toWatcherStr,  []) =  "End of calls\n" 
   204                                      
   204                                      
   205 |   callResProversStr (toWatcherStr,(prover,thmstring,goalstring, proverCmd,settings,clasimpfile, axfile, hypsfile, probfile)::args) =
   205 |   callResProversStr (toWatcherStr,(prover,thmstring,goalstring, proverCmd,settings,clasimpfile, axfile, hypsfile, probfile)::args) =