src/ZF/AC/DC.ML
author paulson
Tue, 14 Oct 1997 17:23:01 +0200
changeset 3862 6f389875ab33
parent 3731 71366483323b
child 4091 771b1f6422a8
permissions -rw-r--r--
Patch to avoid simplification of ~EX to ALL~ Also some better indentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
     1
(*  Title:      ZF/AC/DC.ML
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
     2
    ID:  $Id$
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
     3
    Author:     Krzysztof Grabczewski
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
     4
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
     5
The proofs concerning the Axiom of Dependent Choice
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
     6
*)
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
     7
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
     8
open DC;
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
     9
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    10
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    11
(* DC ==> DC(omega)                                                       *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    12
(*                                                                        *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    13
(* The scheme of the proof:                                               *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    14
(*                                                                        *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    15
(* Assume DC. Let R and x satisfy the premise of DC(omega).               *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    16
(*                                                                        *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    17
(* Define XX and RR as follows:                                           *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    18
(*                                                                        *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    19
(*       XX = (UN n:nat. {f:n->X. ALL k:n. <f``k, f`k> : R})              *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    20
(*       f RR g iff domain(g)=succ(domain(f)) &                           *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    21
(*              restrict(g, domain(f)) = f                                *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    22
(*                                                                        *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    23
(* Then RR satisfies the hypotheses of DC.                                *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    24
(* So applying DC:                                                        *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    25
(*                                                                        *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    26
(*       EX f:nat->XX. ALL n:nat. f`n RR f`succ(n)                        *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    27
(*                                                                        *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    28
(* Thence                                                                 *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    29
(*                                                                        *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    30
(*       ff = {<n, f`succ(n)`n>. n:nat}                                   *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    31
(*                                                                        *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    32
(* is the desired function.                                               *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    33
(*                                                                        *)
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    34
(* ********************************************************************** *)
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    35
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    36
goal thy "{<z1,z2>:XX*XX. domain(z2)=succ(domain(z1))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    37
\       & restrict(z2, domain(z1)) = z1} <= XX*XX";
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    38
by (Fast_tac 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    39
val lemma1_1 = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    40
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    41
goal thy "!!X. ALL Y:Pow(X). Y lesspoll nat --> (EX x:X. <Y, x> : R)  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    42
\       ==> {<z1,z2>: (UN n:nat. {f:n->X. ALL k:n. <f``k, f`k> : R}) *  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    43
\               (UN n:nat. {f:n->X. ALL k:n. <f``k, f`k> : R}).  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    44
\               domain(z2)=succ(domain(z1))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    45
\               & restrict(z2, domain(z1)) = z1} ~= 0";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    46
by (etac ballE 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    47
by (eresolve_tac [empty_subsetI RS PowI RSN (2, notE)] 2);
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    48
by (eresolve_tac [nat_0I RS n_lesspoll_nat RSN (2, impE)] 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    49
by (etac bexE 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    50
by (res_inst_tac [("a","<0, {<0, x>}>")] not_emptyI 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    51
by (rtac CollectI 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    52
by (rtac SigmaI 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    53
by (fast_tac (!claset addSIs [nat_0I RS UN_I, empty_fun]) 1);
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2483
diff changeset
    54
by (rtac (nat_1I RS UN_I) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    55
by (fast_tac (!claset addSIs [singleton_fun RS Pi_type]
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    56
        addss (!simpset addsimps [singleton_0 RS sym])) 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    57
by (asm_full_simp_tac (!simpset addsimps [domain_0, domain_cons,
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    58
                singleton_0]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    59
val lemma1_2 = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    60
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    61
goal thy "!!X. ALL Y:Pow(X). Y lesspoll nat --> (EX x:X. <Y, x> : R)  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    62
\       ==> range({<z1,z2>: (UN n:nat. {f:n->X. ALL k:n. <f``k, f`k> : R}) *  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    63
\               (UN n:nat. {f:n->X. ALL k:n. <f``k, f`k> : R}).  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    64
\               domain(z2)=succ(domain(z1))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    65
\               & restrict(z2, domain(z1)) = z1})  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    66
\       <=  domain({<z1,z2>: (UN n:nat. {f:n->X. ALL k:n. <f``k, f`k> : R}) *  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    67
\               (UN n:nat. {f:n->X. ALL k:n. <f``k, f`k> : R}).  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    68
\               domain(z2)=succ(domain(z1))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    69
\               & restrict(z2, domain(z1)) = z1})";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    70
by (rtac range_subset_domain 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    71
by (rtac subsetI 2);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    72
by (etac CollectD1 2);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    73
by (etac UN_E 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    74
by (etac CollectE 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    75
by (dresolve_tac [fun_is_rel RS image_subset RS PowI RSN (2, bspec)] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    76
        THEN (assume_tac 1));
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    77
by (eresolve_tac [[n_lesspoll_nat, nat_into_Ord RSN (2, image_Ord_lepoll)]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    78
        MRS lepoll_lesspoll_lesspoll RSN (2, impE)] 1
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    79
        THEN REPEAT (assume_tac 1));
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    80
by (etac bexE 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    81
by (res_inst_tac [("x","cons(<n,x>, g)")] exI 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    82
by (rtac CollectI 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    83
by (rtac SigmaI 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    84
by (Fast_tac 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    85
by (rtac UN_I 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    86
by (etac nat_succI 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    87
by (rtac CollectI 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
    88
by (etac cons_fun_type2 1 THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    89
by (fast_tac (!claset addSEs [succE] addss (!simpset
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    90
        addsimps [cons_image_n, cons_val_n, cons_image_k, cons_val_k])) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    91
by (asm_full_simp_tac (!simpset
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    92
        addsimps [domain_cons, domain_of_fun, succ_def, restrict_cons_eq]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    93
val lemma1_3 = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    94
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
    95
goal thy "!!X. [| XX = (UN n:nat. {f:n->X. ALL k:n. <f``k, f`k> : R});  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    96
\       RR = {<z1,z2>:XX*XX. domain(z2)=succ(domain(z1))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
    97
\       & restrict(z2, domain(z1)) = z1};  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    98
\       ALL Y:Pow(X). Y lesspoll nat --> (EX x:X. <Y, x> : R)  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
    99
\       |] ==> RR <= XX*XX & RR ~= 0 & range(RR) <= domain(RR)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   100
by (fast_tac (!claset addSIs [lemma1_1] addSEs [lemma1_2, lemma1_3]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   101
val lemma1 = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   102
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   103
goal thy
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   104
"!!X.[| XX = (UN n:nat. {f:n->X. ALL k:n. <f``k, f`k> : R});  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   105
\       ALL n:nat. <f`n, f`succ(n)> :  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   106
\       {<z1,z2>:XX*XX. domain(z2)=succ(domain(z1))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   107
\                       & restrict(z2, domain(z1)) = z1};  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   108
\       f: nat -> XX; n:nat  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   109
\    |] ==> EX k:nat. f`succ(n) : k -> X & n:k  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   110
\              & <f`succ(n)``n, f`succ(n)`n> : R";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   111
by (etac nat_induct 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   112
by (dresolve_tac [nat_1I RSN (2, apply_type)] 1);
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   113
by (dresolve_tac [nat_0I RSN (2, bspec)] 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   114
by (Asm_full_simp_tac 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   115
by Safe_tac;
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   116
by (rtac bexI 1 THEN (assume_tac 2));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   117
by (best_tac (!claset addIs [ltD]
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2483
diff changeset
   118
                      addSEs [nat_0_le RS leE]
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   119
        addEs [sym RS trans RS succ_neq_0, domain_of_fun]
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2483
diff changeset
   120
        addss (!simpset)) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   121
(** LEVEL 7 **)
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   122
by (dresolve_tac [nat_succI RSN (2, bspec)] 1 THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   123
by (subgoal_tac "f ` succ(succ(x)) : succ(k)->X" 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   124
by (dresolve_tac [nat_succI RS nat_succI RSN (2, apply_type)] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   125
        THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   126
by (Full_simp_tac 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   127
by Safe_tac;
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   128
by (forw_inst_tac [("a","succ(k)")] (domain_of_fun RS sym RS trans) 1 THEN
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   129
    (assume_tac 1));
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   130
by (forw_inst_tac [("a","xa")] (domain_of_fun RS sym RS trans) 1 THEN
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   131
    (assume_tac 1));
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   132
by (fast_tac (!claset addSEs [nat_succI, nat_into_Ord RS succ_in_succ]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   133
        addSDs [nat_into_Ord RS succ_in_succ RSN (2, bspec)]) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   134
by (dtac domain_of_fun 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   135
by (Full_simp_tac 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   136
by (deepen_tac (!claset addDs [domain_of_fun RS sym RS trans]) 0 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   137
val lemma2 = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   138
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   139
goal thy 
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   140
"!!X.[| XX = (UN n:nat. {f:n->X. ALL k:n. <f``k, f`k> : R});  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   141
\       ALL n:nat. <f`n, f`succ(n)> :  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   142
\       {<z1,z2>:XX*XX. domain(z2)=succ(domain(z1))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   143
\       & restrict(z2, domain(z1)) = z1};  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   144
\       f: nat -> XX; n:nat \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   145
\    |] ==>  ALL x:n. f`succ(n)`x = f`succ(x)`x";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   146
by (etac nat_induct 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   147
by (Fast_tac 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   148
by (rtac ballI 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   149
by (etac succE 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   150
by (rtac restrict_eq_imp_val_eq 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   151
by (dresolve_tac [nat_succI RSN (2, bspec)] 1 THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   152
by (Asm_full_simp_tac 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   153
by (dtac lemma2 1 THEN REPEAT (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   154
by (fast_tac (!claset addSDs [domain_of_fun]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   155
by (dres_inst_tac [("x","xa")] bspec 1 THEN (assume_tac 1));
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   156
by (eresolve_tac [sym RS trans RS sym] 1);
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   157
by (resolve_tac [restrict_eq_imp_val_eq RS sym] 1);
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   158
by (dresolve_tac [nat_succI RSN (2, bspec)] 1 THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   159
by (Asm_full_simp_tac 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   160
by (dtac lemma2 1 THEN REPEAT (assume_tac 1));
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   161
by (fast_tac (FOL_cs addSDs [domain_of_fun]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   162
        addSEs [bexE, nat_into_Ord RSN (2, OrdmemD) RS subsetD]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   163
val lemma3_1 = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   164
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   165
goal thy "!!n. ALL x:n. f`succ(n)`x = f`succ(x)`x   \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   166
\       ==> {f`succ(x)`x. x:n} = {f`succ(n)`x. x:n}";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   167
by (Asm_full_simp_tac 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   168
val lemma3_2 = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   169
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   170
goal thy "!!X. [| XX = (UN n:nat. {f:n->X. ALL k:n. <f``k, f`k> : R});  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   171
\       ALL n:nat. <f`n, f`succ(n)> :  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   172
\       {<z1,z2>:XX*XX. domain(z2)=succ(domain(z1))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   173
\       & restrict(z2, domain(z1)) = z1};  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   174
\       f: nat -> XX; n:nat  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   175
\       |] ==> (lam x:nat. f`succ(x)`x) `` n = f`succ(n)``n";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   176
by (etac natE 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   177
by (asm_full_simp_tac (!simpset addsimps [image_0]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   178
by (resolve_tac [image_lam RS ssubst] 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   179
by (fast_tac (!claset addSEs [[nat_succI, Ord_nat] MRS OrdmemD]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   180
by (resolve_tac [lemma3_1 RS lemma3_2 RS ssubst] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   181
        THEN REPEAT (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   182
by (fast_tac (!claset addSEs [nat_succI]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   183
by (dresolve_tac [nat_succI RSN (4, lemma2)] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   184
        THEN REPEAT (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   185
by (fast_tac (!claset addSEs [nat_into_Ord RSN (2, OrdmemD) RSN 
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   186
                            (2, image_fun RS sym)]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   187
val lemma3 = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   188
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   189
goal thy "!!f. [| f:A->B; B<=C |] ==> f:A->C";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   190
by (rtac Pi_type 1 THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   191
by (fast_tac (!claset addSEs [apply_type]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   192
qed "fun_type_gen";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   193
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   194
goalw thy [DC_def, DC0_def] "!!Z. DC0 ==> DC(nat)";
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   195
by (REPEAT (resolve_tac [allI, impI] 1));
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   196
by (REPEAT (eresolve_tac [conjE, allE] 1));
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   197
by (eresolve_tac [[refl, refl] MRS lemma1 RSN (2, impE)] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   198
        THEN (assume_tac 1));
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   199
by (etac bexE 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   200
by (res_inst_tac [("x","lam n:nat. f`succ(n)`n")] bexI 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   201
by (fast_tac (!claset addSIs [lam_type] addSDs [refl RS lemma2]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   202
                addSEs [fun_type_gen, apply_type]) 2);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   203
by (rtac oallI 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   204
by (forward_tac [ltD RSN (3, refl RS lemma2)] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   205
        THEN assume_tac 2);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   206
by (fast_tac (!claset addSEs [fun_type_gen]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   207
by (eresolve_tac [ltD RSN (3, refl RS lemma3) RS ssubst] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   208
        THEN assume_tac 2);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   209
by (fast_tac (!claset addSEs [fun_type_gen]) 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   210
by (fast_tac (!claset addss (!simpset)) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   211
qed "DC0_DC_nat";
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   212
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   213
(* ************************************************************************
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   214
   DC(omega) ==> DC                                                       
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   215
                                                                          
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   216
   The scheme of the proof:                                               
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   217
                                                                          
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   218
   Assume DC(omega). Let R and x satisfy the premise of DC.               
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   219
                                                                          
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   220
   Define XX and RR as follows:                                           
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   221
                                                                          
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   222
    XX = (UN n:nat. {f:succ(n)->domain(R). ALL k:n. <f`k, f`succ(k)> : R})
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   223
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   224
    RR = {<z1,z2>:Fin(XX)*XX. 
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   225
           (domain(z2)=succ(UN f:z1. domain(f)) &
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   226
	    (ALL f:z1. restrict(z2, domain(f)) = f)) |      
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   227
	   (~ (EX g:XX. domain(g)=succ(UN f:z1. domain(f)) &
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   228
	                (ALL f:z1. restrict(g, domain(f)) = f)) &           
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   229
	    z2={<0,x>})}                                          
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   230
                                                                          
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   231
   Then XX and RR satisfy the hypotheses of DC(omega).                    
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   232
   So applying DC:                                                        
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   233
                                                                          
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   234
         EX f:nat->XX. ALL n:nat. f``n RR f`n                             
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   235
                                                                          
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   236
   Thence                                                                 
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   237
                                                                          
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   238
         ff = {<n, f`n`n>. n:nat}                                         
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   239
                                                                          
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   240
   is the desired function.                                               
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   241
                                                                          
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   242
************************************************************************* *)
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   243
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   244
goalw thy [lesspoll_def, Finite_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   245
        "!!A. A lesspoll nat ==> Finite(A)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   246
by (fast_tac (!claset addSDs [ltD, lepoll_imp_ex_le_eqpoll]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   247
        addSIs [Ord_nat]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   248
qed "lesspoll_nat_is_Finite";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   249
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   250
goal thy "!!n. n:nat ==> ALL A. (A eqpoll n & A <= X) --> A : Fin(X)";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   251
by (etac nat_induct 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   252
by (rtac allI 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   253
by (fast_tac (!claset addSIs [Fin.emptyI]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   254
        addSDs [eqpoll_imp_lepoll RS lepoll_0_is_0]) 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   255
by (rtac allI 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   256
by (rtac impI 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   257
by (etac conjE 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   258
by (resolve_tac [eqpoll_succ_imp_not_empty RS not_emptyE] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   259
        THEN (assume_tac 1));
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   260
by (forward_tac [Diff_sing_eqpoll] 1 THEN (assume_tac 1));
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   261
by (etac allE 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   262
by (etac impE 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   263
by (Fast_tac 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   264
by (dtac subsetD 1 THEN (assume_tac 1));
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   265
by (dresolve_tac [Fin.consI] 1 THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   266
by (asm_full_simp_tac (!simpset addsimps [cons_Diff]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   267
qed "Finite_Fin_lemma";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   268
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   269
goalw thy [Finite_def] "!!A. [| Finite(A); A <= X |] ==> A : Fin(X)";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   270
by (etac bexE 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   271
by (dtac Finite_Fin_lemma 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   272
by (etac allE 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   273
by (etac impE 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   274
by (assume_tac 2);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   275
by (Fast_tac 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   276
qed "Finite_Fin";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   277
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   278
goal thy "!!x. x: X  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   279
\ ==> {<0,x>}: (UN n:nat. {f:succ(n)->X. ALL k:n. <f`k, f`succ(k)> : R})";
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2483
diff changeset
   280
by (rtac (nat_0I RS UN_I) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   281
by (fast_tac (!claset addSIs [singleton_fun RS Pi_type]
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   282
        addss (!simpset addsimps [singleton_0 RS sym])) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   283
qed "singleton_in_funs";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   284
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   285
goal thy
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   286
        "!!X. [| XX = (UN n:nat.  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   287
\               {f:succ(n)->domain(R). ALL k:n. <f`k, f`succ(k)> : R});  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   288
\       RR = {<z1,z2>:Fin(XX)*XX. (domain(z2)=succ(UN f:z1. domain(f))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   289
\       & (ALL f:z1. restrict(z2, domain(f)) = f)) |  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   290
\       (~ (EX g:XX. domain(g)=succ(UN f:z1. domain(f))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   291
\       & (ALL f:z1. restrict(g, domain(f)) = f)) & z2={<0,x>})};  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   292
\       range(R) <= domain(R); x:domain(R)  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   293
\       |] ==> RR <= Pow(XX)*XX &  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   294
\       (ALL Y:Pow(XX). Y lesspoll nat --> (EX x:XX. <Y,x>:RR))";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   295
by (rtac conjI 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   296
by (deepen_tac (!claset addSEs [FinD RS PowI]) 0 1);
2483
95c2f9c0930a Default rewrite rules for quantification over Collect(A,P)
paulson
parents: 2469
diff changeset
   297
by (rtac (impI RS ballI) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   298
by (dresolve_tac [[lesspoll_nat_is_Finite, PowD] MRS Finite_Fin] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   299
        THEN (assume_tac 1));
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   300
by (excluded_middle_tac "EX g:XX. domain(g)=succ(UN f:Y. domain(f))  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   301
\       & (ALL f:Y. restrict(g, domain(f)) = f)" 1);
2483
95c2f9c0930a Default rewrite rules for quantification over Collect(A,P)
paulson
parents: 2469
diff changeset
   302
by (etac subst 2 THEN (*elimination equation for greater speed*)
95c2f9c0930a Default rewrite rules for quantification over Collect(A,P)
paulson
parents: 2469
diff changeset
   303
    fast_tac (!claset addss (!simpset)) 2);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   304
by (safe_tac (!claset delrules [domainE]));
2483
95c2f9c0930a Default rewrite rules for quantification over Collect(A,P)
paulson
parents: 2469
diff changeset
   305
by (swap_res_tac [bexI] 1 THEN etac singleton_in_funs 2);
95c2f9c0930a Default rewrite rules for quantification over Collect(A,P)
paulson
parents: 2469
diff changeset
   306
by (asm_full_simp_tac (!simpset addsimps [nat_0I  RSN (2, bexI), 
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2483
diff changeset
   307
                                     cons_fun_type2, empty_fun]) 1);
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   308
val lemma4 = result();
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   309
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   310
goal thy "!!f. [| f:nat->X; n:nat |] ==>  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   311
\       (UN x:f``succ(n). P(x)) =  P(f`n) Un (UN x:f``n. P(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   312
by (asm_full_simp_tac (!simpset
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   313
        addsimps [Ord_nat RSN (2, OrdmemD) RSN (2, image_fun),
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   314
        [nat_succI, Ord_nat] MRS OrdmemD RSN (2, image_fun)]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   315
qed "UN_image_succ_eq";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   316
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   317
goal thy "!!f. [| (UN x:f``n. P(x)) = y; P(f`n) = succ(y);  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   318
\       f:nat -> X; n:nat |] ==> (UN x:f``succ(n). P(x)) = succ(y)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   319
by (asm_full_simp_tac (!simpset addsimps [UN_image_succ_eq]) 1);
2496
40efb87985b5 Removal of needless "addIs [equality]", etc.
paulson
parents: 2493
diff changeset
   320
by (Fast_tac 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   321
qed "UN_image_succ_eq_succ";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   322
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   323
goal thy "!!f. [| f:succ(n) -> D;  n:nat;  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   324
\       domain(f)=succ(x); x=y |] ==> f`y : D";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   325
by (fast_tac (!claset addEs [apply_type]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   326
        addSDs [[sym, domain_of_fun] MRS trans]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   327
qed "apply_domain_type";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   328
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   329
goal thy "!!f. [| f : nat -> X; n:nat |] ==> f``succ(n) = cons(f`n, f``n)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   330
by (asm_full_simp_tac (!simpset
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   331
        addsimps [nat_succI, Ord_nat RSN (2, OrdmemD), image_fun]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   332
qed "image_fun_succ";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   333
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   334
goal thy "!!f. [| domain(f`n) = succ(u); f : nat -> (UN n:nat.  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   335
\       {f:succ(n)->domain(R). ALL k:n. <f`k, f`succ(k)> : R});  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   336
\       u=k; n:nat  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   337
\       |] ==> f`n : succ(k) -> domain(R)";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   338
by (dtac apply_type 1 THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   339
by (fast_tac (!claset addEs [UN_E, domain_eq_imp_fun_type]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   340
qed "f_n_type";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   341
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   342
goal thy "!!f. [| f : nat -> (UN n:nat.  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   343
\       {f:succ(n)->domain(R). ALL k:n. <f`k, f`succ(k)> : R});  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   344
\       domain(f`n) = succ(k); n:nat  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   345
\       |] ==> ALL i:k. <f`n`i, f`n`succ(i)> : R";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   346
by (dtac apply_type 1 THEN (assume_tac 1));
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   347
by (etac UN_E 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   348
by (etac CollectE 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   349
by (dresolve_tac [domain_of_fun RS sym RS trans] 1 THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   350
by (Asm_full_simp_tac 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   351
qed "f_n_pairs_in_R";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   352
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   353
goalw thy [restrict_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   354
        "!!f. [| restrict(f, domain(x))=x; f:n->X; domain(x) <= n  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   355
\       |] ==> restrict(cons(<n, y>, f), domain(x)) = x";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   356
by (eresolve_tac [sym RS trans RS sym] 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   357
by (rtac fun_extension 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   358
by (fast_tac (!claset addSIs [lam_type]) 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   359
by (fast_tac (!claset addSIs [lam_type]) 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   360
by (asm_full_simp_tac (!simpset addsimps [subsetD RS cons_val_k]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   361
qed "restrict_cons_eq_restrict";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   362
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   363
goal thy "!!f. [| ALL x:f``n. restrict(f`n, domain(x))=x;  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   364
\       f : nat -> (UN n:nat.  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   365
\       {f:succ(n)->domain(R). ALL k:n. <f`k, f`succ(k)> : R});  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   366
\       n:nat; domain(f`n) = succ(n);  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   367
\       (UN x:f``n. domain(x)) <= n |] \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   368
\       ==> ALL x:f``succ(n). restrict(cons(<succ(n),y>, f`n), domain(x))=x";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   369
by (rtac ballI 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   370
by (asm_full_simp_tac (!simpset addsimps [image_fun_succ]) 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   371
by (dtac f_n_type 1 THEN REPEAT (ares_tac [refl] 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   372
by (etac disjE 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   373
by (asm_full_simp_tac (!simpset addsimps [domain_of_fun, restrict_cons_eq]) 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   374
by (dtac bspec 1 THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   375
by (fast_tac (!claset addSEs [restrict_cons_eq_restrict]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   376
qed "all_in_image_restrict_eq";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   377
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   378
goal thy
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   379
"!!X.[| ALL b<nat. <f``b, f`b> :  \
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   380
\       {<z1,z2>:Fin(XX)*XX. (domain(z2)=succ(UN f:z1. domain(f))  & \
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   381
\                            (ALL f:z1. restrict(z2, domain(f)) = f)) |  \
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   382
\                    (~ (EX g:XX. domain(g)=succ(UN f:z1. domain(f)) & \
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   383
\                                 (ALL f:z1. restrict(g, domain(f)) = f)) & \
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   384
\                            z2={<0,x>})};  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   385
\       XX = (UN n:nat.  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   386
\       {f:succ(n)->domain(R). ALL k:n. <f`k, f`succ(k)> : R});  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   387
\       f: nat -> XX; range(R) <= domain(R); x:domain(R)  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   388
\    |] ==> ALL b<nat. <f``b, f`b> :  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   389
\           {<z1,z2>:Fin(XX)*XX. (domain(z2)=succ(UN f:z1. domain(f))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   390
\           & (UN f:z1. domain(f)) = b  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   391
\           & (ALL f:z1. restrict(z2, domain(f)) = f))}";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   392
by (rtac oallI 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   393
by (dtac ltD 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   394
by (etac nat_induct 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   395
by (dresolve_tac [[nat_0I, Ord_nat] MRS ltI RSN (2, ospec)] 1);
1200
d4551b1a6da7 Many small changes to make proofs run faster
lcp
parents: 1196
diff changeset
   396
by (fast_tac (FOL_cs addss
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   397
              (!simpset addsimps [singleton_fun RS domain_of_fun,
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2483
diff changeset
   398
                                  singleton_0, singleton_in_funs])) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   399
(*induction step*) (** LEVEL 5 **)
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   400
by (full_simp_tac (*prevent simplification of ~EX to ALL~*)
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   401
		  (FOL_ss addsimps [separation, split]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   402
by (dresolve_tac [[nat_succI, Ord_nat] MRS ltI RSN (2, ospec)] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   403
        THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   404
by (REPEAT (eresolve_tac [conjE, disjE] 1));
1200
d4551b1a6da7 Many small changes to make proofs run faster
lcp
parents: 1196
diff changeset
   405
by (fast_tac (FOL_cs addSEs [trans, subst_context]
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   406
                     addSIs [UN_image_succ_eq_succ] addss (!simpset)) 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   407
by (etac conjE 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   408
by (etac notE 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   409
by (asm_full_simp_tac (!simpset addsimps [UN_image_succ_eq_succ]) 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   410
(** LEVEL 12 **)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   411
by (REPEAT (eresolve_tac [conjE, bexE] 1));
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   412
by (dtac apply_domain_type 1 THEN REPEAT (assume_tac 1));
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   413
by (etac domainE 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   414
by (etac domainE 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   415
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   416
by (forward_tac [f_n_type] 1 THEN REPEAT (assume_tac 1));
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   417
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2483
diff changeset
   418
by (rtac bexI 1);
2483
95c2f9c0930a Default rewrite rules for quantification over Collect(A,P)
paulson
parents: 2469
diff changeset
   419
by (etac nat_succI 2);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   420
by (res_inst_tac [("x","cons(<succ(xa), ya>, f`xa)")] bexI 1);
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2483
diff changeset
   421
by (rtac conjI 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   422
by (fast_tac (FOL_cs
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   423
        addEs [subst_context RSN (2, trans) RS domain_cons_eq_succ,
2483
95c2f9c0930a Default rewrite rules for quantification over Collect(A,P)
paulson
parents: 2469
diff changeset
   424
        subst_context, all_in_image_restrict_eq, trans, equalityD1]) 2);
95c2f9c0930a Default rewrite rules for quantification over Collect(A,P)
paulson
parents: 2469
diff changeset
   425
by (eresolve_tac [rangeI RSN (2, subsetD) RSN (2, cons_fun_type2)] 2
95c2f9c0930a Default rewrite rules for quantification over Collect(A,P)
paulson
parents: 2469
diff changeset
   426
        THEN REPEAT (assume_tac 2));
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   427
by (rtac ballI 1);
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   428
by (etac succE 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   429
(** LEVEL 25 **)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   430
by (dresolve_tac [domain_of_fun RSN (2, f_n_pairs_in_R)] 2
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   431
        THEN REPEAT (assume_tac 2));
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   432
by (dtac bspec 2 THEN (assume_tac 2));
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   433
by (asm_full_simp_tac (!simpset
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   434
        addsimps [nat_into_Ord RS succ_in_succ, succI2, cons_val_k]) 2);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   435
by (asm_full_simp_tac (!simpset addsimps [cons_val_n, cons_val_k]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   436
qed "simplify_recursion";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   437
2483
95c2f9c0930a Default rewrite rules for quantification over Collect(A,P)
paulson
parents: 2469
diff changeset
   438
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   439
goal thy "!!X. [| XX = (UN n:nat.  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   440
\               {f:succ(n)->domain(R). ALL k:n. <f`k, f`succ(k)> : R});  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   441
\       ALL b<nat. <f``b, f`b> :  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   442
\       {<z1,z2>:Fin(XX)*XX. (domain(z2)=succ(UN f:z1. domain(f))  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   443
\       & (UN f:z1. domain(f)) = b  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   444
\       & (ALL f:z1. restrict(z2, domain(f)) = f))};  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   445
\       f: nat -> XX; range(R) <= domain(R); x:domain(R); n:nat  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   446
\       |] ==> f`n : succ(n) -> domain(R)  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   447
\       & (ALL i:n. <f`n`i, f`n`succ(i)>:R)";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   448
by (dtac ospec 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   449
by (eresolve_tac [Ord_nat RSN (2, ltI)] 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   450
by (etac CollectE 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   451
by (Asm_full_simp_tac 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   452
by (rtac conjI 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   453
by (fast_tac (!claset
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   454
        addSEs [trans RS domain_eq_imp_fun_type, subst_context]) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   455
by (fast_tac (FOL_cs addSEs [conjE, f_n_pairs_in_R, trans, subst_context]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   456
val lemma2 = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   457
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   458
goal thy 
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   459
"!!n. [| XX = (UN n:nat.  \
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   460
\                {f:succ(n)->domain(R). ALL k:n. <f`k, f`succ(k)> : R});  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   461
\       ALL b<nat. <f``b, f`b> :  \
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   462
\              {<z1,z2>:Fin(XX)*XX. (domain(z2)=succ(UN f:z1. domain(f))  \
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   463
\       & (UN f:z1. domain(f)) = b  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   464
\       & (ALL f:z1. restrict(z2, domain(f)) = f))};  \
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   465
\       f : nat -> XX;  n:nat;  range(R) <= domain(R);  x:domain(R)  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   466
\       |] ==> f`n`n = f`succ(n)`n";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   467
by (forward_tac [lemma2 RS conjunct1 RS domain_of_fun] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   468
        THEN REPEAT (assume_tac 1));
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   469
by (dresolve_tac [[nat_succI, Ord_nat] MRS ltI RSN (2, ospec)] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   470
        THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   471
by (Asm_full_simp_tac 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   472
by (REPEAT (etac conjE 1));
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   473
by (etac ballE 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   474
by (eresolve_tac [restrict_eq_imp_val_eq RS sym] 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   475
by (fast_tac (!claset addSEs [ssubst]) 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   476
by (asm_full_simp_tac (!simpset
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   477
        addsimps [[nat_succI, Ord_nat] MRS OrdmemD RSN (2, image_fun)]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   478
val lemma3 = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   479
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   480
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   481
goalw thy [DC_def, DC0_def] "!!Z. DC(nat) ==> DC0";
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   482
by (REPEAT (resolve_tac [allI, impI] 1));
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   483
by (REPEAT (eresolve_tac [asm_rl, conjE, ex_in_domain RS exE, allE] 1));
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   484
by (eresolve_tac [[refl, refl] MRS lemma4 RSN (2, impE)] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   485
        THEN REPEAT (assume_tac 1));
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   486
by (etac bexE 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   487
by (dresolve_tac [refl RSN (2, simplify_recursion)] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   488
        THEN REPEAT (assume_tac 1));
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   489
by (res_inst_tac [("x","lam n:nat. f`n`n")] bexI 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   490
by (rtac lam_type 2);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   491
by (eresolve_tac [[refl RS lemma2 RS conjunct1, succI1] MRS apply_type] 2
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   492
        THEN REPEAT (assume_tac 2));
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   493
by (rtac ballI 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   494
by (forward_tac [refl RS (nat_succI RSN (6, lemma2)) RS conjunct2] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   495
        THEN REPEAT (assume_tac 1));
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   496
by (dresolve_tac [refl RS lemma3] 1 THEN REPEAT (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   497
by (asm_full_simp_tac (!simpset addsimps [nat_succI]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   498
qed "DC_nat_DC0";
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   499
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   500
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   501
(* ALL K. Card(K) --> DC(K) ==> WO3                                       *)
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   502
(* ********************************************************************** *)
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   503
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   504
goalw thy [lesspoll_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   505
        "!!A. [| ~ A lesspoll B; C lesspoll B |] ==> A - C ~= 0";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   506
by (fast_tac (!claset addSDs [Diff_eq_0_iff RS iffD1 RS subset_imp_lepoll]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   507
        addSIs [eqpollI] addEs [notE] addSEs [eqpollE, lepoll_trans]) 1);
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   508
val lesspoll_lemma = result();
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   509
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   510
val [f_type, Ord_a, not_eq] = goalw thy [inj_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   511
        "[| f:a->X; Ord(a); (!!b c. [| b<c; c:a |] ==> f`b~=f`c)  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   512
\       |] ==> f:inj(a, X)";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   513
by (resolve_tac [f_type RS CollectI] 1);
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   514
by (REPEAT (resolve_tac [ballI,impI] 1));
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   515
by (resolve_tac [Ord_a RS Ord_in_Ord RS Ord_linear_lt] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   516
        THEN (assume_tac 1));
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   517
by (eres_inst_tac [("j","x")] (Ord_a RS Ord_in_Ord) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   518
by (REPEAT (fast_tac (!claset addDs [not_eq, not_eq RS not_sym]) 1));
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   519
qed "fun_Ord_inj";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   520
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   521
goal thy "!!a. [| f:X->Y; A<=X; a:A |] ==> f`a : f``A";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   522
by (fast_tac (!claset addSEs [image_fun RS ssubst]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   523
qed "value_in_image";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   524
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   525
goalw thy [DC_def, WO3_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   526
        "!!Z. ALL K. Card(K) --> DC(K) ==> WO3";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   527
by (rtac allI 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   528
by (excluded_middle_tac "A lesspoll Hartog(A)" 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   529
by (fast_tac (!claset addSDs [lesspoll_imp_ex_lt_eqpoll]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   530
        addSIs [Ord_Hartog, leI RS le_imp_subset]) 2);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   531
by (REPEAT (eresolve_tac [allE, impE] 1));
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   532
by (rtac Card_Hartog 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   533
by (eres_inst_tac [("x","A")] allE 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   534
by (eres_inst_tac [("x","{<z1,z2>:Pow(A)*A . z1  \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   535
\               lesspoll Hartog(A) & z2 ~: z1}")] allE 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   536
by (Asm_full_simp_tac 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   537
by (etac impE 1);
3862
6f389875ab33 Patch to avoid simplification of ~EX to ALL~
paulson
parents: 3731
diff changeset
   538
by (fast_tac (!claset addEs [lesspoll_lemma RS not_emptyE]) 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   539
by (etac bexE 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   540
by (resolve_tac [exI RS (lepoll_def RS (def_imp_iff RS iffD2))
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   541
        RS (HartogI RS notE)] 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   542
by (resolve_tac [Ord_Hartog RSN (2, fun_Ord_inj)] 1 THEN (assume_tac 1));
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   543
by (dresolve_tac [Ord_Hartog RSN (2, OrdmemD) RSN (2,
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   544
        ltD RSN (3, value_in_image))] 1 
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   545
        THEN REPEAT (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   546
by (fast_tac (!claset addSDs [Ord_Hartog RSN (2, ltI) RSN (2, ospec)]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   547
        addEs [subst]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   548
qed "DC_WO3";
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   549
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   550
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   551
(* WO1 ==> ALL K. Card(K) --> DC(K)                                       *)
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   552
(* ********************************************************************** *)
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   553
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   554
goal thy
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   555
        "!!a. [| Ord(a); b:a |] ==> (lam x:a. P(x))``b = (lam x:b. P(x))``b";
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   556
by (rtac images_eq 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   557
by (REPEAT (fast_tac (!claset addSEs [RepFunI, OrdmemD]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   558
        addSIs [lam_type]) 2));
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   559
by (rtac ballI 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   560
by (dresolve_tac [OrdmemD RS subsetD] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   561
        THEN REPEAT (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   562
by (Asm_full_simp_tac 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   563
qed "lam_images_eq";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   564
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   565
goalw thy [lesspoll_def] "!!K. [| Card(K); b:K |] ==> b lesspoll K";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   566
by (asm_full_simp_tac (!simpset addsimps [Card_iff_initial]) 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   567
by (fast_tac (!claset addSIs [le_imp_lepoll, ltI, leI]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   568
qed "in_Card_imp_lesspoll";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   569
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   570
goal thy "(lam b:a. P(b)) : a -> {P(b). b:a}";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   571
by (fast_tac (!claset addSIs [lam_type, RepFunI]) 1);
3731
71366483323b result() -> qed; Step_tac -> Safe_tac
paulson
parents: 2496
diff changeset
   572
qed "lam_type_RepFun";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   573
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   574
goal thy "!!Z. [| ALL Y:Pow(X). Y lesspoll a --> (EX x:X. <Y, x> : R);  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   575
\       b:a; Z:Pow(X); Z lesspoll a |]  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   576
\       ==> {x:X. <Z,x> : R} ~= 0";
1200
d4551b1a6da7 Many small changes to make proofs run faster
lcp
parents: 1196
diff changeset
   577
by (fast_tac (FOL_cs addEs [bexE, equals0D]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   578
        addSDs [bspec] addIs [CollectI]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   579
val lemma_ = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   580
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   581
goal thy "!!K. [| Card(K); well_ord(X,Q);  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   582
\       ALL Y:Pow(X). Y lesspoll K --> (EX x:X. <Y, x> : R); b:K |]  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   583
\       ==> ff(b, X, Q, R) : {x:X. <(lam c:b. ff(c, X, Q, R))``b, x> : R}";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   584
by (res_inst_tac [("P","b:K")] impE 1 THEN TRYALL assume_tac);
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   585
by (res_inst_tac [("i","b")] (Card_is_Ord RS Ord_in_Ord RS trans_induct) 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   586
        THEN REPEAT (assume_tac 1));
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   587
by (rtac impI 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   588
by (resolve_tac [ff_def RS def_transrec RS ssubst] 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   589
by (etac the_first_in 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   590
by (Fast_tac 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   591
by (asm_full_simp_tac (!simpset
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   592
        addsimps [[lam_type_RepFun, subset_refl] MRS image_fun]) 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   593
by (etac lemma_ 1 THEN (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   594
by (fast_tac (!claset addSEs [RepFunE, impE, notE]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   595
                addEs [Card_is_Ord RSN (2, OrdmemD) RS subsetD]) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   596
by (fast_tac (!claset addSEs [[in_Card_imp_lesspoll, RepFun_lepoll]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   597
                MRS lepoll_lesspoll_lesspoll]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   598
val lemma = result();
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   599
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   600
goalw thy [DC_def, WO1_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   601
        "!!Z. WO1 ==> ALL K. Card(K) --> DC(K)";
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   602
by (REPEAT (resolve_tac [allI,impI] 1));
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   603
by (REPEAT (eresolve_tac [allE,exE,conjE] 1));
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   604
by (res_inst_tac [("x","lam b:K. ff(b, X, Ra, R)")] bexI 1);
1207
3f460842e919 Ran expandshort and changed spelling of Grabczewski
lcp
parents: 1200
diff changeset
   605
by (rtac lam_type 2);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   606
by (resolve_tac [lemma RS CollectD1] 2 THEN REPEAT (assume_tac 2));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   607
by (asm_full_simp_tac (!simpset
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1207
diff changeset
   608
        addsimps [[Card_is_Ord, ltD] MRS lam_images_eq]) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1932
diff changeset
   609
by (fast_tac (!claset addSEs [ltE, lemma RS CollectD2]) 1);
1196
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   610
qed" WO1_DC_Card";
d43c1f7a53fe Numerous small improvements by KG and LCP
lcp
parents:
diff changeset
   611