src/HOL/equalities.ML
changeset 6292 e50e1142dd06
parent 6283 e3096df44326
child 6301 08245f5a436d
equal deleted inserted replaced
6291:2c3f72d9f5d1 6292:e50e1142dd06
    99 Goal "f``insert a B = insert (f a) (f``B)";
    99 Goal "f``insert a B = insert (f a) (f``B)";
   100 by (Blast_tac 1);
   100 by (Blast_tac 1);
   101 qed "image_insert";
   101 qed "image_insert";
   102 Addsimps[image_insert];
   102 Addsimps[image_insert];
   103 
   103 
       
   104 (*image_INTER fails, perhaps even if f is injective*)
   104 Goal  "(f `` (UNION A B)) = (UN x:A.(f `` (B x)))";
   105 Goal  "(f `` (UNION A B)) = (UN x:A.(f `` (B x)))";
   105 by (Blast_tac 1);
   106 by (Blast_tac 1);
   106 qed "image_UNION";
   107 qed "image_UNION";
   107 
   108 
   108 Goal "(%x. x) `` Y = Y";
   109 Goal "(%x. x) `` Y = Y";
   109 by (Blast_tac 1);
   110 by (Blast_tac 1);
   110 qed "image_id";
   111 qed "image_id";
   111 Addsimps [image_id];
   112 Addsimps [image_id];
       
   113 
       
   114 Goal "x:A ==> (%x. c) `` A = {c}";
       
   115 by (Blast_tac 1);
       
   116 qed "image_constant";
   112 
   117 
   113 Goal "f``(g``A) = (%x. f (g x)) `` A";
   118 Goal "f``(g``A) = (%x. f (g x)) `` A";
   114 by (Blast_tac 1);
   119 by (Blast_tac 1);
   115 qed "image_image";
   120 qed "image_image";
   116 
   121 
   135 by (Blast_tac 1);
   140 by (Blast_tac 1);
   136 qed "if_image_distrib";
   141 qed "if_image_distrib";
   137 Addsimps[if_image_distrib];
   142 Addsimps[if_image_distrib];
   138 
   143 
   139 val prems = Goal "[|M = N; !!x. x:N ==> f x = g x|] ==> f``M = g``N";
   144 val prems = Goal "[|M = N; !!x. x:N ==> f x = g x|] ==> f``M = g``N";
   140 by (rtac set_ext 1);
       
   141 by (simp_tac (simpset() addsimps image_def::prems) 1);
   145 by (simp_tac (simpset() addsimps image_def::prems) 1);
   142 qed "image_cong";
   146 qed "image_cong";
   143 
   147 
   144 
   148 
   145 section "Int";
   149 section "Int";
   483 
   487 
   484 Goal "(UN x : (UN y:A. B y). C x) = (UN y:A. UN x: B y. C x)";
   488 Goal "(UN x : (UN y:A. B y). C x) = (UN y:A. UN x: B y. C x)";
   485 by (Blast_tac 1);
   489 by (Blast_tac 1);
   486 qed "UN_UN_flatten";
   490 qed "UN_UN_flatten";
   487 
   491 
       
   492 Goal "((UN i:I. A i) <= B) = (ALL i:I. A i <= B)";
       
   493 by (Blast_tac 1);
       
   494 qed "UN_subset_iff";
       
   495 
       
   496 Goal "(B <= (INT i:I. A i)) = (ALL i:I. B <= A i)";
       
   497 by (Blast_tac 1);
       
   498 qed "INT_subset_iff";
       
   499 
   488 Goal "(INT x:insert a A. B x) = B a Int INTER A B";
   500 Goal "(INT x:insert a A. B x) = B a Int INTER A B";
   489 by (Blast_tac 1);
   501 by (Blast_tac 1);
   490 qed "INT_insert";
   502 qed "INT_insert";
   491 Addsimps[INT_insert];
   503 Addsimps[INT_insert];
   492 
   504 
   499 qed "INT_insert_distrib";
   511 qed "INT_insert_distrib";
   500 
   512 
   501 Goal "Union(B``A) = (UN x:A. B(x))";
   513 Goal "Union(B``A) = (UN x:A. B(x))";
   502 by (Blast_tac 1);
   514 by (Blast_tac 1);
   503 qed "Union_image_eq";
   515 qed "Union_image_eq";
       
   516 Addsimps [Union_image_eq];
   504 
   517 
   505 Goal "f `` Union S = (UN x:S. f `` x)";
   518 Goal "f `` Union S = (UN x:S. f `` x)";
   506 by (Blast_tac 1);
   519 by (Blast_tac 1);
   507 qed "image_Union_eq";
   520 qed "image_Union_eq";
   508 
   521 
   509 Goal "Inter(B``A) = (INT x:A. B(x))";
   522 Goal "Inter(B``A) = (INT x:A. B(x))";
   510 by (Blast_tac 1);
   523 by (Blast_tac 1);
   511 qed "Inter_image_eq";
   524 qed "Inter_image_eq";
       
   525 Addsimps [Inter_image_eq];
   512 
   526 
   513 Goal "u: A ==> (UN y:A. c) = c";
   527 Goal "u: A ==> (UN y:A. c) = c";
   514 by (Blast_tac 1);
   528 by (Blast_tac 1);
   515 qed "UN_constant";
   529 qed "UN_constant";
   516 Addsimps[UN_constant];
   530 Addsimps[UN_constant];
   747 by (case_tac "b" 1);
   761 by (case_tac "b" 1);
   748 by Auto_tac;
   762 by Auto_tac;
   749 qed "INT_bool_eq";
   763 qed "INT_bool_eq";
   750 
   764 
   751 
   765 
   752 section "Miscellany";
   766 section "Pow";
   753 
       
   754 Goal "(A = B) = ((A <= (B::'a set)) & (B<=A))";
       
   755 by (Blast_tac 1);
       
   756 qed "set_eq_subset";
       
   757 
       
   758 Goal "A <= B =  (! t. t:A --> t:B)";
       
   759 by (Blast_tac 1);
       
   760 qed "subset_iff";
       
   761 
       
   762 Goalw [psubset_def] "((A::'a set) <= B) = ((A < B) | (A=B))";
       
   763 by (Blast_tac 1);
       
   764 qed "subset_iff_psubset_eq";
       
   765 
       
   766 Goal "(!x. x ~: A) = (A={})";
       
   767 by (Blast_tac 1);
       
   768 qed "all_not_in_conv";
       
   769 AddIffs [all_not_in_conv];
       
   770 
   767 
   771 Goalw [Pow_def] "Pow {} = {{}}";
   768 Goalw [Pow_def] "Pow {} = {{}}";
   772 by Auto_tac;
   769 by Auto_tac;
   773 qed "Pow_empty";
   770 qed "Pow_empty";
   774 Addsimps [Pow_empty];
   771 Addsimps [Pow_empty];
   778 by (etac swap 1);
   775 by (etac swap 1);
   779 by (res_inst_tac [("x", "x-{a}")] image_eqI 1);
   776 by (res_inst_tac [("x", "x-{a}")] image_eqI 1);
   780 by (ALLGOALS Blast_tac);
   777 by (ALLGOALS Blast_tac);
   781 qed "Pow_insert";
   778 qed "Pow_insert";
   782 
   779 
       
   780 Goal "Pow (- A) = {-B |B. A: Pow B}";
       
   781 by Safe_tac;
       
   782 by (Blast_tac 2);
       
   783 by (res_inst_tac [("x", "-x")] exI 1);
       
   784 by (ALLGOALS Blast_tac);
       
   785 qed "Pow_Compl";
       
   786 
   783 Goal "Pow UNIV = UNIV";
   787 Goal "Pow UNIV = UNIV";
   784 by (Blast_tac 1);
   788 by (Blast_tac 1);
   785 qed "Pow_UNIV";
   789 qed "Pow_UNIV";
   786 Addsimps [Pow_UNIV];
   790 Addsimps [Pow_UNIV];
       
   791 
       
   792 Goal "Pow(A) Un Pow(B) <= Pow(A Un B)";
       
   793 by (Blast_tac 1);
       
   794 qed "Un_Pow_subset";
       
   795 
       
   796 Goal "(UN x:A. Pow(B(x))) <= Pow(UN x:A. B(x))";
       
   797 by (Blast_tac 1);
       
   798 qed "UN_Pow_subset";
       
   799 
       
   800 Goal "A <= Pow(Union(A))";
       
   801 by (Blast_tac 1);
       
   802 qed "subset_Pow_Union";
       
   803 
       
   804 Goal "Union(Pow(A)) = A";
       
   805 by (Blast_tac 1);
       
   806 qed "Union_Pow_eq";
       
   807 
       
   808 Goal "Pow(A Int B) = Pow(A) Int Pow(B)";
       
   809 by (Blast_tac 1);
       
   810 qed "Pow_Int_eq";
       
   811 
       
   812 Goal "Pow(INT x:A. B(x)) = (INT x:A. Pow(B(x)))";
       
   813 by (Blast_tac 1);
       
   814 qed "Pow_INT_eq";
       
   815 
       
   816 Addsimps [Union_Pow_eq, Pow_Int_eq];
       
   817 
       
   818 
       
   819 section "Miscellany";
       
   820 
       
   821 Goal "(A = B) = ((A <= (B::'a set)) & (B<=A))";
       
   822 by (Blast_tac 1);
       
   823 qed "set_eq_subset";
       
   824 
       
   825 Goal "A <= B =  (! t. t:A --> t:B)";
       
   826 by (Blast_tac 1);
       
   827 qed "subset_iff";
       
   828 
       
   829 Goalw [psubset_def] "((A::'a set) <= B) = ((A < B) | (A=B))";
       
   830 by (Blast_tac 1);
       
   831 qed "subset_iff_psubset_eq";
       
   832 
       
   833 Goal "(!x. x ~: A) = (A={})";
       
   834 by (Blast_tac 1);
       
   835 qed "all_not_in_conv";
       
   836 AddIffs [all_not_in_conv];
       
   837 
   787 
   838 
   788 (** for datatypes **)
   839 (** for datatypes **)
   789 Goal "f x ~= f y ==> x ~= y";
   840 Goal "f x ~= f y ==> x ~= y";
   790 by (Fast_tac 1);
   841 by (Fast_tac 1);
   791 qed "distinct_lemma";
   842 qed "distinct_lemma";