src/ZF/Constructible/Relative.thy
changeset 13290 28ce81eff3de
parent 13269 3ba9be497c33
child 13298 b4f370679c65
equal deleted inserted replaced
13289:53e201efdaa2 13290:28ce81eff3de
   169 subsection {*The relativized ZF axioms*}
   169 subsection {*The relativized ZF axioms*}
   170 constdefs
   170 constdefs
   171 
   171 
   172   extensionality :: "(i=>o) => o"
   172   extensionality :: "(i=>o) => o"
   173     "extensionality(M) == 
   173     "extensionality(M) == 
   174 	\<forall>x y. M(x) --> M(y) --> (\<forall>z. M(z) --> (z \<in> x <-> z \<in> y)) --> x=y"
   174 	\<forall>x[M]. \<forall>y[M]. (\<forall>z[M]. z \<in> x <-> z \<in> y) --> x=y"
   175 
   175 
   176   separation :: "[i=>o, i=>o] => o"
   176   separation :: "[i=>o, i=>o] => o"
   177     --{*Big problem: the formula @{text P} should only involve parameters
   177     --{*Big problem: the formula @{text P} should only involve parameters
   178         belonging to @{text M}.  Don't see how to enforce that.*}
   178         belonging to @{text M}.  Don't see how to enforce that.*}
   179     "separation(M,P) == 
   179     "separation(M,P) == 
   180 	\<forall>z. M(z) --> (\<exists>y. M(y) & (\<forall>x. M(x) --> (x \<in> y <-> x \<in> z & P(x))))"
   180 	\<forall>z[M]. \<exists>y[M]. \<forall>x[M]. x \<in> y <-> x \<in> z & P(x)"
   181 
   181 
   182   upair_ax :: "(i=>o) => o"
   182   upair_ax :: "(i=>o) => o"
   183     "upair_ax(M) == \<forall>x y. M(x) --> M(y) --> (\<exists>z. M(z) & upair(M,x,y,z))"
   183     "upair_ax(M) == \<forall>x y. M(x) --> M(y) --> (\<exists>z. M(z) & upair(M,x,y,z))"
   184 
   184 
   185   Union_ax :: "(i=>o) => o"
   185   Union_ax :: "(i=>o) => o"
   267 lemma Collect_in_univ:
   267 lemma Collect_in_univ:
   268      "[| X \<in> univ(A);  Transset(A) |] ==> Collect(X,P) \<in> univ(A)"
   268      "[| X \<in> univ(A);  Transset(A) |] ==> Collect(X,P) \<in> univ(A)"
   269 by (simp add: univ_def Collect_in_VLimit Limit_nat)
   269 by (simp add: univ_def Collect_in_VLimit Limit_nat)
   270 
   270 
   271 lemma "separation(\<lambda>x. x \<in> univ(0), P)"
   271 lemma "separation(\<lambda>x. x \<in> univ(0), P)"
   272 apply (simp add: separation_def)
   272 apply (simp add: separation_def, clarify) 
   273 apply (blast intro: Collect_in_univ Transset_0) 
   273 apply (rule_tac x = "Collect(x,P)" in bexI) 
       
   274 apply (blast intro: Collect_in_univ Transset_0)+
   274 done
   275 done
   275 
   276 
   276 text{*Unordered pairing axiom*}
   277 text{*Unordered pairing axiom*}
   277 lemma "upair_ax(\<lambda>x. x \<in> univ(0))"
   278 lemma "upair_ax(\<lambda>x. x \<in> univ(0))"
   278 apply (simp add: upair_ax_def upair_def)  
   279 apply (simp add: upair_ax_def upair_def)  
   348     "[| strong_replacement(M,P); M(A);  univalent(M,A,P) |]
   349     "[| strong_replacement(M,P); M(A);  univalent(M,A,P) |]
   349      ==> \<exists>Y. M(Y) & (\<forall>b. M(b) --> (b \<in> Y <-> (\<exists>x\<in>A. M(x) & P(x,b))))"
   350      ==> \<exists>Y. M(Y) & (\<forall>b. M(b) --> (b \<in> Y <-> (\<exists>x\<in>A. M(x) & P(x,b))))"
   350 by (simp add: strong_replacement_def) 
   351 by (simp add: strong_replacement_def) 
   351 
   352 
   352 lemma separationD:
   353 lemma separationD:
   353     "[| separation(M,P); M(z) |]
   354     "[| separation(M,P); M(z) |] ==> \<exists>y[M]. \<forall>x[M]. x \<in> y <-> x \<in> z & P(x)"
   354      ==> \<exists>y. M(y) & (\<forall>x. M(x) --> (x \<in> y <-> x \<in> z & P(x)))"
       
   355 by (simp add: separation_def) 
   355 by (simp add: separation_def) 
   356 
   356 
   357 
   357 
   358 text{*More constants, for order types*}
   358 text{*More constants, for order types*}
   359 constdefs
   359 constdefs
   379 
   379 
   380 subsection{*Absoluteness for a transitive class model*}
   380 subsection{*Absoluteness for a transitive class model*}
   381 
   381 
   382 text{*The class M is assumed to be transitive and to satisfy some
   382 text{*The class M is assumed to be transitive and to satisfy some
   383       relativized ZF axioms*}
   383       relativized ZF axioms*}
   384 locale M_axioms =
   384 locale M_triv_axioms =
   385   fixes M
   385   fixes M
   386   assumes transM:           "[| y\<in>x; M(x) |] ==> M(y)"
   386   assumes transM:           "[| y\<in>x; M(x) |] ==> M(y)"
   387       and nonempty [simp]:  "M(0)"
   387       and nonempty [simp]:  "M(0)"
   388       and upair_ax:	    "upair_ax(M)"
   388       and upair_ax:	    "upair_ax(M)"
   389       and Union_ax:	    "Union_ax(M)"
   389       and Union_ax:	    "Union_ax(M)"
   390       and power_ax:         "power_ax(M)"
   390       and power_ax:         "power_ax(M)"
   391       and replacement:      "replacement(M,P)"
   391       and replacement:      "replacement(M,P)"
   392       and M_nat [iff]:      "M(nat)"           (*i.e. the axiom of infinity*)
   392       and M_nat [iff]:      "M(nat)"           (*i.e. the axiom of infinity*)
   393   and Inter_separation:
   393 
       
   394 lemma (in M_triv_axioms) ball_abs [simp]: 
       
   395      "M(A) ==> (\<forall>x\<in>A. M(x) --> P(x)) <-> (\<forall>x\<in>A. P(x))" 
       
   396 by (blast intro: transM) 
       
   397 
       
   398 lemma (in M_triv_axioms) rall_abs [simp]: 
       
   399      "M(A) ==> (\<forall>x[M]. x\<in>A --> P(x)) <-> (\<forall>x\<in>A. P(x))" 
       
   400 by (blast intro: transM) 
       
   401 
       
   402 lemma (in M_triv_axioms) bex_abs [simp]: 
       
   403      "M(A) ==> (\<exists>x\<in>A. M(x) & P(x)) <-> (\<exists>x\<in>A. P(x))" 
       
   404 by (blast intro: transM) 
       
   405 
       
   406 lemma (in M_triv_axioms) rex_abs [simp]: 
       
   407      "M(A) ==> (\<exists>x[M]. x\<in>A & P(x)) <-> (\<exists>x\<in>A. P(x))" 
       
   408 by (blast intro: transM) 
       
   409 
       
   410 lemma (in M_triv_axioms) ball_iff_equiv: 
       
   411      "M(A) ==> (\<forall>x. M(x) --> (x\<in>A <-> P(x))) <-> 
       
   412                (\<forall>x\<in>A. P(x)) & (\<forall>x. P(x) --> M(x) --> x\<in>A)" 
       
   413 by (blast intro: transM)
       
   414 
       
   415 text{*Simplifies proofs of equalities when there's an iff-equality
       
   416       available for rewriting, universally quantified over M. *}
       
   417 lemma (in M_triv_axioms) M_equalityI: 
       
   418      "[| !!x. M(x) ==> x\<in>A <-> x\<in>B; M(A); M(B) |] ==> A=B"
       
   419 by (blast intro!: equalityI dest: transM) 
       
   420 
       
   421 lemma (in M_triv_axioms) empty_abs [simp]: 
       
   422      "M(z) ==> empty(M,z) <-> z=0"
       
   423 apply (simp add: empty_def)
       
   424 apply (blast intro: transM) 
       
   425 done
       
   426 
       
   427 lemma (in M_triv_axioms) subset_abs [simp]: 
       
   428      "M(A) ==> subset(M,A,B) <-> A \<subseteq> B"
       
   429 apply (simp add: subset_def) 
       
   430 apply (blast intro: transM) 
       
   431 done
       
   432 
       
   433 lemma (in M_triv_axioms) upair_abs [simp]: 
       
   434      "M(z) ==> upair(M,a,b,z) <-> z={a,b}"
       
   435 apply (simp add: upair_def) 
       
   436 apply (blast intro: transM) 
       
   437 done
       
   438 
       
   439 lemma (in M_triv_axioms) upair_in_M_iff [iff]:
       
   440      "M({a,b}) <-> M(a) & M(b)"
       
   441 apply (insert upair_ax, simp add: upair_ax_def) 
       
   442 apply (blast intro: transM) 
       
   443 done
       
   444 
       
   445 lemma (in M_triv_axioms) singleton_in_M_iff [iff]:
       
   446      "M({a}) <-> M(a)"
       
   447 by (insert upair_in_M_iff [of a a], simp) 
       
   448 
       
   449 lemma (in M_triv_axioms) pair_abs [simp]: 
       
   450      "M(z) ==> pair(M,a,b,z) <-> z=<a,b>"
       
   451 apply (simp add: pair_def ZF.Pair_def)
       
   452 apply (blast intro: transM) 
       
   453 done
       
   454 
       
   455 lemma (in M_triv_axioms) pair_in_M_iff [iff]:
       
   456      "M(<a,b>) <-> M(a) & M(b)"
       
   457 by (simp add: ZF.Pair_def)
       
   458 
       
   459 lemma (in M_triv_axioms) pair_components_in_M:
       
   460      "[| <x,y> \<in> A; M(A) |] ==> M(x) & M(y)"
       
   461 apply (simp add: Pair_def)
       
   462 apply (blast dest: transM) 
       
   463 done
       
   464 
       
   465 lemma (in M_triv_axioms) cartprod_abs [simp]: 
       
   466      "[| M(A); M(B); M(z) |] ==> cartprod(M,A,B,z) <-> z = A*B"
       
   467 apply (simp add: cartprod_def)
       
   468 apply (rule iffI) 
       
   469  apply (blast intro!: equalityI intro: transM dest!: rspec) 
       
   470 apply (blast dest: transM) 
       
   471 done
       
   472 
       
   473 lemma (in M_triv_axioms) union_abs [simp]: 
       
   474      "[| M(a); M(b); M(z) |] ==> union(M,a,b,z) <-> z = a Un b"
       
   475 apply (simp add: union_def) 
       
   476 apply (blast intro: transM) 
       
   477 done
       
   478 
       
   479 lemma (in M_triv_axioms) inter_abs [simp]: 
       
   480      "[| M(a); M(b); M(z) |] ==> inter(M,a,b,z) <-> z = a Int b"
       
   481 apply (simp add: inter_def) 
       
   482 apply (blast intro: transM) 
       
   483 done
       
   484 
       
   485 lemma (in M_triv_axioms) setdiff_abs [simp]: 
       
   486      "[| M(a); M(b); M(z) |] ==> setdiff(M,a,b,z) <-> z = a-b"
       
   487 apply (simp add: setdiff_def) 
       
   488 apply (blast intro: transM) 
       
   489 done
       
   490 
       
   491 lemma (in M_triv_axioms) Union_abs [simp]: 
       
   492      "[| M(A); M(z) |] ==> big_union(M,A,z) <-> z = Union(A)"
       
   493 apply (simp add: big_union_def) 
       
   494 apply (blast intro!: equalityI dest: transM) 
       
   495 done
       
   496 
       
   497 lemma (in M_triv_axioms) Union_closed [intro,simp]:
       
   498      "M(A) ==> M(Union(A))"
       
   499 by (insert Union_ax, simp add: Union_ax_def) 
       
   500 
       
   501 lemma (in M_triv_axioms) Un_closed [intro,simp]:
       
   502      "[| M(A); M(B) |] ==> M(A Un B)"
       
   503 by (simp only: Un_eq_Union, blast) 
       
   504 
       
   505 lemma (in M_triv_axioms) cons_closed [intro,simp]:
       
   506      "[| M(a); M(A) |] ==> M(cons(a,A))"
       
   507 by (subst cons_eq [symmetric], blast) 
       
   508 
       
   509 lemma (in M_triv_axioms) successor_abs [simp]: 
       
   510      "[| M(a); M(z) |] ==> successor(M,a,z) <-> z=succ(a)"
       
   511 by (simp add: successor_def, blast)  
       
   512 
       
   513 lemma (in M_triv_axioms) succ_in_M_iff [iff]:
       
   514      "M(succ(a)) <-> M(a)"
       
   515 apply (simp add: succ_def) 
       
   516 apply (blast intro: transM) 
       
   517 done
       
   518 
       
   519 lemma (in M_triv_axioms) separation_closed [intro,simp]:
       
   520      "[| separation(M,P); M(A) |] ==> M(Collect(A,P))"
       
   521 apply (insert separation, simp add: separation_def) 
       
   522 apply (drule rspec, assumption, clarify) 
       
   523 apply (subgoal_tac "y = Collect(A,P)", blast)
       
   524 apply (blast dest: transM) 
       
   525 done
       
   526 
       
   527 text{*Probably the premise and conclusion are equivalent*}
       
   528 lemma (in M_triv_axioms) strong_replacementI [rule_format]:
       
   529     "[| \<forall>A. M(A) --> separation(M, %u. \<exists>x\<in>A. P(x,u)) |]
       
   530      ==> strong_replacement(M,P)"
       
   531 apply (simp add: strong_replacement_def, clarify) 
       
   532 apply (frule replacementD [OF replacement], assumption, clarify) 
       
   533 apply (drule_tac x=A in spec, clarify)  
       
   534 apply (drule_tac z=Y in separationD, assumption, clarify) 
       
   535 apply (blast dest: transM) 
       
   536 done
       
   537 
       
   538 
       
   539 (*The last premise expresses that P takes M to M*)
       
   540 lemma (in M_triv_axioms) strong_replacement_closed [intro,simp]:
       
   541      "[| strong_replacement(M,P); M(A); univalent(M,A,P); 
       
   542        !!x y. [| x\<in>A; P(x,y); M(x) |] ==> M(y) |] ==> M(Replace(A,P))"
       
   543 apply (simp add: strong_replacement_def) 
       
   544 apply (drule spec [THEN mp], auto) 
       
   545 apply (subgoal_tac "Replace(A,P) = Y")
       
   546  apply simp 
       
   547 apply (rule equality_iffI) 
       
   548 apply (simp add: Replace_iff, safe)
       
   549  apply (blast dest: transM) 
       
   550 apply (frule transM, assumption) 
       
   551  apply (simp add: univalent_def)
       
   552  apply (drule spec [THEN mp, THEN iffD1], assumption, assumption)
       
   553  apply (blast dest: transM) 
       
   554 done
       
   555 
       
   556 (*The first premise can't simply be assumed as a schema.
       
   557   It is essential to take care when asserting instances of Replacement.
       
   558   Let K be a nonconstructible subset of nat and define
       
   559   f(x) = x if x:K and f(x)=0 otherwise.  Then RepFun(nat,f) = cons(0,K), a 
       
   560   nonconstructible set.  So we cannot assume that M(X) implies M(RepFun(X,f))
       
   561   even for f : M -> M.
       
   562 *)
       
   563 lemma (in M_triv_axioms) RepFun_closed [intro,simp]:
       
   564      "[| strong_replacement(M, \<lambda>x y. y = f(x)); M(A); \<forall>x\<in>A. M(f(x)) |]
       
   565       ==> M(RepFun(A,f))"
       
   566 apply (simp add: RepFun_def) 
       
   567 apply (rule strong_replacement_closed) 
       
   568 apply (auto dest: transM  simp add: univalent_def) 
       
   569 done
       
   570 
       
   571 lemma (in M_triv_axioms) lam_closed [intro,simp]:
       
   572      "[| strong_replacement(M, \<lambda>x y. y = <x,b(x)>); M(A); \<forall>x\<in>A. M(b(x)) |]
       
   573       ==> M(\<lambda>x\<in>A. b(x))"
       
   574 by (simp add: lam_def, blast dest: transM) 
       
   575 
       
   576 lemma (in M_triv_axioms) image_abs [simp]: 
       
   577      "[| M(r); M(A); M(z) |] ==> image(M,r,A,z) <-> z = r``A"
       
   578 apply (simp add: image_def)
       
   579 apply (rule iffI) 
       
   580  apply (blast intro!: equalityI dest: transM, blast) 
       
   581 done
       
   582 
       
   583 text{*What about @{text Pow_abs}?  Powerset is NOT absolute!
       
   584       This result is one direction of absoluteness.*}
       
   585 
       
   586 lemma (in M_triv_axioms) powerset_Pow: 
       
   587      "powerset(M, x, Pow(x))"
       
   588 by (simp add: powerset_def)
       
   589 
       
   590 text{*But we can't prove that the powerset in @{text M} includes the
       
   591       real powerset.*}
       
   592 lemma (in M_triv_axioms) powerset_imp_subset_Pow: 
       
   593      "[| powerset(M,x,y); M(y) |] ==> y <= Pow(x)"
       
   594 apply (simp add: powerset_def) 
       
   595 apply (blast dest: transM) 
       
   596 done
       
   597 
       
   598 lemma (in M_triv_axioms) nat_into_M [intro]:
       
   599      "n \<in> nat ==> M(n)"
       
   600 by (induct n rule: nat_induct, simp_all)
       
   601 
       
   602 lemma (in M_triv_axioms) nat_case_closed:
       
   603   "[|M(k); M(a); \<forall>m[M]. M(b(m))|] ==> M(nat_case(a,b,k))"
       
   604 apply (case_tac "k=0", simp) 
       
   605 apply (case_tac "\<exists>m. k = succ(m)", force)
       
   606 apply (simp add: nat_case_def) 
       
   607 done
       
   608 
       
   609 lemma (in M_triv_axioms) Inl_in_M_iff [iff]:
       
   610      "M(Inl(a)) <-> M(a)"
       
   611 by (simp add: Inl_def) 
       
   612 
       
   613 lemma (in M_triv_axioms) Inr_in_M_iff [iff]:
       
   614      "M(Inr(a)) <-> M(a)"
       
   615 by (simp add: Inr_def)
       
   616 
       
   617 
       
   618 subsection{*Absoluteness for ordinals*}
       
   619 text{*These results constitute Theorem IV 5.1 of Kunen (page 126).*}
       
   620 
       
   621 lemma (in M_triv_axioms) lt_closed:
       
   622      "[| j<i; M(i) |] ==> M(j)" 
       
   623 by (blast dest: ltD intro: transM) 
       
   624 
       
   625 lemma (in M_triv_axioms) transitive_set_abs [simp]: 
       
   626      "M(a) ==> transitive_set(M,a) <-> Transset(a)"
       
   627 by (simp add: transitive_set_def Transset_def)
       
   628 
       
   629 lemma (in M_triv_axioms) ordinal_abs [simp]: 
       
   630      "M(a) ==> ordinal(M,a) <-> Ord(a)"
       
   631 by (simp add: ordinal_def Ord_def)
       
   632 
       
   633 lemma (in M_triv_axioms) limit_ordinal_abs [simp]: 
       
   634      "M(a) ==> limit_ordinal(M,a) <-> Limit(a)"
       
   635 apply (simp add: limit_ordinal_def Ord_0_lt_iff Limit_def) 
       
   636 apply (simp add: lt_def, blast) 
       
   637 done
       
   638 
       
   639 lemma (in M_triv_axioms) successor_ordinal_abs [simp]: 
       
   640      "M(a) ==> successor_ordinal(M,a) <-> Ord(a) & (\<exists>b. M(b) & a = succ(b))"
       
   641 apply (simp add: successor_ordinal_def, safe)
       
   642 apply (drule Ord_cases_disj, auto) 
       
   643 done
       
   644 
       
   645 lemma finite_Ord_is_nat:
       
   646       "[| Ord(a); ~ Limit(a); \<forall>x\<in>a. ~ Limit(x) |] ==> a \<in> nat"
       
   647 by (induct a rule: trans_induct3, simp_all)
       
   648 
       
   649 lemma naturals_not_limit: "a \<in> nat ==> ~ Limit(a)"
       
   650 by (induct a rule: nat_induct, auto)
       
   651 
       
   652 lemma (in M_triv_axioms) finite_ordinal_abs [simp]: 
       
   653      "M(a) ==> finite_ordinal(M,a) <-> a \<in> nat"
       
   654 apply (simp add: finite_ordinal_def)
       
   655 apply (blast intro: finite_Ord_is_nat intro: nat_into_Ord 
       
   656              dest: Ord_trans naturals_not_limit)
       
   657 done
       
   658 
       
   659 lemma Limit_non_Limit_implies_nat:
       
   660      "[| Limit(a); \<forall>x\<in>a. ~ Limit(x) |] ==> a = nat"
       
   661 apply (rule le_anti_sym) 
       
   662 apply (rule all_lt_imp_le, blast, blast intro: Limit_is_Ord)  
       
   663  apply (simp add: lt_def)  
       
   664  apply (blast intro: Ord_in_Ord Ord_trans finite_Ord_is_nat) 
       
   665 apply (erule nat_le_Limit)
       
   666 done
       
   667 
       
   668 lemma (in M_triv_axioms) omega_abs [simp]: 
       
   669      "M(a) ==> omega(M,a) <-> a = nat"
       
   670 apply (simp add: omega_def) 
       
   671 apply (blast intro: Limit_non_Limit_implies_nat dest: naturals_not_limit)
       
   672 done
       
   673 
       
   674 lemma (in M_triv_axioms) number1_abs [simp]: 
       
   675      "M(a) ==> number1(M,a) <-> a = 1"
       
   676 by (simp add: number1_def) 
       
   677 
       
   678 lemma (in M_triv_axioms) number1_abs [simp]: 
       
   679      "M(a) ==> number2(M,a) <-> a = succ(1)"
       
   680 by (simp add: number2_def) 
       
   681 
       
   682 lemma (in M_triv_axioms) number3_abs [simp]: 
       
   683      "M(a) ==> number3(M,a) <-> a = succ(succ(1))"
       
   684 by (simp add: number3_def) 
       
   685 
       
   686 text{*Kunen continued to 20...*}
       
   687 
       
   688 (*Could not get this to work.  The \<lambda>x\<in>nat is essential because everything 
       
   689   but the recursion variable must stay unchanged.  But then the recursion
       
   690   equations only hold for x\<in>nat (or in some other set) and not for the 
       
   691   whole of the class M.
       
   692   consts
       
   693     natnumber_aux :: "[i=>o,i] => i"
       
   694 
       
   695   primrec
       
   696       "natnumber_aux(M,0) = (\<lambda>x\<in>nat. if empty(M,x) then 1 else 0)"
       
   697       "natnumber_aux(M,succ(n)) = 
       
   698 	   (\<lambda>x\<in>nat. if (\<exists>y. M(y) & natnumber_aux(M,n)`y=1 & successor(M,y,x)) 
       
   699 		     then 1 else 0)"
       
   700 
       
   701   constdefs
       
   702     natnumber :: "[i=>o,i,i] => o"
       
   703       "natnumber(M,n,x) == natnumber_aux(M,n)`x = 1"
       
   704 
       
   705   lemma (in M_triv_axioms) [simp]: 
       
   706        "natnumber(M,0,x) == x=0"
       
   707 *)
       
   708 
       
   709 subsection{*Some instances of separation and strong replacement*}
       
   710 
       
   711 locale M_axioms = M_triv_axioms +
       
   712 assumes Inter_separation:
   394      "M(A) ==> separation(M, \<lambda>x. \<forall>y[M]. y\<in>A --> x\<in>y)"
   713      "M(A) ==> separation(M, \<lambda>x. \<forall>y[M]. y\<in>A --> x\<in>y)"
   395   and cartprod_separation:
   714   and cartprod_separation:
   396      "[| M(A); M(B) |] 
   715      "[| M(A); M(B) |] 
   397       ==> separation(M, \<lambda>z. \<exists>x\<in>A. \<exists>y\<in>B. M(x) & M(y) & pair(M,x,y,z))"
   716       ==> separation(M, \<lambda>z. \<exists>x\<in>A. \<exists>y\<in>B. M(x) & M(y) & pair(M,x,y,z))"
   398   and image_separation:
   717   and image_separation:
   399      "[| M(A); M(r) |] 
   718      "[| M(A); M(r) |] 
   400       ==> separation(M, \<lambda>y. \<exists>p[M]. p\<in>r & (\<exists>x[M]. x\<in>A & pair(M,x,y,p)))"
   719       ==> separation(M, \<lambda>y. \<exists>p[M]. p\<in>r & (\<exists>x[M]. x\<in>A & pair(M,x,y,p)))"
   401   and vimage_separation:
       
   402      "[| M(A); M(r) |] 
       
   403       ==> separation(M, \<lambda>x. \<exists>p[M]. p\<in>r & (\<exists>y[M]. y\<in>A & pair(M,x,y,p)))"
       
   404   and converse_separation:
   720   and converse_separation:
   405      "M(r) ==> separation(M, \<lambda>z. \<exists>p\<in>r. 
   721      "M(r) ==> separation(M, \<lambda>z. \<exists>p\<in>r. 
   406                     M(p) & (\<exists>x[M]. \<exists>y[M]. pair(M,x,y,p) & pair(M,y,x,z)))"
   722                     M(p) & (\<exists>x[M]. \<exists>y[M]. pair(M,x,y,p) & pair(M,y,x,z)))"
   407   and restrict_separation:
   723   and restrict_separation:
   408      "M(A) ==> separation(M, \<lambda>z. \<exists>x[M]. x\<in>A & (\<exists>y[M]. pair(M,x,y,z)))"
   724      "M(A) ==> separation(M, \<lambda>z. \<exists>x[M]. x\<in>A & (\<exists>y[M]. pair(M,x,y,z)))"
   445       ==> strong_replacement(M,
   761       ==> strong_replacement(M,
   446              \<lambda>a z. \<exists>x g mx par. M(x) & M(g) & M(mx) & M(par) &
   762              \<lambda>a z. \<exists>x g mx par. M(x) & M(g) & M(mx) & M(par) &
   447 	     ordinal(M,x) & pair(M,a,x,z) & membership(M,x,mx) & 
   763 	     ordinal(M,x) & pair(M,a,x,z) & membership(M,x,mx) & 
   448 	     pred_set(M,A,a,r,par) & order_isomorphism(M,par,r,x,mx,g))"
   764 	     pred_set(M,A,a,r,par) & order_isomorphism(M,par,r,x,mx,g))"
   449 
   765 
   450 lemma (in M_axioms) ball_abs [simp]: 
       
   451      "M(A) ==> (\<forall>x\<in>A. M(x) --> P(x)) <-> (\<forall>x\<in>A. P(x))" 
       
   452 by (blast intro: transM) 
       
   453 
       
   454 lemma (in M_axioms) rall_abs [simp]: 
       
   455      "M(A) ==> (\<forall>x[M]. x\<in>A --> P(x)) <-> (\<forall>x\<in>A. P(x))" 
       
   456 by (blast intro: transM) 
       
   457 
       
   458 lemma (in M_axioms) bex_abs [simp]: 
       
   459      "M(A) ==> (\<exists>x\<in>A. M(x) & P(x)) <-> (\<exists>x\<in>A. P(x))" 
       
   460 by (blast intro: transM) 
       
   461 
       
   462 lemma (in M_axioms) rex_abs [simp]: 
       
   463      "M(A) ==> (\<exists>x[M]. x\<in>A & P(x)) <-> (\<exists>x\<in>A. P(x))" 
       
   464 by (blast intro: transM) 
       
   465 
       
   466 lemma (in M_axioms) ball_iff_equiv: 
       
   467      "M(A) ==> (\<forall>x. M(x) --> (x\<in>A <-> P(x))) <-> 
       
   468                (\<forall>x\<in>A. P(x)) & (\<forall>x. P(x) --> M(x) --> x\<in>A)" 
       
   469 by (blast intro: transM)
       
   470 
       
   471 text{*Simplifies proofs of equalities when there's an iff-equality
       
   472       available for rewriting, universally quantified over M. *}
       
   473 lemma (in M_axioms) M_equalityI: 
       
   474      "[| !!x. M(x) ==> x\<in>A <-> x\<in>B; M(A); M(B) |] ==> A=B"
       
   475 by (blast intro!: equalityI dest: transM) 
       
   476 
       
   477 lemma (in M_axioms) empty_abs [simp]: 
       
   478      "M(z) ==> empty(M,z) <-> z=0"
       
   479 apply (simp add: empty_def)
       
   480 apply (blast intro: transM) 
       
   481 done
       
   482 
       
   483 lemma (in M_axioms) subset_abs [simp]: 
       
   484      "M(A) ==> subset(M,A,B) <-> A \<subseteq> B"
       
   485 apply (simp add: subset_def) 
       
   486 apply (blast intro: transM) 
       
   487 done
       
   488 
       
   489 lemma (in M_axioms) upair_abs [simp]: 
       
   490      "M(z) ==> upair(M,a,b,z) <-> z={a,b}"
       
   491 apply (simp add: upair_def) 
       
   492 apply (blast intro: transM) 
       
   493 done
       
   494 
       
   495 lemma (in M_axioms) upair_in_M_iff [iff]:
       
   496      "M({a,b}) <-> M(a) & M(b)"
       
   497 apply (insert upair_ax, simp add: upair_ax_def) 
       
   498 apply (blast intro: transM) 
       
   499 done
       
   500 
       
   501 lemma (in M_axioms) singleton_in_M_iff [iff]:
       
   502      "M({a}) <-> M(a)"
       
   503 by (insert upair_in_M_iff [of a a], simp) 
       
   504 
       
   505 lemma (in M_axioms) pair_abs [simp]: 
       
   506      "M(z) ==> pair(M,a,b,z) <-> z=<a,b>"
       
   507 apply (simp add: pair_def ZF.Pair_def)
       
   508 apply (blast intro: transM) 
       
   509 done
       
   510 
       
   511 lemma (in M_axioms) pair_in_M_iff [iff]:
       
   512      "M(<a,b>) <-> M(a) & M(b)"
       
   513 by (simp add: ZF.Pair_def)
       
   514 
       
   515 lemma (in M_axioms) pair_components_in_M:
       
   516      "[| <x,y> \<in> A; M(A) |] ==> M(x) & M(y)"
       
   517 apply (simp add: Pair_def)
       
   518 apply (blast dest: transM) 
       
   519 done
       
   520 
       
   521 lemma (in M_axioms) cartprod_abs [simp]: 
       
   522      "[| M(A); M(B); M(z) |] ==> cartprod(M,A,B,z) <-> z = A*B"
       
   523 apply (simp add: cartprod_def)
       
   524 apply (rule iffI) 
       
   525  apply (blast intro!: equalityI intro: transM dest!: rspec) 
       
   526 apply (blast dest: transM) 
       
   527 done
       
   528 
       
   529 lemma (in M_axioms) union_abs [simp]: 
       
   530      "[| M(a); M(b); M(z) |] ==> union(M,a,b,z) <-> z = a Un b"
       
   531 apply (simp add: union_def) 
       
   532 apply (blast intro: transM) 
       
   533 done
       
   534 
       
   535 lemma (in M_axioms) inter_abs [simp]: 
       
   536      "[| M(a); M(b); M(z) |] ==> inter(M,a,b,z) <-> z = a Int b"
       
   537 apply (simp add: inter_def) 
       
   538 apply (blast intro: transM) 
       
   539 done
       
   540 
       
   541 lemma (in M_axioms) setdiff_abs [simp]: 
       
   542      "[| M(a); M(b); M(z) |] ==> setdiff(M,a,b,z) <-> z = a-b"
       
   543 apply (simp add: setdiff_def) 
       
   544 apply (blast intro: transM) 
       
   545 done
       
   546 
       
   547 lemma (in M_axioms) Union_abs [simp]: 
       
   548      "[| M(A); M(z) |] ==> big_union(M,A,z) <-> z = Union(A)"
       
   549 apply (simp add: big_union_def) 
       
   550 apply (blast intro!: equalityI dest: transM) 
       
   551 done
       
   552 
       
   553 lemma (in M_axioms) Union_closed [intro,simp]:
       
   554      "M(A) ==> M(Union(A))"
       
   555 by (insert Union_ax, simp add: Union_ax_def) 
       
   556 
       
   557 lemma (in M_axioms) Un_closed [intro,simp]:
       
   558      "[| M(A); M(B) |] ==> M(A Un B)"
       
   559 by (simp only: Un_eq_Union, blast) 
       
   560 
       
   561 lemma (in M_axioms) cons_closed [intro,simp]:
       
   562      "[| M(a); M(A) |] ==> M(cons(a,A))"
       
   563 by (subst cons_eq [symmetric], blast) 
       
   564 
       
   565 lemma (in M_axioms) successor_abs [simp]: 
       
   566      "[| M(a); M(z) |] ==> successor(M,a,z) <-> z=succ(a)"
       
   567 by (simp add: successor_def, blast)  
       
   568 
       
   569 lemma (in M_axioms) succ_in_M_iff [iff]:
       
   570      "M(succ(a)) <-> M(a)"
       
   571 apply (simp add: succ_def) 
       
   572 apply (blast intro: transM) 
       
   573 done
       
   574 
       
   575 lemma (in M_axioms) separation_closed [intro,simp]:
       
   576      "[| separation(M,P); M(A) |] ==> M(Collect(A,P))"
       
   577 apply (insert separation, simp add: separation_def) 
       
   578 apply (drule spec [THEN mp], assumption, clarify) 
       
   579 apply (subgoal_tac "y = Collect(A,P)", blast)
       
   580 apply (blast dest: transM) 
       
   581 done
       
   582 
       
   583 text{*Probably the premise and conclusion are equivalent*}
       
   584 lemma (in M_axioms) strong_replacementI [rule_format]:
       
   585     "[| \<forall>A. M(A) --> separation(M, %u. \<exists>x\<in>A. P(x,u)) |]
       
   586      ==> strong_replacement(M,P)"
       
   587 apply (simp add: strong_replacement_def, clarify) 
       
   588 apply (frule replacementD [OF replacement], assumption, clarify) 
       
   589 apply (drule_tac x=A in spec, clarify)  
       
   590 apply (drule_tac z=Y in separationD, assumption, clarify) 
       
   591 apply (blast dest: transM) 
       
   592 done
       
   593 
       
   594 
       
   595 (*The last premise expresses that P takes M to M*)
       
   596 lemma (in M_axioms) strong_replacement_closed [intro,simp]:
       
   597      "[| strong_replacement(M,P); M(A); univalent(M,A,P); 
       
   598        !!x y. [| x\<in>A; P(x,y); M(x) |] ==> M(y) |] ==> M(Replace(A,P))"
       
   599 apply (simp add: strong_replacement_def) 
       
   600 apply (drule spec [THEN mp], auto) 
       
   601 apply (subgoal_tac "Replace(A,P) = Y")
       
   602  apply simp 
       
   603 apply (rule equality_iffI) 
       
   604 apply (simp add: Replace_iff, safe)
       
   605  apply (blast dest: transM) 
       
   606 apply (frule transM, assumption) 
       
   607  apply (simp add: univalent_def)
       
   608  apply (drule spec [THEN mp, THEN iffD1], assumption, assumption)
       
   609  apply (blast dest: transM) 
       
   610 done
       
   611 
       
   612 (*The first premise can't simply be assumed as a schema.
       
   613   It is essential to take care when asserting instances of Replacement.
       
   614   Let K be a nonconstructible subset of nat and define
       
   615   f(x) = x if x:K and f(x)=0 otherwise.  Then RepFun(nat,f) = cons(0,K), a 
       
   616   nonconstructible set.  So we cannot assume that M(X) implies M(RepFun(X,f))
       
   617   even for f : M -> M.
       
   618 *)
       
   619 lemma (in M_axioms) RepFun_closed [intro,simp]:
       
   620      "[| strong_replacement(M, \<lambda>x y. y = f(x)); M(A); \<forall>x\<in>A. M(f(x)) |]
       
   621       ==> M(RepFun(A,f))"
       
   622 apply (simp add: RepFun_def) 
       
   623 apply (rule strong_replacement_closed) 
       
   624 apply (auto dest: transM  simp add: univalent_def) 
       
   625 done
       
   626 
       
   627 lemma (in M_axioms) lam_closed [intro,simp]:
       
   628      "[| strong_replacement(M, \<lambda>x y. y = <x,b(x)>); M(A); \<forall>x\<in>A. M(b(x)) |]
       
   629       ==> M(\<lambda>x\<in>A. b(x))"
       
   630 by (simp add: lam_def, blast dest: transM) 
       
   631 
       
   632 lemma (in M_axioms) image_abs [simp]: 
       
   633      "[| M(r); M(A); M(z) |] ==> image(M,r,A,z) <-> z = r``A"
       
   634 apply (simp add: image_def)
       
   635 apply (rule iffI) 
       
   636  apply (blast intro!: equalityI dest: transM, blast) 
       
   637 done
       
   638 
       
   639 text{*What about @{text Pow_abs}?  Powerset is NOT absolute!
       
   640       This result is one direction of absoluteness.*}
       
   641 
       
   642 lemma (in M_axioms) powerset_Pow: 
       
   643      "powerset(M, x, Pow(x))"
       
   644 by (simp add: powerset_def)
       
   645 
       
   646 text{*But we can't prove that the powerset in @{text M} includes the
       
   647       real powerset.*}
       
   648 lemma (in M_axioms) powerset_imp_subset_Pow: 
       
   649      "[| powerset(M,x,y); M(y) |] ==> y <= Pow(x)"
       
   650 apply (simp add: powerset_def) 
       
   651 apply (blast dest: transM) 
       
   652 done
       
   653 
       
   654 lemma (in M_axioms) cartprod_iff_lemma:
   766 lemma (in M_axioms) cartprod_iff_lemma:
   655      "[| M(C);  \<forall>u[M]. u \<in> C <-> (\<exists>x\<in>A. \<exists>y\<in>B. u = {{x}, {x,y}}); 
   767      "[| M(C);  \<forall>u[M]. u \<in> C <-> (\<exists>x\<in>A. \<exists>y\<in>B. u = {{x}, {x,y}}); 
   656          powerset(M, A \<union> B, p1); powerset(M, p1, p2);  M(p2) |]
   768          powerset(M, A \<union> B, p1); powerset(M, p1, p2);  M(p2) |]
   657        ==> C = {u \<in> p2 . \<exists>x\<in>A. \<exists>y\<in>B. u = {{x}, {x,y}}}"
   769        ==> C = {u \<in> p2 . \<exists>x\<in>A. \<exists>y\<in>B. u = {{x}, {x,y}}}"
   658 apply (simp add: powerset_def) 
   770 apply (simp add: powerset_def) 
   659 apply (rule equalityI, clarify, simp)
   771 apply (rule equalityI, clarify, simp)
   660 
       
   661  apply (frule transM, assumption) 
   772  apply (frule transM, assumption) 
   662 
       
   663  apply (frule transM, assumption, simp) 
   773  apply (frule transM, assumption, simp) 
   664  apply blast 
   774  apply blast 
   665 apply clarify
   775 apply clarify
   666 apply (frule transM, assumption, force) 
   776 apply (frule transM, assumption, force) 
   667 done
   777 done
   696 prefer 4 apply assumption
   806 prefer 4 apply assumption
   697 prefer 4 apply assumption
   807 prefer 4 apply assumption
   698 apply (insert cartprod_separation [of A B], auto)
   808 apply (insert cartprod_separation [of A B], auto)
   699 done
   809 done
   700 
   810 
   701 
       
   702 text{*All the lemmas above are necessary because Powerset is not absolute.
   811 text{*All the lemmas above are necessary because Powerset is not absolute.
   703       I should have used Replacement instead!*}
   812       I should have used Replacement instead!*}
   704 lemma (in M_axioms) cartprod_closed [intro,simp]: 
   813 lemma (in M_axioms) cartprod_closed [intro,simp]: 
   705      "[| M(A); M(B) |] ==> M(A*B)"
   814      "[| M(A); M(B) |] ==> M(A*B)"
   706 by (frule cartprod_closed_lemma, assumption, force)
   815 by (frule cartprod_closed_lemma, assumption, force)
   707 
   816 
   708 lemma (in M_axioms) sum_closed [intro,simp]: 
   817 lemma (in M_axioms) sum_closed [intro,simp]: 
   709      "[| M(A); M(B) |] ==> M(A+B)"
   818      "[| M(A); M(B) |] ==> M(A+B)"
   710 by (simp add: sum_def)
   819 by (simp add: sum_def)
   711 
   820 
   712 lemma (in M_axioms) image_closed [intro,simp]: 
   821 
   713      "[| M(A); M(r) |] ==> M(r``A)"
   822 subsubsection {*converse of a relation*}
   714 apply (simp add: image_iff_Collect)
       
   715 apply (insert image_separation [of A r], simp) 
       
   716 done
       
   717 
       
   718 lemma (in M_axioms) vimage_abs [simp]: 
       
   719      "[| M(r); M(A); M(z) |] ==> pre_image(M,r,A,z) <-> z = r-``A"
       
   720 apply (simp add: pre_image_def)
       
   721 apply (rule iffI) 
       
   722  apply (blast intro!: equalityI dest: transM, blast) 
       
   723 done
       
   724 
       
   725 lemma (in M_axioms) vimage_closed [intro,simp]: 
       
   726      "[| M(A); M(r) |] ==> M(r-``A)"
       
   727 apply (simp add: vimage_iff_Collect)
       
   728 apply (insert vimage_separation [of A r], simp) 
       
   729 done
       
   730 
       
   731 lemma (in M_axioms) domain_abs [simp]: 
       
   732      "[| M(r); M(z) |] ==> is_domain(M,r,z) <-> z = domain(r)"
       
   733 apply (simp add: is_domain_def) 
       
   734 apply (blast intro!: equalityI dest: transM) 
       
   735 done
       
   736 
       
   737 lemma (in M_axioms) domain_closed [intro,simp]: 
       
   738      "M(r) ==> M(domain(r))"
       
   739 apply (simp add: domain_eq_vimage)
       
   740 done
       
   741 
       
   742 lemma (in M_axioms) range_abs [simp]: 
       
   743      "[| M(r); M(z) |] ==> is_range(M,r,z) <-> z = range(r)"
       
   744 apply (simp add: is_range_def)
       
   745 apply (blast intro!: equalityI dest: transM)
       
   746 done
       
   747 
       
   748 lemma (in M_axioms) range_closed [intro,simp]: 
       
   749      "M(r) ==> M(range(r))"
       
   750 apply (simp add: range_eq_image)
       
   751 done
       
   752 
       
   753 lemma (in M_axioms) field_abs [simp]: 
       
   754      "[| M(r); M(z) |] ==> is_field(M,r,z) <-> z = field(r)"
       
   755 by (simp add: domain_closed range_closed is_field_def field_def)
       
   756 
       
   757 lemma (in M_axioms) field_closed [intro,simp]: 
       
   758      "M(r) ==> M(field(r))"
       
   759 by (simp add: domain_closed range_closed Un_closed field_def) 
       
   760 
       
   761 
   823 
   762 lemma (in M_axioms) M_converse_iff:
   824 lemma (in M_axioms) M_converse_iff:
   763      "M(r) ==> 
   825      "M(r) ==> 
   764       converse(r) = 
   826       converse(r) = 
   765       {z \<in> range(r) * domain(r). \<exists>p\<in>r. \<exists>x[M]. \<exists>y[M]. p = \<langle>x,y\<rangle> & z = \<langle>y,x\<rangle>}"
   827       {z \<in> Union(Union(r)) * Union(Union(r)). 
   766 by (blast dest: transM)
   828        \<exists>p\<in>r. \<exists>x[M]. \<exists>y[M]. p = \<langle>x,y\<rangle> & z = \<langle>y,x\<rangle>}"
       
   829 apply (rule equalityI)
       
   830  prefer 2 apply (blast dest: transM, clarify, simp) 
       
   831 apply (simp add: Pair_def) 
       
   832 apply (blast dest: transM) 
       
   833 done
   767 
   834 
   768 lemma (in M_axioms) converse_closed [intro,simp]: 
   835 lemma (in M_axioms) converse_closed [intro,simp]: 
   769      "M(r) ==> M(converse(r))"
   836      "M(r) ==> M(converse(r))"
   770 apply (simp add: M_converse_iff)
   837 apply (simp add: M_converse_iff)
   771 apply (insert converse_separation [of r], simp)
   838 apply (insert converse_separation [of r], simp)
   779 apply (rule M_equalityI)
   846 apply (rule M_equalityI)
   780   apply simp
   847   apply simp
   781   apply (blast dest: transM)+
   848   apply (blast dest: transM)+
   782 done
   849 done
   783 
   850 
       
   851 
       
   852 subsubsection {*image, preimage, domain, range*}
       
   853 
       
   854 lemma (in M_axioms) image_closed [intro,simp]: 
       
   855      "[| M(A); M(r) |] ==> M(r``A)"
       
   856 apply (simp add: image_iff_Collect)
       
   857 apply (insert image_separation [of A r], simp) 
       
   858 done
       
   859 
       
   860 lemma (in M_axioms) vimage_abs [simp]: 
       
   861      "[| M(r); M(A); M(z) |] ==> pre_image(M,r,A,z) <-> z = r-``A"
       
   862 apply (simp add: pre_image_def)
       
   863 apply (rule iffI) 
       
   864  apply (blast intro!: equalityI dest: transM, blast) 
       
   865 done
       
   866 
       
   867 lemma (in M_axioms) vimage_closed [intro,simp]: 
       
   868      "[| M(A); M(r) |] ==> M(r-``A)"
       
   869 by (simp add: vimage_def)
       
   870 
       
   871 
       
   872 subsubsection{*Domain, range and field*}
       
   873 
       
   874 lemma (in M_axioms) domain_abs [simp]: 
       
   875      "[| M(r); M(z) |] ==> is_domain(M,r,z) <-> z = domain(r)"
       
   876 apply (simp add: is_domain_def) 
       
   877 apply (blast intro!: equalityI dest: transM) 
       
   878 done
       
   879 
       
   880 lemma (in M_axioms) domain_closed [intro,simp]: 
       
   881      "M(r) ==> M(domain(r))"
       
   882 apply (simp add: domain_eq_vimage)
       
   883 done
       
   884 
       
   885 lemma (in M_axioms) range_abs [simp]: 
       
   886      "[| M(r); M(z) |] ==> is_range(M,r,z) <-> z = range(r)"
       
   887 apply (simp add: is_range_def)
       
   888 apply (blast intro!: equalityI dest: transM)
       
   889 done
       
   890 
       
   891 lemma (in M_axioms) range_closed [intro,simp]: 
       
   892      "M(r) ==> M(range(r))"
       
   893 apply (simp add: range_eq_image)
       
   894 done
       
   895 
       
   896 lemma (in M_axioms) field_abs [simp]: 
       
   897      "[| M(r); M(z) |] ==> is_field(M,r,z) <-> z = field(r)"
       
   898 by (simp add: domain_closed range_closed is_field_def field_def)
       
   899 
       
   900 lemma (in M_axioms) field_closed [intro,simp]: 
       
   901      "M(r) ==> M(field(r))"
       
   902 by (simp add: domain_closed range_closed Un_closed field_def) 
       
   903 
       
   904 
       
   905 subsubsection{*Relations, functions and application*}
       
   906 
   784 lemma (in M_axioms) relation_abs [simp]: 
   907 lemma (in M_axioms) relation_abs [simp]: 
   785      "M(r) ==> is_relation(M,r) <-> relation(r)"
   908      "M(r) ==> is_relation(M,r) <-> relation(r)"
   786 apply (simp add: is_relation_def relation_def) 
   909 apply (simp add: is_relation_def relation_def) 
   787 apply (blast dest!: bspec dest: pair_components_in_M)+
   910 apply (blast dest!: bspec dest: pair_components_in_M)+
   788 done
   911 done
   794   apply (blast dest: pair_components_in_M)+
   917   apply (blast dest: pair_components_in_M)+
   795 done
   918 done
   796 
   919 
   797 lemma (in M_axioms) apply_closed [intro,simp]: 
   920 lemma (in M_axioms) apply_closed [intro,simp]: 
   798      "[|M(f); M(a)|] ==> M(f`a)"
   921      "[|M(f); M(a)|] ==> M(f`a)"
   799 apply (simp add: apply_def)
   922 by (simp add: apply_def)
   800 done
       
   801 
   923 
   802 lemma (in M_axioms) apply_abs: 
   924 lemma (in M_axioms) apply_abs: 
   803      "[| function(f); M(f); M(y) |] 
   925      "[| function(f); M(f); M(y) |] 
   804       ==> fun_apply(M,f,x,y) <-> x \<in> domain(f) & f`x = y"
   926       ==> fun_apply(M,f,x,y) <-> x \<in> domain(f) & f`x = y"
   805 apply (simp add: fun_apply_def)
   927 apply (simp add: fun_apply_def)
   829 
   951 
   830 lemma (in M_axioms) bijection_abs [simp]: 
   952 lemma (in M_axioms) bijection_abs [simp]: 
   831      "[| M(A); M(B); M(f) |] ==> bijection(M,A,B,f) <-> f \<in> bij(A,B)"
   953      "[| M(A); M(B); M(f) |] ==> bijection(M,A,B,f) <-> f \<in> bij(A,B)"
   832 by (simp add: bijection_def bij_def)
   954 by (simp add: bijection_def bij_def)
   833 
   955 
   834 text{*no longer needed*}
   956 
   835 lemma (in M_axioms) restriction_is_function: 
   957 subsubsection{*Composition of relations*}
   836      "[| restriction(M,f,A,z); function(f); M(f); M(A); M(z) |] 
       
   837       ==> function(z)"
       
   838 apply (rotate_tac 1)
       
   839 apply (simp add: restriction_def ball_iff_equiv) 
       
   840 apply (unfold function_def, blast) 
       
   841 done
       
   842 
       
   843 lemma (in M_axioms) restriction_abs [simp]: 
       
   844      "[| M(f); M(A); M(z) |] 
       
   845       ==> restriction(M,f,A,z) <-> z = restrict(f,A)"
       
   846 apply (simp add: ball_iff_equiv restriction_def restrict_def)
       
   847 apply (blast intro!: equalityI dest: transM) 
       
   848 done
       
   849 
       
   850 
       
   851 lemma (in M_axioms) M_restrict_iff:
       
   852      "M(r) ==> restrict(r,A) = {z \<in> r . \<exists>x\<in>A. \<exists>y[M]. z = \<langle>x, y\<rangle>}"
       
   853 by (simp add: restrict_def, blast dest: transM)
       
   854 
       
   855 lemma (in M_axioms) restrict_closed [intro,simp]: 
       
   856      "[| M(A); M(r) |] ==> M(restrict(r,A))"
       
   857 apply (simp add: M_restrict_iff)
       
   858 apply (insert restrict_separation [of A], simp) 
       
   859 done
       
   860 
   958 
   861 lemma (in M_axioms) M_comp_iff:
   959 lemma (in M_axioms) M_comp_iff:
   862      "[| M(r); M(s) |] 
   960      "[| M(r); M(s) |] 
   863       ==> r O s = 
   961       ==> r O s = 
   864           {xz \<in> domain(s) * range(r).  
   962           {xz \<in> domain(s) * range(r).  
   888 apply (rule M_equalityI)
   986 apply (rule M_equalityI)
   889   apply (simp add: composition_def comp_def)
   987   apply (simp add: composition_def comp_def)
   890   apply (blast del: allE dest: transM)+
   988   apply (blast del: allE dest: transM)+
   891 done
   989 done
   892 
   990 
   893 lemma (in M_axioms) nat_into_M [intro]:
   991 text{*no longer needed*}
   894      "n \<in> nat ==> M(n)"
   992 lemma (in M_axioms) restriction_is_function: 
   895 by (induct n rule: nat_induct, simp_all)
   993      "[| restriction(M,f,A,z); function(f); M(f); M(A); M(z) |] 
   896 
   994       ==> function(z)"
   897 lemma (in M_axioms) nat_case_closed:
   995 apply (rotate_tac 1)
   898   "[|M(k); M(a); \<forall>m[M]. M(b(m))|] ==> M(nat_case(a,b,k))"
   996 apply (simp add: restriction_def ball_iff_equiv) 
   899 apply (case_tac "k=0", simp) 
   997 apply (unfold function_def, blast) 
   900 apply (case_tac "\<exists>m. k = succ(m)", force)
   998 done
   901 apply (simp add: nat_case_def) 
   999 
   902 done
  1000 lemma (in M_axioms) restriction_abs [simp]: 
   903 
  1001      "[| M(f); M(A); M(z) |] 
   904 lemma (in M_axioms) Inl_in_M_iff [iff]:
  1002       ==> restriction(M,f,A,z) <-> z = restrict(f,A)"
   905      "M(Inl(a)) <-> M(a)"
  1003 apply (simp add: ball_iff_equiv restriction_def restrict_def)
   906 by (simp add: Inl_def) 
  1004 apply (blast intro!: equalityI dest: transM) 
   907 
  1005 done
   908 lemma (in M_axioms) Inr_in_M_iff [iff]:
  1006 
   909      "M(Inr(a)) <-> M(a)"
  1007 
   910 by (simp add: Inr_def) 
  1008 lemma (in M_axioms) M_restrict_iff:
       
  1009      "M(r) ==> restrict(r,A) = {z \<in> r . \<exists>x\<in>A. \<exists>y[M]. z = \<langle>x, y\<rangle>}"
       
  1010 by (simp add: restrict_def, blast dest: transM)
       
  1011 
       
  1012 lemma (in M_axioms) restrict_closed [intro,simp]: 
       
  1013      "[| M(A); M(r) |] ==> M(restrict(r,A))"
       
  1014 apply (simp add: M_restrict_iff)
       
  1015 apply (insert restrict_separation [of A], simp) 
       
  1016 done
   911 
  1017 
   912 lemma (in M_axioms) Inter_abs [simp]: 
  1018 lemma (in M_axioms) Inter_abs [simp]: 
   913      "[| M(A); M(z) |] ==> big_inter(M,A,z) <-> z = Inter(A)"
  1019      "[| M(A); M(z) |] ==> big_inter(M,A,z) <-> z = Inter(A)"
   914 apply (simp add: big_inter_def Inter_def) 
  1020 apply (simp add: big_inter_def Inter_def) 
   915 apply (blast intro!: equalityI dest: transM) 
  1021 apply (blast intro!: equalityI dest: transM) 
   923      "[| M(A); M(B) |] ==> M(A Int B)"
  1029      "[| M(A); M(B) |] ==> M(A Int B)"
   924 apply (subgoal_tac "M({A,B})")
  1030 apply (subgoal_tac "M({A,B})")
   925 apply (frule Inter_closed, force+) 
  1031 apply (frule Inter_closed, force+) 
   926 done
  1032 done
   927 
  1033 
   928 subsection{*Functions and function space*}
  1034 subsubsection{*Functions and function space*}
   929 
  1035 
   930 text{*M contains all finite functions*}
  1036 text{*M contains all finite functions*}
   931 lemma (in M_axioms) finite_fun_closed_lemma [rule_format]: 
  1037 lemma (in M_axioms) finite_fun_closed_lemma [rule_format]: 
   932      "[| n \<in> nat; M(A) |] ==> \<forall>f \<in> n -> A. M(f)"
  1038      "[| n \<in> nat; M(A) |] ==> \<forall>f \<in> n -> A. M(f)"
   933 apply (induct_tac n, simp)
  1039 apply (induct_tac n, simp)
   975      "[|n\<in>nat; M(B)|] ==> M(n->B)"
  1081      "[|n\<in>nat; M(B)|] ==> M(n->B)"
   976 apply (induct_tac n, simp)
  1082 apply (induct_tac n, simp)
   977 apply (simp add: funspace_succ nat_into_M) 
  1083 apply (simp add: funspace_succ nat_into_M) 
   978 done
  1084 done
   979 
  1085 
   980 
       
   981 subsection{*Absoluteness for ordinals*}
       
   982 text{*These results constitute Theorem IV 5.1 of Kunen (page 126).*}
       
   983 
       
   984 lemma (in M_axioms) lt_closed:
       
   985      "[| j<i; M(i) |] ==> M(j)" 
       
   986 by (blast dest: ltD intro: transM) 
       
   987 
       
   988 lemma (in M_axioms) transitive_set_abs [simp]: 
       
   989      "M(a) ==> transitive_set(M,a) <-> Transset(a)"
       
   990 by (simp add: transitive_set_def Transset_def)
       
   991 
       
   992 lemma (in M_axioms) ordinal_abs [simp]: 
       
   993      "M(a) ==> ordinal(M,a) <-> Ord(a)"
       
   994 by (simp add: ordinal_def Ord_def)
       
   995 
       
   996 lemma (in M_axioms) limit_ordinal_abs [simp]: 
       
   997      "M(a) ==> limit_ordinal(M,a) <-> Limit(a)"
       
   998 apply (simp add: limit_ordinal_def Ord_0_lt_iff Limit_def) 
       
   999 apply (simp add: lt_def, blast) 
       
  1000 done
       
  1001 
       
  1002 lemma (in M_axioms) successor_ordinal_abs [simp]: 
       
  1003      "M(a) ==> successor_ordinal(M,a) <-> Ord(a) & (\<exists>b. M(b) & a = succ(b))"
       
  1004 apply (simp add: successor_ordinal_def, safe)
       
  1005 apply (drule Ord_cases_disj, auto) 
       
  1006 done
       
  1007 
       
  1008 lemma finite_Ord_is_nat:
       
  1009       "[| Ord(a); ~ Limit(a); \<forall>x\<in>a. ~ Limit(x) |] ==> a \<in> nat"
       
  1010 by (induct a rule: trans_induct3, simp_all)
       
  1011 
       
  1012 lemma naturals_not_limit: "a \<in> nat ==> ~ Limit(a)"
       
  1013 by (induct a rule: nat_induct, auto)
       
  1014 
       
  1015 lemma (in M_axioms) finite_ordinal_abs [simp]: 
       
  1016      "M(a) ==> finite_ordinal(M,a) <-> a \<in> nat"
       
  1017 apply (simp add: finite_ordinal_def)
       
  1018 apply (blast intro: finite_Ord_is_nat intro: nat_into_Ord 
       
  1019              dest: Ord_trans naturals_not_limit)
       
  1020 done
       
  1021 
       
  1022 lemma Limit_non_Limit_implies_nat: "[| Limit(a); \<forall>x\<in>a. ~ Limit(x) |] ==> a = nat"
       
  1023 apply (rule le_anti_sym) 
       
  1024 apply (rule all_lt_imp_le, blast, blast intro: Limit_is_Ord)  
       
  1025  apply (simp add: lt_def)  
       
  1026  apply (blast intro: Ord_in_Ord Ord_trans finite_Ord_is_nat) 
       
  1027 apply (erule nat_le_Limit)
       
  1028 done
       
  1029 
       
  1030 lemma (in M_axioms) omega_abs [simp]: 
       
  1031      "M(a) ==> omega(M,a) <-> a = nat"
       
  1032 apply (simp add: omega_def) 
       
  1033 apply (blast intro: Limit_non_Limit_implies_nat dest: naturals_not_limit)
       
  1034 done
       
  1035 
       
  1036 lemma (in M_axioms) number1_abs [simp]: 
       
  1037      "M(a) ==> number1(M,a) <-> a = 1"
       
  1038 by (simp add: number1_def) 
       
  1039 
       
  1040 lemma (in M_axioms) number1_abs [simp]: 
       
  1041      "M(a) ==> number2(M,a) <-> a = succ(1)"
       
  1042 by (simp add: number2_def) 
       
  1043 
       
  1044 lemma (in M_axioms) number3_abs [simp]: 
       
  1045      "M(a) ==> number3(M,a) <-> a = succ(succ(1))"
       
  1046 by (simp add: number3_def) 
       
  1047 
       
  1048 text{*Kunen continued to 20...*}
       
  1049 
       
  1050 (*Could not get this to work.  The \<lambda>x\<in>nat is essential because everything 
       
  1051   but the recursion variable must stay unchanged.  But then the recursion
       
  1052   equations only hold for x\<in>nat (or in some other set) and not for the 
       
  1053   whole of the class M.
       
  1054   consts
       
  1055     natnumber_aux :: "[i=>o,i] => i"
       
  1056 
       
  1057   primrec
       
  1058       "natnumber_aux(M,0) = (\<lambda>x\<in>nat. if empty(M,x) then 1 else 0)"
       
  1059       "natnumber_aux(M,succ(n)) = 
       
  1060 	   (\<lambda>x\<in>nat. if (\<exists>y. M(y) & natnumber_aux(M,n)`y=1 & successor(M,y,x)) 
       
  1061 		     then 1 else 0)"
       
  1062 
       
  1063   constdefs
       
  1064     natnumber :: "[i=>o,i,i] => o"
       
  1065       "natnumber(M,n,x) == natnumber_aux(M,n)`x = 1"
       
  1066 
       
  1067   lemma (in M_axioms) [simp]: 
       
  1068        "natnumber(M,0,x) == x=0"
       
  1069 *)
       
  1070 
       
  1071 
       
  1072 end
  1086 end