src/HOL/Tools/res_atp.ML
changeset 17746 af59c748371d
parent 17717 7c6a96cbc966
child 17764 fde495b9e24b
equal deleted inserted replaced
17745:38b4d8bf2627 17746:af59c748371d
    36   else error ("No such directory: " ^ !destdir);
    36   else error ("No such directory: " ^ !destdir);
    37 
    37 
    38 fun prob_pathname n = probfile_nosuffix n ^ "_" ^ Int.toString n;
    38 fun prob_pathname n = probfile_nosuffix n ^ "_" ^ Int.toString n;
    39 
    39 
    40 
    40 
    41 (**** for Isabelle/ML interface  ****)
       
    42 
       
    43 (*Remove unwanted characters such as ? and newline from the textural 
       
    44   representation of a theorem (surely they don't need to be produced in 
       
    45   the first place?) *)
       
    46 
       
    47 fun is_proof_char ch = (#" " <= ch andalso ch <= #"~" andalso ch <> #"?");
       
    48 
       
    49 val proofstring =
       
    50     String.translate (fn c => if is_proof_char c then str c else "");
       
    51 
       
    52 
       
    53 (**** For running in Isar ****)
    41 (**** For running in Isar ****)
    54 
    42 
    55 (* same function as that in res_axioms.ML *)
    43 (* same function as that in res_axioms.ML *)
    56 fun repeat_RS thm1 thm2 =
    44 fun repeat_RS thm1 thm2 =
    57     let val thm1' =  thm1 RS thm2 handle THM _ => thm1
    45     let val thm1' =  thm1 RS thm2 handle THM _ => thm1
    97 fun watcher_call_provers sign sg_terms (childin, childout,pid) =
    85 fun watcher_call_provers sign sg_terms (childin, childout,pid) =
    98   let
    86   let
    99     fun make_atp_list [] n = []
    87     fun make_atp_list [] n = []
   100       | make_atp_list (sg_term::xs) n =
    88       | make_atp_list (sg_term::xs) n =
   101           let
    89           let
   102             val goalstring = proofstring (Sign.string_of_term sign sg_term)
    90             val goalstring = Sign.string_of_term sign sg_term
   103             val _ = debug ("goalstring in make_atp_lists is " ^ goalstring)
    91             val _ = debug ("goalstring in make_atp_lists is " ^ goalstring)
   104             val probfile = prob_pathname n
    92             val probfile = prob_pathname n
   105             val time = Int.toString (!time_limit)
    93             val time = Int.toString (!time_limit)
   106             val _ = debug ("problem file in watcher_call_provers is " ^ probfile)
    94             val _ = debug ("problem file in watcher_call_provers is " ^ probfile)
   107           in
    95           in
   233     if !destdir = "" andalso !time_limit > 0 then isar_atp (ctxt, goal)
   221     if !destdir = "" andalso !time_limit > 0 then isar_atp (ctxt, goal)
   234     else isar_atp_writeonly (ctxt, goal)
   222     else isar_atp_writeonly (ctxt, goal)
   235   end);
   223   end);
   236 
   224 
   237 val call_atpP =
   225 val call_atpP =
   238   OuterSyntax.improper_command 
   226   OuterSyntax.command 
   239     "ProofGeneral.call_atp" 
   227     "ProofGeneral.call_atp" 
   240     "call automatic theorem provers" 
   228     "call automatic theorem provers" 
   241     OuterKeyword.diag
   229     OuterKeyword.diag
   242     (Scan.succeed (Toplevel.no_timing o invoke_atp));
   230     (Scan.succeed (Toplevel.no_timing o invoke_atp));
   243 
   231