expand type classes into their ancestors for MaSh
authorblanchet
Thu, 06 Dec 2012 11:25:10 +0100
changeset 50392 190053ee24ed
parent 50391 d2261e314146
child 50393 d8aa26c78327
expand type classes into their ancestors for MaSh
src/HOL/Tools/Sledgehammer/sledgehammer_mash.ML
--- a/src/HOL/Tools/Sledgehammer/sledgehammer_mash.ML	Thu Dec 06 11:25:10 2012 +0100
+++ b/src/HOL/Tools/Sledgehammer/sledgehammer_mash.ML	Thu Dec 06 11:25:10 2012 +0100
@@ -516,11 +516,18 @@
 fun interesting_terms_types_and_classes ctxt prover term_max_depth
                                         type_max_depth ts =
   let
+    val thy = Proof_Context.theory_of ctxt
+    val classes = Sign.classes_of thy
     fun is_bad_const (x as (s, _)) args =
       member (op =) logical_consts s orelse
       fst (is_built_in_const_for_prover ctxt prover x args)
     fun add_classes @{sort type} = I
-      | add_classes S = union (op = o pairself fst) (map class_feature_of S)
+      | add_classes S =
+        fold (`(Sorts.super_classes classes)
+              #> swap #> op ::
+              #> subtract (op =) @{sort type}
+              #> map class_feature_of
+              #> union (op = o pairself fst)) S
     fun do_add_type (Type (s, Ts)) =
         (not (member (op =) bad_types s)
          ? insert (op = o pairself fst) (type_feature_of s))