use better score function, based on previous evaluation (cf. Deduct 2011 slides)
1.1 --- a/src/HOL/Tools/Sledgehammer/sledgehammer_filter_mash.ML Wed Jul 18 08:44:04 2012 +0200
1.2 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_filter_mash.ML Wed Jul 18 08:44:04 2012 +0200
1.3 @@ -125,12 +125,12 @@
1.4 find_first (fn (_, th) => Thm.get_name_hint th = sugg) facts
1.5 fun suggested_facts suggs facts = map_filter (find_suggested facts) suggs
1.6
1.7 -val scale_factor = 1000
1.8 -
1.9 -fun scaled_powX x = Integer.pow 8 x
1.10 +(* Ad hoc score function roughly based on Blanchette's Ringberg 2011 data. *)
1.11 +fun score x = Math.pow (1.5, 15.5 - 0.05 * Real.fromInt x) + 15.0
1.12
1.13 fun sum_sq_avg [] = 0
1.14 - | sum_sq_avg xs = fold (Integer.add o scaled_powX) xs 0 div (length xs)
1.15 + | sum_sq_avg xs =
1.16 + Real.ceil (100000.0 * fold (curry (op +) o score) xs 0.0) div length xs
1.17
1.18 fun mesh_facts max_facts [(selected, unknown)] =
1.19 take max_facts selected @ take (max_facts - length selected) unknown
1.20 @@ -141,15 +141,13 @@
1.21 fun score_in fact ((sel_len, sels), unks) =
1.22 case find_index (curry fact_eq fact) sels of
1.23 ~1 => (case find_index (curry fact_eq fact) unks of
1.24 - ~1 => SOME 0
1.25 + ~1 => SOME sel_len
1.26 | _ => NONE)
1.27 - | j => SOME (scale_factor * (sel_len - j) div sel_len)
1.28 + | j => SOME j
1.29 fun score_of fact = mess |> map_filter (score_in fact) |> sum_sq_avg
1.30 val facts = fold (union fact_eq o take max_facts o snd o fst) mess []
1.31 in
1.32 facts |> map (`score_of) |> sort (int_ord o swap o pairself fst)
1.33 -|> tap (List.app (fn (score, (_, th)) => tracing ("score: " ^ string_of_int score ^ " " ^ Thm.get_name_hint th))
1.34 -)
1.35 |> map snd |> take max_facts
1.36 end
1.37