src/HOL/Tools/inductive_codegen.ML
changeset 18928 042608ffa2ec
parent 18728 6790126ab5f6
child 18930 29d39c10822e
equal deleted inserted replaced
18927:2e5b0f3f1418 18928:042608ffa2ec
   227     (fn Prem (us, t) => find_first (fn Mode ((_, is), _) =>
   227     (fn Prem (us, t) => find_first (fn Mode ((_, is), _) =>
   228           let
   228           let
   229             val (in_ts, out_ts) = get_args is 1 us;
   229             val (in_ts, out_ts) = get_args is 1 us;
   230             val (out_ts', in_ts') = List.partition (is_constrt thy) out_ts;
   230             val (out_ts', in_ts') = List.partition (is_constrt thy) out_ts;
   231             val vTs = List.concat (map term_vTs out_ts');
   231             val vTs = List.concat (map term_vTs out_ts');
   232             val dupTs = map snd (duplicates vTs) @
   232             val dupTs = map snd (gen_duplicates (op =) vTs) @
   233               List.mapPartial (AList.lookup (op =) vTs) vs;
   233               List.mapPartial (AList.lookup (op =) vTs) vs;
   234           in
   234           in
   235             terms_vs (in_ts @ in_ts') subset vs andalso
   235             terms_vs (in_ts @ in_ts') subset vs andalso
   236             forall (is_eqT o fastype_of) in_ts' andalso
   236             forall (is_eqT o fastype_of) in_ts' andalso
   237             term_vs t subset vs andalso
   237             term_vs t subset vs andalso
   254             (filter_out (equal x) ps));
   254             (filter_out (equal x) ps));
   255     val (in_ts, in_ts') = List.partition (is_constrt thy) (fst (get_args is 1 ts));
   255     val (in_ts, in_ts') = List.partition (is_constrt thy) (fst (get_args is 1 ts));
   256     val in_vs = terms_vs in_ts;
   256     val in_vs = terms_vs in_ts;
   257     val concl_vs = terms_vs ts
   257     val concl_vs = terms_vs ts
   258   in
   258   in
   259     forall is_eqT (map snd (duplicates (List.concat (map term_vTs in_ts)))) andalso
   259     forall is_eqT (map snd (gen_duplicates (op =) (List.concat (map term_vTs in_ts)))) andalso
   260     forall (is_eqT o fastype_of) in_ts' andalso
   260     forall (is_eqT o fastype_of) in_ts' andalso
   261     (case check_mode_prems (arg_vs union in_vs) ps of
   261     (case check_mode_prems (arg_vs union in_vs) ps of
   262        NONE => false
   262        NONE => false
   263      | SOME vs => concl_vs subset vs)
   263      | SOME vs => concl_vs subset vs)
   264   end;
   264   end;