121 "image(M,r,A,z) == |
121 "image(M,r,A,z) == |
122 \<forall>y[M]. y \<in> z \<longleftrightarrow> (\<exists>w[M]. w\<in>r & (\<exists>x[M]. x\<in>A & pair(M,x,y,w)))" |
122 \<forall>y[M]. y \<in> z \<longleftrightarrow> (\<exists>w[M]. w\<in>r & (\<exists>x[M]. x\<in>A & pair(M,x,y,w)))" |
123 |
123 |
124 definition |
124 definition |
125 is_range :: "[i=>o,i,i] => o" where |
125 is_range :: "[i=>o,i,i] => o" where |
126 --\<open>the cleaner |
126 \<comment>\<open>the cleaner |
127 @{term "\<exists>r'[M]. is_converse(M,r,r') & is_domain(M,r',z)"} |
127 @{term "\<exists>r'[M]. is_converse(M,r,r') & is_domain(M,r',z)"} |
128 unfortunately needs an instance of separation in order to prove |
128 unfortunately needs an instance of separation in order to prove |
129 @{term "M(converse(r))"}.\<close> |
129 @{term "M(converse(r))"}.\<close> |
130 "is_range(M,r,z) == |
130 "is_range(M,r,z) == |
131 \<forall>y[M]. y \<in> z \<longleftrightarrow> (\<exists>w[M]. w\<in>r & (\<exists>x[M]. pair(M,x,y,w)))" |
131 \<forall>y[M]. y \<in> z \<longleftrightarrow> (\<exists>w[M]. w\<in>r & (\<exists>x[M]. pair(M,x,y,w)))" |
198 transitive_set :: "[i=>o,i] => o" where |
198 transitive_set :: "[i=>o,i] => o" where |
199 "transitive_set(M,a) == \<forall>x[M]. x\<in>a \<longrightarrow> subset(M,x,a)" |
199 "transitive_set(M,a) == \<forall>x[M]. x\<in>a \<longrightarrow> subset(M,x,a)" |
200 |
200 |
201 definition |
201 definition |
202 ordinal :: "[i=>o,i] => o" where |
202 ordinal :: "[i=>o,i] => o" where |
203 --\<open>an ordinal is a transitive set of transitive sets\<close> |
203 \<comment>\<open>an ordinal is a transitive set of transitive sets\<close> |
204 "ordinal(M,a) == transitive_set(M,a) & (\<forall>x[M]. x\<in>a \<longrightarrow> transitive_set(M,x))" |
204 "ordinal(M,a) == transitive_set(M,a) & (\<forall>x[M]. x\<in>a \<longrightarrow> transitive_set(M,x))" |
205 |
205 |
206 definition |
206 definition |
207 limit_ordinal :: "[i=>o,i] => o" where |
207 limit_ordinal :: "[i=>o,i] => o" where |
208 --\<open>a limit ordinal is a non-empty, successor-closed ordinal\<close> |
208 \<comment>\<open>a limit ordinal is a non-empty, successor-closed ordinal\<close> |
209 "limit_ordinal(M,a) == |
209 "limit_ordinal(M,a) == |
210 ordinal(M,a) & ~ empty(M,a) & |
210 ordinal(M,a) & ~ empty(M,a) & |
211 (\<forall>x[M]. x\<in>a \<longrightarrow> (\<exists>y[M]. y\<in>a & successor(M,x,y)))" |
211 (\<forall>x[M]. x\<in>a \<longrightarrow> (\<exists>y[M]. y\<in>a & successor(M,x,y)))" |
212 |
212 |
213 definition |
213 definition |
214 successor_ordinal :: "[i=>o,i] => o" where |
214 successor_ordinal :: "[i=>o,i] => o" where |
215 --\<open>a successor ordinal is any ordinal that is neither empty nor limit\<close> |
215 \<comment>\<open>a successor ordinal is any ordinal that is neither empty nor limit\<close> |
216 "successor_ordinal(M,a) == |
216 "successor_ordinal(M,a) == |
217 ordinal(M,a) & ~ empty(M,a) & ~ limit_ordinal(M,a)" |
217 ordinal(M,a) & ~ empty(M,a) & ~ limit_ordinal(M,a)" |
218 |
218 |
219 definition |
219 definition |
220 finite_ordinal :: "[i=>o,i] => o" where |
220 finite_ordinal :: "[i=>o,i] => o" where |
221 --\<open>an ordinal is finite if neither it nor any of its elements are limit\<close> |
221 \<comment>\<open>an ordinal is finite if neither it nor any of its elements are limit\<close> |
222 "finite_ordinal(M,a) == |
222 "finite_ordinal(M,a) == |
223 ordinal(M,a) & ~ limit_ordinal(M,a) & |
223 ordinal(M,a) & ~ limit_ordinal(M,a) & |
224 (\<forall>x[M]. x\<in>a \<longrightarrow> ~ limit_ordinal(M,x))" |
224 (\<forall>x[M]. x\<in>a \<longrightarrow> ~ limit_ordinal(M,x))" |
225 |
225 |
226 definition |
226 definition |
227 omega :: "[i=>o,i] => o" where |
227 omega :: "[i=>o,i] => o" where |
228 --\<open>omega is a limit ordinal none of whose elements are limit\<close> |
228 \<comment>\<open>omega is a limit ordinal none of whose elements are limit\<close> |
229 "omega(M,a) == limit_ordinal(M,a) & (\<forall>x[M]. x\<in>a \<longrightarrow> ~ limit_ordinal(M,x))" |
229 "omega(M,a) == limit_ordinal(M,a) & (\<forall>x[M]. x\<in>a \<longrightarrow> ~ limit_ordinal(M,x))" |
230 |
230 |
231 definition |
231 definition |
232 is_quasinat :: "[i=>o,i] => o" where |
232 is_quasinat :: "[i=>o,i] => o" where |
233 "is_quasinat(M,z) == empty(M,z) | (\<exists>m[M]. successor(M,m,z))" |
233 "is_quasinat(M,z) == empty(M,z) | (\<exists>m[M]. successor(M,m,z))" |
243 relation1 :: "[i=>o, [i,i]=>o, i=>i] => o" where |
243 relation1 :: "[i=>o, [i,i]=>o, i=>i] => o" where |
244 "relation1(M,is_f,f) == \<forall>x[M]. \<forall>y[M]. is_f(x,y) \<longleftrightarrow> y = f(x)" |
244 "relation1(M,is_f,f) == \<forall>x[M]. \<forall>y[M]. is_f(x,y) \<longleftrightarrow> y = f(x)" |
245 |
245 |
246 definition |
246 definition |
247 Relation1 :: "[i=>o, i, [i,i]=>o, i=>i] => o" where |
247 Relation1 :: "[i=>o, i, [i,i]=>o, i=>i] => o" where |
248 --\<open>as above, but typed\<close> |
248 \<comment>\<open>as above, but typed\<close> |
249 "Relation1(M,A,is_f,f) == |
249 "Relation1(M,A,is_f,f) == |
250 \<forall>x[M]. \<forall>y[M]. x\<in>A \<longrightarrow> is_f(x,y) \<longleftrightarrow> y = f(x)" |
250 \<forall>x[M]. \<forall>y[M]. x\<in>A \<longrightarrow> is_f(x,y) \<longleftrightarrow> y = f(x)" |
251 |
251 |
252 definition |
252 definition |
253 relation2 :: "[i=>o, [i,i,i]=>o, [i,i]=>i] => o" where |
253 relation2 :: "[i=>o, [i,i,i]=>o, [i,i]=>i] => o" where |
466 "r -`` A = {x \<in> \<Union>(\<Union>(r)). \<exists>p\<in>r. \<exists>y\<in>A. p=<x,y>}" |
466 "r -`` A = {x \<in> \<Union>(\<Union>(r)). \<exists>p\<in>r. \<exists>y\<in>A. p=<x,y>}" |
467 apply (rule equalityI, auto) |
467 apply (rule equalityI, auto) |
468 apply (simp add: Pair_def, blast) |
468 apply (simp add: Pair_def, blast) |
469 done |
469 done |
470 |
470 |
471 text\<open>These two lemmas lets us prove @{text domain_closed} and |
471 text\<open>These two lemmas lets us prove \<open>domain_closed\<close> and |
472 @{text range_closed} without new instances of separation\<close> |
472 \<open>range_closed\<close> without new instances of separation\<close> |
473 |
473 |
474 lemma domain_eq_vimage: "domain(r) = r -`` Union(Union(r))" |
474 lemma domain_eq_vimage: "domain(r) = r -`` Union(Union(r))" |
475 apply (rule equalityI, auto) |
475 apply (rule equalityI, auto) |
476 apply (rule vimageI, assumption) |
476 apply (rule vimageI, assumption) |
477 apply (simp add: Pair_def, blast) |
477 apply (simp add: Pair_def, blast) |
513 pred_set :: "[i=>o,i,i,i,i] => o" where |
513 pred_set :: "[i=>o,i,i,i,i] => o" where |
514 "pred_set(M,A,x,r,B) == |
514 "pred_set(M,A,x,r,B) == |
515 \<forall>y[M]. y \<in> B \<longleftrightarrow> (\<exists>p[M]. p\<in>r & y \<in> A & pair(M,y,x,p))" |
515 \<forall>y[M]. y \<in> B \<longleftrightarrow> (\<exists>p[M]. p\<in>r & y \<in> A & pair(M,y,x,p))" |
516 |
516 |
517 definition |
517 definition |
518 membership :: "[i=>o,i,i] => o" where --\<open>membership relation\<close> |
518 membership :: "[i=>o,i,i] => o" where \<comment>\<open>membership relation\<close> |
519 "membership(M,A,r) == |
519 "membership(M,A,r) == |
520 \<forall>p[M]. p \<in> r \<longleftrightarrow> (\<exists>x[M]. x\<in>A & (\<exists>y[M]. y\<in>A & x\<in>y & pair(M,x,y,p)))" |
520 \<forall>p[M]. p \<in> r \<longleftrightarrow> (\<exists>x[M]. x\<in>A & (\<exists>y[M]. y\<in>A & x\<in>y & pair(M,x,y,p)))" |
521 |
521 |
522 |
522 |
523 subsection\<open>Introducing a Transitive Class Model\<close> |
523 subsection\<open>Introducing a Transitive Class Model\<close> |
532 and power_ax: "power_ax(M)" |
532 and power_ax: "power_ax(M)" |
533 and replacement: "replacement(M,P)" |
533 and replacement: "replacement(M,P)" |
534 and M_nat [iff]: "M(nat)" (*i.e. the axiom of infinity*) |
534 and M_nat [iff]: "M(nat)" (*i.e. the axiom of infinity*) |
535 |
535 |
536 |
536 |
537 text\<open>Automatically discovers the proof using @{text transM}, @{text nat_0I} |
537 text\<open>Automatically discovers the proof using \<open>transM\<close>, \<open>nat_0I\<close> |
538 and @{text M_nat}.\<close> |
538 and \<open>M_nat\<close>.\<close> |
539 lemma (in M_trivial) nonempty [simp]: "M(0)" |
539 lemma (in M_trivial) nonempty [simp]: "M(0)" |
540 by (blast intro: transM) |
540 by (blast intro: transM) |
541 |
541 |
542 lemma (in M_trivial) rall_abs [simp]: |
542 lemma (in M_trivial) rall_abs [simp]: |
543 "M(A) ==> (\<forall>x[M]. x\<in>A \<longrightarrow> P(x)) \<longleftrightarrow> (\<forall>x\<in>A. P(x))" |
543 "M(A) ==> (\<forall>x[M]. x\<in>A \<longrightarrow> P(x)) \<longleftrightarrow> (\<forall>x\<in>A. P(x))" |
779 lemma (in M_trivial) lam_closed: |
779 lemma (in M_trivial) lam_closed: |
780 "[| strong_replacement(M, \<lambda>x y. y = <x,b(x)>); M(A); \<forall>x\<in>A. M(b(x)) |] |
780 "[| strong_replacement(M, \<lambda>x y. y = <x,b(x)>); M(A); \<forall>x\<in>A. M(b(x)) |] |
781 ==> M(\<lambda>x\<in>A. b(x))" |
781 ==> M(\<lambda>x\<in>A. b(x))" |
782 by (simp add: lam_def, blast intro: RepFun_closed dest: transM) |
782 by (simp add: lam_def, blast intro: RepFun_closed dest: transM) |
783 |
783 |
784 text\<open>Better than @{text lam_closed}: has the formula @{term "x\<in>A"}\<close> |
784 text\<open>Better than \<open>lam_closed\<close>: has the formula @{term "x\<in>A"}\<close> |
785 lemma (in M_trivial) lam_closed2: |
785 lemma (in M_trivial) lam_closed2: |
786 "[|strong_replacement(M, \<lambda>x y. x\<in>A & y = \<langle>x, b(x)\<rangle>); |
786 "[|strong_replacement(M, \<lambda>x y. x\<in>A & y = \<langle>x, b(x)\<rangle>); |
787 M(A); \<forall>m[M]. m\<in>A \<longrightarrow> M(b(m))|] ==> M(Lambda(A,b))" |
787 M(A); \<forall>m[M]. m\<in>A \<longrightarrow> M(b(m))|] ==> M(Lambda(A,b))" |
788 apply (simp add: lam_def) |
788 apply (simp add: lam_def) |
789 apply (blast intro: RepFun_closed2 dest: transM) |
789 apply (blast intro: RepFun_closed2 dest: transM) |
814 apply (simp add: image_def) |
814 apply (simp add: image_def) |
815 apply (rule iffI) |
815 apply (rule iffI) |
816 apply (blast intro!: equalityI dest: transM, blast) |
816 apply (blast intro!: equalityI dest: transM, blast) |
817 done |
817 done |
818 |
818 |
819 text\<open>What about @{text Pow_abs}? Powerset is NOT absolute! |
819 text\<open>What about \<open>Pow_abs\<close>? Powerset is NOT absolute! |
820 This result is one direction of absoluteness.\<close> |
820 This result is one direction of absoluteness.\<close> |
821 |
821 |
822 lemma (in M_trivial) powerset_Pow: |
822 lemma (in M_trivial) powerset_Pow: |
823 "powerset(M, x, Pow(x))" |
823 "powerset(M, x, Pow(x))" |
824 by (simp add: powerset_def) |
824 by (simp add: powerset_def) |
825 |
825 |
826 text\<open>But we can't prove that the powerset in @{text M} includes the |
826 text\<open>But we can't prove that the powerset in \<open>M\<close> includes the |
827 real powerset.\<close> |
827 real powerset.\<close> |
828 lemma (in M_trivial) powerset_imp_subset_Pow: |
828 lemma (in M_trivial) powerset_imp_subset_Pow: |
829 "[| powerset(M,x,y); M(y) |] ==> y \<subseteq> Pow(x)" |
829 "[| powerset(M,x,y); M(y) |] ==> y \<subseteq> Pow(x)" |
830 apply (simp add: powerset_def) |
830 apply (simp add: powerset_def) |
831 apply (blast dest: transM) |
831 apply (blast dest: transM) |
990 "M(n) ==> |
990 "M(n) ==> |
991 strong_replacement(M, \<lambda>p z. \<exists>f[M]. \<exists>b[M]. \<exists>nb[M]. \<exists>cnbf[M]. |
991 strong_replacement(M, \<lambda>p z. \<exists>f[M]. \<exists>b[M]. \<exists>nb[M]. \<exists>cnbf[M]. |
992 pair(M,f,b,p) & pair(M,n,b,nb) & is_cons(M,nb,f,cnbf) & |
992 pair(M,f,b,p) & pair(M,n,b,nb) & is_cons(M,nb,f,cnbf) & |
993 upair(M,cnbf,cnbf,z))" |
993 upair(M,cnbf,cnbf,z))" |
994 and is_recfun_separation: |
994 and is_recfun_separation: |
995 --\<open>for well-founded recursion: used to prove @{text is_recfun_equal}\<close> |
995 \<comment>\<open>for well-founded recursion: used to prove \<open>is_recfun_equal\<close>\<close> |
996 "[| M(r); M(f); M(g); M(a); M(b) |] |
996 "[| M(r); M(f); M(g); M(a); M(b) |] |
997 ==> separation(M, |
997 ==> separation(M, |
998 \<lambda>x. \<exists>xa[M]. \<exists>xb[M]. |
998 \<lambda>x. \<exists>xa[M]. \<exists>xb[M]. |
999 pair(M,x,a,xa) & xa \<in> r & pair(M,x,b,xb) & xb \<in> r & |
999 pair(M,x,a,xa) & xa \<in> r & pair(M,x,b,xb) & xb \<in> r & |
1000 (\<exists>fx[M]. \<exists>gx[M]. fun_apply(M,f,x,fx) & fun_apply(M,g,x,gx) & |
1000 (\<exists>fx[M]. \<exists>gx[M]. fun_apply(M,f,x,fx) & fun_apply(M,g,x,gx) & |
1426 |
1426 |
1427 subsection\<open>Relativization and Absoluteness for List Operators\<close> |
1427 subsection\<open>Relativization and Absoluteness for List Operators\<close> |
1428 |
1428 |
1429 definition |
1429 definition |
1430 is_Nil :: "[i=>o, i] => o" where |
1430 is_Nil :: "[i=>o, i] => o" where |
1431 --\<open>because @{prop "[] \<equiv> Inl(0)"}\<close> |
1431 \<comment>\<open>because @{prop "[] \<equiv> Inl(0)"}\<close> |
1432 "is_Nil(M,xs) == \<exists>zero[M]. empty(M,zero) & is_Inl(M,zero,xs)" |
1432 "is_Nil(M,xs) == \<exists>zero[M]. empty(M,zero) & is_Inl(M,zero,xs)" |
1433 |
1433 |
1434 definition |
1434 definition |
1435 is_Cons :: "[i=>o,i,i,i] => o" where |
1435 is_Cons :: "[i=>o,i,i,i] => o" where |
1436 --\<open>because @{prop "Cons(a, l) \<equiv> Inr(\<langle>a,l\<rangle>)"}\<close> |
1436 \<comment>\<open>because @{prop "Cons(a, l) \<equiv> Inr(\<langle>a,l\<rangle>)"}\<close> |
1437 "is_Cons(M,a,l,Z) == \<exists>p[M]. pair(M,a,l,p) & is_Inr(M,p,Z)" |
1437 "is_Cons(M,a,l,Z) == \<exists>p[M]. pair(M,a,l,p) & is_Inr(M,p,Z)" |
1438 |
1438 |
1439 |
1439 |
1440 lemma (in M_trivial) Nil_in_M [intro,simp]: "M(Nil)" |
1440 lemma (in M_trivial) Nil_in_M [intro,simp]: "M(Nil)" |
1441 by (simp add: Nil_def) |
1441 by (simp add: Nil_def) |
1459 is_quasilist :: "[i=>o,i] => o" where |
1459 is_quasilist :: "[i=>o,i] => o" where |
1460 "is_quasilist(M,z) == is_Nil(M,z) | (\<exists>x[M]. \<exists>l[M]. is_Cons(M,x,l,z))" |
1460 "is_quasilist(M,z) == is_Nil(M,z) | (\<exists>x[M]. \<exists>l[M]. is_Cons(M,x,l,z))" |
1461 |
1461 |
1462 definition |
1462 definition |
1463 list_case' :: "[i, [i,i]=>i, i] => i" where |
1463 list_case' :: "[i, [i,i]=>i, i] => i" where |
1464 --\<open>A version of @{term list_case} that's always defined.\<close> |
1464 \<comment>\<open>A version of @{term list_case} that's always defined.\<close> |
1465 "list_case'(a,b,xs) == |
1465 "list_case'(a,b,xs) == |
1466 if quasilist(xs) then list_case(a,b,xs) else 0" |
1466 if quasilist(xs) then list_case(a,b,xs) else 0" |
1467 |
1467 |
1468 definition |
1468 definition |
1469 is_list_case :: "[i=>o, i, [i,i,i]=>o, i, i] => o" where |
1469 is_list_case :: "[i=>o, i, [i,i,i]=>o, i, i] => o" where |
1470 --\<open>Returns 0 for non-lists\<close> |
1470 \<comment>\<open>Returns 0 for non-lists\<close> |
1471 "is_list_case(M, a, is_b, xs, z) == |
1471 "is_list_case(M, a, is_b, xs, z) == |
1472 (is_Nil(M,xs) \<longrightarrow> z=a) & |
1472 (is_Nil(M,xs) \<longrightarrow> z=a) & |
1473 (\<forall>x[M]. \<forall>l[M]. is_Cons(M,x,l,xs) \<longrightarrow> is_b(x,l,z)) & |
1473 (\<forall>x[M]. \<forall>l[M]. is_Cons(M,x,l,xs) \<longrightarrow> is_b(x,l,z)) & |
1474 (is_quasilist(M,xs) | empty(M,z))" |
1474 (is_quasilist(M,xs) | empty(M,z))" |
1475 |
1475 |
1476 definition |
1476 definition |
1477 hd' :: "i => i" where |
1477 hd' :: "i => i" where |
1478 --\<open>A version of @{term hd} that's always defined.\<close> |
1478 \<comment>\<open>A version of @{term hd} that's always defined.\<close> |
1479 "hd'(xs) == if quasilist(xs) then hd(xs) else 0" |
1479 "hd'(xs) == if quasilist(xs) then hd(xs) else 0" |
1480 |
1480 |
1481 definition |
1481 definition |
1482 tl' :: "i => i" where |
1482 tl' :: "i => i" where |
1483 --\<open>A version of @{term tl} that's always defined.\<close> |
1483 \<comment>\<open>A version of @{term tl} that's always defined.\<close> |
1484 "tl'(xs) == if quasilist(xs) then tl(xs) else 0" |
1484 "tl'(xs) == if quasilist(xs) then tl(xs) else 0" |
1485 |
1485 |
1486 definition |
1486 definition |
1487 is_hd :: "[i=>o,i,i] => o" where |
1487 is_hd :: "[i=>o,i,i] => o" where |
1488 --\<open>@{term "hd([]) = 0"} no constraints if not a list. |
1488 \<comment>\<open>@{term "hd([]) = 0"} no constraints if not a list. |
1489 Avoiding implication prevents the simplifier's looping.\<close> |
1489 Avoiding implication prevents the simplifier's looping.\<close> |
1490 "is_hd(M,xs,H) == |
1490 "is_hd(M,xs,H) == |
1491 (is_Nil(M,xs) \<longrightarrow> empty(M,H)) & |
1491 (is_Nil(M,xs) \<longrightarrow> empty(M,H)) & |
1492 (\<forall>x[M]. \<forall>l[M]. ~ is_Cons(M,x,l,xs) | H=x) & |
1492 (\<forall>x[M]. \<forall>l[M]. ~ is_Cons(M,x,l,xs) | H=x) & |
1493 (is_quasilist(M,xs) | empty(M,H))" |
1493 (is_quasilist(M,xs) | empty(M,H))" |
1494 |
1494 |
1495 definition |
1495 definition |
1496 is_tl :: "[i=>o,i,i] => o" where |
1496 is_tl :: "[i=>o,i,i] => o" where |
1497 --\<open>@{term "tl([]) = []"}; see comments about @{term is_hd}\<close> |
1497 \<comment>\<open>@{term "tl([]) = []"}; see comments about @{term is_hd}\<close> |
1498 "is_tl(M,xs,T) == |
1498 "is_tl(M,xs,T) == |
1499 (is_Nil(M,xs) \<longrightarrow> T=xs) & |
1499 (is_Nil(M,xs) \<longrightarrow> T=xs) & |
1500 (\<forall>x[M]. \<forall>l[M]. ~ is_Cons(M,x,l,xs) | T=l) & |
1500 (\<forall>x[M]. \<forall>l[M]. ~ is_Cons(M,x,l,xs) | T=l) & |
1501 (is_quasilist(M,xs) | empty(M,T))" |
1501 (is_quasilist(M,xs) | empty(M,T))" |
1502 |
1502 |