src/ZF/pair.thy
author paulson
Sun Jun 23 10:14:13 2002 +0200 (2002-06-23)
changeset 13240 bb5f4faea1f3
parent 11694 4c6e9d800628
child 13357 6f54e992777e
permissions -rw-r--r--
conversion of Sum, pair to Isar script
     1 (*  Title:      ZF/pair
     2     ID:         $Id$
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1992  University of Cambridge
     5 
     6 Ordered pairs in Zermelo-Fraenkel Set Theory 
     7 *)
     8 
     9 theory pair = upair
    10 files "simpdata.ML":
    11 
    12 (** Lemmas for showing that <a,b> uniquely determines a and b **)
    13 
    14 lemma singleton_eq_iff [iff]: "{a} = {b} <-> a=b"
    15 by (rule extension [THEN iff_trans], blast)
    16 
    17 lemma doubleton_eq_iff: "{a,b} = {c,d} <-> (a=c & b=d) | (a=d & b=c)"
    18 by (rule extension [THEN iff_trans], blast)
    19 
    20 lemma Pair_iff [simp]: "<a,b> = <c,d> <-> a=c & b=d"
    21 by (simp add: Pair_def doubleton_eq_iff, blast)
    22 
    23 lemmas Pair_inject = Pair_iff [THEN iffD1, THEN conjE, standard, elim!]
    24 
    25 lemmas Pair_inject1 = Pair_iff [THEN iffD1, THEN conjunct1, standard]
    26 lemmas Pair_inject2 = Pair_iff [THEN iffD1, THEN conjunct2, standard]
    27 
    28 lemma Pair_not_0: "<a,b> ~= 0"
    29 apply (unfold Pair_def)
    30 apply (blast elim: equalityE)
    31 done
    32 
    33 lemmas Pair_neq_0 = Pair_not_0 [THEN notE, standard, elim!]
    34 
    35 declare sym [THEN Pair_neq_0, elim!]
    36 
    37 lemma Pair_neq_fst: "<a,b>=a ==> P"
    38 apply (unfold Pair_def)
    39 apply (rule consI1 [THEN mem_asym, THEN FalseE])
    40 apply (erule subst)
    41 apply (rule consI1)
    42 done
    43 
    44 lemma Pair_neq_snd: "<a,b>=b ==> P"
    45 apply (unfold Pair_def)
    46 apply (rule consI1 [THEN consI2, THEN mem_asym, THEN FalseE])
    47 apply (erule subst)
    48 apply (rule consI1 [THEN consI2])
    49 done
    50 
    51 
    52 (*** Sigma: Disjoint union of a family of sets
    53      Generalizes Cartesian product ***)
    54 
    55 lemma Sigma_iff [simp]: "<a,b>: Sigma(A,B) <-> a:A & b:B(a)"
    56 by (simp add: Sigma_def)
    57 
    58 lemma SigmaI [TC,intro!]: "[| a:A;  b:B(a) |] ==> <a,b> : Sigma(A,B)"
    59 by simp
    60 
    61 lemmas SigmaD1 = Sigma_iff [THEN iffD1, THEN conjunct1, standard]
    62 lemmas SigmaD2 = Sigma_iff [THEN iffD1, THEN conjunct2, standard]
    63 
    64 (*The general elimination rule*)
    65 lemma SigmaE [elim!]:
    66     "[| c: Sigma(A,B);   
    67         !!x y.[| x:A;  y:B(x);  c=<x,y> |] ==> P  
    68      |] ==> P"
    69 apply (unfold Sigma_def, blast) 
    70 done
    71 
    72 lemma SigmaE2 [elim!]:
    73     "[| <a,b> : Sigma(A,B);     
    74         [| a:A;  b:B(a) |] ==> P    
    75      |] ==> P"
    76 apply (unfold Sigma_def, blast) 
    77 done
    78 
    79 lemma Sigma_cong:
    80     "[| A=A';  !!x. x:A' ==> B(x)=B'(x) |] ==>  
    81      Sigma(A,B) = Sigma(A',B')"
    82 by (simp add: Sigma_def)
    83 
    84 (*Sigma_cong, Pi_cong NOT given to Addcongs: they cause
    85   flex-flex pairs and the "Check your prover" error.  Most
    86   Sigmas and Pis are abbreviated as * or -> *)
    87 
    88 lemma Sigma_empty1 [simp]: "Sigma(0,B) = 0"
    89 by blast
    90 
    91 lemma Sigma_empty2 [simp]: "A*0 = 0"
    92 by blast
    93 
    94 lemma Sigma_empty_iff: "A*B=0 <-> A=0 | B=0"
    95 by blast
    96 
    97 
    98 (*** Projections: fst, snd ***)
    99 
   100 lemma fst_conv [simp]: "fst(<a,b>) = a"
   101 by (simp add: fst_def, blast)
   102 
   103 lemma snd_conv [simp]: "snd(<a,b>) = b"
   104 by (simp add: snd_def, blast)
   105 
   106 lemma fst_type [TC]: "p:Sigma(A,B) ==> fst(p) : A"
   107 by auto
   108 
   109 lemma snd_type [TC]: "p:Sigma(A,B) ==> snd(p) : B(fst(p))"
   110 by auto
   111 
   112 lemma Pair_fst_snd_eq: "a: Sigma(A,B) ==> <fst(a),snd(a)> = a"
   113 by auto
   114 
   115 
   116 (*** Eliminator - split ***)
   117 
   118 (*A META-equality, so that it applies to higher types as well...*)
   119 lemma split [simp]: "split(%x y. c(x,y), <a,b>) == c(a,b)"
   120 by (simp add: split_def)
   121 
   122 lemma split_type [TC]:
   123     "[|  p:Sigma(A,B);    
   124          !!x y.[| x:A; y:B(x) |] ==> c(x,y):C(<x,y>)  
   125      |] ==> split(%x y. c(x,y), p) : C(p)"
   126 apply (erule SigmaE, auto) 
   127 done
   128 
   129 lemma expand_split: 
   130   "u: A*B ==>    
   131         R(split(c,u)) <-> (ALL x:A. ALL y:B. u = <x,y> --> R(c(x,y)))"
   132 apply (simp add: split_def, auto)
   133 done
   134 
   135 
   136 (*** split for predicates: result type o ***)
   137 
   138 lemma splitI: "R(a,b) ==> split(R, <a,b>)"
   139 by (simp add: split_def)
   140 
   141 lemma splitE:
   142     "[| split(R,z);  z:Sigma(A,B);                       
   143         !!x y. [| z = <x,y>;  R(x,y) |] ==> P            
   144      |] ==> P"
   145 apply (simp add: split_def)
   146 apply (erule SigmaE, force) 
   147 done
   148 
   149 lemma splitD: "split(R,<a,b>) ==> R(a,b)"
   150 by (simp add: split_def)
   151 
   152 ML
   153 {*
   154 val singleton_eq_iff = thm "singleton_eq_iff";
   155 val doubleton_eq_iff = thm "doubleton_eq_iff";
   156 val Pair_iff = thm "Pair_iff";
   157 val Pair_inject = thm "Pair_inject";
   158 val Pair_inject1 = thm "Pair_inject1";
   159 val Pair_inject2 = thm "Pair_inject2";
   160 val Pair_not_0 = thm "Pair_not_0";
   161 val Pair_neq_0 = thm "Pair_neq_0";
   162 val Pair_neq_fst = thm "Pair_neq_fst";
   163 val Pair_neq_snd = thm "Pair_neq_snd";
   164 val Sigma_iff = thm "Sigma_iff";
   165 val SigmaI = thm "SigmaI";
   166 val SigmaD1 = thm "SigmaD1";
   167 val SigmaD2 = thm "SigmaD2";
   168 val SigmaE = thm "SigmaE";
   169 val SigmaE2 = thm "SigmaE2";
   170 val Sigma_cong = thm "Sigma_cong";
   171 val Sigma_empty1 = thm "Sigma_empty1";
   172 val Sigma_empty2 = thm "Sigma_empty2";
   173 val Sigma_empty_iff = thm "Sigma_empty_iff";
   174 val fst_conv = thm "fst_conv";
   175 val snd_conv = thm "snd_conv";
   176 val fst_type = thm "fst_type";
   177 val snd_type = thm "snd_type";
   178 val Pair_fst_snd_eq = thm "Pair_fst_snd_eq";
   179 val split = thm "split";
   180 val split_type = thm "split_type";
   181 val expand_split = thm "expand_split";
   182 val splitI = thm "splitI";
   183 val splitE = thm "splitE";
   184 val splitD = thm "splitD";
   185 *}
   186 
   187 end
   188 
   189