src/HOL/Library/Set_Algebras.thy
changeset 47445 69e96e5500df
parent 47444 d21c95af2df7
child 47446 ed0795caec95
     1.1 --- a/src/HOL/Library/Set_Algebras.thy	Thu Apr 12 22:55:11 2012 +0200
     1.2 +++ b/src/HOL/Library/Set_Algebras.thy	Thu Apr 12 23:07:01 2012 +0200
     1.3 @@ -34,14 +34,6 @@
     1.4  
     1.5  end
     1.6  
     1.7 -
     1.8 -text {* Legacy syntax: *}
     1.9 -
    1.10 -abbreviation (input) set_plus :: "'a::plus set \<Rightarrow> 'a set \<Rightarrow> 'a set" (infixl "\<oplus>" 65) where
    1.11 -  "A \<oplus> B \<equiv> A + B"
    1.12 -abbreviation (input) set_times :: "'a::times set \<Rightarrow> 'a set \<Rightarrow> 'a set" (infixl "\<otimes>" 70) where
    1.13 -  "A \<otimes> B \<equiv> A * B"
    1.14 -
    1.15  instantiation set :: (zero) zero
    1.16  begin
    1.17  
    1.18 @@ -95,14 +87,14 @@
    1.19  instance set :: (comm_monoid_mult) comm_monoid_mult
    1.20  by default (simp_all add: set_times_def)
    1.21  
    1.22 -lemma set_plus_intro [intro]: "a : C ==> b : D ==> a + b : C \<oplus> D"
    1.23 +lemma set_plus_intro [intro]: "a : C ==> b : D ==> a + b : C + D"
    1.24    by (auto simp add: set_plus_def)
    1.25  
    1.26  lemma set_plus_intro2 [intro]: "b : C ==> a + b : a +o C"
    1.27    by (auto simp add: elt_set_plus_def)
    1.28  
    1.29 -lemma set_plus_rearrange: "((a::'a::comm_monoid_add) +o C) \<oplus>
    1.30 -    (b +o D) = (a + b) +o (C \<oplus> D)"
    1.31 +lemma set_plus_rearrange: "((a::'a::comm_monoid_add) +o C) +
    1.32 +    (b +o D) = (a + b) +o (C + D)"
    1.33    apply (auto simp add: elt_set_plus_def set_plus_def add_ac)
    1.34     apply (rule_tac x = "ba + bb" in exI)
    1.35    apply (auto simp add: add_ac)
    1.36 @@ -114,8 +106,8 @@
    1.37      (a + b) +o C"
    1.38    by (auto simp add: elt_set_plus_def add_assoc)
    1.39  
    1.40 -lemma set_plus_rearrange3: "((a::'a::semigroup_add) +o B) \<oplus> C =
    1.41 -    a +o (B \<oplus> C)"
    1.42 +lemma set_plus_rearrange3: "((a::'a::semigroup_add) +o B) + C =
    1.43 +    a +o (B + C)"
    1.44    apply (auto simp add: elt_set_plus_def set_plus_def)
    1.45     apply (blast intro: add_ac)
    1.46    apply (rule_tac x = "a + aa" in exI)
    1.47 @@ -126,8 +118,8 @@
    1.48     apply (auto simp add: add_ac)
    1.49    done
    1.50  
    1.51 -theorem set_plus_rearrange4: "C \<oplus> ((a::'a::comm_monoid_add) +o D) =
    1.52 -    a +o (C \<oplus> D)"
    1.53 +theorem set_plus_rearrange4: "C + ((a::'a::comm_monoid_add) +o D) =
    1.54 +    a +o (C + D)"
    1.55    apply (auto simp add: elt_set_plus_def set_plus_def add_ac)
    1.56     apply (rule_tac x = "aa + ba" in exI)
    1.57     apply (auto simp add: add_ac)
    1.58 @@ -140,17 +132,17 @@
    1.59    by (auto simp add: elt_set_plus_def)
    1.60  
    1.61  lemma set_plus_mono2 [intro]: "(C::('a::plus) set) <= D ==> E <= F ==>
    1.62 -    C \<oplus> E <= D \<oplus> F"
    1.63 +    C + E <= D + F"
    1.64    by (auto simp add: set_plus_def)
    1.65  
    1.66 -lemma set_plus_mono3 [intro]: "a : C ==> a +o D <= C \<oplus> D"
    1.67 +lemma set_plus_mono3 [intro]: "a : C ==> a +o D <= C + D"
    1.68    by (auto simp add: elt_set_plus_def set_plus_def)
    1.69  
    1.70  lemma set_plus_mono4 [intro]: "(a::'a::comm_monoid_add) : C ==>
    1.71 -    a +o D <= D \<oplus> C"
    1.72 +    a +o D <= D + C"
    1.73    by (auto simp add: elt_set_plus_def set_plus_def add_ac)
    1.74  
    1.75 -lemma set_plus_mono5: "a:C ==> B <= D ==> a +o B <= C \<oplus> D"
    1.76 +lemma set_plus_mono5: "a:C ==> B <= D ==> a +o B <= C + D"
    1.77    apply (subgoal_tac "a +o B <= a +o D")
    1.78     apply (erule order_trans)
    1.79     apply (erule set_plus_mono3)
    1.80 @@ -163,21 +155,21 @@
    1.81    apply auto
    1.82    done
    1.83  
    1.84 -lemma set_plus_mono2_b: "C <= D ==> E <= F ==> x : C \<oplus> E ==>
    1.85 -    x : D \<oplus> F"
    1.86 +lemma set_plus_mono2_b: "C <= D ==> E <= F ==> x : C + E ==>
    1.87 +    x : D + F"
    1.88    apply (frule set_plus_mono2)
    1.89     prefer 2
    1.90     apply force
    1.91    apply assumption
    1.92    done
    1.93  
    1.94 -lemma set_plus_mono3_b: "a : C ==> x : a +o D ==> x : C \<oplus> D"
    1.95 +lemma set_plus_mono3_b: "a : C ==> x : a +o D ==> x : C + D"
    1.96    apply (frule set_plus_mono3)
    1.97    apply auto
    1.98    done
    1.99  
   1.100  lemma set_plus_mono4_b: "(a::'a::comm_monoid_add) : C ==>
   1.101 -    x : a +o D ==> x : D \<oplus> C"
   1.102 +    x : a +o D ==> x : D + C"
   1.103    apply (frule set_plus_mono4)
   1.104    apply auto
   1.105    done
   1.106 @@ -185,7 +177,7 @@
   1.107  lemma set_zero_plus [simp]: "(0::'a::comm_monoid_add) +o C = C"
   1.108    by (auto simp add: elt_set_plus_def)
   1.109  
   1.110 -lemma set_zero_plus2: "(0::'a::comm_monoid_add) : A ==> B <= A \<oplus> B"
   1.111 +lemma set_zero_plus2: "(0::'a::comm_monoid_add) : A ==> B <= A + B"
   1.112    apply (auto simp add: set_plus_def)
   1.113    apply (rule_tac x = 0 in bexI)
   1.114     apply (rule_tac x = x in bexI)
   1.115 @@ -206,14 +198,14 @@
   1.116    by (rule iffI, rule set_minus_imp_plus, assumption, rule set_plus_imp_minus,
   1.117      assumption)
   1.118  
   1.119 -lemma set_times_intro [intro]: "a : C ==> b : D ==> a * b : C \<otimes> D"
   1.120 +lemma set_times_intro [intro]: "a : C ==> b : D ==> a * b : C * D"
   1.121    by (auto simp add: set_times_def)
   1.122  
   1.123  lemma set_times_intro2 [intro!]: "b : C ==> a * b : a *o C"
   1.124    by (auto simp add: elt_set_times_def)
   1.125  
   1.126 -lemma set_times_rearrange: "((a::'a::comm_monoid_mult) *o C) \<otimes>
   1.127 -    (b *o D) = (a * b) *o (C \<otimes> D)"
   1.128 +lemma set_times_rearrange: "((a::'a::comm_monoid_mult) *o C) *
   1.129 +    (b *o D) = (a * b) *o (C * D)"
   1.130    apply (auto simp add: elt_set_times_def set_times_def)
   1.131     apply (rule_tac x = "ba * bb" in exI)
   1.132     apply (auto simp add: mult_ac)
   1.133 @@ -225,8 +217,8 @@
   1.134      (a * b) *o C"
   1.135    by (auto simp add: elt_set_times_def mult_assoc)
   1.136  
   1.137 -lemma set_times_rearrange3: "((a::'a::semigroup_mult) *o B) \<otimes> C =
   1.138 -    a *o (B \<otimes> C)"
   1.139 +lemma set_times_rearrange3: "((a::'a::semigroup_mult) *o B) * C =
   1.140 +    a *o (B * C)"
   1.141    apply (auto simp add: elt_set_times_def set_times_def)
   1.142     apply (blast intro: mult_ac)
   1.143    apply (rule_tac x = "a * aa" in exI)
   1.144 @@ -237,8 +229,8 @@
   1.145     apply (auto simp add: mult_ac)
   1.146    done
   1.147  
   1.148 -theorem set_times_rearrange4: "C \<otimes> ((a::'a::comm_monoid_mult) *o D) =
   1.149 -    a *o (C \<otimes> D)"
   1.150 +theorem set_times_rearrange4: "C * ((a::'a::comm_monoid_mult) *o D) =
   1.151 +    a *o (C * D)"
   1.152    apply (auto simp add: elt_set_times_def set_times_def
   1.153      mult_ac)
   1.154     apply (rule_tac x = "aa * ba" in exI)
   1.155 @@ -252,17 +244,17 @@
   1.156    by (auto simp add: elt_set_times_def)
   1.157  
   1.158  lemma set_times_mono2 [intro]: "(C::('a::times) set) <= D ==> E <= F ==>
   1.159 -    C \<otimes> E <= D \<otimes> F"
   1.160 +    C * E <= D * F"
   1.161    by (auto simp add: set_times_def)
   1.162  
   1.163 -lemma set_times_mono3 [intro]: "a : C ==> a *o D <= C \<otimes> D"
   1.164 +lemma set_times_mono3 [intro]: "a : C ==> a *o D <= C * D"
   1.165    by (auto simp add: elt_set_times_def set_times_def)
   1.166  
   1.167  lemma set_times_mono4 [intro]: "(a::'a::comm_monoid_mult) : C ==>
   1.168 -    a *o D <= D \<otimes> C"
   1.169 +    a *o D <= D * C"
   1.170    by (auto simp add: elt_set_times_def set_times_def mult_ac)
   1.171  
   1.172 -lemma set_times_mono5: "a:C ==> B <= D ==> a *o B <= C \<otimes> D"
   1.173 +lemma set_times_mono5: "a:C ==> B <= D ==> a *o B <= C * D"
   1.174    apply (subgoal_tac "a *o B <= a *o D")
   1.175     apply (erule order_trans)
   1.176     apply (erule set_times_mono3)
   1.177 @@ -275,21 +267,21 @@
   1.178    apply auto
   1.179    done
   1.180  
   1.181 -lemma set_times_mono2_b: "C <= D ==> E <= F ==> x : C \<otimes> E ==>
   1.182 -    x : D \<otimes> F"
   1.183 +lemma set_times_mono2_b: "C <= D ==> E <= F ==> x : C * E ==>
   1.184 +    x : D * F"
   1.185    apply (frule set_times_mono2)
   1.186     prefer 2
   1.187     apply force
   1.188    apply assumption
   1.189    done
   1.190  
   1.191 -lemma set_times_mono3_b: "a : C ==> x : a *o D ==> x : C \<otimes> D"
   1.192 +lemma set_times_mono3_b: "a : C ==> x : a *o D ==> x : C * D"
   1.193    apply (frule set_times_mono3)
   1.194    apply auto
   1.195    done
   1.196  
   1.197  lemma set_times_mono4_b: "(a::'a::comm_monoid_mult) : C ==>
   1.198 -    x : a *o D ==> x : D \<otimes> C"
   1.199 +    x : a *o D ==> x : D * C"
   1.200    apply (frule set_times_mono4)
   1.201    apply auto
   1.202    done
   1.203 @@ -301,16 +293,16 @@
   1.204      (a * b) +o (a *o C)"
   1.205    by (auto simp add: elt_set_plus_def elt_set_times_def ring_distribs)
   1.206  
   1.207 -lemma set_times_plus_distrib2: "(a::'a::semiring) *o (B \<oplus> C) =
   1.208 -    (a *o B) \<oplus> (a *o C)"
   1.209 +lemma set_times_plus_distrib2: "(a::'a::semiring) *o (B + C) =
   1.210 +    (a *o B) + (a *o C)"
   1.211    apply (auto simp add: set_plus_def elt_set_times_def ring_distribs)
   1.212     apply blast
   1.213    apply (rule_tac x = "b + bb" in exI)
   1.214    apply (auto simp add: ring_distribs)
   1.215    done
   1.216  
   1.217 -lemma set_times_plus_distrib3: "((a::'a::semiring) +o C) \<otimes> D <=
   1.218 -    a *o D \<oplus> C \<otimes> D"
   1.219 +lemma set_times_plus_distrib3: "((a::'a::semiring) +o C) * D <=
   1.220 +    a *o D + C * D"
   1.221    apply (auto simp add:
   1.222      elt_set_plus_def elt_set_times_def set_times_def
   1.223      set_plus_def ring_distribs)
   1.224 @@ -330,7 +322,7 @@
   1.225    by (auto simp add: elt_set_times_def)
   1.226  
   1.227  lemma set_plus_image:
   1.228 -  fixes S T :: "'n::semigroup_add set" shows "S \<oplus> T = (\<lambda>(x, y). x + y) ` (S \<times> T)"
   1.229 +  fixes S T :: "'n::semigroup_add set" shows "S + T = (\<lambda>(x, y). x + y) ` (S \<times> T)"
   1.230    unfolding set_plus_def by (fastforce simp: image_iff)
   1.231  
   1.232  lemma set_setsum_alt:
   1.233 @@ -339,7 +331,7 @@
   1.234      (is "_ = ?setsum I")
   1.235  using fin proof induct
   1.236    case (insert x F)
   1.237 -  have "setsum S (insert x F) = S x \<oplus> ?setsum F"
   1.238 +  have "setsum S (insert x F) = S x + ?setsum F"
   1.239      using insert.hyps by auto
   1.240    also have "...= {s x + setsum s F |s. \<forall> i\<in>insert x F. s i \<in> S i}"
   1.241      unfolding set_plus_def
   1.242 @@ -355,8 +347,8 @@
   1.243  
   1.244  lemma setsum_set_cond_linear:
   1.245    fixes f :: "('a::comm_monoid_add) set \<Rightarrow> ('b::comm_monoid_add) set"
   1.246 -  assumes [intro!]: "\<And>A B. P A  \<Longrightarrow> P B  \<Longrightarrow> P (A \<oplus> B)" "P {0}"
   1.247 -    and f: "\<And>A B. P A  \<Longrightarrow> P B \<Longrightarrow> f (A \<oplus> B) = f A \<oplus> f B" "f {0} = {0}"
   1.248 +  assumes [intro!]: "\<And>A B. P A  \<Longrightarrow> P B  \<Longrightarrow> P (A + B)" "P {0}"
   1.249 +    and f: "\<And>A B. P A  \<Longrightarrow> P B \<Longrightarrow> f (A + B) = f A + f B" "f {0} = {0}"
   1.250    assumes all: "\<And>i. i \<in> I \<Longrightarrow> P (S i)"
   1.251    shows "f (setsum S I) = setsum (f \<circ> S) I"
   1.252  proof cases
   1.253 @@ -372,7 +364,7 @@
   1.254  
   1.255  lemma setsum_set_linear:
   1.256    fixes f :: "('a::comm_monoid_add) set => ('b::comm_monoid_add) set"
   1.257 -  assumes "\<And>A B. f(A) \<oplus> f(B) = f(A \<oplus> B)" "f {0} = {0}"
   1.258 +  assumes "\<And>A B. f(A) + f(B) = f(A + B)" "f {0} = {0}"
   1.259    shows "f (setsum S I) = setsum (f \<circ> S) I"
   1.260    using setsum_set_cond_linear[of "\<lambda>x. True" f I S] assms by auto
   1.261