22 Goal "inj_on Abs_Prod Prod"; |
22 Goal "inj_on Abs_Prod Prod"; |
23 by (rtac inj_on_inverseI 1); |
23 by (rtac inj_on_inverseI 1); |
24 by (etac Abs_Prod_inverse 1); |
24 by (etac Abs_Prod_inverse 1); |
25 qed "inj_on_Abs_Prod"; |
25 qed "inj_on_Abs_Prod"; |
26 |
26 |
27 val prems = goalw Prod.thy [Pair_def] |
27 val prems = Goalw [Pair_def] |
28 "[| (a, b) = (a',b'); [| a=a'; b=b' |] ==> R |] ==> R"; |
28 "[| (a, b) = (a',b'); [| a=a'; b=b' |] ==> R |] ==> R"; |
29 by (rtac (inj_on_Abs_Prod RS inj_onD RS Pair_Rep_inject RS conjE) 1); |
29 by (rtac (inj_on_Abs_Prod RS inj_onD RS Pair_Rep_inject RS conjE) 1); |
30 by (REPEAT (ares_tac (prems@[ProdI]) 1)); |
30 by (REPEAT (ares_tac (prems@[ProdI]) 1)); |
31 qed "Pair_inject"; |
31 qed "Pair_inject"; |
32 |
32 |
47 by (rtac (rewrite_rule [Prod_def] Rep_Prod RS CollectE) 1); |
47 by (rtac (rewrite_rule [Prod_def] Rep_Prod RS CollectE) 1); |
48 by (EVERY1[etac exE, etac exE, rtac exI, rtac exI, |
48 by (EVERY1[etac exE, etac exE, rtac exI, rtac exI, |
49 rtac (Rep_Prod_inverse RS sym RS trans), etac arg_cong]); |
49 rtac (Rep_Prod_inverse RS sym RS trans), etac arg_cong]); |
50 qed "PairE_lemma"; |
50 qed "PairE_lemma"; |
51 |
51 |
52 val [prem] = goal Prod.thy "[| !!x y. p = (x,y) ==> Q |] ==> Q"; |
52 val [prem] = Goal "[| !!x y. p = (x,y) ==> Q |] ==> Q"; |
53 by (rtac (PairE_lemma RS exE) 1); |
53 by (rtac (PairE_lemma RS exE) 1); |
54 by (REPEAT (eresolve_tac [prem,exE] 1)); |
54 by (REPEAT (eresolve_tac [prem,exE] 1)); |
55 qed "PairE"; |
55 qed "PairE"; |
56 |
56 |
57 fun pair_tac s = EVERY' [res_inst_tac [("p",s)] PairE, hyp_subst_tac, |
57 fun pair_tac s = EVERY' [res_inst_tac [("p",s)] PairE, hyp_subst_tac, |
220 |
220 |
221 Goal "c a b ==> split c (a,b)"; |
221 Goal "c a b ==> split c (a,b)"; |
222 by (Asm_simp_tac 1); |
222 by (Asm_simp_tac 1); |
223 qed "splitI"; |
223 qed "splitI"; |
224 |
224 |
225 val prems = goalw Prod.thy [split_def] |
225 val prems = Goalw [split_def] |
226 "[| split c p; !!x y. [| p = (x,y); c x y |] ==> Q |] ==> Q"; |
226 "[| split c p; !!x y. [| p = (x,y); c x y |] ==> Q |] ==> Q"; |
227 by (REPEAT (resolve_tac (prems@[surjective_pairing]) 1)); |
227 by (REPEAT (resolve_tac (prems@[surjective_pairing]) 1)); |
228 qed "splitE"; |
228 qed "splitE"; |
229 |
229 |
230 val splitE2 = prove_goal Prod.thy |
230 val splitE2 = prove_goal Prod.thy |
244 Goal "!!p. [| !!a b. p=(a,b) ==> z: c a b |] ==> z: split c p"; |
244 Goal "!!p. [| !!a b. p=(a,b) ==> z: c a b |] ==> z: split c p"; |
245 by (split_all_tac 1); |
245 by (split_all_tac 1); |
246 by (Asm_simp_tac 1); |
246 by (Asm_simp_tac 1); |
247 qed "mem_splitI2"; |
247 qed "mem_splitI2"; |
248 |
248 |
249 val prems = goalw Prod.thy [split_def] |
249 val prems = Goalw [split_def] |
250 "[| z: split c p; !!x y. [| p = (x,y); z: c x y |] ==> Q |] ==> Q"; |
250 "[| z: split c p; !!x y. [| p = (x,y); z: c x y |] ==> Q |] ==> Q"; |
251 by (REPEAT (resolve_tac (prems@[surjective_pairing]) 1)); |
251 by (REPEAT (resolve_tac (prems@[surjective_pairing]) 1)); |
252 qed "mem_splitE"; |
252 qed "mem_splitE"; |
253 |
253 |
254 AddSIs [splitI, splitI2, mem_splitI, mem_splitI2]; |
254 AddSIs [splitI, splitI2, mem_splitI, mem_splitI2]; |
296 by (pair_tac "z" 1); |
296 by (pair_tac "z" 1); |
297 by (Asm_simp_tac 1); |
297 by (Asm_simp_tac 1); |
298 qed "prod_fun_ident"; |
298 qed "prod_fun_ident"; |
299 Addsimps [prod_fun_ident]; |
299 Addsimps [prod_fun_ident]; |
300 |
300 |
301 val prems = goal Prod.thy "(a,b):r ==> (f(a),g(b)) : (prod_fun f g)``r"; |
301 Goal "(a,b):r ==> (f(a),g(b)) : (prod_fun f g)``r"; |
302 by (rtac image_eqI 1); |
302 by (rtac image_eqI 1); |
303 by (rtac (prod_fun RS sym) 1); |
303 by (rtac (prod_fun RS sym) 1); |
304 by (resolve_tac prems 1); |
304 by (assume_tac 1); |
305 qed "prod_fun_imageI"; |
305 qed "prod_fun_imageI"; |
306 |
306 |
307 val major::prems = goal Prod.thy |
307 val major::prems = Goal |
308 "[| c: (prod_fun f g)``r; !!x y. [| c=(f(x),g(y)); (x,y):r |] ==> P \ |
308 "[| c: (prod_fun f g)``r; !!x y. [| c=(f(x),g(y)); (x,y):r |] ==> P \ |
309 \ |] ==> P"; |
309 \ |] ==> P"; |
310 by (rtac (major RS imageE) 1); |
310 by (rtac (major RS imageE) 1); |
311 by (res_inst_tac [("p","x")] PairE 1); |
311 by (res_inst_tac [("p","x")] PairE 1); |
312 by (resolve_tac prems 1); |
312 by (resolve_tac prems 1); |
352 (rtac (major RS SigmaD1) 1), |
352 (rtac (major RS SigmaD1) 1), |
353 (rtac (major RS SigmaD2) 1) ]); |
353 (rtac (major RS SigmaD2) 1) ]); |
354 |
354 |
355 AddSEs [SigmaE2, SigmaE]; |
355 AddSEs [SigmaE2, SigmaE]; |
356 |
356 |
357 val prems = goal Prod.thy |
357 val prems = Goal |
358 "[| A<=C; !!x. x:A ==> B x <= D x |] ==> Sigma A B <= Sigma C D"; |
358 "[| A<=C; !!x. x:A ==> B x <= D x |] ==> Sigma A B <= Sigma C D"; |
359 by (cut_facts_tac prems 1); |
359 by (cut_facts_tac prems 1); |
360 by (blast_tac (claset() addIs (prems RL [subsetD])) 1); |
360 by (blast_tac (claset() addIs (prems RL [subsetD])) 1); |
361 qed "Sigma_mono"; |
361 qed "Sigma_mono"; |
362 |
362 |
382 by (Blast_tac 1); |
382 by (Blast_tac 1); |
383 qed "UNION_Times_distrib"; |
383 qed "UNION_Times_distrib"; |
384 |
384 |
385 (*** Domain of a relation ***) |
385 (*** Domain of a relation ***) |
386 |
386 |
387 val prems = goalw Prod.thy [image_def] "(a,b) : r ==> a : fst``r"; |
387 Goalw [image_def] "(a,b) : r ==> a : fst``r"; |
388 by (rtac CollectI 1); |
388 by (rtac CollectI 1); |
389 by (rtac bexI 1); |
389 by (rtac bexI 1); |
390 by (rtac (fst_conv RS sym) 1); |
390 by (rtac (fst_conv RS sym) 1); |
391 by (resolve_tac prems 1); |
391 by (assume_tac 1); |
392 qed "fst_imageI"; |
392 qed "fst_imageI"; |
393 |
393 |
394 val major::prems = goal Prod.thy |
394 val major::prems = Goal |
395 "[| a : fst``r; !!y.[| (a,y) : r |] ==> P |] ==> P"; |
395 "[| a : fst``r; !!y.[| (a,y) : r |] ==> P |] ==> P"; |
396 by (rtac (major RS imageE) 1); |
396 by (rtac (major RS imageE) 1); |
397 by (resolve_tac prems 1); |
397 by (resolve_tac prems 1); |
398 by (etac ssubst 1); |
398 by (etac ssubst 1); |
399 by (rtac (surjective_pairing RS subst) 1); |
399 by (rtac (surjective_pairing RS subst) 1); |
400 by (assume_tac 1); |
400 by (assume_tac 1); |
401 qed "fst_imageE"; |
401 qed "fst_imageE"; |
402 |
402 |
403 (*** Range of a relation ***) |
403 (*** Range of a relation ***) |
404 |
404 |
405 val prems = goalw Prod.thy [image_def] "(a,b) : r ==> b : snd``r"; |
405 Goalw [image_def] "(a,b) : r ==> b : snd``r"; |
406 by (rtac CollectI 1); |
406 by (rtac CollectI 1); |
407 by (rtac bexI 1); |
407 by (rtac bexI 1); |
408 by (rtac (snd_conv RS sym) 1); |
408 by (rtac (snd_conv RS sym) 1); |
409 by (resolve_tac prems 1); |
409 by (assume_tac 1); |
410 qed "snd_imageI"; |
410 qed "snd_imageI"; |
411 |
411 |
412 val major::prems = goal Prod.thy |
412 val major::prems = Goal "[| a : snd``r; !!y.[| (y,a) : r |] ==> P |] ==> P"; |
413 "[| a : snd``r; !!y.[| (y,a) : r |] ==> P |] ==> P"; |
|
414 by (rtac (major RS imageE) 1); |
413 by (rtac (major RS imageE) 1); |
415 by (resolve_tac prems 1); |
414 by (resolve_tac prems 1); |
416 by (etac ssubst 1); |
415 by (etac ssubst 1); |
417 by (rtac (surjective_pairing RS subst) 1); |
416 by (rtac (surjective_pairing RS subst) 1); |
418 by (assume_tac 1); |
417 by (assume_tac 1); |