src/Pure/codegen.ML
changeset 43324 2b47822868e4
parent 42427 5611f178a747
child 43955 efc6f0a81c36
equal deleted inserted replaced
43323:28e71a685c84 43324:2b47822868e4
   271   let val {preprocs, ...} = CodegenData.get thy
   271   let val {preprocs, ...} = CodegenData.get thy
   272   in fold (fn (_, f) => f thy) preprocs end;
   272   in fold (fn (_, f) => f thy) preprocs end;
   273 
   273 
   274 fun preprocess_term thy t =
   274 fun preprocess_term thy t =
   275   let
   275   let
   276     val x = Free (Name.variant (OldTerm.add_term_names (t, [])) "x", fastype_of t);
   276     val x = Free (singleton (Name.variant_list (OldTerm.add_term_names (t, []))) "x", fastype_of t);
   277     (* fake definition *)
   277     (* fake definition *)
   278     val eq = Skip_Proof.make_thm thy (Logic.mk_equals (x, t));
   278     val eq = Skip_Proof.make_thm thy (Logic.mk_equals (x, t));
   279     fun err () = error "preprocess_term: bad preprocessor"
   279     fun err () = error "preprocess_term: bad preprocessor"
   280   in case map prop_of (preprocess thy [eq]) of
   280   in case map prop_of (preprocess thy [eq]) of
   281       [Const ("==", _) $ x' $ t'] => if x = x' then t' else err ()
   281       [Const ("==", _) $ x' $ t'] => if x = x' then t' else err ()