prohibit locally fixed type variables in bnf definitions
authortraytel
Wed, 13 Nov 2013 15:36:32 +0100
changeset 54426 edb87aac9cca
parent 54425 adbcad187fcf
child 54427 783861a66a60
prohibit locally fixed type variables in bnf definitions
src/HOL/BNF/Tools/bnf_def.ML
--- a/src/HOL/BNF/Tools/bnf_def.ML	Wed Nov 13 15:36:32 2013 +0100
+++ b/src/HOL/BNF/Tools/bnf_def.ML	Wed Nov 13 15:36:32 2013 +0100
@@ -744,8 +744,12 @@
 
     val CA_params = map TVar (Term.add_tvarsT CA []);
 
+    val bnf_T = Morphism.typ phi T_rhs;
+    val bad_args = Term.add_tfreesT bnf_T [];
+    val _ = if null bad_args then () else error ("Locally fixed type arguments " ^
+      commas_quote (map (Syntax.string_of_typ no_defs_lthy o TFree) bad_args));
+
     val bnf_sets = map2 (normalize_set CA_params) alphas (map (Morphism.term phi) bnf_set_terms);
-    val bnf_T = Morphism.typ phi T_rhs;
     val bnf_bd =
       Term.subst_TVars (Term.add_tvar_namesT bnf_T [] ~~ CA_params) (Morphism.term phi bnf_bd_term);