proper name generation to avoid clash with 'P' in user specification
authorblanchet
Fri, 03 Jan 2014 14:38:13 +0100
changeset 54927 a5a2598f0651
parent 54926 28b621fce2f9
child 54928 cb077b02c9a4
proper name generation to avoid clash with 'P' in user specification
src/HOL/BNF/Tools/bnf_gfp_rec_sugar.ML
--- a/src/HOL/BNF/Tools/bnf_gfp_rec_sugar.ML	Fri Jan 03 14:14:16 2014 +0100
+++ b/src/HOL/BNF/Tools/bnf_gfp_rec_sugar.ML	Fri Jan 03 14:38:13 2014 +0100
@@ -979,6 +979,9 @@
           |> (if is_none tac_opt then map2 append (take actual_nn thmss'') else I);
         val exclude_thmss = thmss'' |> is_none tac_opt ? drop actual_nn;
 
+        val ps =
+          Variable.variant_frees lthy (maps (maps #fun_args) disc_eqnss) [("P", HOLogic.boolT)];
+
         val exhaust_thmss =
           map2 (fn false => K []
               | true => fn disc_eqns as {fun_args, ...} :: _ =>
@@ -989,7 +992,7 @@
                   [mk_imp_p (map (mk_imp_p o map HOLogic.mk_Trueprop o #prems) disc_eqns)]
                 end)
             de_facto_exhaustives disc_eqnss
-          |> list_all_fun_args [("P", HOLogic.boolT)]
+          |> list_all_fun_args ps
           |> map3 (fn disc_eqns as {fun_args, ...} :: _ => fn [] => K []
               | [nchotomy_thm] => fn [goal] =>
                 [mk_primcorec_exhaust_tac lthy ("" (* for "P" *) :: map (fst o dest_Free) fun_args)