src/ZF/equalities.thy
changeset 13356 c9cfe1638bf2
parent 13259 01fa0c8dbc92
child 13357 6f54e992777e
equal deleted inserted replaced
13355:d19cdbd8b559 13356:c9cfe1638bf2
     1 (*  Title:      ZF/equalities
     1 (*  Title:      ZF/equalities
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1992  University of Cambridge
     4     Copyright   1992  University of Cambridge
     5 
     5 
     6 
       
     7 Basic equations (and inclusions) involving union, intersection, 
       
     8 converse, domain, range, etc.
       
     9 
       
    10 Thanks also to Philippe de Groote.
       
    11 *)
     6 *)
    12 
     7 
       
     8 header{*Basic Equalities and Inclusions*}
       
     9 
    13 theory equalities = pair:
    10 theory equalities = pair:
       
    11 
       
    12 text{*These cover union, intersection, converse, domain, range, etc.  Philippe
       
    13 de Groote proved many of the inclusions.*}
    14 
    14 
    15 (*FIXME: move to ZF.thy or even to FOL.thy??*)
    15 (*FIXME: move to ZF.thy or even to FOL.thy??*)
    16 lemma [simp]: "((P-->Q) <-> (P-->R)) <-> (P --> (Q<->R))"
    16 lemma [simp]: "((P-->Q) <-> (P-->R)) <-> (P --> (Q<->R))"
    17 by blast
    17 by blast
    18 
    18 
    52 
    52 
    53 
    53 
    54 lemma the_eq_0 [simp]: "(THE x. False) = 0"
    54 lemma the_eq_0 [simp]: "(THE x. False) = 0"
    55 by (blast intro: the_0)
    55 by (blast intro: the_0)
    56 
    56 
    57 text {* \medskip Bounded quantifiers.
    57 subsection{*Bounded Quantifiers*}
       
    58 text {* \medskip 
    58 
    59 
    59   The following are not added to the default simpset because
    60   The following are not added to the default simpset because
    60   (a) they duplicate the body and (b) there are no similar rules for @{text Int}. *}
    61   (a) they duplicate the body and (b) there are no similar rules for @{text Int}.*}
    61 
    62 
    62 lemma ball_Un: "(\<forall>x \<in> A\<union>B. P(x)) <-> (\<forall>x \<in> A. P(x)) & (\<forall>x \<in> B. P(x))";
    63 lemma ball_Un: "(\<forall>x \<in> A\<union>B. P(x)) <-> (\<forall>x \<in> A. P(x)) & (\<forall>x \<in> B. P(x))";
    63   by blast
    64   by blast
    64 
    65 
    65 lemma bex_Un: "(\<exists>x \<in> A\<union>B. P(x)) <-> (\<exists>x \<in> A. P(x)) | (\<exists>x \<in> B. P(x))";
    66 lemma bex_Un: "(\<exists>x \<in> A\<union>B. P(x)) <-> (\<exists>x \<in> A. P(x)) | (\<exists>x \<in> B. P(x))";
    69   by blast
    70   by blast
    70 
    71 
    71 lemma bex_UN: "(\<exists>z \<in> (UN x:A. B(x)). P(z)) <-> (\<exists>x\<in>A. \<exists>z\<in>B(x). P(z))"
    72 lemma bex_UN: "(\<exists>z \<in> (UN x:A. B(x)). P(z)) <-> (\<exists>x\<in>A. \<exists>z\<in>B(x). P(z))"
    72   by blast
    73   by blast
    73 
    74 
    74 (*** converse ***)
    75 subsection{*Converse of a Relation*}
    75 
    76 
    76 lemma converse_iff [iff]: "<a,b>: converse(r) <-> <b,a>:r"
    77 lemma converse_iff [iff]: "<a,b>: converse(r) <-> <b,a>:r"
    77 by (unfold converse_def, blast)
    78 by (unfold converse_def, blast)
    78 
    79 
    79 lemma converseI: "<a,b>:r ==> <b,a>:converse(r)"
    80 lemma converseI: "<a,b>:r ==> <b,a>:converse(r)"
   103 lemma converse_subset_iff:
   104 lemma converse_subset_iff:
   104      "A <= Sigma(X,Y) ==> converse(A) <= converse(B) <-> A <= B"
   105      "A <= Sigma(X,Y) ==> converse(A) <= converse(B) <-> A <= B"
   105 by blast
   106 by blast
   106 
   107 
   107 
   108 
   108 (** cons; Finite Sets **)
   109 subsection{*Finite Set Constructions Using @{term cons}*}
   109 
   110 
   110 lemma cons_subsetI: "[| a:C; B<=C |] ==> cons(a,B) <= C"
   111 lemma cons_subsetI: "[| a:C; B<=C |] ==> cons(a,B) <= C"
   111 by blast
   112 by blast
   112 
   113 
   113 lemma subset_consI: "B <= cons(a,B)"
   114 lemma subset_consI: "B <= cons(a,B)"
   152 
   153 
   153 lemma singleton_subsetD: "{a} <= C  ==>  a:C"
   154 lemma singleton_subsetD: "{a} <= C  ==>  a:C"
   154 by blast
   155 by blast
   155 
   156 
   156 
   157 
   157 (*** succ ***)
   158 (** succ **)
   158 
   159 
   159 lemma subset_succI: "i <= succ(i)"
   160 lemma subset_succI: "i <= succ(i)"
   160 by blast
   161 by blast
   161 
   162 
   162 (*But if j is an ordinal or is transitive, then i:j implies i<=j! 
   163 (*But if j is an ordinal or is transitive, then i:j implies i<=j! 
   164 lemma succ_subsetI: "[| i:j;  i<=j |] ==> succ(i)<=j"
   165 lemma succ_subsetI: "[| i:j;  i<=j |] ==> succ(i)<=j"
   165 by (unfold succ_def, blast)
   166 by (unfold succ_def, blast)
   166 
   167 
   167 lemma succ_subsetE:
   168 lemma succ_subsetE:
   168     "[| succ(i) <= j;  [| i:j;  i<=j |] ==> P |] ==> P"
   169     "[| succ(i) <= j;  [| i:j;  i<=j |] ==> P |] ==> P"
   169 apply (unfold succ_def, blast) 
   170 by (unfold succ_def, blast) 
   170 done
       
   171 
   171 
   172 lemma succ_subset_iff: "succ(a) <= B <-> (a <= B & a : B)"
   172 lemma succ_subset_iff: "succ(a) <= B <-> (a <= B & a : B)"
   173 by (unfold succ_def, blast)
   173 by (unfold succ_def, blast)
   174 
   174 
   175 
   175 
   176 (*** Binary Intersection ***)
   176 subsection{*Binary Intersection*}
   177 
   177 
   178 (** Intersection is the greatest lower bound of two sets **)
   178 (** Intersection is the greatest lower bound of two sets **)
   179 
   179 
   180 lemma Int_subset_iff: "C <= A Int B <-> C <= A & C <= B"
   180 lemma Int_subset_iff: "C <= A Int B <-> C <= A & C <= B"
   181 by blast
   181 by blast
   223 by (blast elim!: equalityE)
   223 by (blast elim!: equalityE)
   224 
   224 
   225 lemma Int_Diff_eq: "C<=A ==> (A-B) Int C = C-B"
   225 lemma Int_Diff_eq: "C<=A ==> (A-B) Int C = C-B"
   226 by blast
   226 by blast
   227 
   227 
   228 (*** Binary Union ***)
   228 subsection{*Binary Union*}
   229 
   229 
   230 (** Union is the least upper bound of two sets *)
   230 (** Union is the least upper bound of two sets *)
   231 
   231 
   232 lemma Un_subset_iff: "A Un B <= C <-> A <= C & B <= C"
   232 lemma Un_subset_iff: "A Un B <= C <-> A <= C & B <= C"
   233 by blast
   233 by blast
   275 by blast
   275 by blast
   276 
   276 
   277 lemma Un_eq_Union: "A Un B = Union({A, B})"
   277 lemma Un_eq_Union: "A Un B = Union({A, B})"
   278 by blast
   278 by blast
   279 
   279 
   280 (*** Set difference ***)
   280 subsection{*Set Difference*}
   281 
   281 
   282 lemma Diff_subset: "A-B <= A"
   282 lemma Diff_subset: "A-B <= A"
   283 by blast
   283 by blast
   284 
   284 
   285 lemma Diff_contains: "[| C<=A;  C Int B = 0 |] ==> C <= A-B"
   285 lemma Diff_contains: "[| C<=A;  C Int B = 0 |] ==> C <= A-B"
   352 (*Halmos, Naive Set Theory, page 16.*)
   352 (*Halmos, Naive Set Theory, page 16.*)
   353 lemma Un_Int_assoc_iff: "(A Int B) Un C = A Int (B Un C)  <->  C<=A"
   353 lemma Un_Int_assoc_iff: "(A Int B) Un C = A Int (B Un C)  <->  C<=A"
   354 by (blast elim!: equalityE)
   354 by (blast elim!: equalityE)
   355 
   355 
   356 
   356 
   357 (*** Big Union and Intersection ***)
   357 subsection{*Big Union and Intersection*}
   358 
   358 
   359 (** Big Union is the least upper bound of a set  **)
   359 (** Big Union is the least upper bound of a set  **)
   360 
   360 
   361 lemma Union_subset_iff: "Union(A) <= C <-> (ALL x:A. x <= C)"
   361 lemma Union_subset_iff: "Union(A) <= C <-> (ALL x:A. x <= C)"
   362 by blast
   362 by blast
   422 
   422 
   423 lemma Inter_cons [simp]:
   423 lemma Inter_cons [simp]:
   424      "Inter(cons(a,B)) = (if B=0 then a else a Int Inter(B))"
   424      "Inter(cons(a,B)) = (if B=0 then a else a Int Inter(B))"
   425 by force
   425 by force
   426 
   426 
   427 (*** Unions and Intersections of Families ***)
   427 subsection{*Unions and Intersections of Families*}
   428 
   428 
   429 lemma subset_UN_iff_eq: "A <= (UN i:I. B(i)) <-> A = (UN i:I. A Int B(i))"
   429 lemma subset_UN_iff_eq: "A <= (UN i:I. B(i)) <-> A = (UN i:I. A Int B(i))"
   430 by (blast elim!: equalityE)
   430 by (blast elim!: equalityE)
   431 
   431 
   432 lemma UN_subset_iff: "(UN x:A. B(x)) <= C <-> (ALL x:A. B(x) <= C)"
   432 lemma UN_subset_iff: "(UN x:A. B(x)) <= C <-> (ALL x:A. B(x) <= C)"
   737 
   737 
   738 lemma range_Diff_eq: "[| <c,b> : r; c~=a |] ==> range(r-{<a,b>}) = range(r)"
   738 lemma range_Diff_eq: "[| <c,b> : r; c~=a |] ==> range(r-{<a,b>}) = range(r)"
   739 by blast
   739 by blast
   740 
   740 
   741 
   741 
   742 (*** Image of a set under a function/relation ***)
   742 subsection{*Image of a Set under a Function or Relation*}
   743 
   743 
   744 lemma image_iff: "b : r``A <-> (EX x:A. <x,b>:r)"
   744 lemma image_iff: "b : r``A <-> (EX x:A. <x,b>:r)"
   745 by (unfold image_def, blast)
   745 by (unfold image_def, blast)
   746 
   746 
   747 lemma image_singleton_iff: "b : r``{a} <-> <a,b>:r"
   747 lemma image_singleton_iff: "b : r``{a} <-> <a,b>:r"
   782 
   782 
   783 lemma image_Int_subset_left: "(r Int s)``A <= (r``A) Int (s``A)"
   783 lemma image_Int_subset_left: "(r Int s)``A <= (r``A) Int (s``A)"
   784 by blast
   784 by blast
   785 
   785 
   786 
   786 
   787 (*** Inverse image of a set under a function/relation ***)
   787 subsection{*Inverse Image of a Set under a Function or Relation*}
   788 
   788 
   789 lemma vimage_iff: 
   789 lemma vimage_iff: 
   790     "a : r-``B <-> (EX y:B. <a,y>:r)"
   790     "a : r-``B <-> (EX y:B. <a,y>:r)"
   791 by (unfold vimage_def image_def converse_def, blast)
   791 by (unfold vimage_def image_def converse_def, blast)
   792 
   792 
   866 lemma converse_INT [simp]:
   866 lemma converse_INT [simp]:
   867      "converse(INT x:A. B(x)) = (INT x:A. converse(B(x)))"
   867      "converse(INT x:A. B(x)) = (INT x:A. converse(B(x)))"
   868 apply (unfold Inter_def, blast)
   868 apply (unfold Inter_def, blast)
   869 done
   869 done
   870 
   870 
   871 (** Pow **)
   871 
       
   872 subsection{*Powerset Operator*}
   872 
   873 
   873 lemma Pow_0 [simp]: "Pow(0) = {0}"
   874 lemma Pow_0 [simp]: "Pow(0) = {0}"
   874 by blast
   875 by blast
   875 
   876 
   876 lemma Pow_insert: "Pow (cons(a,A)) = Pow(A) Un {cons(a,X) . X: Pow(A)}"
   877 lemma Pow_insert: "Pow (cons(a,A)) = Pow(A) Un {cons(a,X) . X: Pow(A)}"
   895 by blast
   896 by blast
   896 
   897 
   897 lemma Pow_INT_eq: "x:A ==> Pow(INT x:A. B(x)) = (INT x:A. Pow(B(x)))"
   898 lemma Pow_INT_eq: "x:A ==> Pow(INT x:A. B(x)) = (INT x:A. Pow(B(x)))"
   898 by blast
   899 by blast
   899 
   900 
   900 (*** RepFun ***)
   901 
       
   902 subsection{*RepFun*}
   901 
   903 
   902 lemma RepFun_subset: "[| !!x. x:A ==> f(x): B |] ==> {f(x). x:A} <= B"
   904 lemma RepFun_subset: "[| !!x. x:A ==> f(x): B |] ==> {f(x). x:A} <= B"
   903 by blast
   905 by blast
   904 
   906 
   905 lemma RepFun_eq_0_iff [simp]: "{f(x).x:A}=0 <-> A=0"
   907 lemma RepFun_eq_0_iff [simp]: "{f(x).x:A}=0 <-> A=0"
   908 lemma RepFun_constant [simp]: "{c. x:A} = (if A=0 then 0 else {c})"
   910 lemma RepFun_constant [simp]: "{c. x:A} = (if A=0 then 0 else {c})"
   909 apply auto
   911 apply auto
   910 apply blast
   912 apply blast
   911 done
   913 done
   912 
   914 
   913 (*** Collect ***)
   915 subsection{*Collect*}
   914 
   916 
   915 lemma Collect_subset: "Collect(A,P) <= A"
   917 lemma Collect_subset: "Collect(A,P) <= A"
   916 by blast
   918 by blast
   917 
   919 
   918 lemma Collect_Un: "Collect(A Un B, P) = Collect(A,P) Un Collect(B,P)"
   920 lemma Collect_Un: "Collect(A Un B, P) = Collect(A,P) Un Collect(B,P)"