sort out code equations headed by a projection of a abstract datatype
authorhaftmann
Fri, 28 Jun 2013 21:07:42 +0200
changeset 52475 445ae7a4e4e1
parent 52474 9c7f760d06c2
child 52476 7d7b4e285ea7
sort out code equations headed by a projection of a abstract datatype
src/Pure/Isar/code.ML
--- a/src/Pure/Isar/code.ML	Fri Jun 28 21:07:41 2013 +0200
+++ b/src/Pure/Isar/code.ML	Fri Jun 28 21:07:42 2013 +0200
@@ -502,6 +502,13 @@
     val _ = if not (is_abstr thy c) then ()
       else bad_thm "Abstractor as head in equation";
     val _ = check_decl_ty thy (c, ty);
+    val _ = case strip_type ty
+     of (Type (tyco, _) :: _, _) => (case get_type_entry thy tyco
+       of SOME (_, Abstractor (_, (proj, _))) => if c = proj
+            then bad_thm "Projection as head in equation"
+            else ()
+        | _ => ())
+      | _ => ();
   in () end;
 
 fun gen_assert_eqn thy check_patterns (thm, proper) =