src/ZF/Univ.ML
changeset 27 0e152fe9571e
parent 15 6c6d2f6e3185
child 37 cebe01deba80
equal deleted inserted replaced
26:5aa9c39b480d 27:0e152fe9571e
    38 
    38 
    39 goal Univ.thy "Vfrom(A,x) <= Vfrom(A,rank(x))";
    39 goal Univ.thy "Vfrom(A,x) <= Vfrom(A,rank(x))";
    40 by (eps_ind_tac "x" 1);
    40 by (eps_ind_tac "x" 1);
    41 by (rtac (Vfrom RS ssubst) 1);
    41 by (rtac (Vfrom RS ssubst) 1);
    42 by (rtac (Vfrom RS ssubst) 1);
    42 by (rtac (Vfrom RS ssubst) 1);
    43 by (fast_tac (ZF_cs addSIs [rank_lt]) 1);
    43 by (fast_tac (ZF_cs addSIs [rank_lt RS ltD]) 1);
    44 val Vfrom_rank_subset1 = result();
    44 val Vfrom_rank_subset1 = result();
    45 
    45 
    46 goal Univ.thy "Vfrom(A,rank(x)) <= Vfrom(A,x)";
    46 goal Univ.thy "Vfrom(A,rank(x)) <= Vfrom(A,x)";
    47 by (eps_ind_tac "x" 1);
    47 by (eps_ind_tac "x" 1);
    48 by (rtac (Vfrom RS ssubst) 1);
    48 by (rtac (Vfrom RS ssubst) 1);
    49 by (rtac (Vfrom RS ssubst) 1);
    49 by (rtac (Vfrom RS ssubst) 1);
    50 by (rtac (subset_refl RS Un_mono) 1);
    50 by (rtac (subset_refl RS Un_mono) 1);
    51 by (rtac UN_least 1);
    51 by (rtac UN_least 1);
    52 by (etac (rank_implies_mem RS bexE) 1);
    52 (*expand rank(x1) = (UN y:x1. succ(rank(y))) in assumptions*)
       
    53 by (etac (rank RS equalityD1 RS subsetD RS UN_E) 1);
    53 by (rtac subset_trans 1);
    54 by (rtac subset_trans 1);
    54 by (etac UN_upper 2);
    55 by (etac UN_upper 2);
    55 by (etac (subset_refl RS Vfrom_mono RS subset_trans RS Pow_mono) 1);
    56 by (rtac (subset_refl RS Vfrom_mono RS subset_trans RS Pow_mono) 1);
       
    57 by (etac (ltI RS le_imp_subset) 1);
       
    58 by (rtac (Ord_rank RS Ord_succ) 1);
    56 by (etac bspec 1);
    59 by (etac bspec 1);
    57 by (assume_tac 1);
    60 by (assume_tac 1);
    58 val Vfrom_rank_subset2 = result();
    61 val Vfrom_rank_subset2 = result();
    59 
    62 
    60 goal Univ.thy "Vfrom(A,rank(x)) = Vfrom(A,x)";
    63 goal Univ.thy "Vfrom(A,rank(x)) = Vfrom(A,x)";
   124 by (rtac (Vfrom RS trans) 1);
   127 by (rtac (Vfrom RS trans) 1);
   125 by (rtac (succI1 RS RepFunI RS Union_upper RSN
   128 by (rtac (succI1 RS RepFunI RS Union_upper RSN
   126 	      (2, equalityI RS subst_context)) 1);
   129 	      (2, equalityI RS subst_context)) 1);
   127 by (rtac UN_least 1);
   130 by (rtac UN_least 1);
   128 by (rtac (subset_refl RS Vfrom_mono RS Pow_mono) 1);
   131 by (rtac (subset_refl RS Vfrom_mono RS Pow_mono) 1);
   129 by (etac member_succD 1);
   132 by (etac (ltI RS le_imp_subset) 1);
   130 by (assume_tac 1);
   133 by (etac Ord_succ 1);
   131 val Vfrom_succ_lemma = result();
   134 val Vfrom_succ_lemma = result();
   132 
   135 
   133 goal Univ.thy "Vfrom(A,succ(i)) = A Un Pow(Vfrom(A,i))";
   136 goal Univ.thy "Vfrom(A,succ(i)) = A Un Pow(Vfrom(A,i))";
   134 by (res_inst_tac [("x1", "succ(i)")] (Vfrom_rank_eq RS subst) 1);
   137 by (res_inst_tac [("x1", "succ(i)")] (Vfrom_rank_eq RS subst) 1);
   135 by (res_inst_tac [("x1", "i")] (Vfrom_rank_eq RS subst) 1);
   138 by (res_inst_tac [("x1", "i")] (Vfrom_rank_eq RS subst) 1);
   159 val Vfrom_Union = result();
   162 val Vfrom_Union = result();
   160 
   163 
   161 (*** Limit ordinals -- general properties ***)
   164 (*** Limit ordinals -- general properties ***)
   162 
   165 
   163 goalw Univ.thy [Limit_def] "!!i. Limit(i) ==> Union(i) = i";
   166 goalw Univ.thy [Limit_def] "!!i. Limit(i) ==> Union(i) = i";
   164 by (fast_tac (eq_cs addEs [Ord_trans]) 1);
   167 by (fast_tac (eq_cs addSIs [ltI] addSEs [ltE] addEs [Ord_trans]) 1);
   165 val Limit_Union_eq = result();
   168 val Limit_Union_eq = result();
   166 
   169 
   167 goalw Univ.thy [Limit_def] "!!i. Limit(i) ==> Ord(i)";
   170 goalw Univ.thy [Limit_def] "!!i. Limit(i) ==> Ord(i)";
   168 by (etac conjunct1 1);
   171 by (etac conjunct1 1);
   169 val Limit_is_Ord = result();
   172 val Limit_is_Ord = result();
   170 
   173 
   171 goalw Univ.thy [Limit_def] "!!i. Limit(i) ==> 0 : i";
   174 goalw Univ.thy [Limit_def] "!!i. Limit(i) ==> 0 < i";
   172 by (fast_tac ZF_cs 1);
   175 by (etac (conjunct2 RS conjunct1) 1);
   173 val Limit_has_0 = result();
   176 val Limit_has_0 = result();
   174 
   177 
   175 goalw Univ.thy [Limit_def] "!!i. [| Limit(i);  j:i |] ==> succ(j) : i";
   178 goalw Univ.thy [Limit_def] "!!i. [| Limit(i);  j<i |] ==> succ(j) < i";
   176 by (fast_tac ZF_cs 1);
   179 by (fast_tac ZF_cs 1);
   177 val Limit_has_succ = result();
   180 val Limit_has_succ = result();
   178 
   181 
   179 goalw Univ.thy [Limit_def] "Limit(nat)";
   182 goalw Univ.thy [Limit_def] "Limit(nat)";
   180 by (REPEAT (ares_tac [conjI, ballI, nat_0I, nat_succI, Ord_nat] 1));
   183 by (safe_tac (ZF_cs addSIs (ltI::nat_typechecks)));
       
   184 by (etac ltD 1);
   181 val Limit_nat = result();
   185 val Limit_nat = result();
   182 
   186 
   183 goalw Univ.thy [Limit_def]
   187 goalw Univ.thy [Limit_def]
   184     "!!i. [| Ord(i);  0:i;  ALL y. ~ succ(y)=i |] ==> Limit(i)";
   188     "!!i. [| 0<i;  ALL y. ~ succ(y)=i |] ==> Limit(i)";
   185 by (safe_tac subset_cs);
   189 by (safe_tac subset_cs);
   186 by (rtac Ord_member 1);
   190 by (rtac (not_le_iff_lt RS iffD1) 2);
   187 by (REPEAT_FIRST (eresolve_tac [asm_rl, Ord_in_Ord RS Ord_succ]
   191 by (fast_tac (lt_cs addEs [lt_anti_sym]) 4);
   188           ORELSE' dtac Ord_succ_subsetI ));
   192 by (REPEAT (eresolve_tac [asm_rl, ltE, Ord_succ] 1));
   189 by (fast_tac (subset_cs addSIs [equalityI]) 1);
       
   190 val non_succ_LimitI = result();
   193 val non_succ_LimitI = result();
   191 
   194 
   192 goal Univ.thy "!!i. Ord(i) ==> i=0 | (EX j. i=succ(j)) | Limit(i)";
   195 goal Univ.thy "!!i. Ord(i) ==> i=0 | (EX j. i=succ(j)) | Limit(i)";
   193 by (fast_tac (ZF_cs addSIs [non_succ_LimitI, Ord_0_member_iff RS iffD2]) 1);
   196 by (fast_tac (ZF_cs addSIs [non_succ_LimitI, Ord_0_lt]) 1);
   194 val Ord_cases_lemma = result();
   197 val Ord_cases_lemma = result();
   195 
   198 
   196 val major::prems = goal Univ.thy
   199 val major::prems = goal Univ.thy
   197     "[| Ord(i);			\
   200     "[| Ord(i);			\
   198 \       i=0            ==> P;	\
   201 \       i=0            ==> P;	\
   208 
   211 
   209 (*NB. limit ordinals are non-empty;
   212 (*NB. limit ordinals are non-empty;
   210                         Vfrom(A,0) = A = A Un (UN y:0. Vfrom(A,y)) *)
   213                         Vfrom(A,0) = A = A Un (UN y:0. Vfrom(A,y)) *)
   211 val [limiti] = goal Univ.thy
   214 val [limiti] = goal Univ.thy
   212     "Limit(i) ==> Vfrom(A,i) = (UN y:i. Vfrom(A,y))";
   215     "Limit(i) ==> Vfrom(A,i) = (UN y:i. Vfrom(A,y))";
   213 by (rtac (limiti RS Limit_has_0 RS Vfrom_Union RS subst) 1);
   216 by (rtac (limiti RS (Limit_has_0 RS ltD) RS Vfrom_Union RS subst) 1);
   214 by (rtac (limiti RS Limit_Union_eq RS ssubst) 1);
   217 by (rtac (limiti RS Limit_Union_eq RS ssubst) 1);
   215 by (rtac refl 1);
   218 by (rtac refl 1);
   216 val Limit_Vfrom_eq = result();
   219 val Limit_Vfrom_eq = result();
   217 
   220 
   218 val Limit_VfromE = standard (Limit_Vfrom_eq RS equalityD1 RS subsetD RS UN_E);
   221 goal Univ.thy "!!a. [| a: Vfrom(A,j);  Limit(i);  j<i |] ==> a : Vfrom(A,i)";
       
   222 by (rtac (Limit_Vfrom_eq RS equalityD2 RS subsetD) 1);
       
   223 by (REPEAT (ares_tac [ltD RS UN_I] 1));
       
   224 val Limit_VfromI = result();
       
   225 
       
   226 val prems = goal Univ.thy
       
   227     "[| a: Vfrom(A,i);  Limit(i);		\
       
   228 \       !!x. [| x<i;  a: Vfrom(A,x) |] ==> R 	\
       
   229 \    |] ==> R";
       
   230 by (rtac (Limit_Vfrom_eq RS equalityD1 RS subsetD RS UN_E) 1);
       
   231 by (REPEAT (ares_tac (prems @ [ltI, Limit_is_Ord]) 1));
       
   232 val Limit_VfromE = result();
   219 
   233 
   220 val [major,limiti] = goal Univ.thy
   234 val [major,limiti] = goal Univ.thy
   221     "[| a: Vfrom(A,i);  Limit(i) |] ==> {a} : Vfrom(A,i)";
   235     "[| a: Vfrom(A,i);  Limit(i) |] ==> {a} : Vfrom(A,i)";
   222 by (rtac (limiti RS Limit_VfromE) 1);
   236 by (rtac ([major,limiti] MRS Limit_VfromE) 1);
   223 by (rtac major 1);
   237 by (etac ([singleton_in_Vfrom, limiti] MRS Limit_VfromI) 1);
   224 by (rtac (limiti RS Limit_Vfrom_eq RS ssubst) 1);
       
   225 by (rtac UN_I 1);
       
   226 by (etac singleton_in_Vfrom 2);
       
   227 by (etac (limiti RS Limit_has_succ) 1);
   238 by (etac (limiti RS Limit_has_succ) 1);
   228 val singleton_in_Vfrom_limit = result();
   239 val singleton_in_Vfrom_limit = result();
   229 
   240 
   230 val Vfrom_UnI1 = Un_upper1 RS (subset_refl RS Vfrom_mono RS subsetD)
   241 val Vfrom_UnI1 = Un_upper1 RS (subset_refl RS Vfrom_mono RS subsetD)
   231 and Vfrom_UnI2 = Un_upper2 RS (subset_refl RS Vfrom_mono RS subsetD);
   242 and Vfrom_UnI2 = Un_upper2 RS (subset_refl RS Vfrom_mono RS subsetD);
   232 
   243 
   233 (*Hard work is finding a single j:i such that {a,b}<=Vfrom(A,j)*)
   244 (*Hard work is finding a single j:i such that {a,b}<=Vfrom(A,j)*)
   234 val [aprem,bprem,limiti] = goal Univ.thy
   245 val [aprem,bprem,limiti] = goal Univ.thy
   235     "[| a: Vfrom(A,i);  b: Vfrom(A,i);  Limit(i) |] ==> \
   246     "[| a: Vfrom(A,i);  b: Vfrom(A,i);  Limit(i) |] ==> \
   236 \    {a,b} : Vfrom(A,i)";
   247 \    {a,b} : Vfrom(A,i)";
   237 by (rtac (aprem RS (limiti RS Limit_VfromE)) 1);
   248 by (rtac ([aprem,limiti] MRS Limit_VfromE) 1);
   238 by (rtac (bprem RS (limiti RS Limit_VfromE)) 1);
   249 by (rtac ([bprem,limiti] MRS Limit_VfromE) 1);
   239 by (rtac (limiti RS Limit_Vfrom_eq RS ssubst) 1);
   250 by (rtac ([doubleton_in_Vfrom, limiti] MRS Limit_VfromI) 1);
   240 by (rtac UN_I 1);
   251 by (etac Vfrom_UnI1 1);
   241 by (rtac doubleton_in_Vfrom 2);
   252 by (etac Vfrom_UnI2 1);
   242 by (etac Vfrom_UnI1 2);
   253 by (REPEAT (ares_tac [limiti, Limit_has_succ, Un_least_lt] 1));
   243 by (etac Vfrom_UnI2 2);
       
   244 by (REPEAT (ares_tac[limiti, Limit_has_succ, Ord_member_UnI, Limit_is_Ord] 1));
       
   245 val doubleton_in_Vfrom_limit = result();
   254 val doubleton_in_Vfrom_limit = result();
   246 
   255 
   247 val [aprem,bprem,limiti] = goal Univ.thy
   256 val [aprem,bprem,limiti] = goal Univ.thy
   248     "[| a: Vfrom(A,i);  b: Vfrom(A,i);  Limit(i) |] ==> \
   257     "[| a: Vfrom(A,i);  b: Vfrom(A,i);  Limit(i) |] ==> \
   249 \    <a,b> : Vfrom(A,i)";
   258 \    <a,b> : Vfrom(A,i)";
   250 (*Infer that a, b occur at ordinals x,xa < i.*)
   259 (*Infer that a, b occur at ordinals x,xa < i.*)
   251 by (rtac (aprem RS (limiti RS Limit_VfromE)) 1);
   260 by (rtac ([aprem,limiti] MRS Limit_VfromE) 1);
   252 by (rtac (bprem RS (limiti RS Limit_VfromE)) 1);
   261 by (rtac ([bprem,limiti] MRS Limit_VfromE) 1);
   253 by (rtac (limiti RS Limit_Vfrom_eq RS ssubst) 1);
   262 by (rtac ([Pair_in_Vfrom, limiti] MRS Limit_VfromI) 1);
   254 by (rtac UN_I 1);
       
   255 by (rtac Pair_in_Vfrom 2);
       
   256 (*Infer that succ(succ(x Un xa)) < i *)
   263 (*Infer that succ(succ(x Un xa)) < i *)
   257 by (etac Vfrom_UnI1 2);
   264 by (etac Vfrom_UnI1 1);
   258 by (etac Vfrom_UnI2 2);
   265 by (etac Vfrom_UnI2 1);
   259 by (REPEAT (ares_tac[limiti, Limit_has_succ, Ord_member_UnI, Limit_is_Ord] 1));
   266 by (REPEAT (ares_tac [limiti, Limit_has_succ, Un_least_lt] 1));
   260 val Pair_in_Vfrom_limit = result();
   267 val Pair_in_Vfrom_limit = result();
   261 
   268 
   262 
   269 
   263 (*** Properties assuming Transset(A) ***)
   270 (*** Properties assuming Transset(A) ***)
   264 
   271 
   312 
   319 
   313 val [aprem,bprem,limiti,transset] = goal Univ.thy
   320 val [aprem,bprem,limiti,transset] = goal Univ.thy
   314   "[| a: Vfrom(A,i);  b: Vfrom(A,i);  Limit(i);  Transset(A) |] ==> \
   321   "[| a: Vfrom(A,i);  b: Vfrom(A,i);  Limit(i);  Transset(A) |] ==> \
   315 \  a*b : Vfrom(A,i)";
   322 \  a*b : Vfrom(A,i)";
   316 (*Infer that a, b occur at ordinals x,xa < i.*)
   323 (*Infer that a, b occur at ordinals x,xa < i.*)
   317 by (rtac (aprem RS (limiti RS Limit_VfromE)) 1);
   324 by (rtac ([aprem,limiti] MRS Limit_VfromE) 1);
   318 by (rtac (bprem RS (limiti RS Limit_VfromE)) 1);
   325 by (rtac ([bprem,limiti] MRS Limit_VfromE) 1);
   319 by (rtac (limiti RS Limit_Vfrom_eq RS ssubst) 1);
   326 by (rtac ([prod_in_Vfrom, limiti] MRS Limit_VfromI) 1);
   320 by (rtac UN_I 1);
   327 by (etac (Vfrom_UnI1 RS Vfrom_UnI2) 1);
   321 by (rtac prod_in_Vfrom 2);
   328 by (etac (Vfrom_UnI2 RS Vfrom_UnI2) 1);
   322 (*Infer that succ(succ(succ(x Un xa))) < i *)
   329 (*Infer that succ(succ(succ(x Un xa))) < i *)
   323 by (etac (Vfrom_UnI1 RS Vfrom_UnI2) 2);
   330 by (REPEAT (ares_tac [limiti, Limit_has_succ, Un_least_lt, transset] 1));
   324 by (etac (Vfrom_UnI2 RS Vfrom_UnI2) 2);
       
   325 by (REPEAT (ares_tac [limiti RS Limit_has_succ,
       
   326 		      Ord_member_UnI, limiti RS Limit_is_Ord, transset] 1));
       
   327 val prod_in_Vfrom_limit = result();
   331 val prod_in_Vfrom_limit = result();
   328 
   332 
   329 (** Disjoint sums, aka Quine ordered pairs **)
   333 (** Disjoint sums, aka Quine ordered pairs **)
   330 
   334 
   331 goalw Univ.thy [sum_def]
   335 goalw Univ.thy [sum_def]
   340 
   344 
   341 val [aprem,bprem,limiti,transset] = goal Univ.thy
   345 val [aprem,bprem,limiti,transset] = goal Univ.thy
   342   "[| a: Vfrom(A,i);  b: Vfrom(A,i);  Limit(i);  Transset(A) |] ==> \
   346   "[| a: Vfrom(A,i);  b: Vfrom(A,i);  Limit(i);  Transset(A) |] ==> \
   343 \  a+b : Vfrom(A,i)";
   347 \  a+b : Vfrom(A,i)";
   344 (*Infer that a, b occur at ordinals x,xa < i.*)
   348 (*Infer that a, b occur at ordinals x,xa < i.*)
   345 by (rtac (aprem RS (limiti RS Limit_VfromE)) 1);
   349 by (rtac ([aprem,limiti] MRS Limit_VfromE) 1);
   346 by (rtac (bprem RS (limiti RS Limit_VfromE)) 1);
   350 by (rtac ([bprem,limiti] MRS Limit_VfromE) 1);
   347 by (rtac (limiti RS Limit_Vfrom_eq RS ssubst) 1);
   351 by (rtac ([sum_in_Vfrom, limiti] MRS Limit_VfromI) 1);
   348 by (rtac UN_I 1);
   352 by (rtac (succI1 RS UnI1) 4);
   349 by (rtac sum_in_Vfrom 2);
   353 (*Infer that  succ(succ(succ(succ(1) Un (x Un xa)))) < i *)
   350 by (rtac (succI1 RS UnI1) 5);
   354 by (etac (Vfrom_UnI1 RS Vfrom_UnI2) 1);
   351 (*Infer that succ(succ(succ(x Un xa))) < i *)
   355 by (etac (Vfrom_UnI2 RS Vfrom_UnI2) 1);
   352 by (etac (Vfrom_UnI1 RS Vfrom_UnI2) 2);
   356 by (REPEAT (ares_tac [limiti, Limit_has_0, Limit_has_succ, Un_least_lt, 
   353 by (etac (Vfrom_UnI2 RS Vfrom_UnI2) 2);
   357 		      transset] 1));
   354 by (REPEAT (ares_tac [limiti RS Limit_has_0, 
       
   355 		      limiti RS Limit_has_succ,
       
   356 		      Ord_member_UnI, limiti RS Limit_is_Ord, transset] 1));
       
   357 val sum_in_Vfrom_limit = result();
   358 val sum_in_Vfrom_limit = result();
   358 
   359 
   359 (** function space! **)
   360 (** function space! **)
   360 
   361 
   361 goalw Univ.thy [Pi_def]
   362 goalw Univ.thy [Pi_def]
   375 
   376 
   376 val [aprem,bprem,limiti,transset] = goal Univ.thy
   377 val [aprem,bprem,limiti,transset] = goal Univ.thy
   377   "[| a: Vfrom(A,i);  b: Vfrom(A,i);  Limit(i);  Transset(A) |] ==> \
   378   "[| a: Vfrom(A,i);  b: Vfrom(A,i);  Limit(i);  Transset(A) |] ==> \
   378 \  a->b : Vfrom(A,i)";
   379 \  a->b : Vfrom(A,i)";
   379 (*Infer that a, b occur at ordinals x,xa < i.*)
   380 (*Infer that a, b occur at ordinals x,xa < i.*)
   380 by (rtac (aprem RS (limiti RS Limit_VfromE)) 1);
   381 by (rtac ([aprem,limiti] MRS Limit_VfromE) 1);
   381 by (rtac (bprem RS (limiti RS Limit_VfromE)) 1);
   382 by (rtac ([bprem,limiti] MRS Limit_VfromE) 1);
   382 by (rtac (limiti RS Limit_Vfrom_eq RS ssubst) 1);
   383 by (rtac ([fun_in_Vfrom, limiti] MRS Limit_VfromI) 1);
   383 by (rtac UN_I 1);
       
   384 by (rtac fun_in_Vfrom 2);
       
   385 (*Infer that succ(succ(succ(x Un xa))) < i *)
   384 (*Infer that succ(succ(succ(x Un xa))) < i *)
   386 by (etac (Vfrom_UnI1 RS Vfrom_UnI2) 2);
   385 by (etac (Vfrom_UnI1 RS Vfrom_UnI2) 1);
   387 by (etac (Vfrom_UnI2 RS Vfrom_UnI2) 2);
   386 by (etac (Vfrom_UnI2 RS Vfrom_UnI2) 1);
   388 by (REPEAT (ares_tac [limiti RS Limit_has_succ,
   387 by (REPEAT (ares_tac [limiti, Limit_has_succ, Un_least_lt, transset] 1));
   389 		      Ord_member_UnI, limiti RS Limit_is_Ord, transset] 1));
       
   390 val fun_in_Vfrom_limit = result();
   388 val fun_in_Vfrom_limit = result();
   391 
   389 
   392 
   390 
   393 (*** The set Vset(i) ***)
   391 (*** The set Vset(i) ***)
   394 
   392 
   401 
   399 
   402 val Transset_Vset = Transset_0 RS Transset_Vfrom;
   400 val Transset_Vset = Transset_0 RS Transset_Vfrom;
   403 
   401 
   404 (** Characterisation of the elements of Vset(i) **)
   402 (** Characterisation of the elements of Vset(i) **)
   405 
   403 
   406 val [ordi] = goal Univ.thy "Ord(i) ==> ALL b. b : Vset(i) --> rank(b) : i";
   404 val [ordi] = goal Univ.thy "Ord(i) ==> ALL b. b : Vset(i) --> rank(b) < i";
   407 by (rtac (ordi RS trans_induct) 1);
   405 by (rtac (ordi RS trans_induct) 1);
   408 by (rtac (Vset RS ssubst) 1);
   406 by (rtac (Vset RS ssubst) 1);
   409 by (safe_tac ZF_cs);
   407 by (safe_tac ZF_cs);
   410 by (rtac (rank RS ssubst) 1);
   408 by (rtac (rank RS ssubst) 1);
   411 by (rtac sup_least2 1);
   409 by (rtac UN_succ_least_lt 1);
   412 by (assume_tac 1);
   410 by (fast_tac ZF_cs 2);
   413 by (assume_tac 1);
   411 by (REPEAT (ares_tac [ltI] 1));
   414 by (fast_tac ZF_cs 1);
       
   415 val Vset_rank_imp1 = result();
   412 val Vset_rank_imp1 = result();
   416 
   413 
   417 (*  [| Ord(i); x : Vset(i) |] ==> rank(x) : i  *)
   414 (*  [| Ord(i); x : Vset(i) |] ==> rank(x) < i  *)
   418 val Vset_D = standard (Vset_rank_imp1 RS spec RS mp);
   415 val VsetD = standard (Vset_rank_imp1 RS spec RS mp);
   419 
   416 
   420 val [ordi] = goal Univ.thy "Ord(i) ==> ALL b. rank(b) : i --> b : Vset(i)";
   417 val [ordi] = goal Univ.thy "Ord(i) ==> ALL b. rank(b) : i --> b : Vset(i)";
   421 by (rtac (ordi RS trans_induct) 1);
   418 by (rtac (ordi RS trans_induct) 1);
   422 by (rtac allI 1);
   419 by (rtac allI 1);
   423 by (rtac (Vset RS ssubst) 1);
   420 by (rtac (Vset RS ssubst) 1);
   424 by (fast_tac (ZF_cs addSIs [rank_lt]) 1);
   421 by (fast_tac (ZF_cs addSIs [rank_lt RS ltD]) 1);
   425 val Vset_rank_imp2 = result();
   422 val Vset_rank_imp2 = result();
   426 
   423 
   427 (*  [| Ord(i); rank(x) : i |] ==> x : Vset(i)  *)
   424 goal Univ.thy "!!x i. rank(x)<i ==> x : Vset(i)";
   428 val VsetI = standard (Vset_rank_imp2 RS spec RS mp);
   425 by (etac ltE 1);
   429 
   426 by (etac (Vset_rank_imp2 RS spec RS mp) 1);
   430 val [ordi] = goal Univ.thy "Ord(i) ==> b : Vset(i) <-> rank(b) : i";
   427 by (assume_tac 1);
       
   428 val VsetI = result();
       
   429 
       
   430 goal Univ.thy "!!i. Ord(i) ==> b : Vset(i) <-> rank(b) < i";
   431 by (rtac iffI 1);
   431 by (rtac iffI 1);
   432 by (etac (ordi RS Vset_D) 1);
   432 by (REPEAT (eresolve_tac [asm_rl, VsetD, VsetI] 1));
   433 by (etac (ordi RS VsetI) 1);
       
   434 val Vset_Ord_rank_iff = result();
   433 val Vset_Ord_rank_iff = result();
   435 
   434 
   436 goal Univ.thy "b : Vset(a) <-> rank(b) : rank(a)";
   435 goal Univ.thy "b : Vset(a) <-> rank(b) < rank(a)";
   437 by (rtac (Vfrom_rank_eq RS subst) 1);
   436 by (rtac (Vfrom_rank_eq RS subst) 1);
   438 by (rtac (Ord_rank RS Vset_Ord_rank_iff) 1);
   437 by (rtac (Ord_rank RS Vset_Ord_rank_iff) 1);
   439 val Vset_rank_iff = result();
   438 val Vset_rank_iff = result();
   440 
   439 
   441 goal Univ.thy "!!i. Ord(i) ==> rank(Vset(i)) = i";
   440 goal Univ.thy "!!i. Ord(i) ==> rank(Vset(i)) = i";
   445 by (EVERY' [wtac UN_I, 
   444 by (EVERY' [wtac UN_I, 
   446 	    etac (i_subset_Vfrom RS subsetD),
   445 	    etac (i_subset_Vfrom RS subsetD),
   447 	    etac (Ord_in_Ord RS rank_of_Ord RS ssubst),
   446 	    etac (Ord_in_Ord RS rank_of_Ord RS ssubst),
   448 	    assume_tac,
   447 	    assume_tac,
   449 	    rtac succI1] 3);
   448 	    rtac succI1] 3);
   450 by (REPEAT (eresolve_tac [asm_rl,Vset_D,Ord_trans] 1));
   449 by (REPEAT (eresolve_tac [asm_rl, VsetD RS ltD, Ord_trans] 1));
   451 val rank_Vset = result();
   450 val rank_Vset = result();
   452 
   451 
   453 (** Lemmas for reasoning about sets in terms of their elements' ranks **)
   452 (** Lemmas for reasoning about sets in terms of their elements' ranks **)
   454 
       
   455 (*  rank(x) : rank(a) ==> x : Vset(rank(a))  *)
       
   456 val Vset_rankI = Ord_rank RS VsetI;
       
   457 
   453 
   458 goal Univ.thy "a <= Vset(rank(a))";
   454 goal Univ.thy "a <= Vset(rank(a))";
   459 by (rtac subsetI 1);
   455 by (rtac subsetI 1);
   460 by (etac (rank_lt RS Vset_rankI) 1);
   456 by (etac (rank_lt RS VsetI) 1);
   461 val arg_subset_Vset_rank = result();
   457 val arg_subset_Vset_rank = result();
   462 
   458 
   463 val [iprem] = goal Univ.thy
   459 val [iprem] = goal Univ.thy
   464     "[| !!i. Ord(i) ==> a Int Vset(i) <= b |] ==> a <= b";
   460     "[| !!i. Ord(i) ==> a Int Vset(i) <= b |] ==> a <= b";
   465 by (rtac ([subset_refl, arg_subset_Vset_rank] MRS Int_greatest RS subset_trans) 1);
   461 by (rtac ([subset_refl, arg_subset_Vset_rank] MRS 
       
   462 	  Int_greatest RS subset_trans) 1);
   466 by (rtac (Ord_rank RS iprem) 1);
   463 by (rtac (Ord_rank RS iprem) 1);
   467 val Int_Vset_subset = result();
   464 val Int_Vset_subset = result();
   468 
   465 
   469 (** Set up an environment for simplification **)
   466 (** Set up an environment for simplification **)
   470 
   467 
   471 val rank_rls = [rank_Inl, rank_Inr, rank_pair1, rank_pair2];
   468 val rank_rls = [rank_Inl, rank_Inr, rank_pair1, rank_pair2];
   472 val rank_trans_rls = rank_rls @ (rank_rls RLN (2, [rank_trans]));
   469 val rank_trans_rls = rank_rls @ (rank_rls RLN (2, [lt_trans]));
   473 
   470 
   474 val rank_ss = ZF_ss 
   471 val rank_ss = ZF_ss 
   475     addsimps [case_Inl, case_Inr, Vset_rankI]
   472     addsimps [case_Inl, case_Inr, VsetI]
   476     addsimps rank_trans_rls;
   473     addsimps rank_trans_rls;
   477 
   474 
   478 (** Recursion over Vset levels! **)
   475 (** Recursion over Vset levels! **)
   479 
   476 
   480 (*NOT SUITABLE FOR REWRITING: recursive!*)
   477 (*NOT SUITABLE FOR REWRITING: recursive!*)
   481 goalw Univ.thy [Vrec_def] "Vrec(a,H) = H(a, lam x:Vset(rank(a)). Vrec(x,H))";
   478 goalw Univ.thy [Vrec_def] "Vrec(a,H) = H(a, lam x:Vset(rank(a)). Vrec(x,H))";
   482 by (rtac (transrec RS ssubst) 1);
   479 by (rtac (transrec RS ssubst) 1);
   483 by (simp_tac (ZF_ss addsimps [Ord_rank, Ord_succ, Vset_D RS beta, 
   480 by (simp_tac (ZF_ss addsimps [Ord_rank, Ord_succ, VsetD RS ltD RS beta, 
   484 			      VsetI RS beta]) 1);
   481 			      VsetI RS beta, le_refl]) 1);
   485 val Vrec = result();
   482 val Vrec = result();
   486 
   483 
   487 (*This form avoids giant explosions in proofs.  NOTE USE OF == *)
   484 (*This form avoids giant explosions in proofs.  NOTE USE OF == *)
   488 val rew::prems = goal Univ.thy
   485 val rew::prems = goal Univ.thy
   489     "[| !!x. h(x)==Vrec(x,H) |] ==> \
   486     "[| !!x. h(x)==Vrec(x,H) |] ==> \
   595 goal Univ.thy "1 : univ(A)";
   592 goal Univ.thy "1 : univ(A)";
   596 by (REPEAT (ares_tac [nat_into_univ, nat_0I, nat_succI] 1));
   593 by (REPEAT (ares_tac [nat_into_univ, nat_0I, nat_succI] 1));
   597 val one_in_univ = result();
   594 val one_in_univ = result();
   598 
   595 
   599 (*unused!*)
   596 (*unused!*)
   600 goal Univ.thy "succ(succ(0)) : univ(A)";
   597 goal Univ.thy "succ(1) : univ(A)";
   601 by (REPEAT (ares_tac [nat_into_univ, nat_0I, nat_succI] 1));
   598 by (REPEAT (ares_tac [nat_into_univ, nat_0I, nat_succI] 1));
   602 val two_in_univ = result();
   599 val two_in_univ = result();
   603 
   600 
   604 goalw Univ.thy [bool_def] "bool <= univ(A)";
   601 goalw Univ.thy [bool_def] "bool <= univ(A)";
   605 by (fast_tac (ZF_cs addSIs [zero_in_univ,one_in_univ]) 1);
   602 by (fast_tac (ZF_cs addSIs [zero_in_univ,one_in_univ]) 1);