src/Pure/Isar/proof_context.ML
changeset 12530 c32d201d7c08
parent 12504 5b46173df7ad
child 12550 32843ad8160a
equal deleted inserted replaced
12529:d99716a53f59 12530:c32d201d7c08
   497 (*beta normal form for terms (not eta normal form), chase variables in
   497 (*beta normal form for terms (not eta normal form), chase variables in
   498   bindings environment (code taken from Pure/envir.ML)*)
   498   bindings environment (code taken from Pure/envir.ML)*)
   499 
   499 
   500 fun unifyT ctxt (T, U) =
   500 fun unifyT ctxt (T, U) =
   501   let val maxidx = Int.max (Term.maxidx_of_typ T, Term.maxidx_of_typ U)
   501   let val maxidx = Int.max (Term.maxidx_of_typ T, Term.maxidx_of_typ U)
   502   in #1 (Type.unify (Sign.tsig_of (sign_of ctxt)) maxidx Vartab.empty (T, U)) end;
   502   in #1 (Type.unify (Sign.tsig_of (sign_of ctxt)) (Vartab.empty, maxidx) (T, U)) end;
   503 
   503 
   504 fun norm_term (ctxt as Context {binds, ...}) schematic =
   504 fun norm_term (ctxt as Context {binds, ...}) schematic =
   505   let
   505   let
   506     (*raised when norm has no effect on a term, to do sharing instead of copying*)
   506     (*raised when norm has no effect on a term, to do sharing instead of copying*)
   507     exception SAME;
   507     exception SAME;
   600     | (sorts, TVar v) => Vartab.update (v, sorts)
   600     | (sorts, TVar v) => Vartab.update (v, sorts)
   601     | (sorts, _) => sorts));
   601     | (sorts, _) => sorts));
   602 
   602 
   603 val ins_used = foldl_term_types (fn t => foldl_atyps
   603 val ins_used = foldl_term_types (fn t => foldl_atyps
   604   (fn (used, TFree (x, _)) => x ins_string used
   604   (fn (used, TFree (x, _)) => x ins_string used
   605     | (used, TVar ((x, _), _)) => x ins_string used
       
   606     | (used, _) => used));
   605     | (used, _) => used));
   607 
   606 
   608 val ins_occs = foldl_term_types (fn t => foldl_atyps
   607 val ins_occs = foldl_term_types (fn t => foldl_atyps
   609   (fn (tab, TFree (x, _)) => Symtab.update_multi ((x, t), tab) | (tab, _) => tab));
   608   (fn (tab, TFree (x, _)) => Symtab.update_multi ((x, t), tab) | (tab, _) => tab));
   610 
   609