src/HOL/ex/predicate_compile.ML
changeset 32319 39a6a0800c6c
parent 32318 bca7fd849829
child 32351 96f9e6402403
equal deleted inserted replaced
32318:bca7fd849829 32319:39a6a0800c6c
  1152    
  1152    
  1153 fun compile_expr size thy ((Mode (mode, is, ms)), t) =
  1153 fun compile_expr size thy ((Mode (mode, is, ms)), t) =
  1154   case strip_comb t of
  1154   case strip_comb t of
  1155     (Const (name, T), params) =>
  1155     (Const (name, T), params) =>
  1156        let
  1156        let
  1157          val _ = Output.tracing (Syntax.string_of_term_global thy t)
       
  1158          val params' = map (compile_param size thy PredicateCompFuns.compfuns) (ms ~~ params)
  1157          val params' = map (compile_param size thy PredicateCompFuns.compfuns) (ms ~~ params)
  1159          val _ = Output.tracing "..."
       
  1160          val mk_fun_of = case size of NONE => mk_fun_of | SOME _ => mk_sizelim_fun_of
  1158          val mk_fun_of = case size of NONE => mk_fun_of | SOME _ => mk_sizelim_fun_of
  1161        in
  1159        in
  1162          list_comb (mk_fun_of PredicateCompFuns.compfuns thy (name, T) mode, params')
  1160          list_comb (mk_fun_of PredicateCompFuns.compfuns thy (name, T) mode, params')
  1163        end
  1161        end
  1164   | (Free (name, T), args) =>
  1162   | (Free (name, T), args) =>
  1868     val intrs = maps (intros_of thy) prednames
  1866     val intrs = maps (intros_of thy) prednames
  1869       |> map (Logic.unvarify o prop_of)
  1867       |> map (Logic.unvarify o prop_of)
  1870     val nparams = nparams_of thy (hd prednames)
  1868     val nparams = nparams_of thy (hd prednames)
  1871     val extra_modes = all_modes_of thy |> filter_out (fn (name, _) => member (op =) prednames name)
  1869     val extra_modes = all_modes_of thy |> filter_out (fn (name, _) => member (op =) prednames name)
  1872     val preds = distinct (op =) (map (dest_Const o fst o (strip_intro_concl nparams)) intrs)
  1870     val preds = distinct (op =) (map (dest_Const o fst o (strip_intro_concl nparams)) intrs)
  1873     (*val _ = Output.tracing ("extra_modes are: " ^
       
  1874       cat_lines (map (fn (name, modes) => name ^ " has modes:" ^
       
  1875       (commas (map string_of_mode modes))) extra_modes)) *)
       
  1876     val _ $ u = Logic.strip_imp_concl (hd intrs);
  1871     val _ $ u = Logic.strip_imp_concl (hd intrs);
  1877     val params = List.take (snd (strip_comb u), nparams);
  1872     val params = List.take (snd (strip_comb u), nparams);
  1878     val param_vs = maps term_vs params
  1873     val param_vs = maps term_vs params
  1879     val all_vs = terms_vs intrs
  1874     val all_vs = terms_vs intrs
  1880     fun dest_prem t =
  1875     fun dest_prem t =