185 apply (frule_tac y="<y,z>" in transM, assumption ) |
185 apply (frule_tac y="<y,z>" in transM, assumption ) |
186 apply (rotate_tac -1) |
186 apply (rotate_tac -1) |
187 apply (clarsimp simp add: vimage_singleton_iff is_recfun_type [THEN apply_iff] |
187 apply (clarsimp simp add: vimage_singleton_iff is_recfun_type [THEN apply_iff] |
188 apply_recfun is_recfun_cut) |
188 apply_recfun is_recfun_cut) |
189 txt{*Opposite inclusion: something in f, show in Y*} |
189 txt{*Opposite inclusion: something in f, show in Y*} |
190 apply (frule_tac y="<y,z>" in transM, assumption, simp) |
190 apply (frule_tac y="<y,z>" in transM, assumption) |
191 apply (rule_tac x=y in bexI) |
191 apply (simp add: vimage_singleton_iff) |
192 prefer 2 apply (blast dest: transD) |
192 apply (rule conjI) |
193 apply (rule_tac x=z in rexI) |
193 apply (blast dest: transD) |
194 apply (rule_tac x="restrict(f, r -`` {y})" in rexI) |
194 apply (rule_tac x="restrict(f, r -`` {y})" in rexI) |
195 apply (simp_all add: is_recfun_restrict |
195 apply (simp_all add: is_recfun_restrict |
196 apply_recfun is_recfun_type [THEN apply_iff]) |
196 apply_recfun is_recfun_type [THEN apply_iff]) |
197 done |
197 done |
198 |
198 |
199 text{*For typical applications of Replacement for recursive definitions*} |
199 text{*For typical applications of Replacement for recursive definitions*} |
200 lemma (in M_axioms) univalent_is_recfun: |
200 lemma (in M_axioms) univalent_is_recfun: |
201 "[|wellfounded(M,r); trans(r); M(r)|] |
201 "[|wellfounded(M,r); trans(r); M(r)|] |
202 ==> univalent (M, A, \<lambda>x p. |
202 ==> univalent (M, A, \<lambda>x p. |
203 \<exists>y[M]. \<exists>f[M]. p = \<langle>x, y\<rangle> & is_recfun(r,x,H,f) & y = H(x,f))" |
203 \<exists>y[M]. p = \<langle>x,y\<rangle> & (\<exists>f[M]. is_recfun(r,x,H,f) & y = H(x,f)))" |
204 apply (simp add: univalent_def) |
204 apply (simp add: univalent_def) |
205 apply (blast dest: is_recfun_functional) |
205 apply (blast dest: is_recfun_functional) |
206 done |
206 done |
207 |
207 |
208 text{*Proof of the inductive step for @{text exists_is_recfun}, since |
208 text{*Proof of the inductive step for @{text exists_is_recfun}, since |
226 txt{*The big iff-formula defining @{term Y} is now redundant*} |
226 txt{*The big iff-formula defining @{term Y} is now redundant*} |
227 apply safe |
227 apply safe |
228 apply (simp add: vimage_singleton_iff restrict_Y_lemma [of r H]) |
228 apply (simp add: vimage_singleton_iff restrict_Y_lemma [of r H]) |
229 txt{*one more case*} |
229 txt{*one more case*} |
230 apply (simp (no_asm_simp) add: Bex_def vimage_singleton_iff) |
230 apply (simp (no_asm_simp) add: Bex_def vimage_singleton_iff) |
231 apply (rename_tac x) |
|
232 apply (rule_tac x=x in exI, simp) |
|
233 apply (rule_tac x="H(x, restrict(Y, r -`` {x}))" in rexI) |
|
234 apply (drule_tac x1=x in spec [THEN mp], assumption, clarify) |
231 apply (drule_tac x1=x in spec [THEN mp], assumption, clarify) |
235 apply (rename_tac f) |
232 apply (rename_tac f) |
236 apply (rule_tac x=f in rexI) |
233 apply (rule_tac x=f in rexI) |
237 apply (simp add: restrict_Y_lemma [of r H], simp_all) |
234 apply (simp_all add: restrict_Y_lemma [of r H]) |
238 done |
235 done |
239 |
236 |
240 text{*Relativized version, when we have the (currently weaker) premise |
237 text{*Relativized version, when we have the (currently weaker) premise |
241 @{term "wellfounded(M,r)"}*} |
238 @{term "wellfounded(M,r)"}*} |
242 lemma (in M_axioms) wellfounded_exists_is_recfun: |
239 lemma (in M_axioms) wellfounded_exists_is_recfun: |
335 |
332 |
336 locale M_ord_arith = M_axioms + |
333 locale M_ord_arith = M_axioms + |
337 assumes oadd_strong_replacement: |
334 assumes oadd_strong_replacement: |
338 "[| M(i); M(j) |] ==> |
335 "[| M(i); M(j) |] ==> |
339 strong_replacement(M, |
336 strong_replacement(M, |
340 \<lambda>x z. \<exists>y[M]. \<exists>f[M]. \<exists>fx[M]. pair(M,x,y,z) & is_oadd_fun(M,i,j,x,f) & |
337 \<lambda>x z. \<exists>y[M]. pair(M,x,y,z) & |
341 image(M,f,x,fx) & y = i Un fx)" |
338 (\<exists>f[M]. \<exists>fx[M]. is_oadd_fun(M,i,j,x,f) & |
|
339 image(M,f,x,fx) & y = i Un fx))" |
|
340 |
342 and omult_strong_replacement': |
341 and omult_strong_replacement': |
343 "[| M(i); M(j) |] ==> |
342 "[| M(i); M(j) |] ==> |
344 strong_replacement(M, \<lambda>x z. \<exists>y[M]. \<exists>g[M]. |
343 strong_replacement(M, |
345 z = <x,y> & |
344 \<lambda>x z. \<exists>y[M]. z = <x,y> & |
346 is_recfun(Memrel(succ(j)),x,%x g. THE z. omult_eqns(i,x,g,z),g) & |
345 (\<exists>g[M]. is_recfun(Memrel(succ(j)),x,%x g. THE z. omult_eqns(i,x,g,z),g) & |
347 y = (THE z. omult_eqns(i, x, g, z)))" |
346 y = (THE z. omult_eqns(i, x, g, z))))" |
348 |
347 |
349 |
348 |
350 |
349 |
351 text{*is_oadd_fun: Relating the pure "language of set theory" to Isabelle/ZF*} |
350 text{*is_oadd_fun: Relating the pure "language of set theory" to Isabelle/ZF*} |
352 lemma (in M_ord_arith) is_oadd_fun_iff: |
351 lemma (in M_ord_arith) is_oadd_fun_iff: |
363 done |
362 done |
364 |
363 |
365 |
364 |
366 lemma (in M_ord_arith) oadd_strong_replacement': |
365 lemma (in M_ord_arith) oadd_strong_replacement': |
367 "[| M(i); M(j) |] ==> |
366 "[| M(i); M(j) |] ==> |
368 strong_replacement(M, \<lambda>x z. \<exists>y[M]. \<exists>g[M]. |
367 strong_replacement(M, |
369 z = <x,y> & |
368 \<lambda>x z. \<exists>y[M]. z = <x,y> & |
370 is_recfun(Memrel(succ(j)),x,%x g. i Un g``x,g) & |
369 (\<exists>g[M]. is_recfun(Memrel(succ(j)),x,%x g. i Un g``x,g) & |
371 y = i Un g``x)" |
370 y = i Un g``x))" |
372 apply (insert oadd_strong_replacement [of i j]) |
371 apply (insert oadd_strong_replacement [of i j]) |
373 apply (simp add: Memrel_closed Un_closed image_closed is_oadd_fun_def |
372 apply (simp add: Memrel_closed Un_closed image_closed is_oadd_fun_def |
374 is_recfun_iff_M) |
373 is_recfun_iff_M) |
375 done |
374 done |
376 |
375 |