author  paulson 
Thu, 29 Sep 2005 12:43:40 +0200  
changeset 17715  68583762ebdb 
parent 17702  ea88ddeafabe 
child 17784  5cbb52f2c478 
permissions  rwrr 
923  1 
(* Title: HOL/Set.thy 
2 
ID: $Id$ 

12257  3 
Author: Tobias Nipkow, Lawrence C Paulson and Markus Wenzel 
923  4 
*) 
5 

11979  6 
header {* Set theory for higherorder logic *} 
7 

15131  8 
theory Set 
17508  9 
imports LOrder 
15131  10 
begin 
11979  11 

12 
text {* A set in HOL is simply a predicate. *} 

923  13 

2261  14 

11979  15 
subsection {* Basic syntax *} 
2261  16 

3947  17 
global 
18 

11979  19 
typedecl 'a set 
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12257
diff
changeset

20 
arities set :: (type) type 
3820  21 

923  22 
consts 
11979  23 
"{}" :: "'a set" ("{}") 
24 
UNIV :: "'a set" 

25 
insert :: "'a => 'a set => 'a set" 

26 
Collect :: "('a => bool) => 'a set"  "comprehension" 

27 
Int :: "'a set => 'a set => 'a set" (infixl 70) 

28 
Un :: "'a set => 'a set => 'a set" (infixl 65) 

29 
UNION :: "'a set => ('a => 'b set) => 'b set"  "general union" 

30 
INTER :: "'a set => ('a => 'b set) => 'b set"  "general intersection" 

31 
Union :: "'a set set => 'a set"  "union of a set" 

32 
Inter :: "'a set set => 'a set"  "intersection of a set" 

33 
Pow :: "'a set => 'a set set"  "powerset" 

34 
Ball :: "'a set => ('a => bool) => bool"  "bounded universal quantifiers" 

35 
Bex :: "'a set => ('a => bool) => bool"  "bounded existential quantifiers" 

36 
image :: "('a => 'b) => 'a set => 'b set" (infixr "`" 90) 

37 

38 
syntax 

39 
"op :" :: "'a => 'a set => bool" ("op :") 

40 
consts 

41 
"op :" :: "'a => 'a set => bool" ("(_/ : _)" [50, 51] 50)  "membership" 

42 

43 
local 

44 

14692  45 
instance set :: (type) "{ord, minus}" .. 
923  46 

47 

11979  48 
subsection {* Additional concrete syntax *} 
2261  49 

923  50 
syntax 
11979  51 
range :: "('a => 'b) => 'b set"  "of function" 
923  52 

11979  53 
"op ~:" :: "'a => 'a set => bool" ("op ~:")  "nonmembership" 
54 
"op ~:" :: "'a => 'a set => bool" ("(_/ ~: _)" [50, 51] 50) 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
5931
diff
changeset

55 

11979  56 
"@Finset" :: "args => 'a set" ("{(_)}") 
57 
"@Coll" :: "pttrn => bool => 'a set" ("(1{_./ _})") 

58 
"@SetCompr" :: "'a => idts => bool => 'a set" ("(1{_ /_./ _})") 

15535  59 
"@Collect" :: "idt => 'a set => bool => 'a set" ("(1{_ :/ _./ _})") 
11979  60 
"@INTER1" :: "pttrns => 'b set => 'b set" ("(3INT _./ _)" 10) 
61 
"@UNION1" :: "pttrns => 'b set => 'b set" ("(3UN _./ _)" 10) 

62 
"@INTER" :: "pttrn => 'a set => 'b set => 'b set" ("(3INT _:_./ _)" 10) 

63 
"@UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3UN _:_./ _)" 10) 

923  64 

11979  65 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3ALL _:_./ _)" [0, 0, 10] 10) 
66 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3EX _:_./ _)" [0, 0, 10] 10) 

923  67 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
5931
diff
changeset

68 
syntax (HOL) 
11979  69 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3! _:_./ _)" [0, 0, 10] 10) 
70 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3? _:_./ _)" [0, 0, 10] 10) 

923  71 

72 
translations 

10832  73 
"range f" == "f`UNIV" 
923  74 
"x ~: y" == "~ (x : y)" 
75 
"{x, xs}" == "insert x {xs}" 

76 
"{x}" == "insert x {}" 

13764  77 
"{x. P}" == "Collect (%x. P)" 
15535  78 
"{x:A. P}" => "{x. x:A & P}" 
4159
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4151
diff
changeset

79 
"UN x y. B" == "UN x. UN y. B" 
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4151
diff
changeset

80 
"UN x. B" == "UNION UNIV (%x. B)" 
13858  81 
"UN x. B" == "UN x:UNIV. B" 
7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
5931
diff
changeset

82 
"INT x y. B" == "INT x. INT y. B" 
4159
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4151
diff
changeset

83 
"INT x. B" == "INTER UNIV (%x. B)" 
13858  84 
"INT x. B" == "INT x:UNIV. B" 
13764  85 
"UN x:A. B" == "UNION A (%x. B)" 
86 
"INT x:A. B" == "INTER A (%x. B)" 

87 
"ALL x:A. P" == "Ball A (%x. P)" 

88 
"EX x:A. P" == "Bex A (%x. P)" 

923  89 

12633  90 
syntax (output) 
11979  91 
"_setle" :: "'a set => 'a set => bool" ("op <=") 
92 
"_setle" :: "'a set => 'a set => bool" ("(_/ <= _)" [50, 51] 50) 

93 
"_setless" :: "'a set => 'a set => bool" ("op <") 

94 
"_setless" :: "'a set => 'a set => bool" ("(_/ < _)" [50, 51] 50) 

923  95 

12114
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents:
12023
diff
changeset

96 
syntax (xsymbols) 
11979  97 
"_setle" :: "'a set => 'a set => bool" ("op \<subseteq>") 
98 
"_setle" :: "'a set => 'a set => bool" ("(_/ \<subseteq> _)" [50, 51] 50) 

99 
"_setless" :: "'a set => 'a set => bool" ("op \<subset>") 

100 
"_setless" :: "'a set => 'a set => bool" ("(_/ \<subset> _)" [50, 51] 50) 

101 
"op Int" :: "'a set => 'a set => 'a set" (infixl "\<inter>" 70) 

102 
"op Un" :: "'a set => 'a set => 'a set" (infixl "\<union>" 65) 

103 
"op :" :: "'a => 'a set => bool" ("op \<in>") 

104 
"op :" :: "'a => 'a set => bool" ("(_/ \<in> _)" [50, 51] 50) 

105 
"op ~:" :: "'a => 'a set => bool" ("op \<notin>") 

106 
"op ~:" :: "'a => 'a set => bool" ("(_/ \<notin> _)" [50, 51] 50) 

14381
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

107 
Union :: "'a set set => 'a set" ("\<Union>_" [90] 90) 
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

108 
Inter :: "'a set set => 'a set" ("\<Inter>_" [90] 90) 
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

109 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3\<forall>_\<in>_./ _)" [0, 0, 10] 10) 
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

110 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3\<exists>_\<in>_./ _)" [0, 0, 10] 10) 
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

111 

14565  112 
syntax (HTML output) 
113 
"_setle" :: "'a set => 'a set => bool" ("op \<subseteq>") 

114 
"_setle" :: "'a set => 'a set => bool" ("(_/ \<subseteq> _)" [50, 51] 50) 

115 
"_setless" :: "'a set => 'a set => bool" ("op \<subset>") 

116 
"_setless" :: "'a set => 'a set => bool" ("(_/ \<subset> _)" [50, 51] 50) 

117 
"op Int" :: "'a set => 'a set => 'a set" (infixl "\<inter>" 70) 

118 
"op Un" :: "'a set => 'a set => 'a set" (infixl "\<union>" 65) 

119 
"op :" :: "'a => 'a set => bool" ("op \<in>") 

120 
"op :" :: "'a => 'a set => bool" ("(_/ \<in> _)" [50, 51] 50) 

121 
"op ~:" :: "'a => 'a set => bool" ("op \<notin>") 

122 
"op ~:" :: "'a => 'a set => bool" ("(_/ \<notin> _)" [50, 51] 50) 

123 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3\<forall>_\<in>_./ _)" [0, 0, 10] 10) 

124 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3\<exists>_\<in>_./ _)" [0, 0, 10] 10) 

125 

15120  126 
syntax (xsymbols) 
15535  127 
"@Collect" :: "idt => 'a set => bool => 'a set" ("(1{_ \<in>/ _./ _})") 
11979  128 
"@UNION1" :: "pttrns => 'b set => 'b set" ("(3\<Union>_./ _)" 10) 
129 
"@INTER1" :: "pttrns => 'b set => 'b set" ("(3\<Inter>_./ _)" 10) 

130 
"@UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Union>_\<in>_./ _)" 10) 

131 
"@INTER" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Inter>_\<in>_./ _)" 10) 

15120  132 
(* 
14381
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

133 
syntax (xsymbols) 
14845  134 
"@UNION1" :: "pttrns => 'b set => 'b set" ("(3\<Union>(00\<^bsub>_\<^esub>)/ _)" 10) 
135 
"@INTER1" :: "pttrns => 'b set => 'b set" ("(3\<Inter>(00\<^bsub>_\<^esub>)/ _)" 10) 

136 
"@UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Union>(00\<^bsub>_\<in>_\<^esub>)/ _)" 10) 

137 
"@INTER" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Inter>(00\<^bsub>_\<in>_\<^esub>)/ _)" 10) 

15120  138 
*) 
139 
syntax (latex output) 

140 
"@UNION1" :: "pttrns => 'b set => 'b set" ("(3\<Union>(00\<^bsub>_\<^esub>)/ _)" 10) 

141 
"@INTER1" :: "pttrns => 'b set => 'b set" ("(3\<Inter>(00\<^bsub>_\<^esub>)/ _)" 10) 

142 
"@UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Union>(00\<^bsub>_\<in>_\<^esub>)/ _)" 10) 

143 
"@INTER" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Inter>(00\<^bsub>_\<in>_\<^esub>)/ _)" 10) 

144 

145 
text{* Note the difference between ordinary xsymbol syntax of indexed 

146 
unions and intersections (e.g.\ @{text"\<Union>a\<^isub>1\<in>A\<^isub>1. B"}) 

147 
and their \LaTeX\ rendition: @{term"\<Union>a\<^isub>1\<in>A\<^isub>1. B"}. The 

148 
former does not make the index expression a subscript of the 

149 
union/intersection symbol because this leads to problems with nested 

150 
subscripts in Proof General. *} 

2261  151 

14565  152 

2412  153 
translations 
11979  154 
"op \<subseteq>" => "op <= :: _ set => _ set => bool" 
155 
"op \<subset>" => "op < :: _ set => _ set => bool" 

2261  156 

11979  157 
typed_print_translation {* 
158 
let 

159 
fun le_tr' _ (Type ("fun", (Type ("set", _) :: _))) ts = 

160 
list_comb (Syntax.const "_setle", ts) 

161 
 le_tr' _ _ _ = raise Match; 

162 

163 
fun less_tr' _ (Type ("fun", (Type ("set", _) :: _))) ts = 

164 
list_comb (Syntax.const "_setless", ts) 

165 
 less_tr' _ _ _ = raise Match; 

166 
in [("op <=", le_tr'), ("op <", less_tr')] end 

167 
*} 

2261  168 

14804
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

169 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

170 
subsubsection "Bounded quantifiers" 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

171 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

172 
syntax 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

173 
"_setlessAll" :: "[idt, 'a, bool] => bool" ("(3ALL _<_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

174 
"_setlessEx" :: "[idt, 'a, bool] => bool" ("(3EX _<_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

175 
"_setleAll" :: "[idt, 'a, bool] => bool" ("(3ALL _<=_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

176 
"_setleEx" :: "[idt, 'a, bool] => bool" ("(3EX _<=_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

177 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

178 
syntax (xsymbols) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

179 
"_setlessAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_\<subset>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

180 
"_setlessEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_\<subset>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

181 
"_setleAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_\<subseteq>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

182 
"_setleEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_\<subseteq>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

183 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

184 
syntax (HOL) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

185 
"_setlessAll" :: "[idt, 'a, bool] => bool" ("(3! _<_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

186 
"_setlessEx" :: "[idt, 'a, bool] => bool" ("(3? _<_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

187 
"_setleAll" :: "[idt, 'a, bool] => bool" ("(3! _<=_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

188 
"_setleEx" :: "[idt, 'a, bool] => bool" ("(3? _<=_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

189 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

190 
syntax (HTML output) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

191 
"_setlessAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_\<subset>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

192 
"_setlessEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_\<subset>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

193 
"_setleAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_\<subseteq>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

194 
"_setleEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_\<subseteq>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

195 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

196 
translations 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

197 
"\<forall>A\<subset>B. P" => "ALL A. A \<subset> B > P" 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

198 
"\<exists>A\<subset>B. P" => "EX A. A \<subset> B & P" 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

199 
"\<forall>A\<subseteq>B. P" => "ALL A. A \<subseteq> B > P" 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

200 
"\<exists>A\<subseteq>B. P" => "EX A. A \<subseteq> B & P" 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

201 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

202 
print_translation {* 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

203 
let 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

204 
fun 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

205 
all_tr' [Const ("_bound",_) $ Free (v,Type(T,_)), 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

206 
Const("op >",_) $ (Const ("op <",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

207 
(if v=v' andalso T="set" 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

208 
then Syntax.const "_setlessAll" $ Syntax.mark_bound v' $ n $ P 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

209 
else raise Match) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

210 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

211 
 all_tr' [Const ("_bound",_) $ Free (v,Type(T,_)), 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

212 
Const("op >",_) $ (Const ("op <=",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

213 
(if v=v' andalso T="set" 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

214 
then Syntax.const "_setleAll" $ Syntax.mark_bound v' $ n $ P 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

215 
else raise Match); 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

216 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

217 
fun 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

218 
ex_tr' [Const ("_bound",_) $ Free (v,Type(T,_)), 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

219 
Const("op &",_) $ (Const ("op <",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

220 
(if v=v' andalso T="set" 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

221 
then Syntax.const "_setlessEx" $ Syntax.mark_bound v' $ n $ P 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

222 
else raise Match) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

223 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

224 
 ex_tr' [Const ("_bound",_) $ Free (v,Type(T,_)), 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

225 
Const("op &",_) $ (Const ("op <=",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

226 
(if v=v' andalso T="set" 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

227 
then Syntax.const "_setleEx" $ Syntax.mark_bound v' $ n $ P 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

228 
else raise Match) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

229 
in 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

230 
[("ALL ", all_tr'), ("EX ", ex_tr')] 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

231 
end 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

232 
*} 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

233 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

234 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

235 

11979  236 
text {* 
237 
\medskip Translate between @{text "{e  x1...xn. P}"} and @{text 

238 
"{u. EX x1..xn. u = e & P}"}; @{text "{y. EX x1..xn. y = e & P}"} is 

239 
only translated if @{text "[0..n] subset bvs(e)"}. 

240 
*} 

241 

242 
parse_translation {* 

243 
let 

244 
val ex_tr = snd (mk_binder_tr ("EX ", "Ex")); 

3947  245 

11979  246 
fun nvars (Const ("_idts", _) $ _ $ idts) = nvars idts + 1 
247 
 nvars _ = 1; 

248 

249 
fun setcompr_tr [e, idts, b] = 

250 
let 

251 
val eq = Syntax.const "op =" $ Bound (nvars idts) $ e; 

252 
val P = Syntax.const "op &" $ eq $ b; 

253 
val exP = ex_tr [idts, P]; 

254 
in Syntax.const "Collect" $ Abs ("", dummyT, exP) end; 

255 

256 
in [("@SetCompr", setcompr_tr)] end; 

257 
*} 

923  258 

13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

259 
(* To avoid etacontraction of body: *) 
11979  260 
print_translation {* 
13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

261 
let 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

262 
fun btr' syn [A,Abs abs] = 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

263 
let val (x,t) = atomic_abs_tr' abs 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

264 
in Syntax.const syn $ x $ A $ t end 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

265 
in 
13858  266 
[("Ball", btr' "_Ball"),("Bex", btr' "_Bex"), 
267 
("UNION", btr' "@UNION"),("INTER", btr' "@INTER")] 

13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

268 
end 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

269 
*} 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

270 

f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

271 
print_translation {* 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

272 
let 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

273 
val ex_tr' = snd (mk_binder_tr' ("Ex", "DUMMY")); 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

274 

f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

275 
fun setcompr_tr' [Abs (abs as (_, _, P))] = 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

276 
let 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

277 
fun check (Const ("Ex", _) $ Abs (_, _, P), n) = check (P, n + 1) 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

278 
 check (Const ("op &", _) $ (Const ("op =", _) $ Bound m $ e) $ P, n) = 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

279 
n > 0 andalso m = n andalso not (loose_bvar1 (P, n)) andalso 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

280 
((0 upto (n  1)) subset add_loose_bnos (e, 0, [])) 
13764  281 
 check _ = false 
923  282 

11979  283 
fun tr' (_ $ abs) = 
284 
let val _ $ idts $ (_ $ (_ $ _ $ e) $ Q) = ex_tr' [abs] 

285 
in Syntax.const "@SetCompr" $ e $ idts $ Q end; 

13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

286 
in if check (P, 0) then tr' P 
15535  287 
else let val (x as _ $ Free(xN,_), t) = atomic_abs_tr' abs 
288 
val M = Syntax.const "@Coll" $ x $ t 

289 
in case t of 

290 
Const("op &",_) 

291 
$ (Const("op :",_) $ (Const("_bound",_) $ Free(yN,_)) $ A) 

292 
$ P => 

293 
if xN=yN then Syntax.const "@Collect" $ x $ A $ P else M 

294 
 _ => M 

295 
end 

13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

296 
end; 
11979  297 
in [("Collect", setcompr_tr')] end; 
298 
*} 

299 

300 

301 
subsection {* Rules and definitions *} 

302 

303 
text {* Isomorphisms between predicates and sets. *} 

923  304 

11979  305 
axioms 
17085  306 
mem_Collect_eq: "(a : {x. P(x)}) = P(a)" 
307 
Collect_mem_eq: "{x. x:A} = A" 

17702  308 
finalconsts 
309 
Collect 

310 
"op :" 

11979  311 

312 
defs 

313 
Ball_def: "Ball A P == ALL x. x:A > P(x)" 

314 
Bex_def: "Bex A P == EX x. x:A & P(x)" 

315 

316 
defs (overloaded) 

317 
subset_def: "A <= B == ALL x:A. x:B" 

318 
psubset_def: "A < B == (A::'a set) <= B & ~ A=B" 

319 
Compl_def: " A == {x. ~x:A}" 

12257  320 
set_diff_def: "A  B == {x. x:A & ~x:B}" 
923  321 

322 
defs 

11979  323 
Un_def: "A Un B == {x. x:A  x:B}" 
324 
Int_def: "A Int B == {x. x:A & x:B}" 

325 
INTER_def: "INTER A B == {y. ALL x:A. y: B(x)}" 

326 
UNION_def: "UNION A B == {y. EX x:A. y: B(x)}" 

327 
Inter_def: "Inter S == (INT x:S. x)" 

328 
Union_def: "Union S == (UN x:S. x)" 

329 
Pow_def: "Pow A == {B. B <= A}" 

330 
empty_def: "{} == {x. False}" 

331 
UNIV_def: "UNIV == {x. True}" 

332 
insert_def: "insert a B == {x. x=a} Un B" 

333 
image_def: "f`A == {y. EX x:A. y = f(x)}" 

334 

335 

336 
subsection {* Lemmas and proof tool setup *} 

337 

338 
subsubsection {* Relating predicates and sets *} 

339 

17085  340 
declare mem_Collect_eq [iff] Collect_mem_eq [simp] 
341 

12257  342 
lemma CollectI: "P(a) ==> a : {x. P(x)}" 
11979  343 
by simp 
344 

345 
lemma CollectD: "a : {x. P(x)} ==> P(a)" 

346 
by simp 

347 

348 
lemma Collect_cong: "(!!x. P x = Q x) ==> {x. P(x)} = {x. Q(x)}" 

349 
by simp 

350 

12257  351 
lemmas CollectE = CollectD [elim_format] 
11979  352 

353 

354 
subsubsection {* Bounded quantifiers *} 

355 

356 
lemma ballI [intro!]: "(!!x. x:A ==> P x) ==> ALL x:A. P x" 

357 
by (simp add: Ball_def) 

358 

359 
lemmas strip = impI allI ballI 

360 

361 
lemma bspec [dest?]: "ALL x:A. P x ==> x:A ==> P x" 

362 
by (simp add: Ball_def) 

363 

364 
lemma ballE [elim]: "ALL x:A. P x ==> (P x ==> Q) ==> (x ~: A ==> Q) ==> Q" 

365 
by (unfold Ball_def) blast 

14098  366 
ML {* bind_thm("rev_ballE",permute_prems 1 1 (thm "ballE")) *} 
11979  367 

368 
text {* 

369 
\medskip This tactic takes assumptions @{prop "ALL x:A. P x"} and 

370 
@{prop "a:A"}; creates assumption @{prop "P a"}. 

371 
*} 

372 

373 
ML {* 

374 
local val ballE = thm "ballE" 

375 
in fun ball_tac i = etac ballE i THEN contr_tac (i + 1) end; 

376 
*} 

377 

378 
text {* 

379 
Gives better instantiation for bound: 

380 
*} 

381 

382 
ML_setup {* 

383 
claset_ref() := claset() addbefore ("bspec", datac (thm "bspec") 1); 

384 
*} 

385 

386 
lemma bexI [intro]: "P x ==> x:A ==> EX x:A. P x" 

387 
 {* Normally the best argument order: @{prop "P x"} constrains the 

388 
choice of @{prop "x:A"}. *} 

389 
by (unfold Bex_def) blast 

390 

13113  391 
lemma rev_bexI [intro?]: "x:A ==> P x ==> EX x:A. P x" 
11979  392 
 {* The best argument order when there is only one @{prop "x:A"}. *} 
393 
by (unfold Bex_def) blast 

394 

395 
lemma bexCI: "(ALL x:A. ~P x ==> P a) ==> a:A ==> EX x:A. P x" 

396 
by (unfold Bex_def) blast 

397 

398 
lemma bexE [elim!]: "EX x:A. P x ==> (!!x. x:A ==> P x ==> Q) ==> Q" 

399 
by (unfold Bex_def) blast 

400 

401 
lemma ball_triv [simp]: "(ALL x:A. P) = ((EX x. x:A) > P)" 

402 
 {* Trival rewrite rule. *} 

403 
by (simp add: Ball_def) 

404 

405 
lemma bex_triv [simp]: "(EX x:A. P) = ((EX x. x:A) & P)" 

406 
 {* Dual form for existentials. *} 

407 
by (simp add: Bex_def) 

408 

409 
lemma bex_triv_one_point1 [simp]: "(EX x:A. x = a) = (a:A)" 

410 
by blast 

411 

412 
lemma bex_triv_one_point2 [simp]: "(EX x:A. a = x) = (a:A)" 

413 
by blast 

414 

415 
lemma bex_one_point1 [simp]: "(EX x:A. x = a & P x) = (a:A & P a)" 

416 
by blast 

417 

418 
lemma bex_one_point2 [simp]: "(EX x:A. a = x & P x) = (a:A & P a)" 

419 
by blast 

420 

421 
lemma ball_one_point1 [simp]: "(ALL x:A. x = a > P x) = (a:A > P a)" 

422 
by blast 

423 

424 
lemma ball_one_point2 [simp]: "(ALL x:A. a = x > P x) = (a:A > P a)" 

425 
by blast 

426 

427 
ML_setup {* 

13462  428 
local 
11979  429 
val Ball_def = thm "Ball_def"; 
430 
val Bex_def = thm "Bex_def"; 

431 

17002  432 
val simpset = Simplifier.clear_ss HOL_basic_ss; 
433 
fun unfold_tac ss th = 

434 
ALLGOALS (full_simp_tac (Simplifier.inherit_bounds ss simpset addsimps [th])); 

435 

436 
fun prove_bex_tac ss = 

437 
unfold_tac ss Bex_def THEN Quantifier1.prove_one_point_ex_tac; 

11979  438 
val rearrange_bex = Quantifier1.rearrange_bex prove_bex_tac; 
439 

17002  440 
fun prove_ball_tac ss = 
441 
unfold_tac ss Ball_def THEN Quantifier1.prove_one_point_all_tac; 

11979  442 
val rearrange_ball = Quantifier1.rearrange_ball prove_ball_tac; 
443 
in 

13462  444 
val defBEX_regroup = Simplifier.simproc (Theory.sign_of (the_context ())) 
445 
"defined BEX" ["EX x:A. P x & Q x"] rearrange_bex; 

446 
val defBALL_regroup = Simplifier.simproc (Theory.sign_of (the_context ())) 

447 
"defined BALL" ["ALL x:A. P x > Q x"] rearrange_ball; 

11979  448 
end; 
13462  449 

450 
Addsimprocs [defBALL_regroup, defBEX_regroup]; 

11979  451 
*} 
452 

453 

454 
subsubsection {* Congruence rules *} 

455 

16636
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

456 
lemma ball_cong: 
11979  457 
"A = B ==> (!!x. x:B ==> P x = Q x) ==> 
458 
(ALL x:A. P x) = (ALL x:B. Q x)" 

459 
by (simp add: Ball_def) 

460 

16636
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

461 
lemma strong_ball_cong [cong]: 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

462 
"A = B ==> (!!x. x:B =simp=> P x = Q x) ==> 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

463 
(ALL x:A. P x) = (ALL x:B. Q x)" 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

464 
by (simp add: simp_implies_def Ball_def) 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

465 

1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

466 
lemma bex_cong: 
11979  467 
"A = B ==> (!!x. x:B ==> P x = Q x) ==> 
468 
(EX x:A. P x) = (EX x:B. Q x)" 

469 
by (simp add: Bex_def cong: conj_cong) 

1273  470 

16636
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

471 
lemma strong_bex_cong [cong]: 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

472 
"A = B ==> (!!x. x:B =simp=> P x = Q x) ==> 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

473 
(EX x:A. P x) = (EX x:B. Q x)" 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

474 
by (simp add: simp_implies_def Bex_def cong: conj_cong) 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

475 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
5931
diff
changeset

476 

11979  477 
subsubsection {* Subsets *} 
478 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

479 
lemma subsetI [intro!]: "(!!x. x:A ==> x:B) ==> A \<subseteq> B" 
11979  480 
by (simp add: subset_def) 
481 

482 
text {* 

483 
\medskip Map the type @{text "'a set => anything"} to just @{typ 

484 
'a}; for overloading constants whose first argument has type @{typ 

485 
"'a set"}. 

486 
*} 

487 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

488 
lemma subsetD [elim]: "A \<subseteq> B ==> c \<in> A ==> c \<in> B" 
11979  489 
 {* Rule in Modus Ponens style. *} 
490 
by (unfold subset_def) blast 

491 

492 
declare subsetD [intro?]  FIXME 

493 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

494 
lemma rev_subsetD: "c \<in> A ==> A \<subseteq> B ==> c \<in> B" 
11979  495 
 {* The same, with reversed premises for use with @{text erule}  
496 
cf @{text rev_mp}. *} 

497 
by (rule subsetD) 

498 

499 
declare rev_subsetD [intro?]  FIXME 

500 

501 
text {* 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

502 
\medskip Converts @{prop "A \<subseteq> B"} to @{prop "x \<in> A ==> x \<in> B"}. 
11979  503 
*} 
504 

505 
ML {* 

506 
local val rev_subsetD = thm "rev_subsetD" 

507 
in fun impOfSubs th = th RSN (2, rev_subsetD) end; 

508 
*} 

509 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

510 
lemma subsetCE [elim]: "A \<subseteq> B ==> (c \<notin> A ==> P) ==> (c \<in> B ==> P) ==> P" 
11979  511 
 {* Classical elimination rule. *} 
512 
by (unfold subset_def) blast 

513 

514 
text {* 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

515 
\medskip Takes assumptions @{prop "A \<subseteq> B"}; @{prop "c \<in> A"} and 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

516 
creates the assumption @{prop "c \<in> B"}. 
11979  517 
*} 
518 

519 
ML {* 

520 
local val subsetCE = thm "subsetCE" 

521 
in fun set_mp_tac i = etac subsetCE i THEN mp_tac i end; 

522 
*} 

523 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

524 
lemma contra_subsetD: "A \<subseteq> B ==> c \<notin> B ==> c \<notin> A" 
11979  525 
by blast 
526 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

527 
lemma subset_refl: "A \<subseteq> A" 
11979  528 
by fast 
529 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

530 
lemma subset_trans: "A \<subseteq> B ==> B \<subseteq> C ==> A \<subseteq> C" 
11979  531 
by blast 
923  532 

2261  533 

11979  534 
subsubsection {* Equality *} 
535 

13865  536 
lemma set_ext: assumes prem: "(!!x. (x:A) = (x:B))" shows "A = B" 
537 
apply (rule prem [THEN ext, THEN arg_cong, THEN box_equals]) 

538 
apply (rule Collect_mem_eq) 

539 
apply (rule Collect_mem_eq) 

540 
done 

541 

15554  542 
(* Due to Brian Huffman *) 
543 
lemma expand_set_eq: "(A = B) = (ALL x. (x:A) = (x:B))" 

544 
by(auto intro:set_ext) 

545 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

546 
lemma subset_antisym [intro!]: "A \<subseteq> B ==> B \<subseteq> A ==> A = B" 
11979  547 
 {* Antisymmetry of the subset relation. *} 
17589  548 
by (iprover intro: set_ext subsetD) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

549 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

550 
lemmas equalityI [intro!] = subset_antisym 
11979  551 

552 
text {* 

553 
\medskip Equality rules from ZF set theory  are they appropriate 

554 
here? 

555 
*} 

556 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

557 
lemma equalityD1: "A = B ==> A \<subseteq> B" 
11979  558 
by (simp add: subset_refl) 
559 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

560 
lemma equalityD2: "A = B ==> B \<subseteq> A" 
11979  561 
by (simp add: subset_refl) 
562 

563 
text {* 

564 
\medskip Be careful when adding this to the claset as @{text 

565 
subset_empty} is in the simpset: @{prop "A = {}"} goes to @{prop "{} 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

566 
\<subseteq> A"} and @{prop "A \<subseteq> {}"} and then back to @{prop "A = {}"}! 
11979  567 
*} 
568 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

569 
lemma equalityE: "A = B ==> (A \<subseteq> B ==> B \<subseteq> A ==> P) ==> P" 
11979  570 
by (simp add: subset_refl) 
923  571 

11979  572 
lemma equalityCE [elim]: 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

573 
"A = B ==> (c \<in> A ==> c \<in> B ==> P) ==> (c \<notin> A ==> c \<notin> B ==> P) ==> P" 
11979  574 
by blast 
575 

576 
text {* 

577 
\medskip Lemma for creating induction formulae  for "pattern 

578 
matching" on @{text p}. To make the induction hypotheses usable, 

579 
apply @{text spec} or @{text bspec} to put universal quantifiers over the free 

580 
variables in @{text p}. 

581 
*} 

582 

583 
lemma setup_induction: "p:A ==> (!!z. z:A ==> p = z > R) ==> R" 

584 
by simp 

923  585 

11979  586 
lemma eqset_imp_iff: "A = B ==> (x : A) = (x : B)" 
587 
by simp 

588 

13865  589 
lemma eqelem_imp_iff: "x = y ==> (x : A) = (y : A)" 
590 
by simp 

591 

11979  592 

593 
subsubsection {* The universal set  UNIV *} 

594 

595 
lemma UNIV_I [simp]: "x : UNIV" 

596 
by (simp add: UNIV_def) 

597 

598 
declare UNIV_I [intro]  {* unsafe makes it less likely to cause problems *} 

599 

600 
lemma UNIV_witness [intro?]: "EX x. x : UNIV" 

601 
by simp 

602 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

603 
lemma subset_UNIV: "A \<subseteq> UNIV" 
11979  604 
by (rule subsetI) (rule UNIV_I) 
2388  605 

11979  606 
text {* 
607 
\medskip Etacontracting these two rules (to remove @{text P}) 

608 
causes them to be ignored because of their interaction with 

609 
congruence rules. 

610 
*} 

611 

612 
lemma ball_UNIV [simp]: "Ball UNIV P = All P" 

613 
by (simp add: Ball_def) 

614 

615 
lemma bex_UNIV [simp]: "Bex UNIV P = Ex P" 

616 
by (simp add: Bex_def) 

617 

618 

619 
subsubsection {* The empty set *} 

620 

621 
lemma empty_iff [simp]: "(c : {}) = False" 

622 
by (simp add: empty_def) 

623 

624 
lemma emptyE [elim!]: "a : {} ==> P" 

625 
by simp 

626 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

627 
lemma empty_subsetI [iff]: "{} \<subseteq> A" 
11979  628 
 {* One effect is to delete the ASSUMPTION @{prop "{} <= A"} *} 
629 
by blast 

630 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

631 
lemma equals0I: "(!!y. y \<in> A ==> False) ==> A = {}" 
11979  632 
by blast 
2388  633 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

634 
lemma equals0D: "A = {} ==> a \<notin> A" 
11979  635 
 {* Use for reasoning about disjointness: @{prop "A Int B = {}"} *} 
636 
by blast 

637 

638 
lemma ball_empty [simp]: "Ball {} P = True" 

639 
by (simp add: Ball_def) 

640 

641 
lemma bex_empty [simp]: "Bex {} P = False" 

642 
by (simp add: Bex_def) 

643 

644 
lemma UNIV_not_empty [iff]: "UNIV ~= {}" 

645 
by (blast elim: equalityE) 

646 

647 

12023  648 
subsubsection {* The Powerset operator  Pow *} 
11979  649 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

650 
lemma Pow_iff [iff]: "(A \<in> Pow B) = (A \<subseteq> B)" 
11979  651 
by (simp add: Pow_def) 
652 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

653 
lemma PowI: "A \<subseteq> B ==> A \<in> Pow B" 
11979  654 
by (simp add: Pow_def) 
655 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

656 
lemma PowD: "A \<in> Pow B ==> A \<subseteq> B" 
11979  657 
by (simp add: Pow_def) 
658 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

659 
lemma Pow_bottom: "{} \<in> Pow B" 
11979  660 
by simp 
661 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

662 
lemma Pow_top: "A \<in> Pow A" 
11979  663 
by (simp add: subset_refl) 
2684  664 

2388  665 

11979  666 
subsubsection {* Set complement *} 
667 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

668 
lemma Compl_iff [simp]: "(c \<in> A) = (c \<notin> A)" 
11979  669 
by (unfold Compl_def) blast 
670 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

671 
lemma ComplI [intro!]: "(c \<in> A ==> False) ==> c \<in> A" 
11979  672 
by (unfold Compl_def) blast 
673 

674 
text {* 

675 
\medskip This form, with negated conclusion, works well with the 

676 
Classical prover. Negated assumptions behave like formulae on the 

677 
right side of the notional turnstile ... *} 

678 

17084
fb0a80aef0be
classical rules must have names for ATP integration
paulson
parents:
17002
diff
changeset

679 
lemma ComplD [dest!]: "c : A ==> c~:A" 
11979  680 
by (unfold Compl_def) blast 
681 

17084
fb0a80aef0be
classical rules must have names for ATP integration
paulson
parents:
17002
diff
changeset

682 
lemmas ComplE = ComplD [elim_format] 
11979  683 

684 

685 
subsubsection {* Binary union  Un *} 

923  686 

11979  687 
lemma Un_iff [simp]: "(c : A Un B) = (c:A  c:B)" 
688 
by (unfold Un_def) blast 

689 

690 
lemma UnI1 [elim?]: "c:A ==> c : A Un B" 

691 
by simp 

692 

693 
lemma UnI2 [elim?]: "c:B ==> c : A Un B" 

694 
by simp 

923  695 

11979  696 
text {* 
697 
\medskip Classical introduction rule: no commitment to @{prop A} vs 

698 
@{prop B}. 

699 
*} 

700 

701 
lemma UnCI [intro!]: "(c~:B ==> c:A) ==> c : A Un B" 

702 
by auto 

703 

704 
lemma UnE [elim!]: "c : A Un B ==> (c:A ==> P) ==> (c:B ==> P) ==> P" 

705 
by (unfold Un_def) blast 

706 

707 

12023  708 
subsubsection {* Binary intersection  Int *} 
923  709 

11979  710 
lemma Int_iff [simp]: "(c : A Int B) = (c:A & c:B)" 
711 
by (unfold Int_def) blast 

712 

713 
lemma IntI [intro!]: "c:A ==> c:B ==> c : A Int B" 

714 
by simp 

715 

716 
lemma IntD1: "c : A Int B ==> c:A" 

717 
by simp 

718 

719 
lemma IntD2: "c : A Int B ==> c:B" 

720 
by simp 

721 

722 
lemma IntE [elim!]: "c : A Int B ==> (c:A ==> c:B ==> P) ==> P" 

723 
by simp 

724 

725 

12023  726 
subsubsection {* Set difference *} 
11979  727 

728 
lemma Diff_iff [simp]: "(c : A  B) = (c:A & c~:B)" 

729 
by (unfold set_diff_def) blast 

923  730 

11979  731 
lemma DiffI [intro!]: "c : A ==> c ~: B ==> c : A  B" 
732 
by simp 

733 

734 
lemma DiffD1: "c : A  B ==> c : A" 

735 
by simp 

736 

737 
lemma DiffD2: "c : A  B ==> c : B ==> P" 

738 
by simp 

739 

740 
lemma DiffE [elim!]: "c : A  B ==> (c:A ==> c~:B ==> P) ==> P" 

741 
by simp 

742 

743 

744 
subsubsection {* Augmenting a set  insert *} 

745 

746 
lemma insert_iff [simp]: "(a : insert b A) = (a = b  a:A)" 

747 
by (unfold insert_def) blast 

748 

749 
lemma insertI1: "a : insert a B" 

750 
by simp 

751 

752 
lemma insertI2: "a : B ==> a : insert b B" 

753 
by simp 

923  754 

11979  755 
lemma insertE [elim!]: "a : insert b A ==> (a = b ==> P) ==> (a:A ==> P) ==> P" 
756 
by (unfold insert_def) blast 

757 

758 
lemma insertCI [intro!]: "(a~:B ==> a = b) ==> a: insert b B" 

759 
 {* Classical introduction rule. *} 

760 
by auto 

761 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

762 
lemma subset_insert_iff: "(A \<subseteq> insert x B) = (if x:A then A  {x} \<subseteq> B else A \<subseteq> B)" 
11979  763 
by auto 
764 

765 

766 
subsubsection {* Singletons, using insert *} 

767 

768 
lemma singletonI [intro!]: "a : {a}" 

769 
 {* Redundant? But unlike @{text insertCI}, it proves the subgoal immediately! *} 

770 
by (rule insertI1) 

771 

17084
fb0a80aef0be
classical rules must have names for ATP integration
paulson
parents:
17002
diff
changeset

772 
lemma singletonD [dest!]: "b : {a} ==> b = a" 
11979  773 
by blast 
774 

17084
fb0a80aef0be
classical rules must have names for ATP integration
paulson
parents:
17002
diff
changeset

775 
lemmas singletonE = singletonD [elim_format] 
11979  776 

777 
lemma singleton_iff: "(b : {a}) = (b = a)" 

778 
by blast 

779 

780 
lemma singleton_inject [dest!]: "{a} = {b} ==> a = b" 

781 
by blast 

782 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

783 
lemma singleton_insert_inj_eq [iff]: "({b} = insert a A) = (a = b & A \<subseteq> {b})" 
11979  784 
by blast 
785 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

786 
lemma singleton_insert_inj_eq' [iff]: "(insert a A = {b}) = (a = b & A \<subseteq> {b})" 
11979  787 
by blast 
788 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

789 
lemma subset_singletonD: "A \<subseteq> {x} ==> A = {}  A = {x}" 
11979  790 
by fast 
791 

792 
lemma singleton_conv [simp]: "{x. x = a} = {a}" 

793 
by blast 

794 

795 
lemma singleton_conv2 [simp]: "{x. a = x} = {a}" 

796 
by blast 

923  797 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

798 
lemma diff_single_insert: "A  {x} \<subseteq> B ==> x \<in> A ==> A \<subseteq> insert x B" 
11979  799 
by blast 
800 

801 

802 
subsubsection {* Unions of families *} 

803 

804 
text {* 

805 
@{term [source] "UN x:A. B x"} is @{term "Union (B`A)"}. 

806 
*} 

807 

808 
lemma UN_iff [simp]: "(b: (UN x:A. B x)) = (EX x:A. b: B x)" 

809 
by (unfold UNION_def) blast 

810 

811 
lemma UN_I [intro]: "a:A ==> b: B a ==> b: (UN x:A. B x)" 

812 
 {* The order of the premises presupposes that @{term A} is rigid; 

813 
@{term b} may be flexible. *} 

814 
by auto 

815 

816 
lemma UN_E [elim!]: "b : (UN x:A. B x) ==> (!!x. x:A ==> b: B x ==> R) ==> R" 

817 
by (unfold UNION_def) blast 

923  818 

11979  819 
lemma UN_cong [cong]: 
820 
"A = B ==> (!!x. x:B ==> C x = D x) ==> (UN x:A. C x) = (UN x:B. D x)" 

821 
by (simp add: UNION_def) 

822 

823 

824 
subsubsection {* Intersections of families *} 

825 

826 
text {* @{term [source] "INT x:A. B x"} is @{term "Inter (B`A)"}. *} 

827 

828 
lemma INT_iff [simp]: "(b: (INT x:A. B x)) = (ALL x:A. b: B x)" 

829 
by (unfold INTER_def) blast 

923  830 

11979  831 
lemma INT_I [intro!]: "(!!x. x:A ==> b: B x) ==> b : (INT x:A. B x)" 
832 
by (unfold INTER_def) blast 

833 

834 
lemma INT_D [elim]: "b : (INT x:A. B x) ==> a:A ==> b: B a" 

835 
by auto 

836 

837 
lemma INT_E [elim]: "b : (INT x:A. B x) ==> (b: B a ==> R) ==> (a~:A ==> R) ==> R" 

838 
 {* "Classical" elimination  by the Excluded Middle on @{prop "a:A"}. *} 

839 
by (unfold INTER_def) blast 

840 

841 
lemma INT_cong [cong]: 

842 
"A = B ==> (!!x. x:B ==> C x = D x) ==> (INT x:A. C x) = (INT x:B. D x)" 

843 
by (simp add: INTER_def) 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
5931
diff
changeset

844 

923  845 

11979  846 
subsubsection {* Union *} 
847 

848 
lemma Union_iff [simp]: "(A : Union C) = (EX X:C. A:X)" 

849 
by (unfold Union_def) blast 

850 

851 
lemma UnionI [intro]: "X:C ==> A:X ==> A : Union C" 

852 
 {* The order of the premises presupposes that @{term C} is rigid; 

853 
@{term A} may be flexible. *} 

854 
by auto 

855 

856 
lemma UnionE [elim!]: "A : Union C ==> (!!X. A:X ==> X:C ==> R) ==> R" 

857 
by (unfold Union_def) blast 

858 

859 

860 
subsubsection {* Inter *} 

861 

862 
lemma Inter_iff [simp]: "(A : Inter C) = (ALL X:C. A:X)" 

863 
by (unfold Inter_def) blast 

864 

865 
lemma InterI [intro!]: "(!!X. X:C ==> A:X) ==> A : Inter C" 

866 
by (simp add: Inter_def) 

867 

868 
text {* 

869 
\medskip A ``destruct'' rule  every @{term X} in @{term C} 

870 
contains @{term A} as an element, but @{prop "A:X"} can hold when 

871 
@{prop "X:C"} does not! This rule is analogous to @{text spec}. 

872 
*} 

873 

874 
lemma InterD [elim]: "A : Inter C ==> X:C ==> A:X" 

875 
by auto 

876 

877 
lemma InterE [elim]: "A : Inter C ==> (X~:C ==> R) ==> (A:X ==> R) ==> R" 

878 
 {* ``Classical'' elimination rule  does not require proving 

879 
@{prop "X:C"}. *} 

880 
by (unfold Inter_def) blast 

881 

882 
text {* 

883 
\medskip Image of a set under a function. Frequently @{term b} does 

884 
not have the syntactic form of @{term "f x"}. 

885 
*} 

886 

887 
lemma image_eqI [simp, intro]: "b = f x ==> x:A ==> b : f`A" 

888 
by (unfold image_def) blast 

889 

890 
lemma imageI: "x : A ==> f x : f ` A" 

891 
by (rule image_eqI) (rule refl) 

892 

893 
lemma rev_image_eqI: "x:A ==> b = f x ==> b : f`A" 

894 
 {* This version's more effective when we already have the 

895 
required @{term x}. *} 

896 
by (unfold image_def) blast 

897 

898 
lemma imageE [elim!]: 

899 
"b : (%x. f x)`A ==> (!!x. b = f x ==> x:A ==> P) ==> P" 

900 
 {* The etaexpansion gives variablename preservation. *} 

901 
by (unfold image_def) blast 

902 

903 
lemma image_Un: "f`(A Un B) = f`A Un f`B" 

904 
by blast 

905 

906 
lemma image_iff: "(z : f`A) = (EX x:A. z = f x)" 

907 
by blast 

908 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

909 
lemma image_subset_iff: "(f`A \<subseteq> B) = (\<forall>x\<in>A. f x \<in> B)" 
11979  910 
 {* This rewrite rule would confuse users if made default. *} 
911 
by blast 

912 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

913 
lemma subset_image_iff: "(B \<subseteq> f`A) = (EX AA. AA \<subseteq> A & B = f`AA)" 
11979  914 
apply safe 
915 
prefer 2 apply fast 

14208  916 
apply (rule_tac x = "{a. a : A & f a : B}" in exI, fast) 
11979  917 
done 
918 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

919 
lemma image_subsetI: "(!!x. x \<in> A ==> f x \<in> B) ==> f`A \<subseteq> B" 
11979  920 
 {* Replaces the three steps @{text subsetI}, @{text imageE}, 
921 
@{text hypsubst}, but breaks too many existing proofs. *} 

922 
by blast 

923 

924 
text {* 

925 
\medskip Range of a function  just a translation for image! 

926 
*} 

927 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

928 
lemma range_eqI: "b = f x ==> b \<in> range f" 
11979  929 
by simp 
930 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

931 
lemma rangeI: "f x \<in> range f" 
11979  932 
by simp 
933 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

934 
lemma rangeE [elim?]: "b \<in> range (\<lambda>x. f x) ==> (!!x. b = f x ==> P) ==> P" 
11979  935 
by blast 
936 

937 

938 
subsubsection {* Set reasoning tools *} 

939 

940 
text {* 

941 
Rewrite rules for boolean casesplitting: faster than @{text 

942 
"split_if [split]"}. 

943 
*} 

944 

945 
lemma split_if_eq1: "((if Q then x else y) = b) = ((Q > x = b) & (~ Q > y = b))" 

946 
by (rule split_if) 

947 

948 
lemma split_if_eq2: "(a = (if Q then x else y)) = ((Q > a = x) & (~ Q > a = y))" 

949 
by (rule split_if) 

950 

951 
text {* 

952 
Split ifs on either side of the membership relation. Not for @{text 

953 
"[simp]"}  can cause goals to blow up! 

954 
*} 

955 

956 
lemma split_if_mem1: "((if Q then x else y) : b) = ((Q > x : b) & (~ Q > y : b))" 

957 
by (rule split_if) 

958 

959 
lemma split_if_mem2: "(a : (if Q then x else y)) = ((Q > a : x) & (~ Q > a : y))" 

960 
by (rule split_if) 

961 

962 
lemmas split_ifs = if_bool_eq_conj split_if_eq1 split_if_eq2 split_if_mem1 split_if_mem2 

963 

964 
lemmas mem_simps = 

965 
insert_iff empty_iff Un_iff Int_iff Compl_iff Diff_iff 

966 
mem_Collect_eq UN_iff Union_iff INT_iff Inter_iff 

967 
 {* Each of these has ALREADY been added @{text "[simp]"} above. *} 

968 

969 
(*Would like to add these, but the existing code only searches for the 

970 
outerlevel constant, which in this case is just "op :"; we instead need 

971 
to use termnets to associate patterns with rules. Also, if a rule fails to 

972 
apply, then the formula should be kept. 

973 
[("uminus", Compl_iff RS iffD1), ("op ", [Diff_iff RS iffD1]), 

974 
("op Int", [IntD1,IntD2]), 

975 
("Collect", [CollectD]), ("Inter", [InterD]), ("INTER", [INT_D])] 

976 
*) 

977 

978 
ML_setup {* 

979 
val mksimps_pairs = [("Ball", [thm "bspec"])] @ mksimps_pairs; 

980 
simpset_ref() := simpset() setmksimps (mksimps mksimps_pairs); 

981 
*} 

982 

983 
declare subset_UNIV [simp] subset_refl [simp] 

984 

985 

986 
subsubsection {* The ``proper subset'' relation *} 

987 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

988 
lemma psubsetI [intro!]: "A \<subseteq> B ==> A \<noteq> B ==> A \<subset> B" 
11979  989 
by (unfold psubset_def) blast 
990 

13624  991 
lemma psubsetE [elim!]: 
992 
"[A \<subset> B; [A \<subseteq> B; ~ (B\<subseteq>A)] ==> R] ==> R" 

993 
by (unfold psubset_def) blast 

994 

11979  995 
lemma psubset_insert_iff: 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

996 
"(A \<subset> insert x B) = (if x \<in> B then A \<subset> B else if x \<in> A then A  {x} \<subset> B else A \<subseteq> B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

997 
by (auto simp add: psubset_def subset_insert_iff) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

998 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

999 
lemma psubset_eq: "(A \<subset> B) = (A \<subseteq> B & A \<noteq> B)" 
11979  1000 
by (simp only: psubset_def) 
1001 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1002 
lemma psubset_imp_subset: "A \<subset> B ==> A \<subseteq> B" 
11979  1003 
by (simp add: psubset_eq) 
1004 

14335  1005 
lemma psubset_trans: "[ A \<subset> B; B \<subset> C ] ==> A \<subset> C" 
1006 
apply (unfold psubset_def) 

1007 
apply (auto dest: subset_antisym) 

1008 
done 

1009 

1010 
lemma psubsetD: "[ A \<subset> B; c \<in> A ] ==> c \<in> B" 

1011 
apply (unfold psubset_def) 

1012 
apply (auto dest: subsetD) 

1013 
done 

1014 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1015 
lemma psubset_subset_trans: "A \<subset> B ==> B \<subseteq> C ==> A \<subset> C" 
11979  1016 
by (auto simp add: psubset_eq) 
1017 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1018 
lemma subset_psubset_trans: "A \<subseteq> B ==> B \<subset> C ==> A \<subset> C" 
11979  1019 
by (auto simp add: psubset_eq) 
1020 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1021 
lemma psubset_imp_ex_mem: "A \<subset> B ==> \<exists>b. b \<in> (B  A)" 
11979  1022 
by (unfold psubset_def) blast 
1023 

1024 
lemma atomize_ball: 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1025 
"(!!x. x \<in> A ==> P x) == Trueprop (\<forall>x\<in>A. P x)" 
11979  1026 
by (simp only: Ball_def atomize_all atomize_imp) 
1027 

1028 
declare atomize_ball [symmetric, rulify] 

1029 

1030 

1031 
subsection {* Further settheory lemmas *} 

1032 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1033 
subsubsection {* Derived rules involving subsets. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1034 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1035 
text {* @{text insert}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1036 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1037 
lemma subset_insertI: "B \<subseteq> insert a B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1038 
apply (rule subsetI) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1039 
apply (erule insertI2) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1040 
done 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1041 

14302  1042 
lemma subset_insertI2: "A \<subseteq> B \<Longrightarrow> A \<subseteq> insert b B" 
1043 
by blast 

1044 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1045 
lemma subset_insert: "x \<notin> A ==> (A \<subseteq> insert x B) = (A \<subseteq> B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1046 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1047 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1048 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1049 
text {* \medskip Big Union  least upper bound of a set. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1050 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1051 
lemma Union_upper: "B \<in> A ==> B \<subseteq> Union A" 
17589  1052 
by (iprover intro: subsetI UnionI) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1053 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1054 
lemma Union_least: "(!!X. X \<in> A ==> X \<subseteq> C) ==> Union A \<subseteq> C" 
17589  1055 
by (iprover intro: subsetI elim: UnionE dest: subsetD) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1056 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1057 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1058 
text {* \medskip General union. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1059 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1060 
lemma UN_upper: "a \<in> A ==> B a \<subseteq> (\<Union>x\<in>A. B x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1061 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1062 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1063 
lemma UN_least: "(!!x. x \<in> A ==> B x \<subseteq> C) ==> (\<Union>x\<in>A. B x) \<subseteq> C" 
17589  1064 
by (iprover intro: subsetI elim: UN_E dest: subsetD) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1065 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1066 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1067 
text {* \medskip Big Intersection  greatest lower bound of a set. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1068 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1069 
lemma Inter_lower: "B \<in> A ==> Inter A \<subseteq> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1070 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1071 

14551  1072 
lemma Inter_subset: 
1073 
"[ !!X. X \<in> A ==> X \<subseteq> B; A ~= {} ] ==> \<Inter>A \<subseteq> B" 

1074 
by blast 

1075 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1076 
lemma Inter_greatest: "(!!X. X \<in> A ==> C \<subseteq> X) ==> C \<subseteq> Inter A" 
17589  1077 
by (iprover intro: InterI subsetI dest: subsetD) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1078 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1079 
lemma INT_lower: "a \<in> A ==> (\<Inter>x\<in>A. B x) \<subseteq> B a" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1080 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1081 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1082 
lemma INT_greatest: "(!!x. x \<in> A ==> C \<subseteq> B x) ==> C \<subseteq> (\<Inter>x\<in>A. B x)" 
17589  1083 
by (iprover intro: INT_I subsetI dest: subsetD) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1084 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1085 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1086 
text {* \medskip Finite Union  the least upper bound of two sets. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1087 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1088 
lemma Un_upper1: "A \<subseteq> A \<union> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1089 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1090 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1091 
lemma Un_upper2: "B \<subseteq> A \<union> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1092 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1093 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1094 
lemma Un_least: "A \<subseteq> C ==> B \<subseteq> C ==> A \<union> B \<subseteq> C" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1095 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1096 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1097 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1098 
text {* \medskip Finite Intersection  the greatest lower bound of two sets. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1099 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1100 
lemma Int_lower1: "A \<inter> B \<subseteq> A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1101 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1102 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1103 
lemma Int_lower2: "A \<inter> B \<subseteq> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1104 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1105 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1106 
lemma Int_greatest: "C \<subseteq> A ==> C \<subseteq> B ==> C \<subseteq> A \<inter> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1107 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1108 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1109 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1110 
text {* \medskip Set difference. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1111 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1112 
lemma Diff_subset: "A  B \<subseteq> A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1113 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1114 

14302  1115 
lemma Diff_subset_conv: "(A  B \<subseteq> C) = (A \<subseteq> B \<union> C)" 
1116 
by blast 

1117 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1118 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1119 
text {* \medskip Monotonicity. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1120 

15206
09d78ec709c7
Modified locales: improved implementation of "includes".
ballarin
parents:
15140
diff
changeset

1121 
lemma mono_Un: "mono f ==> f A \<union> f B \<subseteq> f (A \<union> B)" 
16773  1122 
by (auto simp add: mono_def) 
15206
09d78ec709c7
Modified locales: improved implementation of "includes".
ballarin
parents:
15140
diff
changeset

1123 

09d78ec709c7
Modified locales: improved implementation of "includes".
ballarin
parents:
15140
diff
changeset

1124 
lemma mono_Int: "mono f ==> f (A \<inter> B) \<subseteq> f A \<inter> f B" 
16773  1125 
by (auto simp add: mono_def) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1126 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1127 
subsubsection {* Equalities involving union, intersection, inclusion, etc. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1128 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1129 
text {* @{text "{}"}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1130 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1131 
lemma Collect_const [simp]: "{s. P} = (if P then UNIV else {})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1132 
 {* supersedes @{text "Collect_False_empty"} *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1133 
by auto 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1134 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1135 
lemma subset_empty [simp]: "(A \<subseteq> {}) = (A = {})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1136 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1137 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1138 
lemma not_psubset_empty [iff]: "\<not> (A < {})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1139 
by (unfold psubset_def) blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1140 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1141 
lemma Collect_empty_eq [simp]: "(Collect P = {}) = (\<forall>x. \<not> P x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1142 
by auto 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1143 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1144 
lemma Collect_neg_eq: "{x. \<not> P x} =  {x. P x}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1145 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1146 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1147 
lemma Collect_disj_eq: "{x. P x  Q x} = {x. P x} \<union> {x. Q x}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1148 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1149 

14812  1150 
lemma Collect_imp_eq: "{x. P x > Q x} = {x. P x} \<union> {x. Q x}" 
1151 
by blast 

1152 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1153 
lemma Collect_conj_eq: "{x. P x & Q x} = {x. P x} \<inter> {x. Q x}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1154 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1155 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1156 
lemma Collect_all_eq: "{x. \<forall>y. P x y} = (\<Inter>y. {x. P x y})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1157 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1158 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1159 
lemma Collect_ball_eq: "{x. \<forall>y\<in>A. P x y} = (\<Inter>y\<in>A. {x. P x y})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1160 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1161 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1162 
lemma Collect_ex_eq: "{x. \<exists>y. P x y} = (\<Union>y. {x. P x y})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1163 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1164 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1165 
lemma Collect_bex_eq: "{x. \<exists>y\<in>A. P x y} = (\<Union>y\<in>A. {x. P x y})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1166 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1167 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1168 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1169 
text {* \medskip @{text insert}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1170 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1171 
lemma insert_is_Un: "insert a A = {a} Un A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1172 
 {* NOT SUITABLE FOR REWRITING since @{text "{a} == insert a {}"} *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1173 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1174 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1175 
lemma insert_not_empty [simp]: "insert a A \<noteq> {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1176 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1177 

17715  1178 
lemmas empty_not_insert = insert_not_empty [symmetric, standard] 
1179 
declare empty_not_insert [simp] 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1180 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1181 
lemma insert_absorb: "a \<in> A ==> insert a A = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1182 
 {* @{text "[simp]"} causes recursive calls when there are nested inserts *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1183 
 {* with \emph{quadratic} running time *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1184 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1185 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1186 
lemma insert_absorb2 [simp]: "insert x (insert x A) = insert x A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1187 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1188 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1189 
lemma insert_commute: "insert x (insert y A) = insert y (insert x A)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1190 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1191 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1192 
lemma insert_subset [simp]: "(insert x A \<subseteq> B) = (x \<in> B & A \<subseteq> B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1193 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1194 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1195 
lemma mk_disjoint_insert: "a \<in> A ==> \<exists>B. A = insert a B & a \<notin> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1196 
 {* use new @{text B} rather than @{text "A  {a}"} to avoid infinite unfolding *} 
14208  1197 
apply (rule_tac x = "A  {a}" in exI, blast) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1198 
done 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1199 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1200 
lemma insert_Collect: "insert a (Collect P) = {u. u \<noteq> a > P u}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1201 
by auto 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1202 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1203 
lemma UN_insert_distrib: "u \<in> A ==> (\<Union>x\<in>A. insert a (B x)) = insert a (\<Union>x\<in>A. B x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1204 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1205 

14302  1206 
lemma insert_inter_insert[simp]: "insert a A \<inter> insert a B = insert a (A \<inter> B)" 
14742  1207 
by blast 
14302  1208 

13103
66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1209 
lemma insert_disjoint[simp]: 
66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1210 
"(insert a A \<inter> B = {}) = (a \<notin> B \<and> A \<inter> B = {})" 
14742  1211 
"({} = insert a A \<inter> B) = (a \<notin> B \<and> {} = A \<inter> B)" 
16773  1212 
by auto 
13103
66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1213 

66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1214 
lemma disjoint_insert[simp]: 
66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1215 
"(B \<inter> insert a A = {}) = (a \<notin> B \<and> B \<inter> A = {})" 
14742  1216 
"({} = A \<inter> insert b B) = (b \<notin> A \<and> {} = A \<inter> B)" 
16773  1217 
by auto 
14742  1218 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1219 
text {* \medskip @{text image}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1220 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1221 
lemma image_empty [simp]: "f`{} = {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1222 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1223 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1224 
lemma image_insert [simp]: "f ` insert a B = insert (f a) (f`B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1225 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1226 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1227 
lemma image_constant: "x \<in> A ==> (\<lambda>x. c) ` A = {c}" 
16773  1228 
by auto 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1229 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1230 
lemma image_image: "f ` (g ` A) = (\<lambda>x. f (g x)) ` A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1231 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1232 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1233 
lemma insert_image [simp]: "x \<in> A ==> insert (f x) (f`A) = f`A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1234 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1235 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1236 
lemma image_is_empty [iff]: "(f`A = {}) = (A = {})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1237 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1238 

16773  1239 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1240 
lemma image_Collect: "f ` {x. P x} = {f x  x. P x}" 
16773  1241 
 {* NOT suitable as a default simprule: the RHS isn't simpler than the LHS, 
1242 
with its implicit quantifier and conjunction. Also image enjoys better 

1243 
equational properties than does the RHS. *} 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1244 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1245 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1246 
lemma if_image_distrib [simp]: 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1247 
"(\<lambda>x. if P x then f x else g x) ` S 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1248 
= (f ` (S \<inter> {x. P x})) \<union> (g ` (S \<inter> {x. \<not> P x}))" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1249 
by (auto simp add: image_def) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1250 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1251 
lemma image_cong: "M = N ==> (!!x. x \<in> N ==> f x = g x) ==> f`M = g`N" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1252 
by (simp add: image_def) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1253 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1254 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1255 
text {* \medskip @{text range}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1256 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1257 
lemma full_SetCompr_eq: "{u. \<exists>x. u = f x} = range f" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1258 
by auto 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1259 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1260 
lemma range_composition [simp]: "range (\<lambda>x. f (g x)) = f`range g" 
14208  1261 
by (subst image_image, simp) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1262 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1263 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1264 
text {* \medskip @{text Int} *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1265 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1266 
lemma Int_absorb [simp]: "A \<inter> A = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1267 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1268 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1269 
lemma Int_left_absorb: "A \<inter> (A \<inter> B) = A \<inter> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1270 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1271 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1272 
lemma Int_commute: "A \<inter> B = B \<inter> A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1273 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1274 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1275 
lemma Int_left_commute: "A \<inter> (B \<inter> C) = B \<inter> (A \<inter> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1276 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1277 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1278 
lemma Int_assoc: "(A \<inter> B) \<inter> C = A \<inter> (B \<inter> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1279 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1280 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1281 
lemmas Int_ac = Int_assoc Int_left_absorb Int_commute Int_left_commute 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1282 
 {* Intersection is an ACoperator *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1283 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1284 
lemma Int_absorb1: "B \<subseteq> A ==> A \<inter> B = B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1285 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1286 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1287 
lemma Int_absorb2: "A \<subseteq> B ==> A \<inter> B = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1288 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1289 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1290 
lemma Int_empty_left [simp]: "{} \<inter> B = {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1291 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1292 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1293 
lemma Int_empty_right [simp]: "A \<inter> {} = {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1294 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1295 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1296 
lemma disjoint_eq_subset_Compl: "(A \<inter> B = {}) = (A \<subseteq> B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1297 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1298 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1299 
lemma disjoint_iff_not_equal: "(A \<inter> B = {}) = (\<forall>x\<in>A. \<forall>y\<in>B. x \<noteq> y)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1300 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1301 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1302 
lemma Int_UNIV_left [simp]: "UNIV \<inter> B = B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1303 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1304 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1305 
lemma Int_UNIV_right [simp]: "A \<inter> UNIV = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1306 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1307 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1308 
lemma Int_eq_Inter: "A \<inter> B = \<Inter>{A, B}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1309 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1310 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1311 
lemma Int_Un_distrib: "A \<inter> (B \<union> C) = (A \<inter> B) \<union> (A \<inter> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1312 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1313 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1314 
lemma Int_Un_distrib2: "(B \<union> C) \<inter> A = (B \<inter> A) \<union> (C \<inter> A)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1315 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1316 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1317 
lemma Int_UNIV [simp]: "(A \<inter> B = UNIV) = (A = UNIV & B = UNIV)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1318 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1319 

15102  1320 
lemma Int_subset_iff [simp]: "(C \<subseteq> A \<inter> B) = (C \<subseteq> A & C \<subseteq> B)" 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1321 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1322 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1323 
lemma Int_Collect: "(x \<in> A \<inter> {x. P x}) = (x \<in> A & P x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1324 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1325 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1326 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1327 
text {* \medskip @{text Un}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1328 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1329 
lemma Un_absorb [simp]: "A \<union> A = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1330 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1331 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1332 
lemma Un_left_absorb: "A \<union> (A \<union> B) = A \<union> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1333 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1334 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1335 
lemma Un_commute: "A \<union> B = B \<union> A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1336 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1337 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1338 
lemma Un_left_commute: "A \<union> (B \<union> C) = B \<union> (A \<union> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1339 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1340 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1341 
lemma Un_assoc: "(A \<union> B) \<union> C = A \<union> (B \<union> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1342 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1343 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1344 
lemmas Un_ac = Un_assoc Un_left_absorb Un_commute Un_left_commute 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1345 
 {* Union is an ACoperator *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1346 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1347 
lemma Un_absorb1: "A \<subseteq> B ==> A \<union> B = B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1348 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1349 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1350 
lemma Un_absorb2: "B \<subseteq> A ==> A \<union> B = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1351 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1352 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1353 
lemma Un_empty_left [simp]: "{} \<union> B = B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1354 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1355 
