src/ZF/ZF.ML
author paulson
Fri, 16 Feb 1996 18:00:47 +0100
changeset 1512 ce37c64244c0
parent 1461 6bcb44e4d6e5
child 1889 661603db8ee2
permissions -rw-r--r--
Elimination of fully-functorial style. Type tactic changed to a type abbrevation (from a datatype). Constructor tactic and function apply deleted.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1016
diff changeset
     1
(*  Title:      ZF/ZF.ML
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1016
diff changeset
     3
    Author:     Lawrence C Paulson and Martin D Coen, CU Computer Laboratory
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 120
diff changeset
     4
    Copyright   1994  University of Cambridge
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
Basic introduction and elimination rules for Zermelo-Fraenkel Set Theory 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
open ZF;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
825
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
    12
(*Useful examples:  singletonI RS subst_elem,  subst_elem RSN (2,IntI) *)
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
    13
goal ZF.thy "!!a b A. [| b:A;  a=b |] ==> a:A";
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
    14
by (etac ssubst 1);
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
    15
by (assume_tac 1);
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
    16
val subst_elem = result();
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
    17
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
(*** Bounded universal quantifier ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    20
qed_goalw "ballI" ZF.thy [Ball_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
    "[| !!x. x:A ==> P(x) |] ==> ALL x:A. P(x)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
 (fn prems=> [ (REPEAT (ares_tac (prems @ [allI,impI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    24
qed_goalw "bspec" ZF.thy [Ball_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
    "[| ALL x:A. P(x);  x: A |] ==> P(x)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
  [ (rtac (major RS spec RS mp) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
    (resolve_tac prems 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    30
qed_goalw "ballE" ZF.thy [Ball_def]
37
cebe01deba80 added ~: for "not in"
lcp
parents: 6
diff changeset
    31
    "[| ALL x:A. P(x);  P(x) ==> Q;  x~:A ==> Q |] ==> Q"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
  [ (rtac (major RS allE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
    (REPEAT (eresolve_tac (prems@[asm_rl,impCE]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
(*Used in the datatype package*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    37
qed_goal "rev_bspec" ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
    "!!x A P. [| x: A;  ALL x:A. P(x) |] ==> P(x)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
 (fn _ =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
  [ REPEAT (ares_tac [bspec] 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
(*Instantiates x first: better for automatic theorem proving?*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    43
qed_goal "rev_ballE" ZF.thy
37
cebe01deba80 added ~: for "not in"
lcp
parents: 6
diff changeset
    44
    "[| ALL x:A. P(x);  x~:A ==> Q;  P(x) ==> Q |] ==> Q"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
  [ (rtac (major RS ballE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
    (REPEAT (eresolve_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
(*Takes assumptions ALL x:A.P(x) and a:A; creates assumption P(a)*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
val ball_tac = dtac bspec THEN' assume_tac;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
(*Trival rewrite rule;   (ALL x:A.P)<->P holds only if A is nonempty!*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    53
qed_goal "ball_simp" ZF.thy "(ALL x:A. True) <-> True"
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    54
 (fn _=> [ (REPEAT (ares_tac [TrueI,ballI,iffI] 1)) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    55
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    56
(*Congruence rule for rewriting*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    57
qed_goalw "ball_cong" ZF.thy [Ball_def]
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    58
    "[| A=A';  !!x. x:A' ==> P(x) <-> P'(x) |] ==> Ball(A,P) <-> Ball(A',P')"
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    59
 (fn prems=> [ (simp_tac (FOL_ss addsimps prems) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    61
(*** Bounded existential quantifier ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    62
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    63
qed_goalw "bexI" ZF.thy [Bex_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    64
    "[| P(x);  x: A |] ==> EX x:A. P(x)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
 (fn prems=> [ (REPEAT (ares_tac (prems @ [exI,conjI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    66
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
(*Not of the general form for such rules; ~EX has become ALL~ *)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    68
qed_goal "bexCI" ZF.thy 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    69
   "[| ALL x:A. ~P(x) ==> P(a);  a: A |] ==> EX x:A.P(x)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    70
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    71
  [ (rtac classical 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    72
    (REPEAT (ares_tac (prems@[bexI,ballI,notI,notE]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    73
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    74
qed_goalw "bexE" ZF.thy [Bex_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    75
    "[| EX x:A. P(x);  !!x. [| x:A; P(x) |] ==> Q \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    76
\    |] ==> Q"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    77
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    78
  [ (rtac (major RS exE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    79
    (REPEAT (eresolve_tac (prems @ [asm_rl,conjE]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    80
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    81
(*We do not even have (EX x:A. True) <-> True unless A is nonempty!!*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    82
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    83
qed_goalw "bex_cong" ZF.thy [Bex_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    84
    "[| A=A';  !!x. x:A' ==> P(x) <-> P'(x) \
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    85
\    |] ==> Bex(A,P) <-> Bex(A',P')"
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    86
 (fn prems=> [ (simp_tac (FOL_ss addsimps prems addcongs [conj_cong]) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    87
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    88
(*** Rules for subsets ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    90
qed_goalw "subsetI" ZF.thy [subset_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    91
    "(!!x.x:A ==> x:B) ==> A <= B"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    92
 (fn prems=> [ (REPEAT (ares_tac (prems @ [ballI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    93
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    94
(*Rule in Modus Ponens style [was called subsetE] *)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
    95
qed_goalw "subsetD" ZF.thy [subset_def] "[| A <= B;  c:A |] ==> c:B"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    96
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    97
  [ (rtac (major RS bspec) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    98
    (resolve_tac prems 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    99
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   100
(*Classical elimination rule*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   101
qed_goalw "subsetCE" ZF.thy [subset_def]
37
cebe01deba80 added ~: for "not in"
lcp
parents: 6
diff changeset
   102
    "[| A <= B;  c~:A ==> P;  c:B ==> P |] ==> P"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   103
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   104
  [ (rtac (major RS ballE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   105
    (REPEAT (eresolve_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   106
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   107
(*Takes assumptions A<=B; c:A and creates the assumption c:B *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   108
val set_mp_tac = dtac subsetD THEN' assume_tac;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   109
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   110
(*Sometimes useful with premises in this order*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   111
qed_goal "rev_subsetD" ZF.thy "!!A B c. [| c:A; A<=B |] ==> c:B"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   112
 (fn _=> [REPEAT (ares_tac [subsetD] 1)]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   113
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   114
qed_goal "subset_refl" ZF.thy "A <= A"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   115
 (fn _=> [ (rtac subsetI 1), atac 1 ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   116
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   117
qed_goal "subset_trans" ZF.thy "[| A<=B;  B<=C |] ==> A<=C"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   118
 (fn prems=> [ (REPEAT (ares_tac ([subsetI]@(prems RL [subsetD])) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   119
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 120
diff changeset
   120
(*Useful for proving A<=B by rewriting in some cases*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   121
qed_goalw "subset_iff" ZF.thy [subset_def,Ball_def]
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 120
diff changeset
   122
     "A<=B <-> (ALL x. x:A --> x:B)"
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 120
diff changeset
   123
 (fn _=> [ (rtac iff_refl 1) ]);
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 120
diff changeset
   124
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   125
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   126
(*** Rules for equality ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   127
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   128
(*Anti-symmetry of the subset relation*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   129
qed_goal "equalityI" ZF.thy "[| A <= B;  B <= A |] ==> A = B"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   130
 (fn prems=> [ (REPEAT (resolve_tac (prems@[conjI, extension RS iffD2]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   131
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   132
qed_goal "equality_iffI" ZF.thy "(!!x. x:A <-> x:B) ==> A = B"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   133
 (fn [prem] =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   134
  [ (rtac equalityI 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   135
    (REPEAT (ares_tac [subsetI, prem RS iffD1, prem RS iffD2] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   136
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   137
qed_goal "equalityD1" ZF.thy "A = B ==> A<=B"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   138
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   139
  [ (rtac (extension RS iffD1 RS conjunct1) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   140
    (resolve_tac prems 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   141
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   142
qed_goal "equalityD2" ZF.thy "A = B ==> B<=A"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   143
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   144
  [ (rtac (extension RS iffD1 RS conjunct2) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   145
    (resolve_tac prems 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   146
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   147
qed_goal "equalityE" ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   148
    "[| A = B;  [| A<=B; B<=A |] ==> P |]  ==>  P"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   149
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   150
  [ (DEPTH_SOLVE (resolve_tac (prems@[equalityD1,equalityD2]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   151
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   152
qed_goal "equalityCE" ZF.thy
37
cebe01deba80 added ~: for "not in"
lcp
parents: 6
diff changeset
   153
    "[| A = B;  [| c:A; c:B |] ==> P;  [| c~:A; c~:B |] ==> P |]  ==>  P"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   154
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   155
  [ (rtac (major RS equalityE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   156
    (REPEAT (contr_tac 1 ORELSE eresolve_tac ([asm_rl,subsetCE]@prems) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   157
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   158
(*Lemma for creating induction formulae -- for "pattern matching" on p
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   159
  To make the induction hypotheses usable, apply "spec" or "bspec" to
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   160
  put universal quantifiers over the free variables in p. 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   161
  Would it be better to do subgoal_tac "ALL z. p = f(z) --> R(z)" ??*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   162
qed_goal "setup_induction" ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   163
    "[| p: A;  !!z. z: A ==> p=z --> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   164
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   165
  [ (rtac mp 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   166
    (REPEAT (resolve_tac (refl::prems) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   167
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   168
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   169
(*** Rules for Replace -- the derived form of replacement ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   170
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   171
qed_goalw "Replace_iff" ZF.thy [Replace_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   172
    "b : {y. x:A, P(x,y)}  <->  (EX x:A. P(x,b) & (ALL y. P(x,y) --> y=b))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   173
 (fn _=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   174
  [ (rtac (replacement RS iff_trans) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   175
    (REPEAT (ares_tac [refl,bex_cong,iffI,ballI,allI,conjI,impI,ex1I] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   176
        ORELSE eresolve_tac [conjE, spec RS mp, ex1_functional] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   177
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   178
(*Introduction; there must be a unique y such that P(x,y), namely y=b. *)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   179
qed_goal "ReplaceI" ZF.thy
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   180
    "[| P(x,b);  x: A;  !!y. P(x,y) ==> y=b |] ==> \
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   181
\    b : {y. x:A, P(x,y)}"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   182
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   183
  [ (rtac (Replace_iff RS iffD2) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   184
    (REPEAT (ares_tac (prems@[bexI,conjI,allI,impI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   185
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   186
(*Elimination; may asssume there is a unique y such that P(x,y), namely y=b. *)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   187
qed_goal "ReplaceE" ZF.thy 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   188
    "[| b : {y. x:A, P(x,y)};  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   189
\       !!x. [| x: A;  P(x,b);  ALL y. P(x,y)-->y=b |] ==> R \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   190
\    |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   191
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   192
  [ (rtac (Replace_iff RS iffD1 RS bexE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   193
    (etac conjE 2),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   194
    (REPEAT (ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   195
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   196
(*As above but without the (generally useless) 3rd assumption*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   197
qed_goal "ReplaceE2" ZF.thy 
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   198
    "[| b : {y. x:A, P(x,y)};  \
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   199
\       !!x. [| x: A;  P(x,b) |] ==> R \
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   200
\    |] ==> R"
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   201
 (fn major::prems=>
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   202
  [ (rtac (major RS ReplaceE) 1),
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   203
    (REPEAT (ares_tac prems 1)) ]);
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   204
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   205
qed_goal "Replace_cong" ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   206
    "[| A=B;  !!x y. x:B ==> P(x,y) <-> Q(x,y) |] ==> \
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
   207
\    Replace(A,P) = Replace(B,Q)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   208
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   209
   let val substprems = prems RL [subst, ssubst]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   210
       and iffprems = prems RL [iffD1,iffD2]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   211
   in [ (rtac equalityI 1),
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1016
diff changeset
   212
        (REPEAT (eresolve_tac (substprems@[asm_rl, ReplaceE, spec RS mp]) 1
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1016
diff changeset
   213
         ORELSE resolve_tac [subsetI, ReplaceI] 1
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1016
diff changeset
   214
         ORELSE (resolve_tac iffprems 1 THEN assume_tac 2))) ]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   215
   end);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   216
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   217
(*** Rules for RepFun ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   218
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   219
qed_goalw "RepFunI" ZF.thy [RepFun_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   220
    "!!a A. a : A ==> f(a) : {f(x). x:A}"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   221
 (fn _ => [ (REPEAT (ares_tac [ReplaceI,refl] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   222
120
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 37
diff changeset
   223
(*Useful for coinduction proofs*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   224
qed_goal "RepFun_eqI" ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   225
    "!!b a f. [| b=f(a);  a : A |] ==> b : {f(x). x:A}"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   226
 (fn _ => [ etac ssubst 1, etac RepFunI 1 ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   227
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   228
qed_goalw "RepFunE" ZF.thy [RepFun_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   229
    "[| b : {f(x). x:A};  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   230
\       !!x.[| x:A;  b=f(x) |] ==> P |] ==> \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   231
\    P"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   232
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   233
  [ (rtac (major RS ReplaceE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   234
    (REPEAT (ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   235
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   236
qed_goalw "RepFun_cong" ZF.thy [RepFun_def]
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
   237
    "[| A=B;  !!x. x:B ==> f(x)=g(x) |] ==> RepFun(A,f) = RepFun(B,g)"
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
   238
 (fn prems=> [ (simp_tac (FOL_ss addcongs [Replace_cong] addsimps prems) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   239
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   240
qed_goalw "RepFun_iff" ZF.thy [Bex_def]
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   241
    "b : {f(x). x:A} <-> (EX x:A. b=f(x))"
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   242
 (fn _ => [ (fast_tac (FOL_cs addIs [RepFunI] addSEs [RepFunE]) 1) ]);
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   243
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   244
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   245
(*** Rules for Collect -- forming a subset by separation ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   246
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   247
(*Separation is derivable from Replacement*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   248
qed_goalw "separation" ZF.thy [Collect_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   249
    "a : {x:A. P(x)} <-> a:A & P(a)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   250
 (fn _=> [ (fast_tac (FOL_cs addIs  [bexI,ReplaceI] 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1016
diff changeset
   251
                             addSEs [bexE,ReplaceE]) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   252
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   253
qed_goal "CollectI" ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   254
    "[| a:A;  P(a) |] ==> a : {x:A. P(x)}"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   255
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   256
  [ (rtac (separation RS iffD2) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   257
    (REPEAT (resolve_tac (prems@[conjI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   258
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   259
qed_goal "CollectE" ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   260
    "[| a : {x:A. P(x)};  [| a:A; P(a) |] ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   261
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   262
  [ (rtac (separation RS iffD1 RS conjE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   263
    (REPEAT (ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   264
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   265
qed_goal "CollectD1" ZF.thy "a : {x:A. P(x)} ==> a:A"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   266
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   267
  [ (rtac (major RS CollectE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   268
    (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   269
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   270
qed_goal "CollectD2" ZF.thy "a : {x:A. P(x)} ==> P(a)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   271
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   272
  [ (rtac (major RS CollectE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   273
    (assume_tac 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   274
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   275
qed_goalw "Collect_cong" ZF.thy [Collect_def] 
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
   276
    "[| A=B;  !!x. x:B ==> P(x) <-> Q(x) |] ==> Collect(A,P) = Collect(B,Q)"
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
   277
 (fn prems=> [ (simp_tac (FOL_ss addcongs [Replace_cong] addsimps prems) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   278
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   279
(*** Rules for Unions ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   280
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   281
(*The order of the premises presupposes that C is rigid; A may be flexible*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   282
qed_goal "UnionI" ZF.thy "[| B: C;  A: B |] ==> A: Union(C)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   283
 (fn prems=>
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   284
  [ (resolve_tac [Union_iff RS iffD2] 1),
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   285
    (REPEAT (resolve_tac (prems @ [bexI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   286
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   287
qed_goal "UnionE" ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   288
    "[| A : Union(C);  !!B.[| A: B;  B: C |] ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   289
 (fn prems=>
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   290
  [ (resolve_tac [Union_iff RS iffD1 RS bexE] 1),
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   291
    (REPEAT (ares_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   292
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   293
(*** Rules for Inter ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   294
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   295
(*Not obviously useful towards proving InterI, InterD, InterE*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   296
qed_goalw "Inter_iff" ZF.thy [Inter_def,Ball_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   297
    "A : Inter(C) <-> (ALL x:C. A: x) & (EX x. x:C)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   298
 (fn _=> [ (rtac (separation RS iff_trans) 1),
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1016
diff changeset
   299
           (fast_tac (FOL_cs addIs [UnionI] addSEs [UnionE]) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   300
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   301
(* Intersection is well-behaved only if the family is non-empty! *)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   302
qed_goalw "InterI" ZF.thy [Inter_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   303
    "[| !!x. x: C ==> A: x;  c:C |] ==> A : Inter(C)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   304
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   305
  [ (DEPTH_SOLVE (ares_tac ([CollectI,UnionI,ballI] @ prems) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   306
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   307
(*A "destruct" rule -- every B in C contains A as an element, but
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   308
  A:B can hold when B:C does not!  This rule is analogous to "spec". *)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   309
qed_goalw "InterD" ZF.thy [Inter_def]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   310
    "[| A : Inter(C);  B : C |] ==> A : B"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   311
 (fn [major,minor]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   312
  [ (rtac (major RS CollectD2 RS bspec) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   313
    (rtac minor 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   314
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   315
(*"Classical" elimination rule -- does not require exhibiting B:C *)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   316
qed_goalw "InterE" ZF.thy [Inter_def]
37
cebe01deba80 added ~: for "not in"
lcp
parents: 6
diff changeset
   317
    "[| A : Inter(C);  A:B ==> R;  B~:C ==> R |] ==> R"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   318
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   319
  [ (rtac (major RS CollectD2 RS ballE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   320
    (REPEAT (eresolve_tac prems 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   321
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   322
(*** Rules for Unions of families ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   323
(* UN x:A. B(x) abbreviates Union({B(x). x:A}) *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   324
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   325
qed_goalw "UN_iff" ZF.thy [Bex_def]
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   326
    "b : (UN x:A. B(x)) <-> (EX x:A. b : B(x))"
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   327
 (fn _=> [ (fast_tac (FOL_cs addIs [UnionI, RepFunI] 
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   328
                             addSEs [UnionE, RepFunE]) 1) ]);
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   329
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   330
(*The order of the premises presupposes that A is rigid; b may be flexible*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   331
qed_goal "UN_I" ZF.thy "[| a: A;  b: B(a) |] ==> b: (UN x:A. B(x))"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   332
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   333
  [ (REPEAT (resolve_tac (prems@[UnionI,RepFunI]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   334
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   335
qed_goal "UN_E" ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   336
    "[| b : (UN x:A. B(x));  !!x.[| x: A;  b: B(x) |] ==> R |] ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   337
 (fn major::prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   338
  [ (rtac (major RS UnionE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   339
    (REPEAT (eresolve_tac (prems@[asm_rl, RepFunE, subst]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   340
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   341
qed_goal "UN_cong" ZF.thy
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 120
diff changeset
   342
    "[| A=B;  !!x. x:B ==> C(x)=D(x) |] ==> (UN x:A.C(x)) = (UN x:B.D(x))"
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 120
diff changeset
   343
 (fn prems=> [ (simp_tac (FOL_ss addcongs [RepFun_cong] addsimps prems) 1) ]);
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 120
diff changeset
   344
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   345
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   346
(*** Rules for Intersections of families ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   347
(* INT x:A. B(x) abbreviates Inter({B(x). x:A}) *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   348
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   349
qed_goal "INT_iff" ZF.thy
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   350
    "b : (INT x:A. B(x)) <-> (ALL x:A. b : B(x)) & (EX x. x:A)"
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   351
 (fn _=> [ (simp_tac (FOL_ss addsimps [Inter_def, Ball_def, Bex_def, 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1016
diff changeset
   352
                                       separation, Union_iff, RepFun_iff]) 1),
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1016
diff changeset
   353
           (fast_tac FOL_cs 1) ]);
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   354
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   355
qed_goal "INT_I" ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   356
    "[| !!x. x: A ==> b: B(x);  a: A |] ==> b: (INT x:A. B(x))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   357
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   358
  [ (REPEAT (ares_tac (prems@[InterI,RepFunI]) 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   359
     ORELSE eresolve_tac [RepFunE,ssubst] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   360
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   361
qed_goal "INT_E" ZF.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   362
    "[| b : (INT x:A. B(x));  a: A |] ==> b : B(a)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   363
 (fn [major,minor]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   364
  [ (rtac (major RS InterD) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   365
    (rtac (minor RS RepFunI) 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   366
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   367
qed_goal "INT_cong" ZF.thy
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 120
diff changeset
   368
    "[| A=B;  !!x. x:B ==> C(x)=D(x) |] ==> (INT x:A.C(x)) = (INT x:B.D(x))"
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 120
diff changeset
   369
 (fn prems=> [ (simp_tac (FOL_ss addcongs [RepFun_cong] addsimps prems) 1) ]);
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 120
diff changeset
   370
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   371
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   372
(*** Rules for Powersets ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   373
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   374
qed_goal "PowI" ZF.thy "A <= B ==> A : Pow(B)"
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   375
 (fn [prem]=> [ (rtac (prem RS (Pow_iff RS iffD2)) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   376
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   377
qed_goal "PowD" ZF.thy "A : Pow(B)  ==>  A<=B"
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 435
diff changeset
   378
 (fn [major]=> [ (rtac (major RS (Pow_iff RS iffD1)) 1) ]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   379
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   380
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   381
(*** Rules for the empty set ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   382
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   383
(*The set {x:0.False} is empty; by foundation it equals 0 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   384
  See Suppes, page 21.*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   385
qed_goal "emptyE" ZF.thy "a:0 ==> P"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   386
 (fn [major]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   387
  [ (rtac (foundation RS disjE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   388
    (etac (equalityD2 RS subsetD RS CollectD2 RS FalseE) 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   389
    (rtac major 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   390
    (etac bexE 1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   391
    (etac (CollectD2 RS FalseE) 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   392
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   393
qed_goal "empty_subsetI" ZF.thy "0 <= A"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   394
 (fn _ => [ (REPEAT (ares_tac [equalityI,subsetI,emptyE] 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   395
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   396
qed_goal "equals0I" ZF.thy "[| !!y. y:A ==> False |] ==> A=0"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   397
 (fn prems=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   398
  [ (REPEAT (ares_tac (prems@[empty_subsetI,subsetI,equalityI]) 1 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   399
      ORELSE eresolve_tac (prems RL [FalseE]) 1)) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   400
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   401
qed_goal "equals0D" ZF.thy "[| A=0;  a:A |] ==> P"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   402
 (fn [major,minor]=>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   403
  [ (rtac (minor RS (major RS equalityD1 RS subsetD RS emptyE)) 1) ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   404
825
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
   405
qed_goal "not_emptyI" ZF.thy "!!A a. a:A ==> A ~= 0"
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
   406
 (fn _ => [REPEAT (ares_tac [notI, equals0D] 1)]);
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
   407
868
452f1e6ae3bc Deleted semicolon at the end of the qed_goal line, which was preventing
lcp
parents: 854
diff changeset
   408
qed_goal "not_emptyE" ZF.thy "[| A ~= 0;  !!x. x:A ==> R |] ==> R"
825
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
   409
 (fn [major,minor]=>
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
   410
  [ rtac ([major, equals0I] MRS swap) 1,
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
   411
    swap_res_tac [minor] 1,
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
   412
    assume_tac 1 ]);
76d9575950f2 Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents: 775
diff changeset
   413
1016
2317b680fe58 Now the classical sets include UN_E, to avoid calling hyp_subst_tac
lcp
parents: 868
diff changeset
   414
(*A claset that leaves <= formulae unchanged!
2317b680fe58 Now the classical sets include UN_E, to avoid calling hyp_subst_tac
lcp
parents: 868
diff changeset
   415
  UN_E appears before UnionE so that it is tried first, to avoid expensive
2317b680fe58 Now the classical sets include UN_E, to avoid calling hyp_subst_tac
lcp
parents: 868
diff changeset
   416
  calls to hyp_subst_tac.  Cannot include UN_I as it is unsafe: 
2317b680fe58 Now the classical sets include UN_E, to avoid calling hyp_subst_tac
lcp
parents: 868
diff changeset
   417
  would enlarge the search space.*)
688
4dddc8d0c384 ZF/Fixedpt/subset0_cs: moved to ZF/ZF.ML
lcp
parents: 664
diff changeset
   418
val subset0_cs = FOL_cs
4dddc8d0c384 ZF/Fixedpt/subset0_cs: moved to ZF/ZF.ML
lcp
parents: 664
diff changeset
   419
  addSIs [ballI, InterI, CollectI, PowI, empty_subsetI]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   420
  addIs [bexI, UnionI, ReplaceI, RepFunI]
1016
2317b680fe58 Now the classical sets include UN_E, to avoid calling hyp_subst_tac
lcp
parents: 868
diff changeset
   421
  addSEs [bexE, make_elim PowD, UN_E, UnionE, ReplaceE2, RepFunE,
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1016
diff changeset
   422
          CollectE, emptyE]
688
4dddc8d0c384 ZF/Fixedpt/subset0_cs: moved to ZF/ZF.ML
lcp
parents: 664
diff changeset
   423
  addEs [rev_ballE, InterD, make_elim InterD, subsetD];
4dddc8d0c384 ZF/Fixedpt/subset0_cs: moved to ZF/ZF.ML
lcp
parents: 664
diff changeset
   424
4dddc8d0c384 ZF/Fixedpt/subset0_cs: moved to ZF/ZF.ML
lcp
parents: 664
diff changeset
   425
(*Standard claset*)
4dddc8d0c384 ZF/Fixedpt/subset0_cs: moved to ZF/ZF.ML
lcp
parents: 664
diff changeset
   426
val lemmas_cs = subset0_cs addSIs [subsetI] addEs [subsetCE];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   427
748
ba231bd734d2 moved Cantors theorem here from ZF/ex/misc
lcp
parents: 722
diff changeset
   428
(*** Cantor's Theorem: There is no surjection from a set to its powerset. ***)
ba231bd734d2 moved Cantors theorem here from ZF/ex/misc
lcp
parents: 722
diff changeset
   429
ba231bd734d2 moved Cantors theorem here from ZF/ex/misc
lcp
parents: 722
diff changeset
   430
val cantor_cs = FOL_cs   (*precisely the rules needed for the proof*)
ba231bd734d2 moved Cantors theorem here from ZF/ex/misc
lcp
parents: 722
diff changeset
   431
  addSIs [ballI, CollectI, PowI, subsetI] addIs [bexI]
ba231bd734d2 moved Cantors theorem here from ZF/ex/misc
lcp
parents: 722
diff changeset
   432
  addSEs [CollectE, equalityCE];
ba231bd734d2 moved Cantors theorem here from ZF/ex/misc
lcp
parents: 722
diff changeset
   433
ba231bd734d2 moved Cantors theorem here from ZF/ex/misc
lcp
parents: 722
diff changeset
   434
(*The search is undirected; similar proof attempts may fail.
ba231bd734d2 moved Cantors theorem here from ZF/ex/misc
lcp
parents: 722
diff changeset
   435
  b represents ANY map, such as (lam x:A.b(x)): A->Pow(A). *)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   436
qed_goal "cantor" ZF.thy "EX S: Pow(A). ALL x:A. b(x) ~= S"
748
ba231bd734d2 moved Cantors theorem here from ZF/ex/misc
lcp
parents: 722
diff changeset
   437
 (fn _ => [best_tac cantor_cs 1]);
ba231bd734d2 moved Cantors theorem here from ZF/ex/misc
lcp
parents: 722
diff changeset
   438
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 485
diff changeset
   439
(*Lemma for the inductive definition in Zorn.thy*)
775
7b60621e2bad removed ZF_Lemmas and added qed_goal
clasohm
parents: 748
diff changeset
   440
qed_goal "Union_in_Pow" ZF.thy
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 485
diff changeset
   441
    "!!Y. Y : Pow(Pow(A)) ==> Union(Y) : Pow(A)"
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 485
diff changeset
   442
 (fn _ => [fast_tac lemmas_cs 1]);