--- a/src/HOL/Mirabelle/Tools/mirabelle_sledgehammer.ML Wed Sep 09 23:26:34 2009 +0200
+++ b/src/HOL/Mirabelle/Tools/mirabelle_sledgehammer.ML Thu Sep 10 12:53:49 2009 +0200
@@ -30,7 +30,9 @@
calls: int,
success: int,
time: int,
- timeout: int }
+ timeout: int,
+ lemmas: int
+ }
(* The first me_data component is only used if "minimize" is on.
@@ -42,22 +44,21 @@
ShData{calls=sh_calls, success=sh_success, time_isa=sh_time_isa,
time_atp=sh_time_atp, time_atp_fail=sh_time_atp_fail}
-fun make_me_data (metis_calls, metis_success, metis_time, metis_timeout) =
- MeData{calls=metis_calls, success=metis_success,
- time=metis_time, timeout=metis_timeout}
+fun make_me_data (me_calls, me_success, me_time, me_timeout, me_lemmas) =
+ MeData{calls=me_calls, success=me_success, time=me_time, timeout=me_timeout, lemmas=me_lemmas}
-val empty_data = Data(make_sh_data (0, 0, 0, 0, 0), make_me_data(0, 0, 0, 0), make_me_data(0, 0, 0, 0))
+val empty_data = Data(make_sh_data (0, 0, 0, 0, 0), make_me_data(0, 0, 0, 0, 0), make_me_data(0, 0, 0, 0, 0))
fun map_sh_data f
(Data (ShData{calls, success, time_isa, time_atp, time_atp_fail}, meda0, meda)) =
Data (make_sh_data (f (calls, success, time_isa, time_atp, time_atp_fail)),
meda0, meda)
-fun map_me_data0 f (Data (shda, MeData{calls,success,time,timeout}, meda)) =
- Data(shda, make_me_data(f (calls,success,time,timeout)), meda)
+fun map_me_data0 f (Data (shda, MeData{calls,success,time,timeout,lemmas}, meda)) =
+ Data(shda, make_me_data(f (calls,success,time,timeout,lemmas)), meda)
-fun map_me_data f (Data (shda, meda0, MeData{calls,success,time,timeout})) =
- Data(shda, meda0, make_me_data(f (calls,success,time,timeout)))
+fun map_me_data f (Data (shda, meda0, MeData{calls,success,time,timeout,lemmas})) =
+ Data(shda, meda0, make_me_data(f (calls,success,time,timeout,lemmas)))
val inc_sh_calls = map_sh_data (fn (sh_calls, sh_success, sh_time_isa, sh_time_atp, sh_time_atp_fail)
=> (sh_calls + 1, sh_success, sh_time_isa, sh_time_atp, sh_time_atp_fail))
@@ -74,30 +75,35 @@
fun inc_sh_time_atp_fail t = map_sh_data (fn (sh_calls, sh_success, sh_time_isa, sh_time_atp, sh_time_atp_fail)
=> (sh_calls, sh_success, sh_time_isa, sh_time_atp, sh_time_atp_fail + t))
-val inc_metis_calls = map_me_data (fn (metis_calls, metis_success, metis_time, metis_timeout)
- => (metis_calls + 1, metis_success, metis_time, metis_timeout))
+val inc_metis_calls = map_me_data (fn (calls, success, time, timeout, lemmas)
+ => (calls + 1, success, time, timeout, lemmas))
-val inc_metis_success = map_me_data (fn (metis_calls, metis_success, metis_time, metis_timeout)
- => (metis_calls, metis_success + 1, metis_time, metis_timeout))
+val inc_metis_success = map_me_data (fn (calls,success,time,timeout,lemmas)
+ => (calls, success + 1, time, timeout, lemmas))
-fun inc_metis_time t = map_me_data (fn (metis_calls, metis_success, metis_time, metis_timeout)
- => (metis_calls, metis_success, metis_time + t, metis_timeout))
+fun inc_metis_time t = map_me_data (fn (calls,success,time,timeout,lemmas)
+ => (calls, success, time + t, timeout, lemmas))
-val inc_metis_timeout = map_me_data (fn (metis_calls, metis_success, metis_time, metis_timeout)
- => (metis_calls, metis_success, metis_time, metis_timeout + 1))
+val inc_metis_timeout = map_me_data (fn (calls,success,time,timeout,lemmas)
+ => (calls, success, time, timeout + 1, lemmas))
+
+fun inc_metis_lemmas n = map_me_data (fn (calls,success,time,timeout,lemmas)
+ => (calls, success, time, timeout, lemmas + n))
-val inc_metis_calls0 = map_me_data0 (fn (metis_calls, metis_success, metis_time, metis_timeout)
- => (metis_calls + 1, metis_success, metis_time, metis_timeout))
+val inc_metis_calls0 = map_me_data0 (fn (calls, success, time, timeout, lemmas)
+ => (calls + 1, success, time, timeout, lemmas))
-val inc_metis_success0 = map_me_data0 (fn (metis_calls, metis_success, metis_time, metis_timeout)
- => (metis_calls, metis_success + 1, metis_time, metis_timeout))
+val inc_metis_success0 = map_me_data0 (fn (calls,success,time,timeout,lemmas)
+ => (calls, success + 1, time, timeout, lemmas))
-fun inc_metis_time0 t = map_me_data0 (fn (metis_calls, metis_success, metis_time, metis_timeout)
- => (metis_calls, metis_success, metis_time + t, metis_timeout))
+fun inc_metis_time0 t = map_me_data0 (fn (calls,success,time,timeout,lemmas)
+ => (calls, success, time + t, timeout, lemmas))
-val inc_metis_timeout0 = map_me_data0 (fn (metis_calls, metis_success, metis_time, metis_timeout)
- => (metis_calls, metis_success, metis_time, metis_timeout + 1))
+val inc_metis_timeout0 = map_me_data0 (fn (calls,success,time,timeout,lemmas)
+ => (calls, success, time, timeout + 1, lemmas))
+fun inc_metis_lemmas0 n = map_me_data0 (fn (calls,success,time,timeout,lemmas)
+ => (calls, success, time, timeout, lemmas + n))
local
@@ -124,13 +130,14 @@
)
fun log_metis_data log tag sh_calls sh_success metis_calls metis_success metis_time
- metis_timeout =
+ metis_timeout metis_lemmas =
(log ("Total number of " ^ tag ^ "metis calls: " ^ str metis_calls);
log ("Number of successful " ^ tag ^ "metis calls: " ^ str metis_success);
log ("Number of " ^ tag ^ "metis timeouts: " ^ str metis_timeout);
log ("Number of " ^ tag ^ "metis exceptions: " ^
str (sh_success - metis_success - metis_timeout));
log ("Success rate: " ^ percentage metis_success sh_calls ^ "%");
+ log ("Number of " ^ tag ^ "metis lemmas: " ^ str metis_lemmas);
log ("Total time for successful metis calls: " ^ str3 (time metis_time));
log ("Average time for successful metis calls: " ^
str3 (avg_time metis_time metis_success)))
@@ -138,19 +145,19 @@
in
fun log_data id log (Data (ShData{calls=sh_calls, success=sh_success, time_isa=sh_time_isa, time_atp=sh_time_atp, time_atp_fail=sh_time_atp_fail}, MeData{calls=metis_calls0,
- success=metis_success0, time=metis_time0, timeout=metis_timeout0}, MeData{calls=metis_calls,
- success=metis_success, time=metis_time, timeout=metis_timeout})) =
+ success=metis_success0, time=metis_time0, timeout=metis_timeout0, lemmas=metis_lemmas0}, MeData{calls=metis_calls,
+ success=metis_success, time=metis_time, timeout=metis_timeout, lemmas=metis_lemmas})) =
if sh_calls > 0
then
(log ("\n\n\nReport #" ^ string_of_int id ^ ":\n");
log_sh_data log sh_calls sh_success sh_time_isa sh_time_atp sh_time_atp_fail;
log "";
if metis_calls > 0 then log_metis_data log "" sh_calls sh_success metis_calls
- metis_success metis_time metis_timeout else ();
+ metis_success metis_time metis_timeout metis_lemmas else ();
log "";
if metis_calls0 > 0
then log_metis_data log "unminimized " sh_calls sh_success metis_calls0
- metis_success0 metis_time0 metis_timeout0
+ metis_success0 metis_time0 metis_timeout0 metis_lemmas0
else ()
)
else ()
@@ -279,7 +286,7 @@
end
-fun run_metis (inc_metis_calls, inc_metis_success, inc_metis_time, inc_metis_timeout) args named_thms id {pre=st, timeout, log, ...} =
+fun run_metis (inc_metis_calls, inc_metis_success, inc_metis_time, inc_metis_timeout, inc_metis_lemmas) args named_thms id {pre=st, timeout, log, ...} =
let
fun metis thms ctxt = MetisTools.metis_tac ctxt thms
fun apply_metis thms = Mirabelle.can_apply timeout (metis thms) st
@@ -294,6 +301,7 @@
val _ = log separator
val _ = change_data id inc_metis_calls
+ val _ = change_data id (inc_metis_lemmas (length named_thms))
in
maps snd named_thms
|> timed_metis
@@ -302,8 +310,8 @@
fun sledgehammer_action args id (st as {log, ...}) =
let
- val metis_fns = (inc_metis_calls, inc_metis_success, inc_metis_time, inc_metis_timeout)
- val metis0_fns = (inc_metis_calls0, inc_metis_success0, inc_metis_time0, inc_metis_timeout0)
+ val metis_fns = (inc_metis_calls, inc_metis_success, inc_metis_time, inc_metis_timeout, inc_metis_lemmas)
+ val metis0_fns = (inc_metis_calls0, inc_metis_success0, inc_metis_time0, inc_metis_timeout0, inc_metis_lemmas0)
val named_thms = ref (NONE : (string * thm list) list option)
fun if_enabled k f =