src/Pure/Tools/find_theorems.ML
changeset 46716 c45a4427db39
parent 46713 e6e1ec6d5c1c
child 46717 b09afce1e54f
equal deleted inserted replaced
46715:6236ca7b32a7 46716:c45a4427db39
   584 
   584 
   585 fun pretty_thm ctxt (thmref, thm) = pretty_theorem ctxt (Internal (thmref, thm));
   585 fun pretty_thm ctxt (thmref, thm) = pretty_theorem ctxt (Internal (thmref, thm));
   586 
   586 
   587 fun gen_print_theorems find ctxt opt_goal opt_limit rem_dups raw_criteria =
   587 fun gen_print_theorems find ctxt opt_goal opt_limit rem_dups raw_criteria =
   588   let
   588   let
   589     val start = Timing.start ();
       
   590 
       
   591     val criteria = map (apsnd (read_criterion ctxt)) raw_criteria;
   589     val criteria = map (apsnd (read_criterion ctxt)) raw_criteria;
   592     val (foundo, theorems) = find
   590     val (foundo, theorems) = find
   593       {goal=opt_goal, limit=opt_limit, rem_dups=rem_dups, criteria=criteria};
   591       {goal=opt_goal, limit=opt_limit, rem_dups=rem_dups, criteria=criteria};
   594     val returned = length theorems;
   592     val returned = length theorems;
   595 
   593 
   599       | SOME found =>
   597       | SOME found =>
   600           "found " ^ string_of_int found ^ " theorem(s)" ^
   598           "found " ^ string_of_int found ^ " theorem(s)" ^
   601             (if returned < found
   599             (if returned < found
   602              then " (" ^ string_of_int returned ^ " displayed)"
   600              then " (" ^ string_of_int returned ^ " displayed)"
   603              else ""));
   601              else ""));
   604 
       
   605     val end_msg = " in " ^ Timing.message (Timing.result start);
       
   606   in
   602   in
   607     Pretty.big_list "searched for:" (map (pretty_criterion ctxt) criteria) ::
   603     Pretty.big_list "searched for:" (map (pretty_criterion ctxt) criteria) ::
   608     Pretty.str "" ::
   604     Pretty.str "" ::
   609     (if null theorems then [Pretty.str ("nothing found" ^ end_msg)]
   605     (if null theorems then [Pretty.str "nothing found"]
   610      else
   606      else
   611       [Pretty.str (tally_msg ^ end_msg ^ ":"), Pretty.str ""] @
   607       [Pretty.str (tally_msg ^ ":"), Pretty.str ""] @
   612         map (pretty_theorem ctxt) theorems)
   608         map (pretty_theorem ctxt) theorems)
   613   end |> Pretty.chunks |> Pretty.writeln;
   609   end |> Pretty.chunks |> Pretty.writeln;
   614 
   610 
   615 fun print_theorems ctxt =
   611 fun print_theorems ctxt =
   616   gen_print_theorems (filter_theorems ctxt (map Internal (all_facts_of ctxt))) ctxt;
   612   gen_print_theorems (filter_theorems ctxt (map Internal (all_facts_of ctxt))) ctxt;