src/HOL/Import/import_rule.ML
changeset 74282 c2ee8d993d6a
parent 70303 502749883f53
child 75612 03ae0ba2aa9e
equal deleted inserted replaced
74281:7829d6435c60 74282:c2ee8d993d6a
   160 fun freezeT thy thm =
   160 fun freezeT thy thm =
   161   let
   161   let
   162     val tvars = Term.add_tvars (Thm.prop_of thm) []
   162     val tvars = Term.add_tvars (Thm.prop_of thm) []
   163     val tfrees = map (fn ((t, _), s) => TFree (t, s)) tvars
   163     val tfrees = map (fn ((t, _), s) => TFree (t, s)) tvars
   164   in
   164   in
   165     Thm.instantiate ((tvars ~~ map (Thm.global_ctyp_of thy) tfrees), []) thm
   165     Thm.instantiate (TVars.make (tvars ~~ map (Thm.global_ctyp_of thy) tfrees), Vars.empty) thm
   166   end
   166   end
   167 
   167 
   168 fun def' constname rhs thy =
   168 fun def' constname rhs thy =
   169   let
   169   let
   170     val rhs = Thm.term_of rhs
   170     val rhs = Thm.term_of rhs
   272         (case try (assoc (TFree bef)) lambda of
   272         (case try (assoc (TFree bef)) lambda of
   273           SOME cty => (iS, cty)
   273           SOME cty => (iS, cty)
   274         | NONE => (iS, Thm.global_ctyp_of thy (TFree bef))))
   274         | NONE => (iS, Thm.global_ctyp_of thy (TFree bef))))
   275       tys_before tys_after
   275       tys_before tys_after
   276   in
   276   in
   277     Thm.instantiate (tyinst,[]) th1
   277     Thm.instantiate (TVars.make tyinst, Vars.empty) th1
   278   end
   278   end
   279 
   279 
   280 fun inst sigma th =
   280 fun inst sigma th =
   281   let
   281   let
   282     val (dom, rng) = ListPair.unzip (rev sigma)
   282     val (dom, rng) = ListPair.unzip (rev sigma)
   336     val thm = Drule.export_without_context_open thm
   336     val thm = Drule.export_without_context_open thm
   337     val tvs = Term.add_tvars (Thm.prop_of thm) []
   337     val tvs = Term.add_tvars (Thm.prop_of thm) []
   338     val tns = map (fn (_, _) => "'") tvs
   338     val tns = map (fn (_, _) => "'") tvs
   339     val nms = fst (fold_map Name.variant tns (Variable.names_of ctxt))
   339     val nms = fst (fold_map Name.variant tns (Variable.names_of ctxt))
   340     val vs = map TVar ((nms ~~ (map (snd o fst) tvs)) ~~ (map snd tvs))
   340     val vs = map TVar ((nms ~~ (map (snd o fst) tvs)) ~~ (map snd tvs))
   341     val thm' = Thm.instantiate ((tvs ~~ map (Thm.ctyp_of ctxt) vs), []) thm
   341     val thm' = Thm.instantiate (TVars.make (tvs ~~ map (Thm.ctyp_of ctxt) vs), Vars.empty) thm
   342   in
   342   in
   343     snd (Global_Theory.add_thm ((binding, thm'), []) thy)
   343     snd (Global_Theory.add_thm ((binding, thm'), []) thy)
   344   end
   344   end
   345 
   345 
   346 fun log_timestamp () =
   346 fun log_timestamp () =