--- a/src/HOL/BNF/Tools/bnf_fp_rec_sugar.ML Wed Oct 02 22:59:19 2013 +0200
+++ b/src/HOL/BNF/Tools/bnf_fp_rec_sugar.ML Wed Oct 02 22:59:54 2013 +0200
@@ -803,9 +803,12 @@
co_build_defs lthy' bs mxs has_call arg_Tss corec_specs disc_eqnss sel_eqnss;
fun excl_tac (c, c', a) =
- if a orelse c = c' orelse sequential then SOME (K (mk_primcorec_assumption_tac lthy []))
- else if simple then SOME (K (auto_tac lthy))
- else NONE;
+ if a orelse c = c' orelse sequential then
+ SOME (K (HEADGOAL (mk_primcorec_assumption_tac lthy [])))
+ else if simple then
+ SOME (K (auto_tac lthy))
+ else
+ NONE;
(*
val _ = tracing ("exclusiveness properties:\n \<cdot> " ^
--- a/src/HOL/BNF/Tools/bnf_fp_rec_sugar_tactics.ML Wed Oct 02 22:59:19 2013 +0200
+++ b/src/HOL/BNF/Tools/bnf_fp_rec_sugar_tactics.ML Wed Oct 02 22:59:54 2013 +0200
@@ -7,13 +7,13 @@
signature BNF_FP_REC_SUGAR_TACTICS =
sig
- val mk_primcorec_assumption_tac: Proof.context -> thm list -> tactic
- val mk_primcorec_code_of_ctr_tac: Proof.context -> thm list -> thm list -> thm list -> thm list ->
- int list -> thm list -> tactic
- val mk_primcorec_code_of_raw_tac: thm list -> thm list -> thm -> tactic
+ val mk_primcorec_assumption_tac: Proof.context -> thm list -> int -> tactic
+ val mk_primcorec_code_of_raw_code_tac: thm list -> thm -> tactic
val mk_primcorec_ctr_of_dtr_tac: Proof.context -> int -> thm -> thm option -> thm list -> tactic
val mk_primcorec_disc_tac: Proof.context -> thm list -> thm -> int -> int -> thm list list list ->
tactic
+ val mk_primcorec_raw_code_of_ctr_tac: Proof.context -> thm list -> thm list -> thm list ->
+ thm list -> int list -> thm list -> tactic
val mk_primcorec_sel_tac: Proof.context -> thm list -> thm list -> thm list -> thm list ->
thm list -> thm list -> thm list -> thm -> int -> int -> thm list list list -> tactic
val mk_primrec_tac: Proof.context -> int -> thm list -> thm list -> thm list -> thm -> tactic
@@ -38,13 +38,13 @@
HEADGOAL (rtac refl);
fun mk_primcorec_assumption_tac ctxt discIs =
- HEADGOAL (SELECT_GOAL (unfold_thms_tac ctxt
+ SELECT_GOAL (unfold_thms_tac ctxt
@{thms not_not not_False_eq_True de_Morgan_conj de_Morgan_disj} THEN
SOLVE (HEADGOAL (REPEAT o (rtac refl ORELSE' atac ORELSE' etac conjE ORELSE'
resolve_tac @{thms TrueI conjI disjI1 disjI2} ORELSE'
dresolve_tac discIs THEN' atac ORELSE'
etac notE THEN' atac ORELSE'
- etac disjE)))));
+ etac disjE))));
fun mk_primcorec_same_case_tac m =
HEADGOAL (if m = 0 then rtac TrueI
@@ -52,7 +52,7 @@
fun mk_primcorec_different_case_tac ctxt excl =
unfold_thms_tac ctxt @{thms not_not not_False_eq_True not_True_eq_False} THEN
- HEADGOAL (rtac excl THEN_ALL_NEW SELECT_GOAL (mk_primcorec_assumption_tac ctxt []));
+ HEADGOAL (rtac excl THEN_ALL_NEW mk_primcorec_assumption_tac ctxt []);
fun mk_primcorec_cases_tac ctxt k m exclsss =
let val n = length exclsss in
@@ -72,15 +72,15 @@
exclsss =
mk_primcorec_prelude ctxt defs (f_sel RS trans) THEN
mk_primcorec_cases_tac ctxt k m exclsss THEN
- unfold_thms_tac ctxt (@{thms id_apply o_def split_def} @ maps @ map_comps @ map_idents) THEN
HEADGOAL (REPEAT_DETERM o (rtac refl ORELSE' rtac ext ORELSE'
eresolve_tac falseEs ORELSE'
resolve_tac split_connectI ORELSE'
Splitter.split_asm_tac (split_if_asm :: split_asms) ORELSE'
Splitter.split_tac (split_if :: splits) ORELSE'
eresolve_tac (map (fn thm => thm RS neq_eq_eq_contradict) distincts) THEN' atac ORELSE'
- (CHANGED o SELECT_GOAL (unfold_tac @{thms sum.cases} ctxt)) ORELSE'
- etac notE THEN' atac));
+ etac notE THEN' atac ORELSE'
+ (CHANGED o SELECT_GOAL (unfold_thms_tac ctxt
+ (@{thms id_apply o_def split_def sum.cases} @ maps @ map_comps @ map_idents)))));
fun mk_primcorec_ctr_of_dtr_tac ctxt m collapse maybe_disc_f sel_fs =
HEADGOAL (rtac ((if null sel_fs then collapse else collapse RS sym) RS trans) THEN'
@@ -88,30 +88,29 @@
unfold_thms_tac ctxt sel_fs THEN HEADGOAL (rtac refl);
(* TODO: reduce code duplication with selector tactic above *)
-fun mk_primcorec_code_of_ctr_single_tac ctxt distincts discIs splits split_asms m f_ctr =
+fun mk_primcorec_raw_code_of_ctr_single_tac ctxt distincts discIs splits split_asms m f_ctr =
HEADGOAL (REPEAT o (resolve_tac split_connectI ORELSE' split_tac (split_if :: splits))) THEN
mk_primcorec_prelude ctxt [] (f_ctr RS trans) THEN
- REPEAT_DETERM_N m (mk_primcorec_assumption_tac ctxt discIs) THEN
- HEADGOAL (SELECT_GOAL (SOLVE (HEADGOAL (REPEAT_DETERM o
+ HEADGOAL ((REPEAT_DETERM_N m o mk_primcorec_assumption_tac ctxt discIs) THEN'
+ SELECT_GOAL (SOLVE (HEADGOAL (REPEAT_DETERM o
(rtac refl ORELSE' atac ORELSE'
resolve_tac split_connectI ORELSE'
Splitter.split_asm_tac (split_if_asm :: split_asms) ORELSE'
Splitter.split_tac (split_if :: splits) ORELSE'
- K (mk_primcorec_assumption_tac ctxt discIs) ORELSE'
+ mk_primcorec_assumption_tac ctxt discIs ORELSE'
eresolve_tac (map (fn thm => thm RS neq_eq_eq_contradict) distincts) THEN' atac ORELSE'
(TRY o dresolve_tac discIs) THEN' etac notE THEN' atac)))));
-fun mk_primcorec_code_of_ctr_tac ctxt distincts discIs splits split_asms ms ctr_thms =
- EVERY (map2 (mk_primcorec_code_of_ctr_single_tac ctxt distincts discIs splits split_asms)
+fun mk_primcorec_raw_code_of_ctr_tac ctxt distincts discIs splits split_asms ms ctr_thms =
+ EVERY (map2 (mk_primcorec_raw_code_of_ctr_single_tac ctxt distincts discIs splits split_asms)
ms ctr_thms);
-fun mk_primcorec_code_of_raw_tac splits disc_excludes raw =
+fun mk_primcorec_code_of_raw_code_tac splits raw =
HEADGOAL (rtac raw ORELSE' rtac (raw RS trans) THEN' REPEAT_DETERM o
(rtac refl ORELSE'
(TRY o rtac sym) THEN' atac ORELSE'
resolve_tac split_connectI ORELSE'
Splitter.split_tac (split_if :: splits) ORELSE'
- etac notE THEN' atac ORELSE'
- (TRY o dresolve_tac disc_excludes) THEN' etac notE THEN' atac));
+ etac notE THEN' atac));
end;
--- a/src/HOL/Tools/SMT/smt_config.ML Wed Oct 02 22:59:19 2013 +0200
+++ b/src/HOL/Tools/SMT/smt_config.ML Wed Oct 02 22:59:54 2013 +0200
@@ -33,7 +33,6 @@
val monomorph_limit: int Config.T
val monomorph_instances: int Config.T
val infer_triggers: bool Config.T
- val drop_bad_facts: bool Config.T
val filter_only_facts: bool Config.T
val debug_files: string Config.T
@@ -161,7 +160,6 @@
val monomorph_limit = Attrib.setup_config_int @{binding smt_monomorph_limit} (K 10)
val monomorph_instances = Attrib.setup_config_int @{binding smt_monomorph_instances} (K 500)
val infer_triggers = Attrib.setup_config_bool @{binding smt_infer_triggers} (K false)
-val drop_bad_facts = Attrib.setup_config_bool @{binding smt_drop_bad_facts} (K false)
val filter_only_facts = Attrib.setup_config_bool @{binding smt_filter_only_facts} (K false)
val debug_files = Attrib.setup_config_string @{binding smt_debug_files} (K "")
--- a/src/HOL/Tools/SMT/smt_normalize.ML Wed Oct 02 22:59:19 2013 +0200
+++ b/src/HOL/Tools/SMT/smt_normalize.ML Wed Oct 02 22:59:54 2013 +0200
@@ -6,6 +6,7 @@
signature SMT_NORMALIZE =
sig
+ val drop_fact_warning: Proof.context -> thm -> unit
val atomize_conv: Proof.context -> conv
type extra_norm = Proof.context -> thm list * thm list -> thm list * thm list
val add_extra_norm: SMT_Utils.class * extra_norm -> Context.generic ->
@@ -18,6 +19,10 @@
structure SMT_Normalize: SMT_NORMALIZE =
struct
+fun drop_fact_warning ctxt =
+ SMT_Config.verbose_msg ctxt (prefix "Warning: dropping assumption: " o
+ Display.string_of_thm ctxt)
+
(* general theorem normalizations *)
@@ -329,16 +334,10 @@
|> Drule.forall_intr_vars
|> Conv.fconv_rule (gen_normalize1_conv ctxt weight)
-fun drop_fact_warning ctxt =
- let val pre = prefix "Warning: dropping assumption: "
- in SMT_Config.verbose_msg ctxt (pre o Display.string_of_thm ctxt) end
-
fun gen_norm1_safe ctxt (i, (weight, thm)) =
- if Config.get ctxt SMT_Config.drop_bad_facts then
- (case try (gen_normalize1 ctxt weight) thm of
- SOME thm' => SOME (i, thm')
- | NONE => (drop_fact_warning ctxt thm; NONE))
- else SOME (i, gen_normalize1 ctxt weight thm)
+ (case try (gen_normalize1 ctxt weight) thm of
+ SOME thm' => SOME (i, thm')
+ | NONE => (drop_fact_warning ctxt thm; NONE))
fun gen_normalize ctxt iwthms = map_filter (gen_norm1_safe ctxt) iwthms
--- a/src/HOL/Tools/SMT/smt_solver.ML Wed Oct 02 22:59:19 2013 +0200
+++ b/src/HOL/Tools/SMT/smt_solver.ML Wed Oct 02 22:59:54 2013 +0200
@@ -257,11 +257,13 @@
| _ => false))
(* without this test, we would run into problems when atomizing the rules: *)
-fun check_topsort iwthms =
- if exists (has_topsort o Thm.prop_of o snd o snd) iwthms then
- raise SMT_Failure.SMT (SMT_Failure.Other_Failure ("proof state " ^
- "contains the universal sort {}"))
- else ()
+fun check_topsort ctxt thm =
+ if has_topsort (Thm.prop_of thm) then
+ (SMT_Normalize.drop_fact_warning ctxt thm; TrueI)
+ else
+ thm
+
+fun check_topsorts ctxt iwthms = map (apsnd (apsnd (check_topsort ctxt))) iwthms
(* filter *)
@@ -277,7 +279,6 @@
val ctxt =
ctxt
|> Config.put SMT_Config.oracle false
- |> Config.put SMT_Config.drop_bad_facts true
|> Config.put SMT_Config.filter_only_facts true
val ({context=ctxt', prems, concl, ...}, _) = Subgoal.focus ctxt i goal
@@ -291,7 +292,7 @@
map snd xwthms
|> map_index I
|> append (map (pair ~1 o pair NONE) (Thm.assume cprop :: prems @ facts))
- |> tap check_topsort
+ |> check_topsorts ctxt'
|> gen_preprocess ctxt'
|> pair (map (apsnd snd) xwthms)
end
@@ -332,7 +333,7 @@
fun solve ctxt iwthms =
iwthms
- |> tap check_topsort
+ |> check_topsorts ctxt
|> apply_solver ctxt
|>> trace_assumptions ctxt iwthms
|> snd
--- a/src/HOL/Tools/Sledgehammer/sledgehammer_fact.ML Wed Oct 02 22:59:19 2013 +0200
+++ b/src/HOL/Tools/Sledgehammer/sledgehammer_fact.ML Wed Oct 02 22:59:54 2013 +0200
@@ -251,7 +251,7 @@
| interest_of_prop Ts (@{const "==>"} $ t $ u) =
combine_interests (interest_of_prop Ts t) (interest_of_prop Ts u)
| interest_of_prop Ts (Const (@{const_name all}, _) $ Abs (_, T, t)) =
- interest_of_prop (T :: Ts) t
+ if type_has_top_sort T then Deal_Breaker else interest_of_prop (T :: Ts) t
| interest_of_prop Ts ((t as Const (@{const_name all}, _)) $ u) =
interest_of_prop Ts (t $ eta_expand Ts u 1)
| interest_of_prop _ (Const (@{const_name "=="}, _) $ t $ u) =