tuned;
authorwenzelm
Sat, 03 Aug 2019 15:48:28 +0200
changeset 70461 9ac6426ab8e0
parent 70460 b2b44fd1b6ec
child 70462 185c63c40ad7
tuned;
src/Pure/thm.ML
--- a/src/Pure/thm.ML	Sat Aug 03 15:05:53 2019 +0200
+++ b/src/Pure/thm.ML	Sat Aug 03 15:48:28 2019 +0200
@@ -2209,22 +2209,20 @@
   let
     val algebra = Sign.classes_of thy;
     val ars = Symtab.lookup_list arities t;
-    val super_class_completions =
-      Sign.super_classes thy c
-      |> filter_out (fn c1 => exists (fn ((c2, Ss2), _) =>
-            c1 = c2 andalso Sorts.sorts_le algebra (Ss2, Ss)) ars);
-
-    val completions = super_class_completions |> map (fn c1 =>
-      let
-        val th1 =
-          (th RS the_classrel thy (c, c1))
-          |> standard_tvars
-          |> close_derivation
-          |> trim_context;
-      in ((th1, thy_name), c1) end);
-
+    val completions =
+      Sign.super_classes thy c |> map_filter (fn c1 =>
+        if exists (fn ((c', Ss'), _) => c1 = c' andalso Sorts.sorts_le algebra (Ss', Ss)) ars
+        then NONE
+        else
+          let
+            val th1 =
+              (th RS the_classrel thy (c, c1))
+              |> standard_tvars
+              |> close_derivation
+              |> trim_context;
+          in SOME (t, ((c1, Ss), (th1, thy_name))) end);
     val finished' = finished andalso null completions;
-    val arities' = fold (fn (th, c1) => Symtab.cons_list (t, ((c1, Ss), th))) completions arities;
+    val arities' = fold Symtab.cons_list completions arities;
   in (finished', arities') end;
 
 fun complete_arities thy =