35 by (REPEAT (ares_tac (prems@[ballI,fun_is_rel,fun_unique_Pair]) 1)); |
35 by (REPEAT (ares_tac (prems@[ballI,fun_is_rel,fun_unique_Pair]) 1)); |
36 val PiE = result(); |
36 val PiE = result(); |
37 |
37 |
38 val prems = goalw ZF.thy [Pi_def] |
38 val prems = goalw ZF.thy [Pi_def] |
39 "[| A=A'; !!x. x:A' ==> B(x)=B'(x) |] ==> Pi(A,B) = Pi(A',B')"; |
39 "[| A=A'; !!x. x:A' ==> B(x)=B'(x) |] ==> Pi(A,B) = Pi(A',B')"; |
40 by (prove_cong_tac (prems@[Collect_cong,Sigma_cong,ball_cong]) 1); |
40 by (simp_tac (FOL_ss addsimps prems addcongs [Sigma_cong]) 1); |
41 val Pi_cong = result(); |
41 val Pi_cong = result(); |
42 |
42 |
43 (*Weaking one function type to another*) |
43 (*Weaking one function type to another*) |
44 goalw ZF.thy [Pi_def] "!!f. [| f: A->B; B<=D |] ==> f: A->D"; |
44 goalw ZF.thy [Pi_def] "!!f. [| f: A->B; B<=D |] ==> f: A->D"; |
45 by (safe_tac ZF_cs); |
45 by (safe_tac ZF_cs); |
82 by (etac (apply_equality RS ssubst) 1); |
82 by (etac (apply_equality RS ssubst) 1); |
83 by (resolve_tac prems 1); |
83 by (resolve_tac prems 1); |
84 by (rtac refl 1); |
84 by (rtac refl 1); |
85 val memberPiE = result(); |
85 val memberPiE = result(); |
86 |
86 |
87 (*Conclusion is flexible -- use res_inst_tac or else RS with a theorem |
87 (*Conclusion is flexible -- use res_inst_tac or else apply_funtype below!*) |
88 of the form f:A->B *) |
|
89 goal ZF.thy "!!f. [| f: Pi(A,B); a:A |] ==> f`a : B(a)"; |
88 goal ZF.thy "!!f. [| f: Pi(A,B); a:A |] ==> f`a : B(a)"; |
90 by (rtac (fun_unique_Pair RS ex1E) 1); |
89 by (rtac (fun_unique_Pair RS ex1E) 1); |
91 by (REPEAT (assume_tac 1)); |
90 by (REPEAT (assume_tac 1)); |
92 by (rtac (fun_is_rel RS subsetD RS SigmaE2) 1); |
91 by (rtac (fun_is_rel RS subsetD RS SigmaE2) 1); |
93 by (etac (apply_equality RS ssubst) 3); |
92 by (etac (apply_equality RS ssubst) 3); |
94 by (REPEAT (assume_tac 1)); |
93 by (REPEAT (assume_tac 1)); |
95 val apply_type = result(); |
94 val apply_type = result(); |
|
95 |
|
96 (*This version is acceptable to the simplifier*) |
|
97 goal ZF.thy "!!f. [| f: A->B; a:A |] ==> f`a : B"; |
|
98 by (REPEAT (ares_tac [apply_type] 1)); |
|
99 val apply_funtype = result(); |
96 |
100 |
97 goal ZF.thy "!!f. [| f: Pi(A,B); a:A |] ==> <a,f`a>: f"; |
101 goal ZF.thy "!!f. [| f: Pi(A,B); a:A |] ==> <a,f`a>: f"; |
98 by (rtac (fun_unique_Pair RS ex1E) 1); |
102 by (rtac (fun_unique_Pair RS ex1E) 1); |
99 by (resolve_tac [apply_equality RS ssubst] 3); |
103 by (resolve_tac [apply_equality RS ssubst] 3); |
100 by (REPEAT (assume_tac 1)); |
104 by (REPEAT (assume_tac 1)); |
167 by (REPEAT (ares_tac [apply_equality,lam_funtype,lamI] 1)); |
171 by (REPEAT (ares_tac [apply_equality,lam_funtype,lamI] 1)); |
168 val beta = result(); |
172 val beta = result(); |
169 |
173 |
170 (*congruence rule for lambda abstraction*) |
174 (*congruence rule for lambda abstraction*) |
171 val prems = goalw ZF.thy [lam_def] |
175 val prems = goalw ZF.thy [lam_def] |
172 "[| A=A'; !!x. x:A' ==> b(x)=b'(x) |] ==> \ |
176 "[| A=A'; !!x. x:A' ==> b(x)=b'(x) |] ==> Lambda(A,b) = Lambda(A',b')"; |
173 \ (lam x:A.b(x)) = (lam x:A'.b'(x))"; |
177 by (simp_tac (FOL_ss addsimps prems addcongs [RepFun_cong]) 1); |
174 by (rtac RepFun_cong 1); |
|
175 by (res_inst_tac [("t","Pair")] subst_context2 2); |
|
176 by (REPEAT (ares_tac (prems@[refl]) 1)); |
|
177 val lam_cong = result(); |
178 val lam_cong = result(); |
178 |
179 |
179 val [major] = goal ZF.thy |
180 val [major] = goal ZF.thy |
180 "(!!x. x:A ==> EX! y. Q(x,y)) ==> EX f. ALL x:A. Q(x, f`x)"; |
181 "(!!x. x:A ==> EX! y. Q(x,y)) ==> EX f. ALL x:A. Q(x, f`x)"; |
181 by (res_inst_tac [("x", "lam x: A. THE y. Q(x,y)")] exI 1); |
182 by (res_inst_tac [("x", "lam x: A. THE y. Q(x,y)")] exI 1); |
257 val domain_restrict = result(); |
258 val domain_restrict = result(); |
258 |
259 |
259 val [prem] = goalw ZF.thy [restrict_def] |
260 val [prem] = goalw ZF.thy [restrict_def] |
260 "A<=C ==> restrict(lam x:C. b(x), A) = (lam x:A. b(x))"; |
261 "A<=C ==> restrict(lam x:C. b(x), A) = (lam x:A. b(x))"; |
261 by (rtac (refl RS lam_cong) 1); |
262 by (rtac (refl RS lam_cong) 1); |
262 be (prem RS subsetD RS beta) 1; (*easier than calling SIMP_TAC*) |
263 be (prem RS subsetD RS beta) 1; (*easier than calling simp_tac*) |
263 val restrict_lam_eq = result(); |
264 val restrict_lam_eq = result(); |
264 |
265 |
265 |
266 |
266 |
267 |
267 (*** Unions of functions ***) |
268 (*** Unions of functions ***) |