# HG changeset patch # User wenzelm # Date 1152035394 -7200 # Node ID aac2c0d297518adc48f549a1b7735a7e3ea42fad # Parent 09ac655904a9b157d4bfb94f91ea4e705b2cf7bc polymorphic: always generalize wrt. used_types; diff -r 09ac655904a9 -r aac2c0d29751 src/Pure/variable.ML --- a/src/Pure/variable.ML Tue Jul 04 19:49:53 2006 +0200 +++ b/src/Pure/variable.ML Tue Jul 04 19:49:54 2006 +0200 @@ -271,9 +271,8 @@ fun gen_export inst inner outer ths = let val ths' = map Thm.adjust_maxidx_thm ths; - val maxidx = fold Thm.maxidx_thm ths' ~1; val inner' = fold (declare_occs o Thm.full_prop_of) ths' inner; - in map (Thm.generalize (inst inner' outer) (maxidx + 1)) ths' end; + in map (Thm.generalize (inst inner' outer) (fold Thm.maxidx_thm ths' ~1 + 1)) ths' end; val exportT = gen_export (rpair [] oo exportT_inst); val export = gen_export export_inst; @@ -368,7 +367,12 @@ #1 (importT_terms ts (fold declare_term ts ctxt)); fun polymorphic ctxt ts = - exportT_terms (fold declare_term ts ctxt) ctxt ts; + let + val ctxt' = fold declare_term ts ctxt; + val types = subtract (op =) (used_types ctxt) (used_types ctxt'); + val idx = fold (Term.fold_types Term.maxidx_typ) ts ~1 + 1; + in map (Term.generalize (types, []) idx) ts end; + (** term bindings **)