equal
deleted
inserted
replaced
1 (* Title: ZF/Induct/Multiset.thy |
1 (* Title: ZF/Induct/Multiset.thy |
2 ID: $Id$ |
|
3 Author: Sidi O Ehmety, Cambridge University Computer Laboratory |
2 Author: Sidi O Ehmety, Cambridge University Computer Laboratory |
4 |
3 |
5 A definitional theory of multisets, |
4 A definitional theory of multisets, |
6 including a wellfoundedness proof for the multiset order. |
5 including a wellfoundedness proof for the multiset order. |
7 |
6 |
48 else 0" |
47 else 0" |
49 |
48 |
50 definition |
49 definition |
51 mdiff :: "[i, i] => i" (infixl "-#" 65) where |
50 mdiff :: "[i, i] => i" (infixl "-#" 65) where |
52 "M -# N == normalize(\<lambda>x \<in> mset_of(M). |
51 "M -# N == normalize(\<lambda>x \<in> mset_of(M). |
53 if x \<in> mset_of(N) then M`x #- N`x else M`x)" |
52 if x \<in> mset_of(N) then M`x #- N`x else M`x)" |
54 |
53 |
55 definition |
54 definition |
56 (* set of elements of a multiset *) |
55 (* set of elements of a multiset *) |
57 msingle :: "i => i" ("{#_#}") where |
56 msingle :: "i => i" ("{#_#}") where |
58 "{#a#} == {<a, 1>}" |
57 "{#a#} == {<a, 1>}" |
92 \<exists>a \<in> A. \<exists>M0 \<in> Mult(A). \<exists>K \<in> Mult(A). |
91 \<exists>a \<in> A. \<exists>M0 \<in> Mult(A). \<exists>K \<in> Mult(A). |
93 N=M0 +# {#a#} & M=M0 +# K & (\<forall>b \<in> mset_of(K). <b,a> \<in> r)}" |
92 N=M0 +# {#a#} & M=M0 +# K & (\<forall>b \<in> mset_of(K). <b,a> \<in> r)}" |
94 |
93 |
95 definition |
94 definition |
96 multirel :: "[i, i] => i" where |
95 multirel :: "[i, i] => i" where |
97 "multirel(A, r) == multirel1(A, r)^+" |
96 "multirel(A, r) == multirel1(A, r)^+" |
98 |
97 |
99 (* ordinal multiset orderings *) |
98 (* ordinal multiset orderings *) |
100 |
99 |
101 definition |
100 definition |
102 omultiset :: "i => o" where |
101 omultiset :: "i => o" where |
378 apply (auto simp del: int_of_0 simp add: int_of_add [symmetric] int_of_0 [symmetric]) |
377 apply (auto simp del: int_of_0 simp add: int_of_add [symmetric] int_of_0 [symmetric]) |
379 done |
378 done |
380 |
379 |
381 lemma setsum_mcount_Int: |
380 lemma setsum_mcount_Int: |
382 "Finite(A) ==> setsum(%a. $# mcount(N, a), A Int mset_of(N)) |
381 "Finite(A) ==> setsum(%a. $# mcount(N, a), A Int mset_of(N)) |
383 = setsum(%a. $# mcount(N, a), A)" |
382 = setsum(%a. $# mcount(N, a), A)" |
384 apply (induct rule: Finite_induct) |
383 apply (induct rule: Finite_induct) |
385 apply auto |
384 apply auto |
386 apply (subgoal_tac "Finite (B Int mset_of (N))") |
385 apply (subgoal_tac "Finite (B Int mset_of (N))") |
387 prefer 2 apply (blast intro: subset_Finite) |
386 prefer 2 apply (blast intro: subset_Finite) |
388 apply (auto simp add: mcount_def Int_cons_left) |
387 apply (auto simp add: mcount_def Int_cons_left) |