src/HOL/Tools/Quickcheck/find_unused_assms.ML
changeset 46716 c45a4427db39
parent 46713 e6e1ec6d5c1c
child 46961 5c6955f487e5
equal deleted inserted replaced
46715:6236ca7b32a7 46716:c45a4427db39
    82     Pretty.str "unnecessary assumption(s) " ::
    82     Pretty.str "unnecessary assumption(s) " ::
    83     separate (Pretty.str ", or ") (map pretty_indexes set_of_indexes))
    83     separate (Pretty.str ", or ") (map pretty_indexes set_of_indexes))
    84 
    84 
    85 fun print_unused_assms ctxt opt_thy_name =
    85 fun print_unused_assms ctxt opt_thy_name =
    86   let
    86   let
    87     val start = Timing.start ()
       
    88     val thy_name = the_default (Context.theory_name (Proof_Context.theory_of ctxt)) opt_thy_name
    87     val thy_name = the_default (Context.theory_name (Proof_Context.theory_of ctxt)) opt_thy_name
    89     val results = find_unused_assms ctxt thy_name
    88     val results = find_unused_assms ctxt thy_name
    90     val total = length results
    89     val total = length results
    91     val with_assumptions = length (filter (is_some o snd) results)
    90     val with_assumptions = length (filter (is_some o snd) results)
    92     val with_superfluous_assumptions = filter_out (fn (_, r) => r = SOME [])
    91     val with_superfluous_assumptions = filter_out (fn (_, r) => r = SOME [])
    95     val msg = "Found " ^ string_of_int (length with_superfluous_assumptions)
    94     val msg = "Found " ^ string_of_int (length with_superfluous_assumptions)
    96       ^ " theorem(s) with (potentially) superfluous assumptions"      
    95       ^ " theorem(s) with (potentially) superfluous assumptions"      
    97     val end_msg = "Checked " ^ string_of_int with_assumptions ^ " theorem(s) with assumptions"
    96     val end_msg = "Checked " ^ string_of_int with_assumptions ^ " theorem(s) with assumptions"
    98       ^ " in the theory " ^ quote thy_name
    97       ^ " in the theory " ^ quote thy_name
    99       ^ " with a total of " ^ string_of_int total ^ " theorem(s)"  
    98       ^ " with a total of " ^ string_of_int total ^ " theorem(s)"  
   100       ^ " in " ^ Timing.message (Timing.result start);
       
   101   in
    99   in
   102     ([Pretty.str (msg ^ ":"), Pretty.str ""] @
   100     ([Pretty.str (msg ^ ":"), Pretty.str ""] @
   103         map pretty_thm with_superfluous_assumptions
   101         map pretty_thm with_superfluous_assumptions
   104     @ [Pretty.str "", Pretty.str end_msg])
   102     @ [Pretty.str "", Pretty.str end_msg])
   105   end |> Pretty.chunks |> Pretty.writeln;
   103   end |> Pretty.chunks |> Pretty.writeln;