More liberal consistency check for defines elements.
authorballarin
Tue, 23 Dec 2008 14:29:27 +0100
changeset 29250 96b1b4d5157d
parent 29249 4dc278c8dc59
child 29251 8f84a608883d
More liberal consistency check for defines elements.
src/Pure/Isar/expression.ML
--- a/src/Pure/Isar/expression.ML	Fri Dec 19 16:39:23 2008 +0100
+++ b/src/Pure/Isar/expression.ML	Tue Dec 23 14:29:27 2008 +0100
@@ -486,11 +486,11 @@
     val b' = norm_term env b;
     fun err msg = error (msg ^ ": " ^ quote y);
   in
-    exists (fn (x, _) => x = y) xs andalso
-      err "Attempt to define previously specified variable";
-    exists (fn (Free (y', _), _) => y = y' | _ => false) env andalso
-      err "Attempt to redefine variable";
-    (Term.add_frees b' xs, (Free (y, T), b') :: env, eq :: eqs)
+    case filter (fn (Free (y', _), _) => y = y' | _ => false) env of
+      [] => (Term.add_frees b' xs, (Free (y, T), b') :: env, eq :: eqs) |
+      dups => if forall (fn (_, b'') => b' aconv b'') dups
+        then (xs, env, eqs)
+        else err "Attempt to redefine variable"
   end;
 
 (* text has the following structure: