src/ZF/ord.ML
author wenzelm
Fri, 13 Dec 1996 17:50:04 +0100
changeset 2390 4e183a4d9cd0
parent 186 320f6bdb593a
permissions -rw-r--r--
now also loads etc/isa-settings.el;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     1
(*  Title: 	ZF/ordinal.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
For ordinal.thy.  Ordinals in 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 Ord;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
(*** Rules for Transset ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
(** Two neat characterisations of Transset **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
goalw Ord.thy [Transset_def] "Transset(A) <-> A<=Pow(A)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
by (fast_tac ZF_cs 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
val Transset_iff_Pow = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
goalw Ord.thy [Transset_def] "Transset(A) <-> Union(succ(A)) = A";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
by (fast_tac (eq_cs addSEs [equalityE]) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
val Transset_iff_Union_succ = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
(** Consequences of downwards closure **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
goalw Ord.thy [Transset_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
    "!!C a b. [| Transset(C); {a,b}: C |] ==> a:C & b: C";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
by (fast_tac ZF_cs 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
val Transset_doubleton_D = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
val [prem1,prem2] = goalw Ord.thy [Pair_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
    "[| Transset(C); <a,b>: C |] ==> a:C & b: C";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
by (cut_facts_tac [prem2] 1);	
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
by (fast_tac (ZF_cs addSDs [prem1 RS Transset_doubleton_D]) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
val Transset_Pair_D = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
val prem1::prems = goal Ord.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    37
    "[| Transset(C); A*B <= C; b: B |] ==> A <= C";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
by (cut_facts_tac prems 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
by (fast_tac (ZF_cs addSDs [prem1 RS Transset_Pair_D]) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
val Transset_includes_domain = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
val prem1::prems = goal Ord.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
    "[| Transset(C); A*B <= C; a: A |] ==> B <= C";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    44
by (cut_facts_tac prems 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
by (fast_tac (ZF_cs addSDs [prem1 RS Transset_Pair_D]) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
val Transset_includes_range = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
val [prem1,prem2] = goalw (merge_theories(Ord.thy,Sum.thy)) [sum_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
    "[| Transset(C); A+B <= C |] ==> A <= C & B <= C";
14
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 6
diff changeset
    50
by (rtac (prem2 RS (Un_subset_iff RS iffD1) RS conjE) 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
by (REPEAT (etac (prem1 RS Transset_includes_range) 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
     ORELSE resolve_tac [conjI, singletonI] 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
val Transset_includes_summands = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    54
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    55
val [prem] = goalw (merge_theories(Ord.thy,Sum.thy)) [sum_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    56
    "Transset(C) ==> (A+B) Int C <= (A Int C) + (B Int C)";
14
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 6
diff changeset
    57
by (rtac (Int_Un_distrib RS ssubst) 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    58
by (fast_tac (ZF_cs addSDs [prem RS Transset_Pair_D]) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    59
val Transset_sum_Int_subset = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    61
(** Closure properties **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    62
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    63
goalw Ord.thy [Transset_def] "Transset(0)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    64
by (fast_tac ZF_cs 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
val Transset_0 = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    66
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
goalw Ord.thy [Transset_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    68
    "!!i j. [| Transset(i);  Transset(j) |] ==> Transset(i Un j)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    69
by (fast_tac ZF_cs 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    70
val Transset_Un = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    71
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    72
goalw Ord.thy [Transset_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    73
    "!!i j. [| Transset(i);  Transset(j) |] ==> Transset(i Int j)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    74
by (fast_tac ZF_cs 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    75
val Transset_Int = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    76
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    77
goalw Ord.thy [Transset_def] "!!i. Transset(i) ==> Transset(succ(i))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    78
by (fast_tac ZF_cs 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    79
val Transset_succ = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    80
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    81
goalw Ord.thy [Transset_def] "!!i. Transset(i) ==> Transset(Pow(i))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    82
by (fast_tac ZF_cs 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    83
val Transset_Pow = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    84
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    85
goalw Ord.thy [Transset_def] "!!A. Transset(A) ==> Transset(Union(A))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    86
by (fast_tac ZF_cs 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    87
val Transset_Union = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    88
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
val [Transprem] = goalw Ord.thy [Transset_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    90
    "[| !!i. i:A ==> Transset(i) |] ==> Transset(Union(A))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    91
by (fast_tac (ZF_cs addEs [Transprem RS bspec RS subsetD]) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    92
val Transset_Union_family = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    93
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    94
val [prem,Transprem] = goalw Ord.thy [Transset_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    95
    "[| j:A;  !!i. i:A ==> Transset(i) |] ==> Transset(Inter(A))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    96
by (cut_facts_tac [prem] 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    97
by (fast_tac (ZF_cs addEs [Transprem RS bspec RS subsetD]) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    98
val Transset_Inter_family = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    99
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   100
(*** Natural Deduction rules for Ord ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   101
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   102
val prems = goalw Ord.thy [Ord_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   103
    "[| Transset(i);  !!x. x:i ==> Transset(x) |]  ==>  Ord(i) ";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   104
by (REPEAT (ares_tac (prems@[ballI,conjI]) 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   105
val OrdI = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   106
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   107
val [major] = goalw Ord.thy [Ord_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   108
    "Ord(i) ==> Transset(i)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   109
by (rtac (major RS conjunct1) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   110
val Ord_is_Transset = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   111
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   112
val [major,minor] = goalw Ord.thy [Ord_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   113
    "[| Ord(i);  j:i |] ==> Transset(j) ";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   114
by (rtac (minor RS (major RS conjunct2 RS bspec)) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   115
val Ord_contains_Transset = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   116
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   117
(*** Lemmas for ordinals ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   118
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   119
goalw Ord.thy [Ord_def,Transset_def] "!!i j. [| Ord(i);  j:i |] ==> Ord(j) ";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   120
by (fast_tac ZF_cs 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   121
val Ord_in_Ord = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   122
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   123
(* Ord(succ(j)) ==> Ord(j) *)
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   124
val Ord_succD = succI1 RSN (2, Ord_in_Ord);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   125
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   126
goal Ord.thy "!!i j. [| Ord(i);  Transset(j);  j<=i |] ==> Ord(j)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   127
by (REPEAT (ares_tac [OrdI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   128
     ORELSE eresolve_tac [Ord_contains_Transset, subsetD] 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   129
val Ord_subset_Ord = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   130
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   131
goalw Ord.thy [Ord_def,Transset_def] "!!i j. [| j:i;  Ord(i) |] ==> j<=i";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   132
by (fast_tac ZF_cs 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   133
val OrdmemD = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   134
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   135
goal Ord.thy "!!i j k. [| i:j;  j:k;  Ord(k) |] ==> i:k";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   136
by (REPEAT (ares_tac [OrdmemD RS subsetD] 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   137
val Ord_trans = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   138
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   139
goal Ord.thy "!!i j. [| i:j;  Ord(j) |] ==> succ(i) <= j";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   140
by (REPEAT (ares_tac [OrdmemD RSN (2,succ_subsetI)] 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   141
val Ord_succ_subsetI = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   142
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   143
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   144
(*** The construction of ordinals: 0, succ, Union ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   145
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   146
goal Ord.thy "Ord(0)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   147
by (REPEAT (ares_tac [OrdI,Transset_0] 1 ORELSE etac emptyE 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   148
val Ord_0 = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   149
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   150
goal Ord.thy "!!i. Ord(i) ==> Ord(succ(i))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   151
by (REPEAT (ares_tac [OrdI,Transset_succ] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   152
     ORELSE eresolve_tac [succE,ssubst,Ord_is_Transset,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   153
			  Ord_contains_Transset] 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   154
val Ord_succ = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   155
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   156
goal Ord.thy "Ord(succ(i)) <-> Ord(i)";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   157
by (fast_tac (ZF_cs addIs [Ord_succ] addDs [Ord_succD]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   158
val Ord_succ_iff = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   159
186
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   160
goalw Ord.thy [Ord_def] "!!i j. [| Ord(i); Ord(j) |] ==> Ord(i Un j)";
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   161
by (fast_tac (ZF_cs addSIs [Transset_Un]) 1);
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   162
val Ord_Un = result();
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   163
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   164
goalw Ord.thy [Ord_def] "!!i j. [| Ord(i); Ord(j) |] ==> Ord(i Int j)";
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   165
by (fast_tac (ZF_cs addSIs [Transset_Int]) 1);
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   166
val Ord_Int = result();
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   167
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   168
val nonempty::prems = goal Ord.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   169
    "[| j:A;  !!i. i:A ==> Ord(i) |] ==> Ord(Inter(A))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   170
by (rtac (nonempty RS Transset_Inter_family RS OrdI) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   171
by (rtac Ord_is_Transset 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   172
by (REPEAT (ares_tac ([Ord_contains_Transset,nonempty]@prems) 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   173
     ORELSE etac InterD 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   174
val Ord_Inter = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   175
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   176
val jmemA::prems = goal Ord.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   177
    "[| j:A;  !!x. x:A ==> Ord(B(x)) |] ==> Ord(INT x:A. B(x))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   178
by (rtac (jmemA RS RepFunI RS Ord_Inter) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   179
by (etac RepFunE 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   180
by (etac ssubst 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   181
by (eresolve_tac prems 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   182
val Ord_INT = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   183
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   184
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   185
(*** < is 'less than' for ordinals ***)
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   186
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   187
goalw Ord.thy [lt_def] "!!i j. [| i:j;  Ord(j) |] ==> i<j";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   188
by (REPEAT (ares_tac [conjI] 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   189
val ltI = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   190
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   191
val major::prems = goalw Ord.thy [lt_def]
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   192
    "[| i<j;  [| i:j;  Ord(i);  Ord(j) |] ==> P |] ==> P";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   193
by (rtac (major RS conjE) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   194
by (REPEAT (ares_tac (prems@[Ord_in_Ord]) 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   195
val ltE = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   196
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   197
goal Ord.thy "!!i j. i<j ==> i:j";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   198
by (etac ltE 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   199
by (assume_tac 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   200
val ltD = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   201
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   202
goalw Ord.thy [lt_def] "~ i<0";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   203
by (fast_tac ZF_cs 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   204
val not_lt0 = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   205
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   206
(* i<0 ==> R *)
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   207
val lt0E = standard (not_lt0 RS notE);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   208
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   209
goal Ord.thy "!!i j k. [| i<j;  j<k |] ==> i<k";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   210
by (fast_tac (ZF_cs addSIs [ltI] addSEs [ltE, Ord_trans]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   211
val lt_trans = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   212
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   213
goalw Ord.thy [lt_def] "!!i j. [| i<j;  j<i |] ==> P";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   214
by (REPEAT (eresolve_tac [asm_rl, conjE, mem_anti_sym] 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   215
val lt_anti_sym = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   216
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   217
val lt_anti_refl = prove_goal Ord.thy "i<i ==> P"
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   218
 (fn [major]=> [ (rtac (major RS (major RS lt_anti_sym)) 1) ]);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   219
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   220
val lt_not_refl = prove_goal Ord.thy "~ i<i"
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   221
 (fn _=> [ (rtac notI 1), (etac lt_anti_refl 1) ]);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   222
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   223
(** le is less than or equals;  recall  i le j  abbrevs  i<succ(j) !! **)
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   224
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   225
goalw Ord.thy [lt_def] "i le j <-> i<j | (i=j & Ord(j))";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   226
by (fast_tac (ZF_cs addSIs [Ord_succ] addSDs [Ord_succD]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   227
val le_iff = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   228
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   229
goal Ord.thy "!!i j. i<j ==> i le j";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   230
by (asm_simp_tac (ZF_ss addsimps [le_iff]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   231
val leI = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   232
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   233
goal Ord.thy "!!i. [| i=j;  Ord(j) |] ==> i le j";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   234
by (asm_simp_tac (ZF_ss addsimps [le_iff]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   235
val le_eqI = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   236
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   237
val le_refl = refl RS le_eqI;
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   238
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   239
val [prem] = goal Ord.thy "(~ (i=j & Ord(j)) ==> i<j) ==> i le j";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   240
by (rtac (disjCI RS (le_iff RS iffD2)) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   241
by (etac prem 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   242
val leCI = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   243
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   244
val major::prems = goal Ord.thy
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   245
    "[| i le j;  i<j ==> P;  [| i=j;  Ord(j) |] ==> P |] ==> P";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   246
by (rtac (major RS (le_iff RS iffD1 RS disjE)) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   247
by (DEPTH_SOLVE (ares_tac prems 1 ORELSE etac conjE 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   248
val leE = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   249
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   250
goal Ord.thy "!!i j. [| i le j;  j le i |] ==> i=j";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   251
by (asm_full_simp_tac (ZF_ss addsimps [le_iff]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   252
by (fast_tac (ZF_cs addEs [lt_anti_sym]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   253
val le_asym = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   254
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   255
goal Ord.thy "i le 0 <-> i=0";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   256
by (fast_tac (ZF_cs addSIs [Ord_0 RS le_refl] addSEs [leE, lt0E]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   257
val le0_iff = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   258
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   259
val le0D = standard (le0_iff RS iffD1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   260
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   261
val lt_cs = 
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   262
    ZF_cs addSIs [le_refl, leCI]
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   263
          addSDs [le0D]
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   264
          addSEs [lt_anti_refl, lt0E, leE];
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   265
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   266
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   267
(*** Natural Deduction rules for Memrel ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   268
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   269
goalw Ord.thy [Memrel_def] "<a,b> : Memrel(A) <-> a:b & a:A & b:A";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   270
by (fast_tac ZF_cs 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   271
val Memrel_iff = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   272
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   273
val prems = goal Ord.thy "[| a: b;  a: A;  b: A |]  ==>  <a,b> : Memrel(A)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   274
by (REPEAT (resolve_tac (prems@[conjI, Memrel_iff RS iffD2]) 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   275
val MemrelI = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   276
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   277
val [major,minor] = goal Ord.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   278
    "[| <a,b> : Memrel(A);  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   279
\       [| a: A;  b: A;  a:b |]  ==> P \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   280
\    |]  ==> P";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   281
by (rtac (major RS (Memrel_iff RS iffD1) RS conjE) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   282
by (etac conjE 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   283
by (rtac minor 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   284
by (REPEAT (assume_tac 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   285
val MemrelE = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   286
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   287
(*The membership relation (as a set) is well-founded.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   288
  Proof idea: show A<=B by applying the foundation axiom to A-B *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   289
goalw Ord.thy [wf_def] "wf(Memrel(A))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   290
by (EVERY1 [rtac (foundation RS disjE RS allI),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   291
	    etac disjI1,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   292
	    etac bexE, 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   293
	    rtac (impI RS allI RS bexI RS disjI2),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   294
	    etac MemrelE,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   295
	    etac bspec,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   296
	    REPEAT o assume_tac]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   297
val wf_Memrel = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   298
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   299
(*** Transfinite induction ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   300
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   301
(*Epsilon induction over a transitive set*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   302
val major::prems = goalw Ord.thy [Transset_def]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   303
    "[| i: k;  Transset(k);                          \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   304
\       !!x.[| x: k;  ALL y:x. P(y) |] ==> P(x) \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   305
\    |]  ==>  P(i)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   306
by (rtac (major RS (wf_Memrel RS wf_induct2)) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   307
by (fast_tac (ZF_cs addEs [MemrelE]) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   308
by (resolve_tac prems 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   309
by (assume_tac 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   310
by (cut_facts_tac prems 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   311
by (fast_tac (ZF_cs addIs [MemrelI]) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   312
val Transset_induct = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   313
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   314
(*Induction over an ordinal*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   315
val Ord_induct = Ord_is_Transset RSN (2, Transset_induct);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   316
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   317
(*Induction over the class of ordinals -- a useful corollary of Ord_induct*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   318
val [major,indhyp] = goal Ord.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   319
    "[| Ord(i); \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   320
\       !!x.[| Ord(x);  ALL y:x. P(y) |] ==> P(x) \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   321
\    |]  ==>  P(i)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   322
by (rtac (major RS Ord_succ RS (succI1 RS Ord_induct)) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   323
by (rtac indhyp 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   324
by (rtac (major RS Ord_succ RS Ord_in_Ord) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   325
by (REPEAT (assume_tac 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   326
val trans_induct = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   327
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   328
(*Perform induction on i, then prove the Ord(i) subgoal using prems. *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   329
fun trans_ind_tac a prems i = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   330
    EVERY [res_inst_tac [("i",a)] trans_induct i,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   331
	   rename_last_tac a ["1"] (i+1),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   332
	   ares_tac prems i];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   333
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   334
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   335
(*** Fundamental properties of the epsilon ordering (< on ordinals) ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   336
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   337
(*Finds contradictions for the following proof*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   338
val Ord_trans_tac = EVERY' [etac notE, etac Ord_trans, REPEAT o atac];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   339
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   340
(** Proving that < is a linear ordering on the ordinals **)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   341
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   342
val prems = goal Ord.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   343
    "Ord(i) ==> (ALL j. Ord(j) --> i:j | i=j | j:i)";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   344
by (trans_ind_tac "i" prems 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   345
by (rtac (impI RS allI) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   346
by (trans_ind_tac "j" [] 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   347
by (DEPTH_SOLVE (swap_res_tac [disjCI,equalityI,subsetI] 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   348
     ORELSE ball_tac 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   349
     ORELSE eresolve_tac [impE,disjE,allE] 1 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   350
     ORELSE hyp_subst_tac 1
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   351
     ORELSE Ord_trans_tac 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   352
val Ord_linear_lemma = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   353
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   354
(*The trichotomy law for ordinals!*)
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   355
val ordi::ordj::prems = goalw Ord.thy [lt_def]
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   356
    "[| Ord(i);  Ord(j);  i<j ==> P;  i=j ==> P;  j<i ==> P |] ==> P";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   357
by (rtac ([ordi,ordj] MRS (Ord_linear_lemma RS spec RS impE)) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   358
by (REPEAT (FIRSTGOAL (etac disjE)));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   359
by (DEPTH_SOLVE (ares_tac ([ordi,ordj,conjI] @ prems) 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   360
val Ord_linear_lt = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   361
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   362
val prems = goal Ord.thy
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   363
    "[| Ord(i);  Ord(j);  i le j ==> P;  j le i ==> P |]  ==> P";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   364
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_lt 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   365
by (DEPTH_SOLVE (ares_tac ([leI,le_eqI] @ prems) 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   366
val Ord_linear_le = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   367
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   368
goal Ord.thy "!!i j. j le i ==> ~ i<j";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   369
by (fast_tac (lt_cs addEs [lt_anti_sym]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   370
val le_imp_not_lt = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   371
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   372
goal Ord.thy "!!i j. [| ~ i<j;  Ord(i);  Ord(j) |] ==> j le i";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   373
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   374
by (REPEAT (SOMEGOAL assume_tac));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   375
by (fast_tac (lt_cs addEs [lt_anti_sym]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   376
val not_lt_imp_le = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   377
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   378
goal Ord.thy "!!i j. [| Ord(i);  Ord(j) |] ==> ~ i<j <-> j le i";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   379
by (REPEAT (ares_tac [iffI, le_imp_not_lt, not_lt_imp_le] 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   380
val not_lt_iff_le = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   381
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   382
goal Ord.thy "!!i j. [| Ord(i);  Ord(j) |] ==> ~ i le j <-> j<i";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   383
by (asm_simp_tac (ZF_ss addsimps [not_lt_iff_le RS iff_sym]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   384
val not_le_iff_lt = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   385
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   386
goal Ord.thy "!!i. Ord(i) ==> 0 le i";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   387
by (etac (not_lt_iff_le RS iffD1) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   388
by (REPEAT (resolve_tac [Ord_0, not_lt0] 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   389
val Ord_0_le = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   390
37
cebe01deba80 added ~: for "not in"
lcp
parents: 30
diff changeset
   391
goal Ord.thy "!!i. [| Ord(i);  i~=0 |] ==> 0<i";
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   392
by (etac (not_le_iff_lt RS iffD1) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   393
by (rtac Ord_0 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   394
by (fast_tac lt_cs 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   395
val Ord_0_lt = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   396
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   397
(*** Results about less-than or equals ***)
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   398
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   399
(** For ordinals, j<=i (subset) implies j le i (less-than or equals) **)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   400
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   401
goal Ord.thy "!!i j. [| j<=i;  Ord(i);  Ord(j) |] ==> j le i";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   402
by (rtac (not_lt_iff_le RS iffD1) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   403
by (assume_tac 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   404
by (assume_tac 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   405
by (fast_tac (ZF_cs addEs [ltE, mem_anti_refl]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   406
val subset_imp_le = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   407
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   408
goal Ord.thy "!!i j. i le j ==> i<=j";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   409
by (etac leE 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   410
by (fast_tac ZF_cs 2);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   411
by (fast_tac (subset_cs addIs [OrdmemD] addEs [ltE]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   412
val le_imp_subset = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   413
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   414
goal Ord.thy "j le i <-> j<=i & Ord(i) & Ord(j)";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   415
by (fast_tac (ZF_cs addSEs [subset_imp_le, le_imp_subset]
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   416
	            addEs [ltE, make_elim Ord_succD]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   417
val le_subset_iff = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   418
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   419
goal Ord.thy "i le succ(j) <-> i le j | i=succ(j) & Ord(i)";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   420
by (simp_tac (ZF_ss addsimps [le_iff]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   421
by (fast_tac (ZF_cs addIs [Ord_succ] addDs [Ord_succD]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   422
val le_succ_iff = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   423
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   424
goal Ord.thy "!!i j. [| i le j;  j<k |] ==> i<k";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   425
by (fast_tac (ZF_cs addEs [leE, lt_trans]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   426
val lt_trans1 = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   427
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   428
goal Ord.thy "!!i j. [| i<j;  j le k |] ==> i<k";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   429
by (fast_tac (ZF_cs addEs [leE, lt_trans]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   430
val lt_trans2 = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   431
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   432
goal Ord.thy "!!i j. [| i le j;  j le k |] ==> i le k";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   433
by (REPEAT (ares_tac [lt_trans1] 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   434
val le_trans = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   435
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   436
goal Ord.thy "!!i j. i<j ==> succ(i) le j";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   437
by (rtac (not_lt_iff_le RS iffD1) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   438
by (fast_tac (lt_cs addEs [lt_anti_sym]) 3);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   439
by (ALLGOALS (fast_tac (ZF_cs addEs [ltE] addIs [Ord_succ])));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   440
val succ_leI = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   441
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   442
goal Ord.thy "!!i j. succ(i) le j ==> i<j";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   443
by (rtac (not_le_iff_lt RS iffD1) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   444
by (fast_tac (lt_cs addEs [lt_anti_sym]) 3);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   445
by (ALLGOALS (fast_tac (ZF_cs addEs [ltE, make_elim Ord_succD])));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   446
val succ_leE = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   447
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   448
goal Ord.thy "succ(i) le j <-> i<j";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   449
by (REPEAT (ares_tac [iffI,succ_leI,succ_leE] 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   450
val succ_le_iff = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   451
14
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 6
diff changeset
   452
(** Union and Intersection **)
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 6
diff changeset
   453
186
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   454
goal Ord.thy "!!i j. [| Ord(i); Ord(j) |] ==> i le i Un j";
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   455
by (rtac (Un_upper1 RS subset_imp_le) 1);
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   456
by (REPEAT (ares_tac [Ord_Un] 1));
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   457
val Un_upper1_le = result();
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   458
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   459
goal Ord.thy "!!i j. [| Ord(i); Ord(j) |] ==> j le i Un j";
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   460
by (rtac (Un_upper2 RS subset_imp_le) 1);
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   461
by (REPEAT (ares_tac [Ord_Un] 1));
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   462
val Un_upper2_le = result();
320f6bdb593a ZF/ord/Ord_Un,Ord_Int,Un_upper1_le,Un_upper2_le: new
lcp
parents: 37
diff changeset
   463
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   464
(*Replacing k by succ(k') yields the similar rule for le!*)
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   465
goal Ord.thy "!!i j k. [| i<k;  j<k |] ==> i Un j < k";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   466
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   467
by (rtac (Un_commute RS ssubst) 4);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   468
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Un_iff]) 4);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   469
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Un_iff]) 3);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   470
by (REPEAT (eresolve_tac [asm_rl, ltE] 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   471
val Un_least_lt = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   472
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   473
(*Replacing k by succ(k') yields the similar rule for le!*)
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   474
goal Ord.thy "!!i j k. [| i<k;  j<k |] ==> i Int j < k";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   475
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   476
by (rtac (Int_commute RS ssubst) 4);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   477
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Int_iff]) 4);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   478
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Int_iff]) 3);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   479
by (REPEAT (eresolve_tac [asm_rl, ltE] 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   480
val Int_greatest_lt = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   481
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   482
(*** Results about limits ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   483
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   484
val prems = goal Ord.thy "[| !!i. i:A ==> Ord(i) |] ==> Ord(Union(A))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   485
by (rtac (Ord_is_Transset RS Transset_Union_family RS OrdI) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   486
by (REPEAT (etac UnionE 1 ORELSE ares_tac ([Ord_contains_Transset]@prems) 1));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   487
val Ord_Union = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   488
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   489
val prems = goal Ord.thy "[| !!x. x:A ==> Ord(B(x)) |] ==> Ord(UN x:A. B(x))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   490
by (rtac Ord_Union 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   491
by (etac RepFunE 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   492
by (etac ssubst 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   493
by (eresolve_tac prems 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   494
val Ord_UN = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   495
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   496
(* No < version; consider (UN i:nat.i)=nat *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   497
val [ordi,limit] = goal Ord.thy
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   498
    "[| Ord(i);  !!x. x:A ==> b(x) le i |] ==> (UN x:A. b(x)) le i";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   499
by (rtac (le_imp_subset RS UN_least RS subset_imp_le) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   500
by (REPEAT (ares_tac [ordi, Ord_UN, limit] 1 ORELSE etac (limit RS ltE) 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   501
val UN_least_le = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   502
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   503
val [jlti,limit] = goal Ord.thy
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   504
    "[| j<i;  !!x. x:A ==> b(x)<j |] ==> (UN x:A. succ(b(x))) < i";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   505
by (rtac (jlti RS ltE) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   506
by (rtac (UN_least_le RS lt_trans2) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   507
by (REPEAT (ares_tac [jlti, succ_leI, limit] 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   508
val UN_succ_least_lt = result();
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   509
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   510
val prems = goal Ord.thy
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   511
    "[| a: A;  i le b(a);  !!x. x:A ==> Ord(b(x)) |] ==> i le (UN x:A. b(x))";
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   512
by (resolve_tac (prems RL [ltE]) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   513
by (rtac (le_imp_subset RS subset_trans RS subset_imp_le) 1);
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   514
by (REPEAT (ares_tac (prems @ [UN_upper, Ord_UN]) 1));
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   515
val UN_upper_le = result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   516
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   517
goal Ord.thy "!!i. Ord(i) ==> (UN y:i. succ(y)) = i";
30
d49df4181f0d Retrying yet again after network problems
lcp
parents: 14
diff changeset
   518
by (fast_tac (eq_cs addEs [Ord_trans]) 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   519
val Ord_equality = result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   520
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   521
(*Holds for all transitive sets, not just ordinals*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   522
goal Ord.thy "!!i. Ord(i) ==> Union(i) <= i";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   523
by (fast_tac (ZF_cs addSEs [Ord_trans]) 1);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   524
val Ord_Union_subset = result();