src/HOL/Tools/res_atp.ML
changeset 20757 fe84fe0dfd30
parent 20661 46832fee1215
child 20781 e26fe5c63c2f
equal deleted inserted replaced
20756:fec7f5834ffe 20757:fe84fe0dfd30
   479     | [] => [s];
   479     | [] => [s];
   480 
   480 
   481 fun banned_thmlist s =
   481 fun banned_thmlist s =
   482   (Sign.base_name s) mem_string ["induct","inducts","split","splits","split_asm"];
   482   (Sign.base_name s) mem_string ["induct","inducts","split","splits","split_asm"];
   483 
   483 
       
   484 (*Reject theorems with names like "List.filter.filter_list_def" or
       
   485   "Accessible_Part.acc.defs", as these are definitions arising from packages*)
       
   486 fun is_package_def a =
       
   487   let val l = NameSpace.unpack a
       
   488   in  length l > 2 andalso String.isSubstring "def" (List.last l)  end;
       
   489 
   484 fun make_banned_test xs = 
   490 fun make_banned_test xs = 
   485   let val ht = Polyhash.mkTable (Polyhash.hash_string, op =)
   491   let val ht = Polyhash.mkTable (Polyhash.hash_string, op =)
   486                                 (6000, HASH_STRING)
   492                                 (6000, HASH_STRING)
   487       fun banned_aux s = isSome (Polyhash.peek ht s) orelse banned_thmlist s
   493       fun banned_aux s = 
       
   494             isSome (Polyhash.peek ht s) orelse banned_thmlist s orelse is_package_def s
   488       fun banned s = exists banned_aux (delete_numeric_suffix s)
   495       fun banned s = exists banned_aux (delete_numeric_suffix s)
   489   in  app (fn x => Polyhash.insert ht (x,())) (!blacklist);
   496   in  app (fn x => Polyhash.insert ht (x,())) (!blacklist);
   490       app (insert_suffixed_names ht) (!blacklist @ xs); 
   497       app (insert_suffixed_names ht) (!blacklist @ xs); 
   491       banned
   498       banned
   492   end;
   499   end;
   659 	val logic = case mode of 
   666 	val logic = case mode of 
   660                             Auto => problem_logic_goals [map prop_of goal_cls]
   667                             Auto => problem_logic_goals [map prop_of goal_cls]
   661 			  | Fol => FOL
   668 			  | Fol => FOL
   662 			  | Hol => HOL
   669 			  | Hol => HOL
   663 	val (included_thms,user_rules) = get_clasimp_atp_lemmas ctxt user_thms
   670 	val (included_thms,user_rules) = get_clasimp_atp_lemmas ctxt user_thms
   664 	val user_lemmas_names = map #1 user_rules
       
   665 	val cla_simp_atp_clauses = included_thms |> blacklist_filter
   671 	val cla_simp_atp_clauses = included_thms |> blacklist_filter
   666 	                             |> make_unique |> ResAxioms.cnf_rules_pairs
   672 	                             |> make_unique |> ResAxioms.cnf_rules_pairs
   667                                      |> restrict_to_logic logic 
   673                                      |> restrict_to_logic logic 
   668 	val user_cls = ResAxioms.cnf_rules_pairs user_rules
   674 	val user_cls = ResAxioms.cnf_rules_pairs user_rules
   669 	val thy = ProofContext.theory_of ctxt
   675 	val thy = ProofContext.theory_of ctxt
   671 	                            user_cls (map prop_of goal_cls)
   677 	                            user_cls (map prop_of goal_cls)
   672 	val keep_types = if is_fol_logic logic then !fol_keep_types else is_typed_hol ()
   678 	val keep_types = if is_fol_logic logic then !fol_keep_types else is_typed_hol ()
   673 	val classrel_clauses = if keep_types then ResClause.classrel_clauses_thy thy else []
   679 	val classrel_clauses = if keep_types then ResClause.classrel_clauses_thy thy else []
   674 	val arity_clauses = if keep_types then ResClause.arity_clause_thy thy else []
   680 	val arity_clauses = if keep_types then ResClause.arity_clause_thy thy else []
   675         val writer = if dfg then dfg_writer else tptp_writer 
   681         val writer = if dfg then dfg_writer else tptp_writer 
   676 	val file = atp_input_file()
   682 	and file = atp_input_file()
   677     in
   683 	and user_lemmas_names = map #1 user_rules
   678 	(writer logic goal_cls file (axclauses,classrel_clauses,arity_clauses) user_lemmas_names;
   684     in
   679 	 Output.debug ("Writing to " ^ file);
   685 	writer logic goal_cls file (axclauses,classrel_clauses,arity_clauses) user_lemmas_names;
   680 	 file)
   686 	Output.debug ("Writing to " ^ file);
       
   687 	file
   681     end;
   688     end;
   682 
   689 
   683 
   690 
   684 (**** remove tmp files ****)
   691 (**** remove tmp files ****)
   685 fun cond_rm_tmp file = 
   692 fun cond_rm_tmp file =