author | berghofe |
Fri, 24 Jul 1998 13:03:20 +0200 | |
changeset 5183 | 89f162de39cf |
parent 5143 | b94cd208f073 |
child 5278 | a903b66822e2 |
permissions | -rw-r--r-- |
1496 | 1 |
(* Title: HOL/RelPow.ML |
2 |
ID: $Id$ |
|
3 |
Author: Tobias Nipkow |
|
4 |
Copyright 1996 TU Muenchen |
|
5 |
*) |
|
6 |
||
7 |
open RelPow; |
|
8 |
||
5069 | 9 |
Goal "!!R:: ('a*'a)set. R^1 = R"; |
2741 | 10 |
by (Simp_tac 1); |
1693 | 11 |
qed "rel_pow_1"; |
12 |
Addsimps [rel_pow_1]; |
|
13 |
||
5069 | 14 |
Goal "(x,x) : R^0"; |
1552 | 15 |
by (Simp_tac 1); |
1496 | 16 |
qed "rel_pow_0_I"; |
17 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
18 |
Goal "[| (x,y) : R^n; (y,z):R |] ==> (x,z):R^(Suc n)"; |
2741 | 19 |
by (Simp_tac 1); |
2922 | 20 |
by (Blast_tac 1); |
1496 | 21 |
qed "rel_pow_Suc_I"; |
22 |
||
5069 | 23 |
Goal "!z. (x,y) : R --> (y,z):R^n --> (x,z):R^(Suc n)"; |
1552 | 24 |
by (nat_ind_tac "n" 1); |
2741 | 25 |
by (Simp_tac 1); |
26 |
by (Asm_full_simp_tac 1); |
|
2922 | 27 |
by (Blast_tac 1); |
1496 | 28 |
qed_spec_mp "rel_pow_Suc_I2"; |
29 |
||
5069 | 30 |
Goal "!!R. [| (x,y) : R^0; x=y ==> P |] ==> P"; |
1552 | 31 |
by (Asm_full_simp_tac 1); |
1515 | 32 |
qed "rel_pow_0_E"; |
33 |
||
34 |
val [major,minor] = goal RelPow.thy |
|
35 |
"[| (x,z) : R^(Suc n); !!y. [| (x,y) : R^n; (y,z) : R |] ==> P |] ==> P"; |
|
1552 | 36 |
by (cut_facts_tac [major] 1); |
2741 | 37 |
by (Asm_full_simp_tac 1); |
4089 | 38 |
by (blast_tac (claset() addIs [minor]) 1); |
1515 | 39 |
qed "rel_pow_Suc_E"; |
40 |
||
41 |
val [p1,p2,p3] = goal RelPow.thy |
|
42 |
"[| (x,z) : R^n; [| n=0; x = z |] ==> P; \ |
|
43 |
\ !!y m. [| n = Suc m; (x,y) : R^m; (y,z) : R |] ==> P \ |
|
44 |
\ |] ==> P"; |
|
1552 | 45 |
by (cut_facts_tac [p1] 1); |
5183 | 46 |
by (exhaust_tac "n" 1); |
4089 | 47 |
by (asm_full_simp_tac (simpset() addsimps [p2]) 1); |
1552 | 48 |
by (Asm_full_simp_tac 1); |
2741 | 49 |
by (etac compEpair 1); |
1552 | 50 |
by (REPEAT(ares_tac [p3] 1)); |
1515 | 51 |
qed "rel_pow_E"; |
52 |
||
5069 | 53 |
Goal "!x z. (x,z):R^(Suc n) --> (? y. (x,y):R & (y,z):R^n)"; |
1552 | 54 |
by (nat_ind_tac "n" 1); |
4089 | 55 |
by (blast_tac (claset() addIs [rel_pow_0_I] addEs [rel_pow_0_E,rel_pow_Suc_E]) 1); |
56 |
by (blast_tac (claset() addIs [rel_pow_Suc_I] addEs[rel_pow_0_E,rel_pow_Suc_E]) 1); |
|
1515 | 57 |
qed_spec_mp "rel_pow_Suc_D2"; |
1496 | 58 |
|
2741 | 59 |
|
5069 | 60 |
Goal |
2741 | 61 |
"!x y z. (x,y) : R^n & (y,z) : R --> (? w. (x,w) : R & (w,z) : R^n)"; |
62 |
by (nat_ind_tac "n" 1); |
|
4089 | 63 |
by (fast_tac (claset() addss (simpset())) 1); |
64 |
by (fast_tac (claset() addss (simpset())) 1); |
|
2741 | 65 |
qed_spec_mp "rel_pow_Suc_D2'"; |
66 |
||
1496 | 67 |
val [p1,p2,p3] = goal RelPow.thy |
68 |
"[| (x,z) : R^n; [| n=0; x = z |] ==> P; \ |
|
69 |
\ !!y m. [| n = Suc m; (x,y) : R; (y,z) : R^m |] ==> P \ |
|
70 |
\ |] ==> P"; |
|
1552 | 71 |
by (cut_facts_tac [p1] 1); |
5183 | 72 |
by (exhaust_tac "n" 1); |
4089 | 73 |
by (asm_full_simp_tac (simpset() addsimps [p2]) 1); |
1552 | 74 |
by (Asm_full_simp_tac 1); |
3023 | 75 |
by (etac compEpair 1); |
2741 | 76 |
by (dtac (conjI RS rel_pow_Suc_D2') 1); |
3023 | 77 |
by (assume_tac 1); |
1552 | 78 |
by (etac exE 1); |
79 |
by (etac p3 1); |
|
80 |
by (etac conjunct1 1); |
|
81 |
by (etac conjunct2 1); |
|
1515 | 82 |
qed "rel_pow_E2"; |
1496 | 83 |
|
5069 | 84 |
Goal "!!p. p:R^* ==> p : (UN n. R^n)"; |
1552 | 85 |
by (split_all_tac 1); |
86 |
by (etac rtrancl_induct 1); |
|
4089 | 87 |
by (ALLGOALS (blast_tac (claset() addIs [rel_pow_0_I,rel_pow_Suc_I]))); |
1496 | 88 |
qed "rtrancl_imp_UN_rel_pow"; |
89 |
||
5069 | 90 |
Goal "!y. (x,y):R^n --> (x,y):R^*"; |
1552 | 91 |
by (nat_ind_tac "n" 1); |
4089 | 92 |
by (blast_tac (claset() addIs [rtrancl_refl] addEs [rel_pow_0_E]) 1); |
93 |
by (blast_tac (claset() addEs [rel_pow_Suc_E] |
|
3023 | 94 |
addIs [rtrancl_into_rtrancl]) 1); |
1496 | 95 |
val lemma = result() RS spec RS mp; |
96 |
||
5069 | 97 |
Goal "!!p. p:R^n ==> p:R^*"; |
1552 | 98 |
by (split_all_tac 1); |
99 |
by (etac lemma 1); |
|
1515 | 100 |
qed "rel_pow_imp_rtrancl"; |
1496 | 101 |
|
5069 | 102 |
Goal "R^* = (UN n. R^n)"; |
4089 | 103 |
by (blast_tac (claset() addIs [rtrancl_imp_UN_rel_pow, rel_pow_imp_rtrancl]) 1); |
1496 | 104 |
qed "rtrancl_is_UN_rel_pow"; |
2741 | 105 |
|
106 |
||
5069 | 107 |
Goal "!!r::('a * 'a)set. Univalent r ==> Univalent (r^n)"; |
4759 | 108 |
by (rtac UnivalentI 1); |
109 |
by (induct_tac "n" 1); |
|
110 |
by (Simp_tac 1); |
|
111 |
by (fast_tac (claset() addDs [UnivalentD] addEs [rel_pow_Suc_E]) 1); |
|
112 |
qed_spec_mp "Univalent_rel_pow"; |
|
2741 | 113 |
|
4759 | 114 |
|
115 |
||
116 |