src/HOL/Set.ML
changeset 2499 0bc87b063447
parent 2031 03a843f0f447
child 2608 450c9b682a92
     1.1 --- a/src/HOL/Set.ML	Thu Jan 09 10:22:42 1997 +0100
     1.2 +++ b/src/HOL/Set.ML	Thu Jan 09 10:23:39 1997 +0100
     1.3 @@ -10,13 +10,14 @@
     1.4  
     1.5  section "Relating predicates and sets";
     1.6  
     1.7 -val [prem] = goal Set.thy "P(a) ==> a : {x.P(x)}";
     1.8 -by (stac mem_Collect_eq 1);
     1.9 -by (rtac prem 1);
    1.10 +AddIffs [mem_Collect_eq];
    1.11 +
    1.12 +goal Set.thy "!!a. P(a) ==> a : {x.P(x)}";
    1.13 +by (Asm_simp_tac 1);
    1.14  qed "CollectI";
    1.15  
    1.16 -val prems = goal Set.thy "[| a : {x.P(x)} |] ==> P(a)";
    1.17 -by (resolve_tac (prems RL [mem_Collect_eq  RS subst]) 1);
    1.18 +val prems = goal Set.thy "!!a. a : {x.P(x)} ==> P(a)";
    1.19 +by (Asm_full_simp_tac 1);
    1.20  qed "CollectD";
    1.21  
    1.22  val [prem] = goal Set.thy "[| !!x. (x:A) = (x:B) |] ==> A = B";
    1.23 @@ -31,6 +32,10 @@
    1.24  
    1.25  val CollectE = make_elim CollectD;
    1.26  
    1.27 +AddSIs [CollectI];
    1.28 +AddSEs [CollectE];
    1.29 +
    1.30 +
    1.31  section "Bounded quantifiers";
    1.32  
    1.33  val prems = goalw Set.thy [Ball_def]
    1.34 @@ -52,6 +57,9 @@
    1.35  (*Takes assumptions ! x:A.P(x) and a:A; creates assumption P(a)*)
    1.36  fun ball_tac i = etac ballE i THEN contr_tac (i+1);
    1.37  
    1.38 +AddSIs [ballI];
    1.39 +AddEs  [ballE];
    1.40 +
    1.41  val prems = goalw Set.thy [Bex_def]
    1.42      "[| P(x);  x:A |] ==> ? x:A. P(x)";
    1.43  by (REPEAT (ares_tac (prems @ [exI,conjI]) 1));
    1.44 @@ -69,6 +77,9 @@
    1.45  by (REPEAT (eresolve_tac (prems @ [asm_rl,conjE]) 1));
    1.46  qed "bexE";
    1.47  
    1.48 +AddIs  [bexI];
    1.49 +AddSEs [bexE];
    1.50 +
    1.51  (*Trival rewrite rule;   (! x:A.P)=P holds only if A is nonempty!*)
    1.52  goalw Set.thy [Ball_def] "(! x:A. True) = True";
    1.53  by (Simp_tac 1);
    1.54 @@ -134,12 +145,14 @@
    1.55  (*Takes assumptions A<=B; c:A and creates the assumption c:B *)
    1.56  fun set_mp_tac i = etac subsetCE i  THEN  mp_tac i;
    1.57  
    1.58 -qed_goal "subset_refl" Set.thy "A <= (A::'a set)"
    1.59 - (fn _=> [ (REPEAT (ares_tac [subsetI] 1)) ]);
    1.60 +AddSIs [subsetI];
    1.61 +AddEs  [subsetD, subsetCE];
    1.62  
    1.63 -val prems = goal Set.thy "[| A<=B;  B<=C |] ==> A<=(C::'a set)";
    1.64 -by (cut_facts_tac prems 1);
    1.65 -by (REPEAT (ares_tac [subsetI] 1 ORELSE set_mp_tac 1));
    1.66 +qed_goal "subset_refl" Set.thy "A <= (A::'a set)"
    1.67 + (fn _=> [Fast_tac 1]);
    1.68 +
    1.69 +val prems = goal Set.thy "!!B. [| A<=B;  B<=C |] ==> A<=(C::'a set)";
    1.70 +by (Fast_tac 1);
    1.71  qed "subset_trans";
    1.72  
    1.73  
    1.74 @@ -189,6 +202,11 @@
    1.75  
    1.76  section "Set complement -- Compl";
    1.77  
    1.78 +qed_goalw "Compl_iff" Set.thy [Compl_def] "(c : Compl(A)) = (c~:A)"
    1.79 + (fn _ => [ (Fast_tac 1) ]);
    1.80 +
    1.81 +Addsimps [Compl_iff];
    1.82 +
    1.83  val prems = goalw Set.thy [Compl_def]
    1.84      "[| c:A ==> False |] ==> c : Compl(A)";
    1.85  by (REPEAT (ares_tac (prems @ [CollectI,notI]) 1));
    1.86 @@ -198,32 +216,36 @@
    1.87    Negated assumptions behave like formulae on the right side of the notional
    1.88    turnstile...*)
    1.89  val major::prems = goalw Set.thy [Compl_def]
    1.90 -    "[| c : Compl(A) |] ==> c~:A";
    1.91 +    "c : Compl(A) ==> c~:A";
    1.92  by (rtac (major RS CollectD) 1);
    1.93  qed "ComplD";
    1.94  
    1.95  val ComplE = make_elim ComplD;
    1.96  
    1.97 -qed_goal "Compl_iff" Set.thy "(c : Compl(A)) = (c~:A)"
    1.98 - (fn _ => [ (fast_tac (!claset addSIs [ComplI] addSEs [ComplE]) 1) ]);
    1.99 +AddSIs [ComplI];
   1.100 +AddSEs [ComplE];
   1.101  
   1.102  
   1.103  section "Binary union -- Un";
   1.104  
   1.105 -val prems = goalw Set.thy [Un_def] "c:A ==> c : A Un B";
   1.106 -by (REPEAT (resolve_tac (prems @ [CollectI,disjI1]) 1));
   1.107 +qed_goalw "Un_iff" Set.thy [Un_def] "(c : A Un B) = (c:A | c:B)"
   1.108 + (fn _ => [ Fast_tac 1 ]);
   1.109 +
   1.110 +Addsimps [Un_iff];
   1.111 +
   1.112 +goal Set.thy "!!c. c:A ==> c : A Un B";
   1.113 +by (Asm_simp_tac 1);
   1.114  qed "UnI1";
   1.115  
   1.116 -val prems = goalw Set.thy [Un_def] "c:B ==> c : A Un B";
   1.117 -by (REPEAT (resolve_tac (prems @ [CollectI,disjI2]) 1));
   1.118 +goal Set.thy "!!c. c:B ==> c : A Un B";
   1.119 +by (Asm_simp_tac 1);
   1.120  qed "UnI2";
   1.121  
   1.122  (*Classical introduction rule: no commitment to A vs B*)
   1.123  qed_goal "UnCI" Set.thy "(c~:B ==> c:A) ==> c : A Un B"
   1.124   (fn prems=>
   1.125 -  [ (rtac classical 1),
   1.126 -    (REPEAT (ares_tac (prems@[UnI1,notI]) 1)),
   1.127 -    (REPEAT (ares_tac (prems@[UnI2,notE]) 1)) ]);
   1.128 +  [ (Simp_tac 1),
   1.129 +    (REPEAT (ares_tac (prems@[disjCI]) 1)) ]);
   1.130  
   1.131  val major::prems = goalw Set.thy [Un_def]
   1.132      "[| c : A Un B;  c:A ==> P;  c:B ==> P |] ==> P";
   1.133 @@ -231,23 +253,27 @@
   1.134  by (REPEAT (eresolve_tac prems 1));
   1.135  qed "UnE";
   1.136  
   1.137 -qed_goal "Un_iff" Set.thy "(c : A Un B) = (c:A | c:B)"
   1.138 - (fn _ => [ (fast_tac (!claset addSIs [UnCI] addSEs [UnE]) 1) ]);
   1.139 +AddSIs [UnCI];
   1.140 +AddSEs [UnE];
   1.141  
   1.142  
   1.143  section "Binary intersection -- Int";
   1.144  
   1.145 -val prems = goalw Set.thy [Int_def]
   1.146 -    "[| c:A;  c:B |] ==> c : A Int B";
   1.147 -by (REPEAT (resolve_tac (prems @ [CollectI,conjI]) 1));
   1.148 +qed_goalw "Int_iff" Set.thy [Int_def] "(c : A Int B) = (c:A & c:B)"
   1.149 + (fn _ => [ (Fast_tac 1) ]);
   1.150 +
   1.151 +Addsimps [Int_iff];
   1.152 +
   1.153 +goal Set.thy "!!c. [| c:A;  c:B |] ==> c : A Int B";
   1.154 +by (Asm_simp_tac 1);
   1.155  qed "IntI";
   1.156  
   1.157 -val [major] = goalw Set.thy [Int_def] "c : A Int B ==> c:A";
   1.158 -by (rtac (major RS CollectD RS conjunct1) 1);
   1.159 +goal Set.thy "!!c. c : A Int B ==> c:A";
   1.160 +by (Asm_full_simp_tac 1);
   1.161  qed "IntD1";
   1.162  
   1.163 -val [major] = goalw Set.thy [Int_def] "c : A Int B ==> c:B";
   1.164 -by (rtac (major RS CollectD RS conjunct2) 1);
   1.165 +goal Set.thy "!!c. c : A Int B ==> c:B";
   1.166 +by (Asm_full_simp_tac 1);
   1.167  qed "IntD2";
   1.168  
   1.169  val [major,minor] = goal Set.thy
   1.170 @@ -257,53 +283,54 @@
   1.171  by (rtac (major RS IntD2) 1);
   1.172  qed "IntE";
   1.173  
   1.174 -qed_goal "Int_iff" Set.thy "(c : A Int B) = (c:A & c:B)"
   1.175 - (fn _ => [ (fast_tac (!claset addSIs [IntI] addSEs [IntE]) 1) ]);
   1.176 -
   1.177 +AddSIs [IntI];
   1.178 +AddSEs [IntE];
   1.179  
   1.180  section "Set difference";
   1.181  
   1.182 -qed_goalw "DiffI" Set.thy [set_diff_def]
   1.183 -    "[| c : A;  c ~: B |] ==> c : A - B"
   1.184 - (fn prems=> [ (REPEAT (resolve_tac (prems @ [CollectI,conjI]) 1)) ]);
   1.185 +qed_goalw "Diff_iff" Set.thy [set_diff_def] "(c : A-B) = (c:A & c~:B)"
   1.186 + (fn _ => [ (Fast_tac 1) ]);
   1.187  
   1.188 -qed_goalw "DiffD1" Set.thy [set_diff_def]
   1.189 -    "c : A - B ==> c : A"
   1.190 - (fn [major]=> [ (rtac (major RS CollectD RS conjunct1) 1) ]);
   1.191 +Addsimps [Diff_iff];
   1.192 +
   1.193 +qed_goal "DiffI" Set.thy "!!c. [| c : A;  c ~: B |] ==> c : A - B"
   1.194 + (fn _=> [ Asm_simp_tac 1 ]);
   1.195  
   1.196 -qed_goalw "DiffD2" Set.thy [set_diff_def]
   1.197 -    "[| c : A - B;  c : B |] ==> P"
   1.198 - (fn [major,minor]=>
   1.199 -     [rtac (minor RS (major RS CollectD RS conjunct2 RS notE)) 1]);
   1.200 +qed_goal "DiffD1" Set.thy "!!c. c : A - B ==> c : A"
   1.201 + (fn _=> [ (Asm_full_simp_tac 1) ]);
   1.202  
   1.203 -qed_goal "DiffE" Set.thy
   1.204 -    "[| c : A - B;  [| c:A; c~:B |] ==> P |] ==> P"
   1.205 +qed_goal "DiffD2" Set.thy "!!c. [| c : A - B;  c : B |] ==> P"
   1.206 + (fn _=> [ (Asm_full_simp_tac 1) ]);
   1.207 +
   1.208 +qed_goal "DiffE" Set.thy "[| c : A - B;  [| c:A; c~:B |] ==> P |] ==> P"
   1.209   (fn prems=>
   1.210    [ (resolve_tac prems 1),
   1.211      (REPEAT (ares_tac (prems RL [DiffD1, DiffD2 RS notI]) 1)) ]);
   1.212  
   1.213 -qed_goal "Diff_iff" Set.thy "(c : A-B) = (c:A & c~:B)"
   1.214 - (fn _ => [ (fast_tac (!claset addSIs [DiffI] addSEs [DiffE]) 1) ]);
   1.215 +AddSIs [DiffI];
   1.216 +AddSEs [DiffE];
   1.217  
   1.218  section "The empty set -- {}";
   1.219  
   1.220 -qed_goalw "emptyE" Set.thy [empty_def] "a:{} ==> P"
   1.221 - (fn [prem] => [rtac (prem RS CollectD RS FalseE) 1]);
   1.222 +qed_goalw "empty_iff" Set.thy [empty_def] "(c : {}) = False"
   1.223 + (fn _ => [ (Fast_tac 1) ]);
   1.224 +
   1.225 +Addsimps [empty_iff];
   1.226 +
   1.227 +qed_goal "emptyE" Set.thy "!!a. a:{} ==> P"
   1.228 + (fn _ => [Full_simp_tac 1]);
   1.229 +
   1.230 +AddSEs [emptyE];
   1.231  
   1.232  qed_goal "empty_subsetI" Set.thy "{} <= A"
   1.233 - (fn _ => [ (REPEAT (ares_tac [equalityI,subsetI,emptyE] 1)) ]);
   1.234 + (fn _ => [ (Fast_tac 1) ]);
   1.235  
   1.236  qed_goal "equals0I" Set.thy "[| !!y. y:A ==> False |] ==> A={}"
   1.237 - (fn prems=>
   1.238 -  [ (REPEAT (ares_tac (prems@[empty_subsetI,subsetI,equalityI]) 1 
   1.239 -      ORELSE eresolve_tac (prems RL [FalseE]) 1)) ]);
   1.240 + (fn [prem]=>
   1.241 +  [ (fast_tac (!claset addIs [prem RS FalseE]) 1) ]);
   1.242  
   1.243 -qed_goal "equals0D" Set.thy "[| A={};  a:A |] ==> P"
   1.244 - (fn [major,minor]=>
   1.245 -  [ (rtac (minor RS (major RS equalityD1 RS subsetD RS emptyE)) 1) ]);
   1.246 -
   1.247 -qed_goal "empty_iff" Set.thy "(c : {}) = False"
   1.248 - (fn _ => [ (fast_tac (!claset addSEs [emptyE]) 1) ]);
   1.249 +qed_goal "equals0D" Set.thy "!!a. [| A={};  a:A |] ==> P"
   1.250 + (fn _ => [ (Fast_tac 1) ]);
   1.251  
   1.252  goal Set.thy "Ball {} P = True";
   1.253  by (simp_tac (HOL_ss addsimps [mem_Collect_eq, Ball_def, empty_def]) 1);
   1.254 @@ -317,11 +344,16 @@
   1.255  
   1.256  section "Augmenting a set -- insert";
   1.257  
   1.258 -qed_goalw "insertI1" Set.thy [insert_def] "a : insert a B"
   1.259 - (fn _ => [rtac (CollectI RS UnI1) 1, rtac refl 1]);
   1.260 +qed_goalw "insert_iff" Set.thy [insert_def] "a : insert b A = (a=b | a:A)"
   1.261 + (fn _ => [Fast_tac 1]);
   1.262 +
   1.263 +Addsimps [insert_iff];
   1.264  
   1.265 -qed_goalw "insertI2" Set.thy [insert_def] "a : B ==> a : insert b B"
   1.266 - (fn [prem]=> [ (rtac (prem RS UnI2) 1) ]);
   1.267 +qed_goal "insertI1" Set.thy "a : insert a B"
   1.268 + (fn _ => [Simp_tac 1]);
   1.269 +
   1.270 +qed_goal "insertI2" Set.thy "!!a. a : B ==> a : insert b B"
   1.271 + (fn _=> [Asm_simp_tac 1]);
   1.272  
   1.273  qed_goalw "insertE" Set.thy [insert_def]
   1.274      "[| a : insert b A;  a=b ==> P;  a:A ==> P |] ==> P"
   1.275 @@ -329,37 +361,35 @@
   1.276    [ (rtac (major RS UnE) 1),
   1.277      (REPEAT (eresolve_tac (prems @ [CollectE]) 1)) ]);
   1.278  
   1.279 -qed_goal "insert_iff" Set.thy "a : insert b A = (a=b | a:A)"
   1.280 - (fn _ => [fast_tac (!claset addIs [insertI1,insertI2] addSEs [insertE]) 1]);
   1.281 -
   1.282  (*Classical introduction rule*)
   1.283  qed_goal "insertCI" Set.thy "(a~:B ==> a=b) ==> a: insert b B"
   1.284 - (fn [prem]=>
   1.285 -  [ (rtac (disjCI RS (insert_iff RS iffD2)) 1),
   1.286 -    (etac prem 1) ]);
   1.287 + (fn prems=>
   1.288 +  [ (Simp_tac 1),
   1.289 +    (REPEAT (ares_tac (prems@[disjCI]) 1)) ]);
   1.290 +
   1.291 +AddSIs [insertCI]; 
   1.292 +AddSEs [insertE];
   1.293  
   1.294  section "Singletons, using insert";
   1.295  
   1.296  qed_goal "singletonI" Set.thy "a : {a}"
   1.297   (fn _=> [ (rtac insertI1 1) ]);
   1.298  
   1.299 -goalw Set.thy [insert_def] "!!a. b : {a} ==> b=a";
   1.300 -by (fast_tac (!claset addSEs [emptyE,CollectE,UnE]) 1);
   1.301 +goal Set.thy "!!a. b : {a} ==> b=a";
   1.302 +by (Fast_tac 1);
   1.303  qed "singletonD";
   1.304  
   1.305  bind_thm ("singletonE", make_elim singletonD);
   1.306  
   1.307 -qed_goal "singleton_iff" thy "(b : {a}) = (b=a)" (fn _ => [
   1.308 -        rtac iffI 1,
   1.309 -        etac singletonD 1,
   1.310 -        hyp_subst_tac 1,
   1.311 -        rtac singletonI 1]);
   1.312 +qed_goal "singleton_iff" thy "(b : {a}) = (b=a)" 
   1.313 +(fn _ => [Fast_tac 1]);
   1.314  
   1.315 -val [major] = goal Set.thy "{a}={b} ==> a=b";
   1.316 -by (rtac (major RS equalityD1 RS subsetD RS singletonD) 1);
   1.317 -by (rtac singletonI 1);
   1.318 +goal Set.thy "!!a b. {a}={b} ==> a=b";
   1.319 +by (fast_tac (!claset addEs [equalityE]) 1);
   1.320  qed "singleton_inject";
   1.321  
   1.322 +AddSDs [singleton_inject];
   1.323 +
   1.324  
   1.325  section "The universal set -- UNIV";
   1.326  
   1.327 @@ -372,10 +402,15 @@
   1.328  
   1.329  section "Unions of families -- UNION x:A. B(x) is Union(B``A)";
   1.330  
   1.331 +goalw Set.thy [UNION_def] "(b: (UN x:A. B(x))) = (EX x:A. b: B(x))";
   1.332 +by (Fast_tac 1);
   1.333 +qed "UN_iff";
   1.334 +
   1.335 +Addsimps [UN_iff];
   1.336 +
   1.337  (*The order of the premises presupposes that A is rigid; b may be flexible*)
   1.338 -val prems = goalw Set.thy [UNION_def]
   1.339 -    "[| a:A;  b: B(a) |] ==> b: (UN x:A. B(x))";
   1.340 -by (REPEAT (resolve_tac (prems @ [bexI,CollectI]) 1));
   1.341 +goal Set.thy "!!b. [| a:A;  b: B(a) |] ==> b: (UN x:A. B(x))";
   1.342 +by (Auto_tac());
   1.343  qed "UN_I";
   1.344  
   1.345  val major::prems = goalw Set.thy [UNION_def]
   1.346 @@ -384,6 +419,9 @@
   1.347  by (REPEAT (ares_tac prems 1));
   1.348  qed "UN_E";
   1.349  
   1.350 +AddIs  [UN_I];
   1.351 +AddSEs [UN_E];
   1.352 +
   1.353  val prems = goal Set.thy
   1.354      "[| A=B;  !!x. x:B ==> C(x) = D(x) |] ==> \
   1.355  \    (UN x:A. C(x)) = (UN x:B. D(x))";
   1.356 @@ -395,15 +433,19 @@
   1.357  
   1.358  section "Intersections of families -- INTER x:A. B(x) is Inter(B``A)";
   1.359  
   1.360 +goalw Set.thy [INTER_def] "(b: (INT x:A. B(x))) = (ALL x:A. b: B(x))";
   1.361 +by (Auto_tac());
   1.362 +qed "INT_iff";
   1.363 +
   1.364 +Addsimps [INT_iff];
   1.365 +
   1.366  val prems = goalw Set.thy [INTER_def]
   1.367      "(!!x. x:A ==> b: B(x)) ==> b : (INT x:A. B(x))";
   1.368  by (REPEAT (ares_tac ([CollectI,ballI] @ prems) 1));
   1.369  qed "INT_I";
   1.370  
   1.371 -val major::prems = goalw Set.thy [INTER_def]
   1.372 -    "[| b : (INT x:A. B(x));  a:A |] ==> b: B(a)";
   1.373 -by (rtac (major RS CollectD RS bspec) 1);
   1.374 -by (resolve_tac prems 1);
   1.375 +goal Set.thy "!!b. [| b : (INT x:A. B(x));  a:A |] ==> b: B(a)";
   1.376 +by (Auto_tac());
   1.377  qed "INT_D";
   1.378  
   1.379  (*"Classical" elimination -- by the Excluded Middle on a:A *)
   1.380 @@ -413,6 +455,9 @@
   1.381  by (REPEAT (eresolve_tac prems 1));
   1.382  qed "INT_E";
   1.383  
   1.384 +AddSIs [INT_I];
   1.385 +AddEs  [INT_D, INT_E];
   1.386 +
   1.387  val prems = goal Set.thy
   1.388      "[| A=B;  !!x. x:B ==> C(x) = D(x) |] ==> \
   1.389  \    (INT x:A. C(x)) = (INT x:B. D(x))";
   1.390 @@ -424,10 +469,16 @@
   1.391  
   1.392  section "Unions over a type; UNION1(B) = Union(range(B))";
   1.393  
   1.394 +goalw Set.thy [UNION1_def] "(b: (UN x. B(x))) = (EX x. b: B(x))";
   1.395 +by (Simp_tac 1);
   1.396 +by (Fast_tac 1);
   1.397 +qed "UN1_iff";
   1.398 +
   1.399 +Addsimps [UN1_iff];
   1.400 +
   1.401  (*The order of the premises presupposes that A is rigid; b may be flexible*)
   1.402 -val prems = goalw Set.thy [UNION1_def]
   1.403 -    "b: B(x) ==> b: (UN x. B(x))";
   1.404 -by (REPEAT (resolve_tac (prems @ [TrueI, CollectI RS UN_I]) 1));
   1.405 +goal Set.thy "!!b. b: B(x) ==> b: (UN x. B(x))";
   1.406 +by (Auto_tac());
   1.407  qed "UN1_I";
   1.408  
   1.409  val major::prems = goalw Set.thy [UNION1_def]
   1.410 @@ -436,25 +487,43 @@
   1.411  by (REPEAT (ares_tac prems 1));
   1.412  qed "UN1_E";
   1.413  
   1.414 +AddIs  [UN1_I];
   1.415 +AddSEs [UN1_E];
   1.416 +
   1.417  
   1.418  section "Intersections over a type; INTER1(B) = Inter(range(B))";
   1.419  
   1.420 +goalw Set.thy [INTER1_def] "(b: (INT x. B(x))) = (ALL x. b: B(x))";
   1.421 +by (Simp_tac 1);
   1.422 +by (Fast_tac 1);
   1.423 +qed "INT1_iff";
   1.424 +
   1.425 +Addsimps [INT1_iff];
   1.426 +
   1.427  val prems = goalw Set.thy [INTER1_def]
   1.428      "(!!x. b: B(x)) ==> b : (INT x. B(x))";
   1.429  by (REPEAT (ares_tac (INT_I::prems) 1));
   1.430  qed "INT1_I";
   1.431  
   1.432 -val [major] = goalw Set.thy [INTER1_def]
   1.433 -    "b : (INT x. B(x)) ==> b: B(a)";
   1.434 -by (rtac (TrueI RS (CollectI RS (major RS INT_D))) 1);
   1.435 +goal Set.thy "!!b. b : (INT x. B(x)) ==> b: B(a)";
   1.436 +by (Asm_full_simp_tac 1);
   1.437  qed "INT1_D";
   1.438  
   1.439 +AddSIs [INT1_I]; 
   1.440 +AddDs  [INT1_D];
   1.441 +
   1.442 +
   1.443  section "Union";
   1.444  
   1.445 +goalw Set.thy [Union_def] "(A : Union(C)) = (EX X:C. A:X)";
   1.446 +by (Fast_tac 1);
   1.447 +qed "Union_iff";
   1.448 +
   1.449 +Addsimps [Union_iff];
   1.450 +
   1.451  (*The order of the premises presupposes that C is rigid; A may be flexible*)
   1.452 -val prems = goalw Set.thy [Union_def]
   1.453 -    "[| X:C;  A:X |] ==> A : Union(C)";
   1.454 -by (REPEAT (resolve_tac (prems @ [UN_I]) 1));
   1.455 +goal Set.thy "!!X. [| X:C;  A:X |] ==> A : Union(C)";
   1.456 +by (Auto_tac());
   1.457  qed "UnionI";
   1.458  
   1.459  val major::prems = goalw Set.thy [Union_def]
   1.460 @@ -463,8 +532,18 @@
   1.461  by (REPEAT (ares_tac prems 1));
   1.462  qed "UnionE";
   1.463  
   1.464 +AddIs  [UnionI];
   1.465 +AddSEs [UnionE];
   1.466 +
   1.467 +
   1.468  section "Inter";
   1.469  
   1.470 +goalw Set.thy [Inter_def] "(A : Inter(C)) = (ALL X:C. A:X)";
   1.471 +by (Fast_tac 1);
   1.472 +qed "Inter_iff";
   1.473 +
   1.474 +Addsimps [Inter_iff];
   1.475 +
   1.476  val prems = goalw Set.thy [Inter_def]
   1.477      "[| !!X. X:C ==> A:X |] ==> A : Inter(C)";
   1.478  by (REPEAT (ares_tac ([INT_I] @ prems) 1));
   1.479 @@ -472,10 +551,8 @@
   1.480  
   1.481  (*A "destruct" rule -- every X in C contains A as an element, but
   1.482    A:X can hold when X:C does not!  This rule is analogous to "spec". *)
   1.483 -val major::prems = goalw Set.thy [Inter_def]
   1.484 -    "[| A : Inter(C);  X:C |] ==> A:X";
   1.485 -by (rtac (major RS INT_D) 1);
   1.486 -by (resolve_tac prems 1);
   1.487 +goal Set.thy "!!X. [| A : Inter(C);  X:C |] ==> A:X";
   1.488 +by (Auto_tac());
   1.489  qed "InterD";
   1.490  
   1.491  (*"Classical" elimination rule -- does not require proving X:C *)
   1.492 @@ -485,8 +562,17 @@
   1.493  by (REPEAT (eresolve_tac prems 1));
   1.494  qed "InterE";
   1.495  
   1.496 +AddSIs [InterI];
   1.497 +AddEs  [InterD, InterE];
   1.498 +
   1.499 +
   1.500  section "The Powerset operator -- Pow";
   1.501  
   1.502 +qed_goalw "Pow_iff" Set.thy [Pow_def] "(A : Pow(B)) = (A <= B)"
   1.503 + (fn _ => [ (Asm_simp_tac 1) ]);
   1.504 +
   1.505 +AddIffs [Pow_iff]; 
   1.506 +
   1.507  qed_goalw "PowI" Set.thy [Pow_def] "!!A B. A <= B ==> A : Pow(B)"
   1.508   (fn _ => [ (etac CollectI 1) ]);
   1.509  
   1.510 @@ -501,8 +587,11 @@
   1.511  (*** Set reasoning tools ***)
   1.512  
   1.513  
   1.514 +(*Each of these has ALREADY been added to !simpset above.*)
   1.515  val mem_simps = [insert_iff, empty_iff, Un_iff, Int_iff, Compl_iff, Diff_iff, 
   1.516 -                 mem_Collect_eq];
   1.517 +                 mem_Collect_eq, 
   1.518 +		 UN_iff, UN1_iff, Union_iff, 
   1.519 +		 INT_iff, INT1_iff, Inter_iff];
   1.520  
   1.521  (*Not for Addsimps -- it can cause goals to blow up!*)
   1.522  goal Set.thy "(a : (if Q then x else y)) = ((Q --> a:x) & (~Q --> a : y))";
   1.523 @@ -511,6 +600,5 @@
   1.524  
   1.525  val mksimps_pairs = ("Ball",[bspec]) :: mksimps_pairs;
   1.526  
   1.527 -simpset := !simpset addsimps mem_simps
   1.528 -                    addcongs [ball_cong,bex_cong]
   1.529 +simpset := !simpset addcongs [ball_cong,bex_cong]
   1.530                      setmksimps (mksimps mksimps_pairs);