372 by (forward_tac [single_fun RS fun_disjoint_Un] 1); |
372 by (forward_tac [single_fun RS fun_disjoint_Un] 1); |
373 by (asm_full_simp_tac (FOL_ss addsimps [cons_eq]) 2); |
373 by (asm_full_simp_tac (FOL_ss addsimps [cons_eq]) 2); |
374 by (fast_tac eq_cs 1); |
374 by (fast_tac eq_cs 1); |
375 val fun_extend = result(); |
375 val fun_extend = result(); |
376 |
376 |
|
377 goal ZF.thy |
|
378 "!!f A B. [| f: A->B; c~:A; b: B |] ==> cons(<c,b>,f) : cons(c,A) -> B"; |
|
379 by (fast_tac (ZF_cs addEs [fun_extend RS fun_weaken_type]) 1); |
|
380 val fun_extend3 = result(); |
|
381 |
377 goal ZF.thy "!!f A B. [| f: A->B; a:A; c~:A |] ==> cons(<c,b>,f)`a = f`a"; |
382 goal ZF.thy "!!f A B. [| f: A->B; a:A; c~:A |] ==> cons(<c,b>,f)`a = f`a"; |
378 by (rtac (apply_Pair RS consI2 RS apply_equality) 1); |
383 by (rtac (apply_Pair RS consI2 RS apply_equality) 1); |
379 by (rtac fun_extend 3); |
384 by (rtac fun_extend 3); |
380 by (REPEAT (assume_tac 1)); |
385 by (REPEAT (assume_tac 1)); |
381 val fun_extend_apply1 = result(); |
386 val fun_extend_apply1 = result(); |
384 by (rtac (consI1 RS apply_equality) 1); |
389 by (rtac (consI1 RS apply_equality) 1); |
385 by (rtac fun_extend 1); |
390 by (rtac fun_extend 1); |
386 by (REPEAT (assume_tac 1)); |
391 by (REPEAT (assume_tac 1)); |
387 val fun_extend_apply2 = result(); |
392 val fun_extend_apply2 = result(); |
388 |
393 |
|
394 (*For Finite.ML. Inclusion of right into left is easy*) |
389 goal ZF.thy |
395 goal ZF.thy |
390 "!!c. c ~: A ==> cons(c,A) -> B = (UN f: A->B. UN b:B. {cons(<c,b>, f)})"; |
396 "!!c. c ~: A ==> cons(c,A) -> B = (UN f: A->B. UN b:B. {cons(<c,b>, f)})"; |
391 by (safe_tac eq_cs); |
397 by (safe_tac (eq_cs addSEs [fun_extend3])); |
392 (*Inclusion of right into left is easy*) |
|
393 by (fast_tac (ZF_cs addEs [fun_extend RS fun_weaken_type]) 2); |
|
394 (*Inclusion of left into right*) |
398 (*Inclusion of left into right*) |
395 by (subgoal_tac "restrict(x, A) : A -> B" 1); |
399 by (subgoal_tac "restrict(x, A) : A -> B" 1); |
396 by (fast_tac (ZF_cs addEs [restrict_type2]) 2); |
400 by (fast_tac (ZF_cs addEs [restrict_type2]) 2); |
397 by (rtac UN_I 1 THEN assume_tac 1); |
401 by (rtac UN_I 1 THEN assume_tac 1); |
398 by (rtac UN_I 1 THEN fast_tac (ZF_cs addEs [apply_type]) 1); |
402 by (rtac UN_I 1 THEN fast_tac (ZF_cs addEs [apply_type]) 1); |
399 by (subgoal_tac "x = cons(<c, x ` c>, restrict(x, A))" 1); |
403 by (simp_tac (FOL_ss addsimps cons_iff::mem_simps) 1); |
400 by (fast_tac ZF_cs 1); |
|
401 (*Proving the lemma*) |
|
402 by (resolve_tac [fun_extension] 1 THEN REPEAT (ares_tac [fun_extend] 1)); |
404 by (resolve_tac [fun_extension] 1 THEN REPEAT (ares_tac [fun_extend] 1)); |
403 by (etac consE 1); |
405 by (etac consE 1); |
404 by (ALLGOALS |
406 by (ALLGOALS |
405 (asm_simp_tac (FOL_ss addsimps [restrict, fun_extend_apply1, |
407 (asm_simp_tac (FOL_ss addsimps [restrict, fun_extend_apply1, |
406 fun_extend_apply2]))); |
408 fun_extend_apply2]))); |
407 val cons_fun_eq = result(); |
409 val cons_fun_eq = result(); |
408 |
410 |