
diff -r 69c9fc1d11f2 -r 07f75bf77a33 src/HOL/Library/Multiset.thy
--- a/src/HOL/Library/Multiset.thy	Thu Dec 21 10:11:10 2000 +0100
+++ b/src/HOL/Library/Multiset.thy	Thu Dec 21 10:16:07 2000 +0100
@@ -16,7 +16,7 @@
 
 typedef 'a multiset = "{f::'a => nat. finite {x . 0 < f x}}"
 proof
-  show "(\<lambda>x. 0::nat) \<in> ?multiset" by simp
+  show "(\\<lambda>x. 0::nat) \\<in> ?multiset" by simp
 qed
 
 lemmas multiset_typedef [simp] =
@@ -25,23 +25,23 @@
 
 constdefs
   Mempty :: "'a multiset"    ("{#}")
-  "{#} == Abs_multiset (\<lambda>a. 0)"
+  "{#} == Abs_multiset (\\<lambda>a. 0)"
 
   single :: "'a => 'a multiset"    ("{#_#}")
-  "{#a#} == Abs_multiset (\<lambda>b. if b = a then 1 else 0)"
+  "{#a#} == Abs_multiset (\\<lambda>b. if b = a then 1 else 0)"
 
   count :: "'a multiset => 'a => nat"
   "count == Rep_multiset"
 
   MCollect :: "'a multiset => ('a => bool) => 'a multiset"
-  "MCollect M P == Abs_multiset (\<lambda>x. if P x then Rep_multiset M x else 0)"
+  "MCollect M P == Abs_multiset (\\<lambda>x. if P x then Rep_multiset M x else 0)"
 
 syntax
   "_Melem" :: "'a => 'a multiset => bool"    ("(_/ :# _)" [50, 51] 50)
   "_MCollect" :: "pttrn => 'a multiset => bool => 'a multiset"    ("(1{# _ : _./ _#})")
 translations
   "a :# M" == "0 < count M a"
-  "{#x:M. P#}" == "MCollect M (\<lambda>x. P)"
+  "{#x:M. P#}" == "MCollect M (\\<lambda>x. P)"
 
 constdefs
   set_of :: "'a multiset => 'a set"
@@ -52,8 +52,8 @@
 instance multiset :: ("term") zero ..
 
 defs (overloaded)
-  union_def: "M + N == Abs_multiset (\<lambda>a. Rep_multiset M a + Rep_multiset N a)"
-  diff_def: "M - N == Abs_multiset (\<lambda>a. Rep_multiset M a - Rep_multiset N a)"
+  union_def: "M + N == Abs_multiset (\\<lambda>a. Rep_multiset M a + Rep_multiset N a)"
+  diff_def: "M - N == Abs_multiset (\\<lambda>a. Rep_multiset M a - Rep_multiset N a)"
   Zero_def [simp]: "0 == {#}"
   size_def: "size M == setsum (count M) (set_of M)"
 
@@ -62,16 +62,16 @@
  \medskip Preservation of the representing set @{term multiset}.
 *}
 
-lemma const0_in_multiset [simp]: "(\<lambda>a. 0) \<in> multiset"
+lemma const0_in_multiset [simp]: "(\\<lambda>a. 0) \\<in> multiset"
   apply (simp add: multiset_def)
   done
 
-lemma only1_in_multiset [simp]: "(\<lambda>b. if b = a then 1 else 0) \<in> multiset"
+lemma only1_in_multiset [simp]: "(\\<lambda>b. if b = a then 1 else 0) \\<in> multiset"
   apply (simp add: multiset_def)
   done
 
 lemma union_preserves_multiset [simp]:
-    "M \<in> multiset ==> N \<in> multiset ==> (\<lambda>a. M a + N a) \<in> multiset"
+    "M \\<in> multiset ==> N \\<in> multiset ==> (\\<lambda>a. M a + N a) \\<in> multiset"
   apply (unfold multiset_def)
   apply simp
   apply (drule finite_UnI)
@@ -80,7 +80,7 @@
   done
 
 lemma diff_preserves_multiset [simp]:
-    "M \<in> multiset ==> (\<lambda>a. M a - N a) \<in> multiset"
+    "M \\<in> multiset ==> (\\<lambda>a. M a - N a) \\<in> multiset"
   apply (unfold multiset_def)
   apply simp
   apply (rule finite_subset)
@@ -94,7 +94,7 @@
 
 subsubsection {* Union *}
 
-theorem union_empty [simp]: "M + {#} = M \<and> {#} + M = M"
+theorem union_empty [simp]: "M + {#} = M \\<and> {#} + M = M"
   apply (simp add: union_def Mempty_def)
   done
 
@@ -124,7 +124,7 @@
 
 subsubsection {* Difference *}
 
-theorem diff_empty [simp]: "M - {#} = M \<and> {#} - M = {#}"
+theorem diff_empty [simp]: "M - {#} = M \\<and> {#} - M = {#}"
   apply (simp add: Mempty_def diff_def)
   done
 
@@ -162,7 +162,7 @@
   apply (simp add: set_of_def)
   done
 
-theorem set_of_union [simp]: "set_of (M + N) = set_of M \<union> set_of N"
+theorem set_of_union [simp]: "set_of (M + N) = set_of M \\<union> set_of N"
   apply (auto simp add: set_of_def)
   done
 
@@ -170,7 +170,7 @@
   apply (auto simp add: set_of_def Mempty_def count_def expand_fun_eq)
   done
 
-theorem mem_set_of_iff [simp]: "(x \<in> set_of M) = (x :# M)"
+theorem mem_set_of_iff [simp]: "(x \\<in> set_of M) = (x :# M)"
   apply (auto simp add: set_of_def)
   done
 
@@ -191,7 +191,7 @@
   done
 
 theorem setsum_count_Int:
-    "finite A ==> setsum (count N) (A \<inter> set_of N) = setsum (count N) A"
+    "finite A ==> setsum (count N) (A \\<inter> set_of N) = setsum (count N) A"
   apply (erule finite_induct)
    apply simp
   apply (simp add: Int_insert_left set_of_def)
@@ -199,7 +199,7 @@
 
 theorem size_union [simp]: "size (M + N::'a multiset) = size M + size N"
   apply (unfold size_def)
-  apply (subgoal_tac "count (M + N) = (\<lambda>a. count M a + count N a)")
+  apply (subgoal_tac "count (M + N) = (\\<lambda>a. count M a + count N a)")
    prefer 2
    apply (rule ext)
    apply simp
@@ -214,7 +214,7 @@
   apply (simp add: set_of_def count_def expand_fun_eq)
   done
 
-theorem size_eq_Suc_imp_elem: "size M = Suc n ==> \<exists>a. a :# M"
+theorem size_eq_Suc_imp_elem: "size M = Suc n ==> \\<exists>a. a :# M"
   apply (unfold size_def)
   apply (drule setsum_SucD)
   apply auto
@@ -223,11 +223,11 @@
 
 subsubsection {* Equality of multisets *}
 
-theorem multiset_eq_conv_count_eq: "(M = N) = (\<forall>a. count M a = count N a)"
+theorem multiset_eq_conv_count_eq: "(M = N) = (\\<forall>a. count M a = count N a)"
   apply (simp add: count_def expand_fun_eq)
   done
 
-theorem single_not_empty [simp]: "{#a#} \<noteq> {#} \<and> {#} \<noteq> {#a#}"
+theorem single_not_empty [simp]: "{#a#} \\<noteq> {#} \\<and> {#} \\<noteq> {#a#}"
   apply (simp add: single_def Mempty_def expand_fun_eq)
   done
 
@@ -235,11 +235,11 @@
   apply (auto simp add: single_def expand_fun_eq)
   done
 
-theorem union_eq_empty [iff]: "(M + N = {#}) = (M = {#} \<and> N = {#})"
+theorem union_eq_empty [iff]: "(M + N = {#}) = (M = {#} \\<and> N = {#})"
   apply (auto simp add: union_def Mempty_def expand_fun_eq)
   done
 
-theorem empty_eq_union [iff]: "({#} = M + N) = (M = {#} \<and> N = {#})"
+theorem empty_eq_union [iff]: "({#} = M + N) = (M = {#} \\<and> N = {#})"
   apply (auto simp add: union_def Mempty_def expand_fun_eq)
   done
 
@@ -252,7 +252,7 @@
   done
 
 theorem union_is_single:
-    "(M + N = {#a#}) = (M = {#a#} \<and> N={#} \<or> M = {#} \<and> N = {#a#})"
+    "(M + N = {#a#}) = (M = {#a#} \\<and> N={#} \\<or> M = {#} \\<and> N = {#a#})"
   apply (unfold Mempty_def single_def union_def)
   apply (simp add: add_is_1 expand_fun_eq)
   apply blast
@@ -260,16 +260,16 @@
 
 theorem single_is_union:
   "({#a#} = M + N) =
-    ({#a#} = M \<and> N = {#} \<or> M = {#} \<and> {#a#} = N)"
+    ({#a#} = M \\<and> N = {#} \\<or> M = {#} \\<and> {#a#} = N)"
   apply (unfold Mempty_def single_def union_def)
-  apply (simp add: one_is_add expand_fun_eq)
+  apply (simp add: add_is_1 expand_fun_eq)
   apply (blast dest: sym)
   done
 
 theorem add_eq_conv_diff:
   "(M + {#a#} = N + {#b#}) =
-    (M = N \<and> a = b \<or>
-      M = N - {#a#} + {#b#} \<and> N = M - {#b#} + {#a#})"
+    (M = N \\<and> a = b \\<or>
+      M = N - {#a#} + {#b#} \\<and> N = M - {#b#} + {#a#})"
   apply (unfold single_def union_def diff_def)
   apply (simp (no_asm) add: expand_fun_eq)
   apply (rule conjI)
@@ -291,7 +291,7 @@
 (*
 val prems = Goal
  "[| !!F. [| finite F; !G. G < F --> P G |] ==> P F |] ==> finite F --> P F";
-by (res_inst_tac [("a","F"),("f","\<lambda>A. if finite A then card A else 0")]
+by (res_inst_tac [("a","F"),("f","\\<lambda>A. if finite A then card A else 0")]
      measure_induct 1);
 by (Clarify_tac 1);
 by (resolve_tac prems 1);
@@ -320,7 +320,7 @@
 
 lemma setsum_decr:
   "finite F ==> 0 < f a ==>
-    setsum (f (a := f a - 1)) F = (if a \<in> F then setsum f F - 1 else setsum f F)"
+    setsum (f (a := f a - 1)) F = (if a \\<in> F then setsum f F - 1 else setsum f F)"
   apply (erule finite_induct)
    apply auto
   apply (drule_tac a = a in mk_disjoint_insert)
@@ -328,8 +328,8 @@
   done
 
 lemma rep_multiset_induct_aux:
-  "P (\<lambda>a. 0) ==> (!!f b. f \<in> multiset ==> P f ==> P (f (b := f b + 1)))
-    ==> \<forall>f. f \<in> multiset --> setsum f {x. 0 < f x} = n --> P f"
+  "P (\\<lambda>a. 0) ==> (!!f b. f \\<in> multiset ==> P f ==> P (f (b := f b + 1)))
+    ==> \\<forall>f. f \\<in> multiset --> setsum f {x. 0 < f x} = n --> P f"
 proof -
   case antecedent
   note prems = this [unfolded multiset_def]
@@ -338,7 +338,7 @@
     apply (induct_tac n)
      apply simp
      apply clarify
-     apply (subgoal_tac "f = (\<lambda>a.0)")
+     apply (subgoal_tac "f = (\\<lambda>a.0)")
       apply simp
       apply (rule prems)
      apply (rule ext)
@@ -363,10 +363,10 @@
     apply (erule allE, erule impE, erule_tac [2] mp)
      apply blast
     apply (simp (no_asm_simp) add: setsum_decr del: fun_upd_apply)
-    apply (subgoal_tac "{x. x \<noteq> a --> 0 < f x} = {x. 0 < f x}")
+    apply (subgoal_tac "{x. x \\<noteq> a --> 0 < f x} = {x. 0 < f x}")
      prefer 2
      apply blast
-    apply (subgoal_tac "{x. x \<noteq> a \<and> 0 < f x} = {x. 0 < f x} - {a}")
+    apply (subgoal_tac "{x. x \\<noteq> a \\<and> 0 < f x} = {x. 0 < f x} - {a}")
      prefer 2
      apply blast
     apply (simp add: le_imp_diff_is_add setsum_diff1 cong: conj_cong)
@@ -374,8 +374,8 @@
 qed
 
 theorem rep_multiset_induct:
-  "f \<in> multiset ==> P (\<lambda>a. 0) ==>
-    (!!f b. f \<in> multiset ==> P f ==> P (f (b := f b + 1))) ==> P f"
+  "f \\<in> multiset ==> P (\\<lambda>a. 0) ==>
+    (!!f b. f \\<in> multiset ==> P f ==> P (f (b := f b + 1))) ==> P f"
   apply (insert rep_multiset_induct_aux)
   apply blast
   done
@@ -390,7 +390,7 @@
     apply (rule Rep_multiset_inverse [THEN subst])
     apply (rule Rep_multiset [THEN rep_multiset_induct])
      apply (rule prem1)
-    apply (subgoal_tac "f (b := f b + 1) = (\<lambda>a. f a + (if a = b then 1 else 0))")
+    apply (subgoal_tac "f (b := f b + 1) = (\\<lambda>a. f a + (if a = b then 1 else 0))")
      prefer 2
      apply (simp add: expand_fun_eq)
     apply (erule ssubst)
@@ -401,7 +401,7 @@
 
 
 lemma MCollect_preserves_multiset:
-    "M \<in> multiset ==> (\<lambda>x. if P x then M x else 0) \<in> multiset"
+    "M \\<in> multiset ==> (\\<lambda>x. if P x then M x else 0) \\<in> multiset"
   apply (simp add: multiset_def)
   apply (rule finite_subset)
    apply auto
@@ -413,11 +413,11 @@
   apply (simp add: MCollect_preserves_multiset)
   done
 
-theorem set_of_MCollect [simp]: "set_of {# x:M. P x #} = set_of M \<inter> {x. P x}"
+theorem set_of_MCollect [simp]: "set_of {# x:M. P x #} = set_of M \\<inter> {x. P x}"
   apply (auto simp add: set_of_def)
   done
 
-theorem multiset_partition: "M = {# x:M. P x #} + {# x:M. \<not> P x #}"
+theorem multiset_partition: "M = {# x:M. P x #} + {# x:M. \\<not> P x #}"
   apply (subst multiset_eq_conv_count_eq)
   apply auto
   done
@@ -427,7 +427,7 @@
 
 theorem add_eq_conv_ex:
   "(M + {#a#} = N + {#b#}) =
-    (M = N \<and> a = b \<or> (\<exists>K. M = K + {#b#} \<and> N = K + {#a#}))"
+    (M = N \\<and> a = b \\<or> (\\<exists>K. M = K + {#b#} \\<and> N = K + {#a#}))"
   apply (auto simp add: add_eq_conv_diff)
   done
 
@@ -437,41 +437,41 @@
 subsubsection {* Well-foundedness *}
 
 constdefs
-  mult1 :: "('a \<times> 'a) set => ('a multiset \<times> 'a multiset) set"
+  mult1 :: "('a \\<times> 'a) set => ('a multiset \\<times> 'a multiset) set"
   "mult1 r ==
-    {(N, M). \<exists>a M0 K. M = M0 + {#a#} \<and> N = M0 + K \<and>
-      (\<forall>b. b :# K --> (b, a) \<in> r)}"
+    {(N, M). \\<exists>a M0 K. M = M0 + {#a#} \\<and> N = M0 + K \\<and>
+      (\\<forall>b. b :# K --> (b, a) \\<in> r)}"
 
-  mult :: "('a \<times> 'a) set => ('a multiset \<times> 'a multiset) set"
+  mult :: "('a \\<times> 'a) set => ('a multiset \\<times> 'a multiset) set"
   "mult r == (mult1 r)\<^sup>+"
 
-lemma not_less_empty [iff]: "(M, {#}) \<notin> mult1 r"
+lemma not_less_empty [iff]: "(M, {#}) \\<notin> mult1 r"
   by (simp add: mult1_def)
 
-lemma less_add: "(N, M0 + {#a#}) \<in> mult1 r ==>
-    (\<exists>M. (M, M0) \<in> mult1 r \<and> N = M + {#a#}) \<or>
-    (\<exists>K. (\<forall>b. b :# K --> (b, a) \<in> r) \<and> N = M0 + K)"
-  (concl is "?case1 (mult1 r) \<or> ?case2")
+lemma less_add: "(N, M0 + {#a#}) \\<in> mult1 r ==>
+    (\\<exists>M. (M, M0) \\<in> mult1 r \\<and> N = M + {#a#}) \\<or>
+    (\\<exists>K. (\\<forall>b. b :# K --> (b, a) \\<in> r) \\<and> N = M0 + K)"
+  (concl is "?case1 (mult1 r) \\<or> ?case2")
 proof (unfold mult1_def)
-  let ?r = "\<lambda>K a. \<forall>b. b :# K --> (b, a) \<in> r"
-  let ?R = "\<lambda>N M. \<exists>a M0 K. M = M0 + {#a#} \<and> N = M0 + K \<and> ?r K a"
+  let ?r = "\\<lambda>K a. \\<forall>b. b :# K --> (b, a) \\<in> r"
+  let ?R = "\\<lambda>N M. \\<exists>a M0 K. M = M0 + {#a#} \\<and> N = M0 + K \\<and> ?r K a"
   let ?case1 = "?case1 {(N, M). ?R N M}"
 
-  assume "(N, M0 + {#a#}) \<in> {(N, M). ?R N M}"
-  hence "\<exists>a' M0' K.
-      M0 + {#a#} = M0' + {#a'#} \<and> N = M0' + K \<and> ?r K a'" by simp
-  thus "?case1 \<or> ?case2"
+  assume "(N, M0 + {#a#}) \\<in> {(N, M). ?R N M}"
+  hence "\\<exists>a' M0' K.
+      M0 + {#a#} = M0' + {#a'#} \\<and> N = M0' + K \\<and> ?r K a'" by simp
+  thus "?case1 \\<or> ?case2"
   proof (elim exE conjE)
     fix a' M0' K
     assume N: "N = M0' + K" and r: "?r K a'"
     assume "M0 + {#a#} = M0' + {#a'#}"
-    hence "M0 = M0' \<and> a = a' \<or>
-        (\<exists>K'. M0 = K' + {#a'#} \<and> M0' = K' + {#a#})"
+    hence "M0 = M0' \\<and> a = a' \\<or>
+        (\\<exists>K'. M0 = K' + {#a'#} \\<and> M0' = K' + {#a#})"
       by (simp only: add_eq_conv_ex)
     thus ?thesis
     proof (elim disjE conjE exE)
       assume "M0 = M0'" "a = a'"
-      with N r have "?r K a \<and> N = M0 + K" by simp
+      with N r have "?r K a \\<and> N = M0 + K" by simp
       hence ?case2 .. thus ?thesis ..
     next
       fix K'
@@ -485,78 +485,78 @@
   qed
 qed
 
-lemma all_accessible: "wf r ==> \<forall>M. M \<in> acc (mult1 r)"
+lemma all_accessible: "wf r ==> \\<forall>M. M \\<in> acc (mult1 r)"
 proof
   let ?R = "mult1 r"
   let ?W = "acc ?R"
   {
     fix M M0 a
-    assume M0: "M0 \<in> ?W"
-      and wf_hyp: "\<forall>b. (b, a) \<in> r --> (\<forall>M \<in> ?W. M + {#b#} \<in> ?W)"
-      and acc_hyp: "\<forall>M. (M, M0) \<in> ?R --> M + {#a#} \<in> ?W"
-    have "M0 + {#a#} \<in> ?W"
+    assume M0: "M0 \\<in> ?W"
+      and wf_hyp: "\\<forall>b. (b, a) \\<in> r --> (\\<forall>M \\<in> ?W. M + {#b#} \\<in> ?W)"
+      and acc_hyp: "\\<forall>M. (M, M0) \\<in> ?R --> M + {#a#} \\<in> ?W"
+    have "M0 + {#a#} \\<in> ?W"
     proof (rule accI [of "M0 + {#a#}"])
       fix N
-      assume "(N, M0 + {#a#}) \<in> ?R"
-      hence "((\<exists>M. (M, M0) \<in> ?R \<and> N = M + {#a#}) \<or>
-          (\<exists>K. (\<forall>b. b :# K --> (b, a) \<in> r) \<and> N = M0 + K))"
+      assume "(N, M0 + {#a#}) \\<in> ?R"
+      hence "((\\<exists>M. (M, M0) \\<in> ?R \\<and> N = M + {#a#}) \\<or>
+          (\\<exists>K. (\\<forall>b. b :# K --> (b, a) \\<in> r) \\<and> N = M0 + K))"
         by (rule less_add)
-      thus "N \<in> ?W"
+      thus "N \\<in> ?W"
       proof (elim exE disjE conjE)
-        fix M assume "(M, M0) \<in> ?R" and N: "N = M + {#a#}"
-        from acc_hyp have "(M, M0) \<in> ?R --> M + {#a#} \<in> ?W" ..
-        hence "M + {#a#} \<in> ?W" ..
-        thus "N \<in> ?W" by (simp only: N)
+        fix M assume "(M, M0) \\<in> ?R" and N: "N = M + {#a#}"
+        from acc_hyp have "(M, M0) \\<in> ?R --> M + {#a#} \\<in> ?W" ..
+        hence "M + {#a#} \\<in> ?W" ..
+        thus "N \\<in> ?W" by (simp only: N)
       next
         fix K
         assume N: "N = M0 + K"
-        assume "\<forall>b. b :# K --> (b, a) \<in> r"
-        have "?this --> M0 + K \<in> ?W" (is "?P K")
+        assume "\\<forall>b. b :# K --> (b, a) \\<in> r"
+        have "?this --> M0 + K \\<in> ?W" (is "?P K")
         proof (induct K)
-          from M0 have "M0 + {#} \<in> ?W" by simp
+          from M0 have "M0 + {#} \\<in> ?W" by simp
           thus "?P {#}" ..
 
           fix K x assume hyp: "?P K"
           show "?P (K + {#x#})"
           proof
-            assume a: "\<forall>b. b :# (K + {#x#}) --> (b, a) \<in> r"
-            hence "(x, a) \<in> r" by simp
-            with wf_hyp have b: "\<forall>M \<in> ?W. M + {#x#} \<in> ?W" by blast
+            assume a: "\\<forall>b. b :# (K + {#x#}) --> (b, a) \\<in> r"
+            hence "(x, a) \\<in> r" by simp
+            with wf_hyp have b: "\\<forall>M \\<in> ?W. M + {#x#} \\<in> ?W" by blast
 
-            from a hyp have "M0 + K \<in> ?W" by simp
-            with b have "(M0 + K) + {#x#} \<in> ?W" ..
-            thus "M0 + (K + {#x#}) \<in> ?W" by (simp only: union_assoc)
+            from a hyp have "M0 + K \\<in> ?W" by simp
+            with b have "(M0 + K) + {#x#} \\<in> ?W" ..
+            thus "M0 + (K + {#x#}) \\<in> ?W" by (simp only: union_assoc)
           qed
         qed
-        hence "M0 + K \<in> ?W" ..
-        thus "N \<in> ?W" by (simp only: N)
+        hence "M0 + K \\<in> ?W" ..
+        thus "N \\<in> ?W" by (simp only: N)
       qed
     qed
   } note tedious_reasoning = this
 
   assume wf: "wf r"
   fix M
-  show "M \<in> ?W"
+  show "M \\<in> ?W"
   proof (induct M)
-    show "{#} \<in> ?W"
+    show "{#} \\<in> ?W"
     proof (rule accI)
-      fix b assume "(b, {#}) \<in> ?R"
-      with not_less_empty show "b \<in> ?W" by contradiction
+      fix b assume "(b, {#}) \\<in> ?R"
+      with not_less_empty show "b \\<in> ?W" by contradiction
     qed
 
-    fix M a assume "M \<in> ?W"
-    from wf have "\<forall>M \<in> ?W. M + {#a#} \<in> ?W"
+    fix M a assume "M \\<in> ?W"
+    from wf have "\\<forall>M \\<in> ?W. M + {#a#} \\<in> ?W"
     proof induct
       fix a
-      assume "\<forall>b. (b, a) \<in> r --> (\<forall>M \<in> ?W. M + {#b#} \<in> ?W)"
-      show "\<forall>M \<in> ?W. M + {#a#} \<in> ?W"
+      assume "\\<forall>b. (b, a) \\<in> r --> (\\<forall>M \\<in> ?W. M + {#b#} \\<in> ?W)"
+      show "\\<forall>M \\<in> ?W. M + {#a#} \\<in> ?W"
       proof
-        fix M assume "M \<in> ?W"
-        thus "M + {#a#} \<in> ?W"
+        fix M assume "M \\<in> ?W"
+        thus "M + {#a#} \\<in> ?W"
           by (rule acc_induct) (rule tedious_reasoning)
       qed
     qed
-    thus "M + {#a#} \<in> ?W" ..
+    thus "M + {#a#} \\<in> ?W" ..
   qed
 qed
 
@@ -578,9 +578,9 @@
 text {* One direction. *}
 
 lemma mult_implies_one_step:
-  "trans r ==> (M, N) \<in> mult r ==>
-    \<exists>I J K. N = I + J \<and> M = I + K \<and> J \<noteq> {#} \<and>
-    (\<forall>k \<in> set_of K. \<exists>j \<in> set_of J. (k, j) \<in> r)"
+  "trans r ==> (M, N) \\<in> mult r ==>
+    \\<exists>I J K. N = I + J \\<and> M = I + K \\<and> J \\<noteq> {#} \\<and>
+    (\\<forall>k \\<in> set_of K. \\<exists>j \\<in> set_of J. (k, j) \\<in> r)"
   apply (unfold mult_def mult1_def set_of_def)
   apply (erule converse_trancl_induct)
   apply clarify
@@ -592,7 +592,7 @@
    apply (simp (no_asm))
    apply (rule_tac x = "(K - {#a#}) + Ka" in exI)
    apply (simp (no_asm_simp) add: union_assoc [symmetric])
-   apply (drule_tac f = "\<lambda>M. M - {#a#}" in arg_cong)
+   apply (drule_tac f = "\\<lambda>M. M - {#a#}" in arg_cong)
    apply (simp add: diff_union_single_conv)
    apply (simp (no_asm_use) add: trans_def)
    apply blast
@@ -603,7 +603,7 @@
    apply (rule conjI)
     apply (simp add: multiset_eq_conv_count_eq split: nat_diff_split)
    apply (rule conjI)
-    apply (drule_tac f = "\<lambda>M. M - {#a#}" in arg_cong)
+    apply (drule_tac f = "\\<lambda>M. M - {#a#}" in arg_cong)
     apply simp
     apply (simp add: multiset_eq_conv_count_eq split: nat_diff_split)
    apply (simp (no_asm_use) add: trans_def)
@@ -617,7 +617,7 @@
   apply (simp add: multiset_eq_conv_count_eq)
   done
 
-lemma size_eq_Suc_imp_eq_union: "size M = Suc n ==> \<exists>a N. M = N + {#a#}"
+lemma size_eq_Suc_imp_eq_union: "size M = Suc n ==> \\<exists>a N. M = N + {#a#}"
   apply (erule size_eq_Suc_imp_elem [THEN exE])
   apply (drule elem_imp_eq_diff_union)
   apply auto
@@ -625,8 +625,8 @@
 
 lemma one_step_implies_mult_aux:
   "trans r ==>
-    \<forall>I J K. (size J = n \<and> J \<noteq> {#} \<and> (\<forall>k \<in> set_of K. \<exists>j \<in> set_of J. (k, j) \<in> r))
-      --> (I + K, I + J) \<in> mult r"
+    \\<forall>I J K. (size J = n \\<and> J \\<noteq> {#} \\<and> (\\<forall>k \\<in> set_of K. \\<exists>j \\<in> set_of J. (k, j) \\<in> r))
+      --> (I + K, I + J) \\<in> mult r"
   apply (induct_tac n)
    apply auto
   apply (frule size_eq_Suc_imp_eq_union)
@@ -640,15 +640,15 @@
    apply (rule r_into_trancl)
    apply (simp add: mult1_def set_of_def)
    apply blast
-  txt {* Now we know @{term "J' \<noteq> {#}"}. *}
-  apply (cut_tac M = K and P = "\<lambda>x. (x, a) \<in> r" in multiset_partition)
-  apply (erule_tac P = "\<forall>k \<in> set_of K. ?P k" in rev_mp)
+  txt {* Now we know @{term "J' \\<noteq> {#}"}. *}
+  apply (cut_tac M = K and P = "\\<lambda>x. (x, a) \\<in> r" in multiset_partition)
+  apply (erule_tac P = "\\<forall>k \\<in> set_of K. ?P k" in rev_mp)
   apply (erule ssubst)
   apply (simp add: Ball_def)
   apply auto
   apply (subgoal_tac
-    "((I + {# x : K. (x, a) \<in> r #}) + {# x : K. (x, a) \<notin> r #},
-      (I + {# x : K. (x, a) \<in> r #}) + J') \<in> mult r")
+    "((I + {# x : K. (x, a) \\<in> r #}) + {# x : K. (x, a) \\<notin> r #},
+      (I + {# x : K. (x, a) \\<in> r #}) + J') \\<in> mult r")
    prefer 2
    apply force
   apply (simp (no_asm_use) add: union_assoc [symmetric] mult_def)
@@ -661,8 +661,8 @@
   done
 
 theorem one_step_implies_mult:
-  "trans r ==> J \<noteq> {#} ==> \<forall>k \<in> set_of K. \<exists>j \<in> set_of J. (k, j) \<in> r
-    ==> (I + K, I + J) \<in> mult r"
+  "trans r ==> J \\<noteq> {#} ==> \\<forall>k \\<in> set_of K. \\<exists>j \\<in> set_of J. (k, j) \\<in> r
+    ==> (I + K, I + J) \\<in> mult r"
   apply (insert one_step_implies_mult_aux)
   apply blast
   done
@@ -673,8 +673,8 @@
 instance multiset :: ("term") ord ..
 
 defs (overloaded)
-  less_multiset_def: "M' < M == (M', M) \<in> mult {(x', x). x' < x}"
-  le_multiset_def: "M' <= M == M' = M \<or> M' < (M::'a multiset)"
+  less_multiset_def: "M' < M == (M', M) \\<in> mult {(x', x). x' < x}"
+  le_multiset_def: "M' <= M == M' = M \\<or> M' < (M::'a multiset)"
 
 lemma trans_base_order: "trans {(x', x). x' < (x::'a::order)}"
   apply (unfold trans_def)
@@ -686,12 +686,12 @@
 *}
 
 lemma mult_irrefl_aux:
-    "finite A ==> (\<forall>x \<in> A. \<exists>y \<in> A. x < (y::'a::order)) --> A = {}"
+    "finite A ==> (\\<forall>x \\<in> A. \\<exists>y \\<in> A. x < (y::'a::order)) --> A = {}"
   apply (erule finite_induct)
    apply (auto intro: order_less_trans)
   done
 
-theorem mult_less_not_refl: "\<not> M < (M::'a::order multiset)"
+theorem mult_less_not_refl: "\\<not> M < (M::'a::order multiset)"
   apply (unfold less_multiset_def)
   apply auto
   apply (drule trans_base_order [THEN mult_implies_one_step])
@@ -715,7 +715,7 @@
 
 text {* Asymmetry. *}
 
-theorem mult_less_not_sym: "M < N ==> \<not> N < (M::'a::order multiset)"
+theorem mult_less_not_sym: "M < N ==> \\<not> N < (M::'a::order multiset)"
   apply auto
   apply (rule mult_less_not_refl [THEN notE])
   apply (erule mult_less_trans)
@@ -723,7 +723,7 @@
   done
 
 theorem mult_less_asym:
-    "M < N ==> (\<not> P ==> N < (M::'a::order multiset)) ==> P"
+    "M < N ==> (\\<not> P ==> N < (M::'a::order multiset)) ==> P"
   apply (insert mult_less_not_sym)
   apply blast
   done
@@ -749,7 +749,7 @@
   apply (blast intro: mult_less_trans)
   done
 
-theorem mult_less_le: "M < N = (M <= N \<and> M \<noteq> (N::'a::order multiset))"
+theorem mult_less_le: "M < N = (M <= N \\<and> M \\<noteq> (N::'a::order multiset))"
   apply (unfold le_multiset_def)
   apply auto
   done
@@ -770,7 +770,7 @@
 subsubsection {* Monotonicity of multiset union *}
 
 theorem mult1_union:
-    "(B, D) \<in> mult1 r ==> trans r ==> (C + B, C + D) \<in> mult1 r"
+    "(B, D) \\<in> mult1 r ==> trans r ==> (C + B, C + D) \\<in> mult1 r"
   apply (unfold mult1_def)
   apply auto
   apply (rule_tac x = a in exI)
@@ -806,7 +806,7 @@
   apply (unfold le_multiset_def less_multiset_def)
   apply (case_tac "M = {#}")
    prefer 2
-   apply (subgoal_tac "({#} + {#}, {#} + M) \<in> mult (Collect (split op <))")
+   apply (subgoal_tac "({#} + {#}, {#} + M) \\<in> mult (Collect (split op <))")
     prefer 2
     apply (rule one_step_implies_mult)
       apply (simp only: trans_def)




