| author | huffman | 
| Sat, 21 Apr 2012 10:59:52 +0200 | |
| changeset 47647 | ec29cc09599d | 
| parent 47446 | ed0795caec95 | 
| child 53596 | d29d63460d84 | 
| permissions | -rw-r--r-- | 
| 38622 | 1  | 
(* Title: HOL/Library/Set_Algebras.thy  | 
2  | 
Author: Jeremy Avigad and Kevin Donnelly; Florian Haftmann, TUM  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
3  | 
*)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
4  | 
|
| 38622 | 5  | 
header {* Algebraic operations on sets *}
 | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
6  | 
|
| 38622 | 7  | 
theory Set_Algebras  | 
| 30738 | 8  | 
imports Main  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
9  | 
begin  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
10  | 
|
| 19736 | 11  | 
text {*
 | 
| 38622 | 12  | 
This library lifts operations like addition and muliplication to  | 
13  | 
sets. It was designed to support asymptotic calculations. See the  | 
|
14  | 
  comments at the top of theory @{text BigO}.
 | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
15  | 
*}  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
16  | 
|
| 
47443
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
17  | 
instantiation set :: (plus) plus  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
18  | 
begin  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
19  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
20  | 
definition plus_set :: "'a::plus set \<Rightarrow> 'a set \<Rightarrow> 'a set" where  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
21  | 
  set_plus_def: "A + B = {c. \<exists>a\<in>A. \<exists>b\<in>B. c = a + b}"
 | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
22  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
23  | 
instance ..  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
24  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
25  | 
end  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
26  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
27  | 
instantiation set :: (times) times  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
28  | 
begin  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
29  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
30  | 
definition times_set :: "'a::times set \<Rightarrow> 'a set \<Rightarrow> 'a set" where  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
31  | 
  set_times_def: "A * B = {c. \<exists>a\<in>A. \<exists>b\<in>B. c = a * b}"
 | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
32  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
33  | 
instance ..  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
34  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
35  | 
end  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
36  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
37  | 
instantiation set :: (zero) zero  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
38  | 
begin  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
39  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
40  | 
definition  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
41  | 
  set_zero[simp]: "0::('a::zero)set == {0}"
 | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
42  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
43  | 
instance ..  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
44  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
45  | 
end  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
46  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
47  | 
instantiation set :: (one) one  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
48  | 
begin  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
49  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
50  | 
definition  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
51  | 
  set_one[simp]: "1::('a::one)set == {1}"
 | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
52  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
53  | 
instance ..  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
54  | 
|
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
55  | 
end  | 
| 25594 | 56  | 
|
| 38622 | 57  | 
definition elt_set_plus :: "'a::plus \<Rightarrow> 'a set \<Rightarrow> 'a set" (infixl "+o" 70) where  | 
58  | 
  "a +o B = {c. \<exists>b\<in>B. c = a + b}"
 | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
59  | 
|
| 38622 | 60  | 
definition elt_set_times :: "'a::times \<Rightarrow> 'a set \<Rightarrow> 'a set" (infixl "*o" 80) where  | 
61  | 
  "a *o B = {c. \<exists>b\<in>B. c = a * b}"
 | 
|
| 25594 | 62  | 
|
| 38622 | 63  | 
abbreviation (input) elt_set_eq :: "'a \<Rightarrow> 'a set \<Rightarrow> bool" (infix "=o" 50) where  | 
64  | 
"x =o A \<equiv> x \<in> A"  | 
|
| 25594 | 65  | 
|
| 
47443
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
66  | 
instance set :: (semigroup_add) semigroup_add  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
67  | 
by default (force simp add: set_plus_def add.assoc)  | 
| 25594 | 68  | 
|
| 
47443
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
69  | 
instance set :: (ab_semigroup_add) ab_semigroup_add  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
70  | 
by default (force simp add: set_plus_def add.commute)  | 
| 25594 | 71  | 
|
| 
47443
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
72  | 
instance set :: (monoid_add) monoid_add  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
73  | 
by default (simp_all add: set_plus_def)  | 
| 25594 | 74  | 
|
| 
47443
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
75  | 
instance set :: (comm_monoid_add) comm_monoid_add  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
76  | 
by default (simp_all add: set_plus_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
77  | 
|
| 
47443
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
78  | 
instance set :: (semigroup_mult) semigroup_mult  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
79  | 
by default (force simp add: set_times_def mult.assoc)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
80  | 
|
| 
47443
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
81  | 
instance set :: (ab_semigroup_mult) ab_semigroup_mult  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
82  | 
by default (force simp add: set_times_def mult.commute)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
83  | 
|
| 
47443
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
84  | 
instance set :: (monoid_mult) monoid_mult  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
85  | 
by default (simp_all add: set_times_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
86  | 
|
| 
47443
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
87  | 
instance set :: (comm_monoid_mult) comm_monoid_mult  | 
| 
 
aeff49a3369b
backported Set_Algebras to use type classes (basically reverting b3e8d5ec721d from 2008)
 
krauss 
parents: 
44890 
diff
changeset
 | 
88  | 
by default (simp_all add: set_times_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
89  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
90  | 
lemma set_plus_intro [intro]: "a : C ==> b : D ==> a + b : C + D"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
91  | 
by (auto simp add: set_plus_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
92  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
93  | 
lemma set_plus_intro2 [intro]: "b : C ==> a + b : a +o C"  | 
| 19736 | 94  | 
by (auto simp add: elt_set_plus_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
95  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
96  | 
lemma set_plus_rearrange: "((a::'a::comm_monoid_add) +o C) +  | 
| 
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
97  | 
(b +o D) = (a + b) +o (C + D)"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
98  | 
apply (auto simp add: elt_set_plus_def set_plus_def add_ac)  | 
| 19736 | 99  | 
apply (rule_tac x = "ba + bb" in exI)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
100  | 
apply (auto simp add: add_ac)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
101  | 
apply (rule_tac x = "aa + a" in exI)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
102  | 
apply (auto simp add: add_ac)  | 
| 19736 | 103  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
104  | 
|
| 19736 | 105  | 
lemma set_plus_rearrange2: "(a::'a::semigroup_add) +o (b +o C) =  | 
106  | 
(a + b) +o C"  | 
|
107  | 
by (auto simp add: elt_set_plus_def add_assoc)  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
108  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
109  | 
lemma set_plus_rearrange3: "((a::'a::semigroup_add) +o B) + C =  | 
| 
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
110  | 
a +o (B + C)"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
111  | 
apply (auto simp add: elt_set_plus_def set_plus_def)  | 
| 19736 | 112  | 
apply (blast intro: add_ac)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
113  | 
apply (rule_tac x = "a + aa" in exI)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
114  | 
apply (rule conjI)  | 
| 19736 | 115  | 
apply (rule_tac x = "aa" in bexI)  | 
116  | 
apply auto  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
117  | 
apply (rule_tac x = "ba" in bexI)  | 
| 19736 | 118  | 
apply (auto simp add: add_ac)  | 
119  | 
done  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
120  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
121  | 
theorem set_plus_rearrange4: "C + ((a::'a::comm_monoid_add) +o D) =  | 
| 
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
122  | 
a +o (C + D)"  | 
| 44142 | 123  | 
apply (auto simp add: elt_set_plus_def set_plus_def add_ac)  | 
| 19736 | 124  | 
apply (rule_tac x = "aa + ba" in exI)  | 
125  | 
apply (auto simp add: add_ac)  | 
|
126  | 
done  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
127  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
128  | 
theorems set_plus_rearranges = set_plus_rearrange set_plus_rearrange2  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
129  | 
set_plus_rearrange3 set_plus_rearrange4  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
130  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
131  | 
lemma set_plus_mono [intro!]: "C <= D ==> a +o C <= a +o D"  | 
| 19736 | 132  | 
by (auto simp add: elt_set_plus_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
133  | 
|
| 19736 | 134  | 
lemma set_plus_mono2 [intro]: "(C::('a::plus) set) <= D ==> E <= F ==>
 | 
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
135  | 
C + E <= D + F"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
136  | 
by (auto simp add: set_plus_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
137  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
138  | 
lemma set_plus_mono3 [intro]: "a : C ==> a +o D <= C + D"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
139  | 
by (auto simp add: elt_set_plus_def set_plus_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
140  | 
|
| 19736 | 141  | 
lemma set_plus_mono4 [intro]: "(a::'a::comm_monoid_add) : C ==>  | 
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
142  | 
a +o D <= D + C"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
143  | 
by (auto simp add: elt_set_plus_def set_plus_def add_ac)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
144  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
145  | 
lemma set_plus_mono5: "a:C ==> B <= D ==> a +o B <= C + D"  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
146  | 
apply (subgoal_tac "a +o B <= a +o D")  | 
| 19736 | 147  | 
apply (erule order_trans)  | 
148  | 
apply (erule set_plus_mono3)  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
149  | 
apply (erule set_plus_mono)  | 
| 19736 | 150  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
151  | 
|
| 19736 | 152  | 
lemma set_plus_mono_b: "C <= D ==> x : a +o C  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
153  | 
==> x : a +o D"  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
154  | 
apply (frule set_plus_mono)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
155  | 
apply auto  | 
| 19736 | 156  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
157  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
158  | 
lemma set_plus_mono2_b: "C <= D ==> E <= F ==> x : C + E ==>  | 
| 
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
159  | 
x : D + F"  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
160  | 
apply (frule set_plus_mono2)  | 
| 19736 | 161  | 
prefer 2  | 
162  | 
apply force  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
163  | 
apply assumption  | 
| 19736 | 164  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
165  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
166  | 
lemma set_plus_mono3_b: "a : C ==> x : a +o D ==> x : C + D"  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
167  | 
apply (frule set_plus_mono3)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
168  | 
apply auto  | 
| 19736 | 169  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
170  | 
|
| 19736 | 171  | 
lemma set_plus_mono4_b: "(a::'a::comm_monoid_add) : C ==>  | 
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
172  | 
x : a +o D ==> x : D + C"  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
173  | 
apply (frule set_plus_mono4)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
174  | 
apply auto  | 
| 19736 | 175  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
176  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
177  | 
lemma set_zero_plus [simp]: "(0::'a::comm_monoid_add) +o C = C"  | 
| 19736 | 178  | 
by (auto simp add: elt_set_plus_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
179  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
180  | 
lemma set_zero_plus2: "(0::'a::comm_monoid_add) : A ==> B <= A + B"  | 
| 44142 | 181  | 
apply (auto simp add: set_plus_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
182  | 
apply (rule_tac x = 0 in bexI)  | 
| 19736 | 183  | 
apply (rule_tac x = x in bexI)  | 
184  | 
apply (auto simp add: add_ac)  | 
|
185  | 
done  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
186  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
187  | 
lemma set_plus_imp_minus: "(a::'a::ab_group_add) : b +o C ==> (a - b) : C"  | 
| 19736 | 188  | 
by (auto simp add: elt_set_plus_def add_ac diff_minus)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
189  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
190  | 
lemma set_minus_imp_plus: "(a::'a::ab_group_add) - b : C ==> a : b +o C"  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
191  | 
apply (auto simp add: elt_set_plus_def add_ac diff_minus)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
192  | 
apply (subgoal_tac "a = (a + - b) + b")  | 
| 19736 | 193  | 
apply (rule bexI, assumption, assumption)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
194  | 
apply (auto simp add: add_ac)  | 
| 19736 | 195  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
196  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
197  | 
lemma set_minus_plus: "((a::'a::ab_group_add) - b : C) = (a : b +o C)"  | 
| 19736 | 198  | 
by (rule iffI, rule set_minus_imp_plus, assumption, rule set_plus_imp_minus,  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
199  | 
assumption)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
200  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
201  | 
lemma set_times_intro [intro]: "a : C ==> b : D ==> a * b : C * D"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
202  | 
by (auto simp add: set_times_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
203  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
204  | 
lemma set_times_intro2 [intro!]: "b : C ==> a * b : a *o C"  | 
| 19736 | 205  | 
by (auto simp add: elt_set_times_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
206  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
207  | 
lemma set_times_rearrange: "((a::'a::comm_monoid_mult) *o C) *  | 
| 
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
208  | 
(b *o D) = (a * b) *o (C * D)"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
209  | 
apply (auto simp add: elt_set_times_def set_times_def)  | 
| 19736 | 210  | 
apply (rule_tac x = "ba * bb" in exI)  | 
211  | 
apply (auto simp add: mult_ac)  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
212  | 
apply (rule_tac x = "aa * a" in exI)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
213  | 
apply (auto simp add: mult_ac)  | 
| 19736 | 214  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
215  | 
|
| 19736 | 216  | 
lemma set_times_rearrange2: "(a::'a::semigroup_mult) *o (b *o C) =  | 
217  | 
(a * b) *o C"  | 
|
218  | 
by (auto simp add: elt_set_times_def mult_assoc)  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
219  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
220  | 
lemma set_times_rearrange3: "((a::'a::semigroup_mult) *o B) * C =  | 
| 
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
221  | 
a *o (B * C)"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
222  | 
apply (auto simp add: elt_set_times_def set_times_def)  | 
| 19736 | 223  | 
apply (blast intro: mult_ac)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
224  | 
apply (rule_tac x = "a * aa" in exI)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
225  | 
apply (rule conjI)  | 
| 19736 | 226  | 
apply (rule_tac x = "aa" in bexI)  | 
227  | 
apply auto  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
228  | 
apply (rule_tac x = "ba" in bexI)  | 
| 19736 | 229  | 
apply (auto simp add: mult_ac)  | 
230  | 
done  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
231  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
232  | 
theorem set_times_rearrange4: "C * ((a::'a::comm_monoid_mult) *o D) =  | 
| 
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
233  | 
a *o (C * D)"  | 
| 44142 | 234  | 
apply (auto simp add: elt_set_times_def set_times_def  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
235  | 
mult_ac)  | 
| 19736 | 236  | 
apply (rule_tac x = "aa * ba" in exI)  | 
237  | 
apply (auto simp add: mult_ac)  | 
|
238  | 
done  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
239  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
240  | 
theorems set_times_rearranges = set_times_rearrange set_times_rearrange2  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
241  | 
set_times_rearrange3 set_times_rearrange4  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
242  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
243  | 
lemma set_times_mono [intro]: "C <= D ==> a *o C <= a *o D"  | 
| 19736 | 244  | 
by (auto simp add: elt_set_times_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
245  | 
|
| 19736 | 246  | 
lemma set_times_mono2 [intro]: "(C::('a::times) set) <= D ==> E <= F ==>
 | 
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
247  | 
C * E <= D * F"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
248  | 
by (auto simp add: set_times_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
249  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
250  | 
lemma set_times_mono3 [intro]: "a : C ==> a *o D <= C * D"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
251  | 
by (auto simp add: elt_set_times_def set_times_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
252  | 
|
| 19736 | 253  | 
lemma set_times_mono4 [intro]: "(a::'a::comm_monoid_mult) : C ==>  | 
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
254  | 
a *o D <= D * C"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
255  | 
by (auto simp add: elt_set_times_def set_times_def mult_ac)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
256  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
257  | 
lemma set_times_mono5: "a:C ==> B <= D ==> a *o B <= C * D"  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
258  | 
apply (subgoal_tac "a *o B <= a *o D")  | 
| 19736 | 259  | 
apply (erule order_trans)  | 
260  | 
apply (erule set_times_mono3)  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
261  | 
apply (erule set_times_mono)  | 
| 19736 | 262  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
263  | 
|
| 19736 | 264  | 
lemma set_times_mono_b: "C <= D ==> x : a *o C  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
265  | 
==> x : a *o D"  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
266  | 
apply (frule set_times_mono)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
267  | 
apply auto  | 
| 19736 | 268  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
269  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
270  | 
lemma set_times_mono2_b: "C <= D ==> E <= F ==> x : C * E ==>  | 
| 
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
271  | 
x : D * F"  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
272  | 
apply (frule set_times_mono2)  | 
| 19736 | 273  | 
prefer 2  | 
274  | 
apply force  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
275  | 
apply assumption  | 
| 19736 | 276  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
277  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
278  | 
lemma set_times_mono3_b: "a : C ==> x : a *o D ==> x : C * D"  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
279  | 
apply (frule set_times_mono3)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
280  | 
apply auto  | 
| 19736 | 281  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
282  | 
|
| 19736 | 283  | 
lemma set_times_mono4_b: "(a::'a::comm_monoid_mult) : C ==>  | 
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
284  | 
x : a *o D ==> x : D * C"  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
285  | 
apply (frule set_times_mono4)  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
286  | 
apply auto  | 
| 19736 | 287  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
288  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
289  | 
lemma set_one_times [simp]: "(1::'a::comm_monoid_mult) *o C = C"  | 
| 19736 | 290  | 
by (auto simp add: elt_set_times_def)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
291  | 
|
| 19736 | 292  | 
lemma set_times_plus_distrib: "(a::'a::semiring) *o (b +o C)=  | 
293  | 
(a * b) +o (a *o C)"  | 
|
| 
23477
 
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
 
nipkow 
parents: 
21404 
diff
changeset
 | 
294  | 
by (auto simp add: elt_set_plus_def elt_set_times_def ring_distribs)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
295  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
296  | 
lemma set_times_plus_distrib2: "(a::'a::semiring) *o (B + C) =  | 
| 
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
297  | 
(a *o B) + (a *o C)"  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
298  | 
apply (auto simp add: set_plus_def elt_set_times_def ring_distribs)  | 
| 19736 | 299  | 
apply blast  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
300  | 
apply (rule_tac x = "b + bb" in exI)  | 
| 
23477
 
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
 
nipkow 
parents: 
21404 
diff
changeset
 | 
301  | 
apply (auto simp add: ring_distribs)  | 
| 19736 | 302  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
303  | 
|
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
304  | 
lemma set_times_plus_distrib3: "((a::'a::semiring) +o C) * D <=  | 
| 
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
305  | 
a *o D + C * D"  | 
| 44142 | 306  | 
apply (auto simp add:  | 
| 
26814
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
307  | 
elt_set_plus_def elt_set_times_def set_times_def  | 
| 
 
b3e8d5ec721d
Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
 
berghofe 
parents: 
25764 
diff
changeset
 | 
308  | 
set_plus_def ring_distribs)  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
309  | 
apply auto  | 
| 19736 | 310  | 
done  | 
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
311  | 
|
| 19380 | 312  | 
theorems set_times_plus_distribs =  | 
313  | 
set_times_plus_distrib  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
314  | 
set_times_plus_distrib2  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
315  | 
|
| 19736 | 316  | 
lemma set_neg_intro: "(a::'a::ring_1) : (- 1) *o C ==>  | 
317  | 
- a : C"  | 
|
318  | 
by (auto simp add: elt_set_times_def)  | 
|
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
319  | 
|
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
320  | 
lemma set_neg_intro2: "(a::'a::ring_1) : C ==>  | 
| 
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
321  | 
- a : (- 1) *o C"  | 
| 19736 | 322  | 
by (auto simp add: elt_set_times_def)  | 
323  | 
||
| 
40887
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
324  | 
lemma set_plus_image:  | 
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
325  | 
fixes S T :: "'n::semigroup_add set" shows "S + T = (\<lambda>(x, y). x + y) ` (S \<times> T)"  | 
| 
44890
 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 
nipkow 
parents: 
44142 
diff
changeset
 | 
326  | 
unfolding set_plus_def by (fastforce simp: image_iff)  | 
| 
40887
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
327  | 
|
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
328  | 
lemma set_setsum_alt:  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
329  | 
assumes fin: "finite I"  | 
| 
47444
 
d21c95af2df7
removed "setsum_set", now subsumed by generic setsum
 
krauss 
parents: 
47443 
diff
changeset
 | 
330  | 
  shows "setsum S I = {setsum s I |s. \<forall>i\<in>I. s i \<in> S i}"
 | 
| 
40887
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
331  | 
(is "_ = ?setsum I")  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
332  | 
using fin proof induct  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
333  | 
case (insert x F)  | 
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
334  | 
have "setsum S (insert x F) = S x + ?setsum F"  | 
| 
40887
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
335  | 
using insert.hyps by auto  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
336  | 
  also have "...= {s x + setsum s F |s. \<forall> i\<in>insert x F. s i \<in> S i}"
 | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
337  | 
unfolding set_plus_def  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
338  | 
proof safe  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
339  | 
fix y s assume "y \<in> S x" "\<forall>i\<in>F. s i \<in> S i"  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
340  | 
then show "\<exists>s'. y + setsum s F = s' x + setsum s' F \<and> (\<forall>i\<in>insert x F. s' i \<in> S i)"  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
341  | 
using insert.hyps  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
342  | 
by (intro exI[of _ "\<lambda>i. if i \<in> F then s i else y"]) (auto simp add: set_plus_def)  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
343  | 
qed auto  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
344  | 
finally show ?case  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
345  | 
using insert.hyps by auto  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
346  | 
qed auto  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
347  | 
|
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
348  | 
lemma setsum_set_cond_linear:  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
349  | 
  fixes f :: "('a::comm_monoid_add) set \<Rightarrow> ('b::comm_monoid_add) set"
 | 
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
350  | 
  assumes [intro!]: "\<And>A B. P A  \<Longrightarrow> P B  \<Longrightarrow> P (A + B)" "P {0}"
 | 
| 
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
351  | 
    and f: "\<And>A B. P A  \<Longrightarrow> P B \<Longrightarrow> f (A + B) = f A + f B" "f {0} = {0}"
 | 
| 
40887
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
352  | 
assumes all: "\<And>i. i \<in> I \<Longrightarrow> P (S i)"  | 
| 
47444
 
d21c95af2df7
removed "setsum_set", now subsumed by generic setsum
 
krauss 
parents: 
47443 
diff
changeset
 | 
353  | 
shows "f (setsum S I) = setsum (f \<circ> S) I"  | 
| 
40887
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
354  | 
proof cases  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
355  | 
assume "finite I" from this all show ?thesis  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
356  | 
proof induct  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
357  | 
case (insert x F)  | 
| 
47444
 
d21c95af2df7
removed "setsum_set", now subsumed by generic setsum
 
krauss 
parents: 
47443 
diff
changeset
 | 
358  | 
from `finite F` `\<And>i. i \<in> insert x F \<Longrightarrow> P (S i)` have "P (setsum S F)"  | 
| 
40887
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
359  | 
by induct auto  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
360  | 
with insert show ?case  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
361  | 
by (simp, subst f) auto  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
362  | 
qed (auto intro!: f)  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
363  | 
qed (auto intro!: f)  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
364  | 
|
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
365  | 
lemma setsum_set_linear:  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
366  | 
  fixes f :: "('a::comm_monoid_add) set => ('b::comm_monoid_add) set"
 | 
| 
47445
 
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
 
krauss 
parents: 
47444 
diff
changeset
 | 
367  | 
  assumes "\<And>A B. f(A) + f(B) = f(A + B)" "f {0} = {0}"
 | 
| 
47444
 
d21c95af2df7
removed "setsum_set", now subsumed by generic setsum
 
krauss 
parents: 
47443 
diff
changeset
 | 
368  | 
shows "f (setsum S I) = setsum (f \<circ> S) I"  | 
| 
40887
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
369  | 
using setsum_set_cond_linear[of "\<lambda>x. True" f I S] assms by auto  | 
| 
 
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
 
hoelzl 
parents: 
39302 
diff
changeset
 | 
370  | 
|
| 47446 | 371  | 
lemma set_times_Un_distrib:  | 
372  | 
"A * (B \<union> C) = A * B \<union> A * C"  | 
|
373  | 
"(A \<union> B) * C = A * C \<union> B * C"  | 
|
374  | 
by (auto simp: set_times_def)  | 
|
375  | 
||
376  | 
lemma set_times_UNION_distrib:  | 
|
377  | 
"A * UNION I M = UNION I (%i. A * M i)"  | 
|
378  | 
"UNION I M * A = UNION I (%i. M i * A)"  | 
|
379  | 
by (auto simp: set_times_def)  | 
|
380  | 
||
| 
16908
 
d374530bfaaa
Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
 
avigad 
parents:  
diff
changeset
 | 
381  | 
end  |