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