src/Tools/nbe.ML
changeset 39290 44e4d8dfd6bf
parent 39288 f1ae2493d93f
child 39388 fdbb2c55ffc2
equal deleted inserted replaced
39289:92b50c8bb67b 39290:44e4d8dfd6bf
   545 
   545 
   546 (* evaluation with type reconstruction *)
   546 (* evaluation with type reconstruction *)
   547 
   547 
   548 fun normalize thy program ((vs0, (vs, ty)), t) deps =
   548 fun normalize thy program ((vs0, (vs, ty)), t) deps =
   549   let
   549   let
       
   550     val ctxt = Syntax.init_pretty_global thy;
   550     val ty' = typ_of_itype program vs0 ty;
   551     val ty' = typ_of_itype program vs0 ty;
   551     fun type_infer t =
   552     fun type_infer t =
   552       singleton (Type_Infer.infer_types (Syntax.pp_global thy) (Sign.tsig_of thy) I
   553       singleton
   553         (try (Type.strip_sorts o Sign.the_const_type thy)) (K NONE) Name.context 0)
   554         (Type_Infer.infer_types ctxt (try (Type.strip_sorts o Sign.the_const_type thy)) (K NONE))
   554       (Type.constraint ty' t);
   555         (Type.constraint ty' t);
   555     val string_of_term =
   556     val string_of_term = Syntax.string_of_term (Config.put show_types true ctxt);
   556       Syntax.string_of_term (Config.put show_types true (Syntax.init_pretty_global thy));
       
   557     fun check_tvars t =
   557     fun check_tvars t =
   558       if null (Term.add_tvars t []) then t
   558       if null (Term.add_tvars t []) then t
   559       else error ("Illegal schematic type variables in normalized term: " ^ string_of_term t);
   559       else error ("Illegal schematic type variables in normalized term: " ^ string_of_term t);
   560   in
   560   in
   561     compile_eval thy program (vs, t) deps
   561     compile_eval thy program (vs, t) deps