proper treatment of variable names;
authorwenzelm
Mon, 02 Dec 2019 15:30:17 +0100
changeset 71215 37eb175895c5
parent 71214 5727bcc3c47c
child 71216 e64c249d3d98
proper treatment of variable names;
src/Pure/Thy/export_theory.ML
--- a/src/Pure/Thy/export_theory.ML	Mon Dec 02 15:04:38 2019 +0100
+++ b/src/Pure/Thy/export_theory.ML	Mon Dec 02 15:30:17 2019 +0100
@@ -122,19 +122,20 @@
 
 (* spec rules *)
 
-fun spec_rule_content {pos, name, rough_classification, terms = terms0, rules = rules0} =
+fun spec_rule_content {pos, name, rough_classification, terms, rules} =
   let
-    val terms = map Logic.unvarify_global terms0;
-    val rules = map (Logic.unvarify_global o Thm.plain_prop_of) rules0;
-    val text = terms @ rules;
+    val spec =
+      terms @ map Thm.plain_prop_of rules
+      |> Term_Subst.zero_var_indexes_list
+      |> map Logic.unvarify_global;
   in
    {props = Position.properties_of pos,
     name = name,
     rough_classification = rough_classification,
-    typargs = rev (fold Term.add_tfrees text []),
-    args = rev (fold Term.add_frees text []),
-    terms = map (fn t => (t, Term.type_of t)) terms,
-    rules = rules}
+    typargs = rev (fold Term.add_tfrees spec []),
+    args = rev (fold Term.add_frees spec []),
+    terms = map (fn t => (t, Term.type_of t)) (take (length terms) spec),
+    rules = drop (length terms) spec}
   end;