src/ZF/equalities.ML
changeset 12199 8213fd95acb5
parent 11695 8c66866fb0ff
child 12891 92af5c3a10fb
equal deleted inserted replaced
12198:113c1cd7a164 12199:8213fd95acb5
    40 qed "Int_cons";
    40 qed "Int_cons";
    41 
    41 
    42 Goal "A Int A = A";
    42 Goal "A Int A = A";
    43 by (Blast_tac 1);
    43 by (Blast_tac 1);
    44 qed "Int_absorb";
    44 qed "Int_absorb";
       
    45 Addsimps [Int_absorb];
       
    46 
       
    47 Goal "A Int (A Int B) = A Int B";
       
    48 by (Blast_tac 1);
       
    49 qed "Int_left_absorb";
    45 
    50 
    46 Goal "A Int B = B Int A";
    51 Goal "A Int B = B Int A";
    47 by (Blast_tac 1);
    52 by (Blast_tac 1);
    48 qed "Int_commute";
    53 qed "Int_commute";
    49 
    54 
       
    55 Goal "A Int (B Int C) = B Int (A Int C)";
       
    56 by (Blast_tac 1);
       
    57 qed "Int_left_commute";
       
    58 
    50 Goal "(A Int B) Int C  =  A Int (B Int C)";
    59 Goal "(A Int B) Int C  =  A Int (B Int C)";
    51 by (Blast_tac 1);
    60 by (Blast_tac 1);
    52 qed "Int_assoc";
    61 qed "Int_assoc";
    53 
    62 
    54 Goal "(A Un B) Int C  =  (A Int C) Un (B Int C)";
    63 (*Intersection is an AC-operator*)
       
    64 bind_thms ("Int_ac", 
       
    65            [Int_assoc, Int_left_absorb, Int_commute, Int_left_commute]);
       
    66 
       
    67 Goal "A Int (B Un C) = (A Int B) Un (A Int C)";
    55 by (Blast_tac 1);
    68 by (Blast_tac 1);
    56 qed "Int_Un_distrib";
    69 qed "Int_Un_distrib";
       
    70 
       
    71 Goal "(B Un C) Int A = (B Int A) Un (C Int A)";
       
    72 by (Blast_tac 1);
       
    73 qed "Int_Un_distrib2";
    57 
    74 
    58 Goal "A<=B <-> A Int B = A";
    75 Goal "A<=B <-> A Int B = A";
    59 by (blast_tac (claset() addSEs [equalityE]) 1);
    76 by (blast_tac (claset() addSEs [equalityE]) 1);
    60 qed "subset_Int_iff";
    77 qed "subset_Int_iff";
    61 
    78 
    74 qed "Un_cons";
    91 qed "Un_cons";
    75 
    92 
    76 Goal "A Un A = A";
    93 Goal "A Un A = A";
    77 by (Blast_tac 1);
    94 by (Blast_tac 1);
    78 qed "Un_absorb";
    95 qed "Un_absorb";
       
    96 Addsimps [Un_absorb];
       
    97 
       
    98 Goal "A Un (A Un B) = A Un B";
       
    99 by (Blast_tac 1);
       
   100 qed "Un_left_absorb";
    79 
   101 
    80 Goal "A Un B = B Un A";
   102 Goal "A Un B = B Un A";
    81 by (Blast_tac 1);
   103 by (Blast_tac 1);
    82 qed "Un_commute";
   104 qed "Un_commute";
    83 
   105 
       
   106 Goal "A Un (B Un C) = B Un (A Un C)";
       
   107 by (Blast_tac 1);
       
   108 qed "Un_left_commute";
       
   109 
    84 Goal "(A Un B) Un C  =  A Un (B Un C)";
   110 Goal "(A Un B) Un C  =  A Un (B Un C)";
    85 by (Blast_tac 1);
   111 by (Blast_tac 1);
    86 qed "Un_assoc";
   112 qed "Un_assoc";
       
   113 
       
   114 (*Union is an AC-operator*)
       
   115 bind_thms ("Un_ac", [Un_assoc, Un_left_absorb, Un_commute, Un_left_commute]);
    87 
   116 
    88 Goal "(A Int B) Un C  =  (A Un C) Int (B Un C)";
   117 Goal "(A Int B) Un C  =  (A Un C) Int (B Un C)";
    89 by (Blast_tac 1);
   118 by (Blast_tac 1);
    90 qed "Un_Int_distrib";
   119 qed "Un_Int_distrib";
    91 
   120 
    95 
   124 
    96 Goal "A<=B <-> B Un A = B";
   125 Goal "A<=B <-> B Un A = B";
    97 by (blast_tac (claset() addSEs [equalityE]) 1);
   126 by (blast_tac (claset() addSEs [equalityE]) 1);
    98 qed "subset_Un_iff2";
   127 qed "subset_Un_iff2";
    99 
   128 
       
   129 Goal "(A Un B = 0) <-> (A = 0 & B = 0)";
       
   130 by (Blast_tac 1); 
       
   131 qed "Un_empty";
       
   132 AddIffs[Un_empty];
       
   133 
       
   134 Goal "A Un B = Union({A, B})";
       
   135 by (Blast_tac 1);
       
   136 qed "Un_eq_Union";
       
   137 
   100 (** Simple properties of Diff -- set difference **)
   138 (** Simple properties of Diff -- set difference **)
   101 
   139 
   102 Goal "A - A = 0";
   140 Goal "A - A = 0";
   103 by (Blast_tac 1);
   141 by (Blast_tac 1);
   104 qed "Diff_cancel";
   142 qed "Diff_cancel";
   105 
   143 
       
   144 Goal "A  Int B = 0 ==> A - B = A";
       
   145 by (Blast_tac 1);
       
   146 qed "Diff_triv";
       
   147 
   106 Goal "0 - A = 0";
   148 Goal "0 - A = 0";
   107 by (Blast_tac 1);
   149 by (Blast_tac 1);
   108 qed "empty_Diff";
   150 qed "empty_Diff";
       
   151 Addsimps[empty_Diff];
   109 
   152 
   110 Goal "A - 0 = A";
   153 Goal "A - 0 = A";
   111 by (Blast_tac 1);
   154 by (Blast_tac 1);
   112 qed "Diff_0";
   155 qed "Diff_0";
       
   156 Addsimps[Diff_0];
   113 
   157 
   114 Goal "A - B = 0 <-> A <= B";
   158 Goal "A - B = 0 <-> A <= B";
   115 by (blast_tac (claset() addEs [equalityE]) 1);
   159 by (blast_tac (claset() addEs [equalityE]) 1);
   116 qed "Diff_eq_0_iff";
   160 qed "Diff_eq_0_iff";
   117 
   161 
   155 qed "Diff_Un";
   199 qed "Diff_Un";
   156 
   200 
   157 Goal "A - (B Int C) = (A-B) Un (A-C)";
   201 Goal "A - (B Int C) = (A-B) Un (A-C)";
   158 by (Blast_tac 1);
   202 by (Blast_tac 1);
   159 qed "Diff_Int";
   203 qed "Diff_Int";
       
   204 
       
   205 Goal "(A Un B) - C = (A - C) Un (B - C)";
       
   206 by (Blast_tac 1);
       
   207 qed "Un_Diff";
       
   208 
       
   209 Goal "(A Int B) - C = A Int (B - C)";
       
   210 by (Blast_tac 1);
       
   211 qed "Int_Diff";
       
   212 
       
   213 Goal "C Int (A-B) = (C Int A) - (C Int B)";
       
   214 by (Blast_tac 1);
       
   215 qed "Diff_Int_distrib";
       
   216 
       
   217 Goal "(A-B) Int C = (A Int C) - (B Int C)";
       
   218 by (Blast_tac 1);
       
   219 qed "Diff_Int_distrib2";
   160 
   220 
   161 (*Halmos, Naive Set Theory, page 16.*)
   221 (*Halmos, Naive Set Theory, page 16.*)
   162 Goal "(A Int B) Un C = A Int (B Un C)  <->  C<=A";
   222 Goal "(A Int B) Un C = A Int (B Un C)  <->  C<=A";
   163 by (blast_tac (claset() addSEs [equalityE]) 1);
   223 by (blast_tac (claset() addSEs [equalityE]) 1);
   164 qed "Un_Int_assoc_iff";
   224 qed "Un_Int_assoc_iff";
   167 (** Big Union and Intersection **)
   227 (** Big Union and Intersection **)
   168 
   228 
   169 Goal "Union(cons(a,B)) = a Un Union(B)";
   229 Goal "Union(cons(a,B)) = a Un Union(B)";
   170 by (Blast_tac 1);
   230 by (Blast_tac 1);
   171 qed "Union_cons";
   231 qed "Union_cons";
       
   232 Addsimps [Union_cons];
   172 
   233 
   173 Goal "Union(A Un B) = Union(A) Un Union(B)";
   234 Goal "Union(A Un B) = Union(A) Un Union(B)";
   174 by (Blast_tac 1);
   235 by (Blast_tac 1);
   175 qed "Union_Un_distrib";
   236 qed "Union_Un_distrib";
   176 
   237 
   205 
   266 
   206 Goal "Inter({b}) = b";
   267 Goal "Inter({b}) = b";
   207 by (Blast_tac 1);
   268 by (Blast_tac 1);
   208 qed "Inter_singleton";
   269 qed "Inter_singleton";
   209 
   270 
       
   271 Goal "Inter(cons(a,B)) = (if B=0 then a else a Int Inter(B))"; 
       
   272 by (Simp_tac 1);
       
   273 by (Blast_tac 1); 
       
   274 qed "Inter_cons";
       
   275 Addsimps [Inter_cons];
       
   276 
   210 (** Unions and Intersections of Families **)
   277 (** Unions and Intersections of Families **)
   211 
   278 
   212 Goal "Union(A) = (UN x:A. x)";
   279 Goal "Union(A) = (UN x:A. x)";
   213 by (Blast_tac 1);
   280 by (Blast_tac 1);
   214 qed "Union_eq_UN";
   281 qed "Union_eq_UN";
   218 qed "Inter_eq_INT";
   285 qed "Inter_eq_INT";
   219 
   286 
   220 Goal "(UN i:0. A(i)) = 0";
   287 Goal "(UN i:0. A(i)) = 0";
   221 by (Blast_tac 1);
   288 by (Blast_tac 1);
   222 qed "UN_0";
   289 qed "UN_0";
       
   290 Addsimps [UN_0];
       
   291 
       
   292 Goal "(UN x:A. {x}) = A";
       
   293 by (Blast_tac 1);
       
   294 qed "UN_singleton";
       
   295 
       
   296 Goal "(UN i: A Un B. C(i)) = (UN i: A. C(i)) Un (UN i:B. C(i))";
       
   297 by (Blast_tac 1);
       
   298 qed "UN_Un";
       
   299 
       
   300 Goal "(INT i:I Un J. A(i)) = (if I=0 then INT j:J. A(j) \
       
   301 \                             else if J=0 then INT i:I. A(i) \
       
   302 \                             else ((INT i:I. A(i)) Int  (INT j:J. A(j))))"; 
       
   303 by Auto_tac;
       
   304 by (blast_tac (claset() addSIs [equalityI]) 1);
       
   305 qed "INT_Un";
       
   306 
       
   307 Goal "(UN x : (UN y:A. B(y)). C(x)) = (UN y:A. UN x: B(y). C(x))";
       
   308 by (Blast_tac 1);
       
   309 qed "UN_UN_flatten";
   223 
   310 
   224 (*Halmos, Naive Set Theory, page 35.*)
   311 (*Halmos, Naive Set Theory, page 35.*)
   225 Goal "B Int (UN i:I. A(i)) = (UN i:I. B Int A(i))";
   312 Goal "B Int (UN i:I. A(i)) = (UN i:I. B Int A(i))";
   226 by (Blast_tac 1);
   313 by (Blast_tac 1);
   227 qed "Int_UN_distrib";
   314 qed "Int_UN_distrib";
   248 qed "INT_constant";
   335 qed "INT_constant";
   249 
   336 
   250 Goal "(UN y: RepFun(A,f). B(y)) = (UN x:A. B(f(x)))";
   337 Goal "(UN y: RepFun(A,f). B(y)) = (UN x:A. B(f(x)))";
   251 by (Blast_tac 1);
   338 by (Blast_tac 1);
   252 qed "UN_RepFun";
   339 qed "UN_RepFun";
   253 
   340 Addsimps [UN_RepFun];
   254 Goal "x:A ==> (INT y: RepFun(A,f). B(y)) = (INT x:A. B(f(x)))";
   341 
   255 by (Blast_tac 1);
   342 Goal "(INT x:RepFun(A,f). B(x))    = (INT a:A. B(f(a)))";
       
   343 by (auto_tac (claset(), simpset() addsimps [Inter_def])); 
   256 qed "INT_RepFun";
   344 qed "INT_RepFun";
   257 
   345 Addsimps [INT_RepFun];
   258 Addsimps [UN_RepFun, INT_RepFun];
   346 
       
   347 Goal "0 ~: A ==> (INT x: Union(A). B(x)) = (INT y:A. INT x:y. B(x))";
       
   348 by (asm_full_simp_tac (simpset() addsimps [Inter_def]) 1); 
       
   349 by (subgoal_tac "ALL x:A. x~=0" 1);
       
   350 by (Blast_tac 2);
       
   351 by (rtac equalityI 1);   
       
   352 by (Clarify_tac 1); 
       
   353 by (blast_tac (claset() addIs []) 1); 
       
   354 by (blast_tac (claset() addSDs [bspec]) 1);   
       
   355 qed "INT_Union_eq";
       
   356 
       
   357 Goal "(ALL x:A. B(x) ~= 0) \
       
   358 \     ==> (INT z: (UN x:A. B(x)). C(z)) = (INT x:A. INT z: B(x). C(z))";
       
   359 by (stac INT_Union_eq 1);  
       
   360 by (Blast_tac 1);
       
   361 by (simp_tac (simpset() addsimps [Inter_def]) 1); 
       
   362 qed "INT_UN_eq";
   259 
   363 
   260 
   364 
   261 (** Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5: 
   365 (** Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5: 
   262     Union of a family of unions **)
   366     Union of a family of unions **)
   263 
   367 
   349 qed "domain_of_prod";
   453 qed "domain_of_prod";
   350 
   454 
   351 Goal "domain(0) = 0";
   455 Goal "domain(0) = 0";
   352 by (Blast_tac 1);
   456 by (Blast_tac 1);
   353 qed "domain_0";
   457 qed "domain_0";
       
   458 Addsimps [domain_0];
   354 
   459 
   355 Goal "domain(cons(<a,b>,r)) = cons(a, domain(r))";
   460 Goal "domain(cons(<a,b>,r)) = cons(a, domain(r))";
   356 by (Blast_tac 1);
   461 by (Blast_tac 1);
   357 qed "domain_cons";
   462 qed "domain_cons";
       
   463 Addsimps [domain_cons];
   358 
   464 
   359 Goal "domain(A Un B) = domain(A) Un domain(B)";
   465 Goal "domain(A Un B) = domain(A) Un domain(B)";
   360 by (Blast_tac 1);
   466 by (Blast_tac 1);
   361 qed "domain_Un_eq";
   467 qed "domain_Un_eq";
       
   468 Addsimps [domain_Un_eq];
   362 
   469 
   363 Goal "domain(A Int B) <= domain(A) Int domain(B)";
   470 Goal "domain(A Int B) <= domain(A) Int domain(B)";
   364 by (Blast_tac 1);
   471 by (Blast_tac 1);
   365 qed "domain_Int_subset";
   472 qed "domain_Int_subset";
   366 
   473 
   369 qed "domain_Diff_subset";
   476 qed "domain_Diff_subset";
   370 
   477 
   371 Goal "domain(converse(r)) = range(r)";
   478 Goal "domain(converse(r)) = range(r)";
   372 by (Blast_tac 1);
   479 by (Blast_tac 1);
   373 qed "domain_converse";
   480 qed "domain_converse";
   374 
   481 Addsimps [domain_converse];
   375 Addsimps [domain_0, domain_cons, domain_Un_eq, domain_converse];
   482 
       
   483 Goal "domain(UN x:A. B(x)) = (UN x:A. domain(B(x)))";
       
   484 by (Blast_tac 1); 
       
   485 qed "domain_UN";
       
   486 
       
   487 Goal "domain(Union(A)) = (UN x:A. domain(x))";
       
   488 by (Blast_tac 1); 
       
   489 qed "domain_Union";
   376 
   490 
   377 
   491 
   378 (** Range **)
   492 (** Range **)
   379 
   493 
   380 Goal "a:A ==> range(A*B) = B";
   494 Goal "a:A ==> range(A*B) = B";
   484 (** Inverse Image **)
   598 (** Inverse Image **)
   485 
   599 
   486 Goal "r-``0 = 0";
   600 Goal "r-``0 = 0";
   487 by (Blast_tac 1);
   601 by (Blast_tac 1);
   488 qed "vimage_0";
   602 qed "vimage_0";
       
   603 Addsimps [vimage_0];
   489 
   604 
   490 Goal "r-``(A Un B) = (r-``A) Un (r-``B)";
   605 Goal "r-``(A Un B) = (r-``A) Un (r-``B)";
   491 by (Blast_tac 1);
   606 by (Blast_tac 1);
   492 qed "vimage_Un";
   607 qed "vimage_Un";
       
   608 Addsimps [vimage_Un];
   493 
   609 
   494 Goal "r-``(A Int B) <= (r-``A) Int (r-``B)";
   610 Goal "r-``(A Int B) <= (r-``A) Int (r-``B)";
   495 by (Blast_tac 1);
   611 by (Blast_tac 1);
   496 qed "vimage_Int_subset";
   612 qed "vimage_Int_subset";
   497 
   613 
       
   614 (*NOT suitable for rewriting*)
       
   615 Goal "f -``B = (UN y:B. f-``{y})";
       
   616 by (Blast_tac 1);
       
   617 qed "vimage_eq_UN";
       
   618 
   498 Goalw [function_def] "function(f) ==> f-``(A Int B) = (f-``A)  Int  (f-``B)";
   619 Goalw [function_def] "function(f) ==> f-``(A Int B) = (f-``A)  Int  (f-``B)";
   499 by (Blast_tac 1);
   620 by (Blast_tac 1);
   500 qed "function_vimage_Int";
   621 qed "function_vimage_Int";
   501 
   622 
   502 Goalw [function_def] "function(f) ==> f-``(A-B) = (f-``A) - (f-``B)";
   623 Goalw [function_def] "function(f) ==> f-``(A-B) = (f-``A) - (f-``B)";
   513 
   634 
   514 Goal "B<=A ==> (r Int A*A)-``B = (r-``B) Int A";
   635 Goal "B<=A ==> (r Int A*A)-``B = (r-``B) Int A";
   515 by (Blast_tac 1);
   636 by (Blast_tac 1);
   516 qed "vimage_Int_square";
   637 qed "vimage_Int_square";
   517 
   638 
   518 Addsimps [vimage_0, vimage_Un];
       
   519 
   639 
   520 
   640 
   521 (*Invese image laws for special relations*)
   641 (*Invese image laws for special relations*)
   522 Goal "0-``A = 0";
   642 Goal "0-``A = 0";
   523 by (Blast_tac 1);
   643 by (Blast_tac 1);
   601 (** RepFun **)
   721 (** RepFun **)
   602 
   722 
   603 Goal "{f(x).x:A}=0 <-> A=0";
   723 Goal "{f(x).x:A}=0 <-> A=0";
   604 by (Blast_tac 1);
   724 by (Blast_tac 1);
   605 qed "RepFun_eq_0_iff";
   725 qed "RepFun_eq_0_iff";
       
   726 Addsimps [RepFun_eq_0_iff];
       
   727 
       
   728 Goal "{c. x:A} = (if A=0 then 0 else {c})";
       
   729 by Auto_tac; 
       
   730 by (Blast_tac 1);
       
   731 qed "RepFun_constant";
       
   732 Addsimps [RepFun_constant];
   606 
   733 
   607 (** Collect **)
   734 (** Collect **)
   608 
   735 
   609 Goal "Collect(A Un B, P) = Collect(A,P) Un Collect(B,P)";
   736 Goal "Collect(A Un B, P) = Collect(A,P) Un Collect(B,P)";
   610 by (Blast_tac 1);
   737 by (Blast_tac 1);
   621 Goal "{x:cons(a,B). P(x)} = \
   748 Goal "{x:cons(a,B). P(x)} = \
   622 \     (if P(a) then cons(a, {x:B. P(x)}) else {x:B. P(x)})";
   749 \     (if P(a) then cons(a, {x:B. P(x)}) else {x:B. P(x)})";
   623 by (simp_tac (simpset() addsplits [split_if]) 1);
   750 by (simp_tac (simpset() addsplits [split_if]) 1);
   624 by (Blast_tac 1);
   751 by (Blast_tac 1);
   625 qed "Collect_cons";
   752 qed "Collect_cons";
   626