author | paulson |
Wed, 15 Jul 1998 10:15:13 +0200 | |
changeset 5143 | b94cd208f073 |
parent 5132 | 24f992a25adc |
child 5148 | 74919e8f221c |
permissions | -rw-r--r-- |
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
1 |
(* Title: HOL/Trancl |
923 | 2 |
ID: $Id$ |
1465 | 3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
923 | 4 |
Copyright 1992 University of Cambridge |
5 |
||
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
6 |
For Trancl.thy. Theorems about the transitive closure of a relation |
923 | 7 |
*) |
8 |
||
9 |
open Trancl; |
|
10 |
||
11 |
(** The relation rtrancl **) |
|
12 |
||
5069 | 13 |
Goal "mono(%s. id Un (r O s))"; |
923 | 14 |
by (rtac monoI 1); |
15 |
by (REPEAT (ares_tac [monoI, subset_refl, comp_mono, Un_mono] 1)); |
|
16 |
qed "rtrancl_fun_mono"; |
|
17 |
||
18 |
val rtrancl_unfold = rtrancl_fun_mono RS (rtrancl_def RS def_lfp_Tarski); |
|
19 |
||
20 |
(*Reflexivity of rtrancl*) |
|
5069 | 21 |
Goal "(a,a) : r^*"; |
923 | 22 |
by (stac rtrancl_unfold 1); |
2891 | 23 |
by (Blast_tac 1); |
923 | 24 |
qed "rtrancl_refl"; |
25 |
||
1921 | 26 |
Addsimps [rtrancl_refl]; |
27 |
AddSIs [rtrancl_refl]; |
|
28 |
||
29 |
||
923 | 30 |
(*Closure under composition with r*) |
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5132
diff
changeset
|
31 |
Goal "[| (a,b) : r^*; (b,c) : r |] ==> (a,c) : r^*"; |
923 | 32 |
by (stac rtrancl_unfold 1); |
2891 | 33 |
by (Blast_tac 1); |
923 | 34 |
qed "rtrancl_into_rtrancl"; |
35 |
||
36 |
(*rtrancl of r contains r*) |
|
5069 | 37 |
Goal "!!p. p : r ==> p : r^*"; |
1552 | 38 |
by (split_all_tac 1); |
1301 | 39 |
by (etac (rtrancl_refl RS rtrancl_into_rtrancl) 1); |
923 | 40 |
qed "r_into_rtrancl"; |
41 |
||
42 |
(*monotonicity of rtrancl*) |
|
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5132
diff
changeset
|
43 |
Goalw [rtrancl_def] "r <= s ==> r^* <= s^*"; |
1552 | 44 |
by (REPEAT(ares_tac [lfp_mono,Un_mono,comp_mono,subset_refl] 1)); |
923 | 45 |
qed "rtrancl_mono"; |
46 |
||
47 |
(** standard induction rule **) |
|
48 |
||
49 |
val major::prems = goal Trancl.thy |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
50 |
"[| (a,b) : r^*; \ |
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
51 |
\ !!x. P((x,x)); \ |
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
52 |
\ !!x y z.[| P((x,y)); (x,y): r^*; (y,z): r |] ==> P((x,z)) |] \ |
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
53 |
\ ==> P((a,b))"; |
923 | 54 |
by (rtac ([rtrancl_def, rtrancl_fun_mono, major] MRS def_induct) 1); |
4089 | 55 |
by (blast_tac (claset() addIs prems) 1); |
923 | 56 |
qed "rtrancl_full_induct"; |
57 |
||
58 |
(*nice induction rule*) |
|
59 |
val major::prems = goal Trancl.thy |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
60 |
"[| (a::'a,b) : r^*; \ |
923 | 61 |
\ P(a); \ |
1465 | 62 |
\ !!y z.[| (a,y) : r^*; (y,z) : r; P(y) |] ==> P(z) |] \ |
923 | 63 |
\ ==> P(b)"; |
64 |
(*by induction on this formula*) |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
65 |
by (subgoal_tac "! y. (a::'a,b) = (a,y) --> P(y)" 1); |
923 | 66 |
(*now solve first subgoal: this formula is sufficient*) |
2891 | 67 |
by (Blast_tac 1); |
923 | 68 |
(*now do the induction*) |
69 |
by (resolve_tac [major RS rtrancl_full_induct] 1); |
|
4089 | 70 |
by (blast_tac (claset() addIs prems) 1); |
71 |
by (blast_tac (claset() addIs prems) 1); |
|
923 | 72 |
qed "rtrancl_induct"; |
73 |
||
5098 | 74 |
bind_thm ("rtrancl_induct2", split_rule |
75 |
(read_instantiate [("a","(ax,ay)"), ("b","(bx,by)")] rtrancl_induct)); |
|
1706
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
76 |
|
923 | 77 |
(*transitivity of transitive closure!! -- by induction.*) |
5069 | 78 |
Goalw [trans_def] "trans(r^*)"; |
4153 | 79 |
by Safe_tac; |
1642 | 80 |
by (eres_inst_tac [("b","z")] rtrancl_induct 1); |
4089 | 81 |
by (ALLGOALS(blast_tac (claset() addIs [rtrancl_into_rtrancl]))); |
1642 | 82 |
qed "trans_rtrancl"; |
83 |
||
84 |
bind_thm ("rtrancl_trans", trans_rtrancl RS transD); |
|
85 |
||
923 | 86 |
|
87 |
(*elimination of rtrancl -- by induction on a special formula*) |
|
88 |
val major::prems = goal Trancl.thy |
|
1465 | 89 |
"[| (a::'a,b) : r^*; (a = b) ==> P; \ |
90 |
\ !!y.[| (a,y) : r^*; (y,b) : r |] ==> P \ |
|
923 | 91 |
\ |] ==> P"; |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
92 |
by (subgoal_tac "(a::'a) = b | (? y. (a,y) : r^* & (y,b) : r)" 1); |
923 | 93 |
by (rtac (major RS rtrancl_induct) 2); |
4089 | 94 |
by (blast_tac (claset() addIs prems) 2); |
95 |
by (blast_tac (claset() addIs prems) 2); |
|
923 | 96 |
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1)); |
97 |
qed "rtranclE"; |
|
98 |
||
1642 | 99 |
bind_thm ("rtrancl_into_rtrancl2", r_into_rtrancl RS rtrancl_trans); |
100 |
||
101 |
||
102 |
(*** More r^* equations and inclusions ***) |
|
103 |
||
5069 | 104 |
Goal "(r^*)^* = r^*"; |
1642 | 105 |
by (rtac set_ext 1); |
106 |
by (res_inst_tac [("p","x")] PairE 1); |
|
107 |
by (hyp_subst_tac 1); |
|
108 |
by (rtac iffI 1); |
|
1552 | 109 |
by (etac rtrancl_induct 1); |
1642 | 110 |
by (rtac rtrancl_refl 1); |
4089 | 111 |
by (blast_tac (claset() addIs [rtrancl_trans]) 1); |
1642 | 112 |
by (etac r_into_rtrancl 1); |
113 |
qed "rtrancl_idemp"; |
|
114 |
Addsimps [rtrancl_idemp]; |
|
115 |
||
5069 | 116 |
Goal "R^* O R^* = R^*"; |
5132 | 117 |
by (rtac set_ext 1); |
118 |
by (split_all_tac 1); |
|
119 |
by (blast_tac (claset() addIs [rtrancl_trans]) 1); |
|
4830 | 120 |
qed "rtrancl_idemp_self_comp"; |
121 |
Addsimps [rtrancl_idemp_self_comp]; |
|
122 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5132
diff
changeset
|
123 |
Goal "r <= s^* ==> r^* <= s^*"; |
2031 | 124 |
by (dtac rtrancl_mono 1); |
1642 | 125 |
by (Asm_full_simp_tac 1); |
126 |
qed "rtrancl_subset_rtrancl"; |
|
127 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5132
diff
changeset
|
128 |
Goal "[| R <= S; S <= R^* |] ==> S^* = R^*"; |
1642 | 129 |
by (dtac rtrancl_mono 1); |
130 |
by (dtac rtrancl_mono 1); |
|
131 |
by (Asm_full_simp_tac 1); |
|
2891 | 132 |
by (Blast_tac 1); |
1642 | 133 |
qed "rtrancl_subset"; |
134 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5132
diff
changeset
|
135 |
Goal "(R^* Un S^*)^* = (R Un S)^*"; |
4089 | 136 |
by (blast_tac (claset() addSIs [rtrancl_subset] |
2922 | 137 |
addIs [r_into_rtrancl, rtrancl_mono RS subsetD]) 1); |
1642 | 138 |
qed "rtrancl_Un_rtrancl"; |
1496 | 139 |
|
5069 | 140 |
Goal "(R^=)^* = R^*"; |
4089 | 141 |
by (blast_tac (claset() addSIs [rtrancl_subset] |
2922 | 142 |
addIs [rtrancl_refl, r_into_rtrancl]) 1); |
1642 | 143 |
qed "rtrancl_reflcl"; |
144 |
Addsimps [rtrancl_reflcl]; |
|
145 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5132
diff
changeset
|
146 |
Goal "(x,y) : (r^-1)^* ==> (x,y) : (r^*)^-1"; |
4746 | 147 |
by (rtac converseI 1); |
1642 | 148 |
by (etac rtrancl_induct 1); |
149 |
by (rtac rtrancl_refl 1); |
|
4089 | 150 |
by (blast_tac (claset() addIs [r_into_rtrancl,rtrancl_trans]) 1); |
4746 | 151 |
qed "rtrancl_converseD"; |
1642 | 152 |
|
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5132
diff
changeset
|
153 |
Goal "(x,y) : (r^*)^-1 ==> (x,y) : (r^-1)^*"; |
4746 | 154 |
by (dtac converseD 1); |
1642 | 155 |
by (etac rtrancl_induct 1); |
156 |
by (rtac rtrancl_refl 1); |
|
4089 | 157 |
by (blast_tac (claset() addIs [r_into_rtrancl,rtrancl_trans]) 1); |
4746 | 158 |
qed "rtrancl_converseI"; |
1642 | 159 |
|
5069 | 160 |
Goal "(r^-1)^* = (r^*)^-1"; |
4838 | 161 |
by (safe_tac (claset() addSDs [rtrancl_converseD] addSIs [rtrancl_converseI])); |
4746 | 162 |
qed "rtrancl_converse"; |
1642 | 163 |
|
1706
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
164 |
val major::prems = goal Trancl.thy |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
165 |
"[| (a,b) : r^*; P(b); \ |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
166 |
\ !!y z.[| (y,z) : r; (z,b) : r^*; P(z) |] ==> P(y) |] \ |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
167 |
\ ==> P(a)"; |
4746 | 168 |
by (rtac ((major RS converseI RS rtrancl_converseI) RS rtrancl_induct) 1); |
2031 | 169 |
by (resolve_tac prems 1); |
4746 | 170 |
by (blast_tac (claset() addIs prems addSDs[rtrancl_converseD])1); |
171 |
qed "converse_rtrancl_induct"; |
|
1706
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
172 |
|
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
173 |
val prems = goal Trancl.thy |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
174 |
"[| ((a,b),(c,d)) : r^*; P c d; \ |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
175 |
\ !!x y z u.[| ((x,y),(z,u)) : r; ((z,u),(c,d)) : r^*; P z u |] ==> P x y\ |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
176 |
\ |] ==> P a b"; |
2031 | 177 |
by (res_inst_tac[("R","P")]splitD 1); |
4746 | 178 |
by (res_inst_tac[("P","split P")]converse_rtrancl_induct 1); |
2031 | 179 |
by (resolve_tac prems 1); |
180 |
by (Simp_tac 1); |
|
181 |
by (resolve_tac prems 1); |
|
182 |
by (split_all_tac 1); |
|
183 |
by (Asm_full_simp_tac 1); |
|
184 |
by (REPEAT(ares_tac prems 1)); |
|
4746 | 185 |
qed "converse_rtrancl_induct2"; |
1496 | 186 |
|
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
187 |
val major::prems = goal Trancl.thy |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
188 |
"[| (x,z):r^*; \ |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
189 |
\ x=z ==> P; \ |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
190 |
\ !!y. [| (x,y):r; (y,z):r^* |] ==> P \ |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
191 |
\ |] ==> P"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
192 |
by (subgoal_tac "x = z | (? y. (x,y) : r & (y,z) : r^*)" 1); |
4746 | 193 |
by (rtac (major RS converse_rtrancl_induct) 2); |
4089 | 194 |
by (blast_tac (claset() addIs prems) 2); |
195 |
by (blast_tac (claset() addIs prems) 2); |
|
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
196 |
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1)); |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
197 |
qed "rtranclE2"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
198 |
|
5069 | 199 |
Goal "r O r^* = r^* O r"; |
4089 | 200 |
by (blast_tac (claset() addEs [rtranclE, rtranclE2] |
3723 | 201 |
addIs [rtrancl_into_rtrancl, rtrancl_into_rtrancl2]) 1); |
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
202 |
qed "r_comp_rtrancl_eq"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
203 |
|
923 | 204 |
|
205 |
(**** The relation trancl ****) |
|
206 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5132
diff
changeset
|
207 |
Goalw [trancl_def] "[| p:r^+; r <= s |] ==> p:s^+"; |
4089 | 208 |
by (blast_tac (claset() addIs [rtrancl_mono RS subsetD]) 1); |
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
209 |
qed "trancl_mono"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
210 |
|
923 | 211 |
(** Conversions between trancl and rtrancl **) |
212 |
||
5069 | 213 |
Goalw [trancl_def] |
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
214 |
"!!p. p : r^+ ==> p : r^*"; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
215 |
by (split_all_tac 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
216 |
by (etac compEpair 1); |
923 | 217 |
by (REPEAT (ares_tac [rtrancl_into_rtrancl] 1)); |
218 |
qed "trancl_into_rtrancl"; |
|
219 |
||
220 |
(*r^+ contains r*) |
|
5069 | 221 |
Goalw [trancl_def] |
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
222 |
"!!p. p : r ==> p : r^+"; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
223 |
by (split_all_tac 1); |
923 | 224 |
by (REPEAT (ares_tac [prem,compI,rtrancl_refl] 1)); |
225 |
qed "r_into_trancl"; |
|
226 |
||
227 |
(*intro rule by definition: from rtrancl and r*) |
|
228 |
val prems = goalw Trancl.thy [trancl_def] |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
229 |
"[| (a,b) : r^*; (b,c) : r |] ==> (a,c) : r^+"; |
923 | 230 |
by (REPEAT (resolve_tac ([compI]@prems) 1)); |
231 |
qed "rtrancl_into_trancl1"; |
|
232 |
||
233 |
(*intro rule from r and rtrancl*) |
|
234 |
val prems = goal Trancl.thy |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
235 |
"[| (a,b) : r; (b,c) : r^* |] ==> (a,c) : r^+"; |
923 | 236 |
by (resolve_tac (prems RL [rtranclE]) 1); |
237 |
by (etac subst 1); |
|
238 |
by (resolve_tac (prems RL [r_into_trancl]) 1); |
|
1122
20b708827030
renamed trans_rtrancl to rtrancl_trans and modified it by expanding trans.
nipkow
parents:
1121
diff
changeset
|
239 |
by (rtac (rtrancl_trans RS rtrancl_into_trancl1) 1); |
923 | 240 |
by (REPEAT (ares_tac (prems@[r_into_rtrancl]) 1)); |
241 |
qed "rtrancl_into_trancl2"; |
|
242 |
||
1642 | 243 |
(*Nice induction rule for trancl*) |
244 |
val major::prems = goal Trancl.thy |
|
245 |
"[| (a,b) : r^+; \ |
|
246 |
\ !!y. [| (a,y) : r |] ==> P(y); \ |
|
247 |
\ !!y z.[| (a,y) : r^+; (y,z) : r; P(y) |] ==> P(z) \ |
|
248 |
\ |] ==> P(b)"; |
|
249 |
by (rtac (rewrite_rule [trancl_def] major RS compEpair) 1); |
|
250 |
(*by induction on this formula*) |
|
251 |
by (subgoal_tac "ALL z. (y,z) : r --> P(z)" 1); |
|
252 |
(*now solve first subgoal: this formula is sufficient*) |
|
2891 | 253 |
by (Blast_tac 1); |
1642 | 254 |
by (etac rtrancl_induct 1); |
4089 | 255 |
by (ALLGOALS (blast_tac (claset() addIs (rtrancl_into_trancl1::prems)))); |
1642 | 256 |
qed "trancl_induct"; |
257 |
||
923 | 258 |
(*elimination of r^+ -- NOT an induction rule*) |
259 |
val major::prems = goal Trancl.thy |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
260 |
"[| (a::'a,b) : r^+; \ |
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
261 |
\ (a,b) : r ==> P; \ |
1465 | 262 |
\ !!y.[| (a,y) : r^+; (y,b) : r |] ==> P \ |
923 | 263 |
\ |] ==> P"; |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
264 |
by (subgoal_tac "(a::'a,b) : r | (? y. (a,y) : r^+ & (y,b) : r)" 1); |
923 | 265 |
by (REPEAT (eresolve_tac ([asm_rl,disjE,exE,conjE]@prems) 1)); |
266 |
by (rtac (rewrite_rule [trancl_def] major RS compEpair) 1); |
|
267 |
by (etac rtranclE 1); |
|
2891 | 268 |
by (Blast_tac 1); |
4089 | 269 |
by (blast_tac (claset() addSIs [rtrancl_into_trancl1]) 1); |
923 | 270 |
qed "tranclE"; |
271 |
||
272 |
(*Transitivity of r^+. |
|
273 |
Proved by unfolding since it uses transitivity of rtrancl. *) |
|
5069 | 274 |
Goalw [trancl_def] "trans(r^+)"; |
923 | 275 |
by (rtac transI 1); |
276 |
by (REPEAT (etac compEpair 1)); |
|
1122
20b708827030
renamed trans_rtrancl to rtrancl_trans and modified it by expanding trans.
nipkow
parents:
1121
diff
changeset
|
277 |
by (rtac (rtrancl_into_rtrancl RS (rtrancl_trans RS compI)) 1); |
923 | 278 |
by (REPEAT (assume_tac 1)); |
279 |
qed "trans_trancl"; |
|
280 |
||
1642 | 281 |
bind_thm ("trancl_trans", trans_trancl RS transD); |
282 |
||
5069 | 283 |
Goalw [trancl_def] |
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
284 |
"!!r. [| (x,y):r^*; (y,z):r^+ |] ==> (x,z):r^+"; |
4089 | 285 |
by (blast_tac (claset() addIs [rtrancl_trans,r_into_rtrancl]) 1); |
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
286 |
qed "rtrancl_trancl_trancl"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
287 |
|
923 | 288 |
val prems = goal Trancl.thy |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
289 |
"[| (a,b) : r; (b,c) : r^+ |] ==> (a,c) : r^+"; |
923 | 290 |
by (rtac (r_into_trancl RS (trans_trancl RS transD)) 1); |
291 |
by (resolve_tac prems 1); |
|
292 |
by (resolve_tac prems 1); |
|
293 |
qed "trancl_into_trancl2"; |
|
294 |
||
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
295 |
(* primitive recursion for trancl over finite relations: *) |
5069 | 296 |
Goal "(insert (y,x) r)^+ = r^+ Un {(a,b). (a,y):r^* & (x,b):r^*}"; |
3457 | 297 |
by (rtac equalityI 1); |
298 |
by (rtac subsetI 1); |
|
299 |
by (split_all_tac 1); |
|
300 |
by (etac trancl_induct 1); |
|
4089 | 301 |
by (blast_tac (claset() addIs [r_into_trancl]) 1); |
302 |
by (blast_tac (claset() addIs |
|
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
303 |
[rtrancl_into_trancl1,trancl_into_rtrancl,r_into_trancl,trancl_trans]) 1); |
3457 | 304 |
by (rtac subsetI 1); |
4089 | 305 |
by (blast_tac (claset() addIs |
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
306 |
[rtrancl_into_trancl2, rtrancl_trancl_trancl, |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
307 |
impOfSubs rtrancl_mono, trancl_mono]) 1); |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
308 |
qed "trancl_insert"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
309 |
|
5069 | 310 |
Goalw [trancl_def] "(r^-1)^+ = (r^+)^-1"; |
4746 | 311 |
by (simp_tac (simpset() addsimps [rtrancl_converse,converse_comp]) 1); |
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
312 |
by (simp_tac (simpset() addsimps [rtrancl_converse RS sym,r_comp_rtrancl_eq])1); |
4746 | 313 |
qed "trancl_converse"; |
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
314 |
|
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
315 |
val irrefl_tranclI = prove_goal Trancl.thy |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
316 |
"!!r. r^-1 Int r^+ = {} ==> !x. (x, x) ~: r^+" (K [ |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
317 |
rtac allI 1, |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
318 |
subgoal_tac "!y. (x, y) : r^+ --> x~=y" 1, |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
319 |
Fast_tac 1, |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
320 |
strip_tac 1, |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
321 |
etac trancl_induct 1, |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
322 |
auto_tac (claset() addEs [equals0D, r_into_trancl], simpset())]); |
1130 | 323 |
|
923 | 324 |
val major::prems = goal Trancl.thy |
1642 | 325 |
"[| (a,b) : r^*; r <= A Times A |] ==> a=b | a:A"; |
923 | 326 |
by (cut_facts_tac prems 1); |
327 |
by (rtac (major RS rtrancl_induct) 1); |
|
328 |
by (rtac (refl RS disjI1) 1); |
|
2891 | 329 |
by (Blast_tac 1); |
1642 | 330 |
val lemma = result(); |
923 | 331 |
|
5069 | 332 |
Goalw [trancl_def] |
1642 | 333 |
"!!r. r <= A Times A ==> r^+ <= A Times A"; |
4089 | 334 |
by (blast_tac (claset() addSDs [lemma]) 1); |
923 | 335 |
qed "trancl_subset_Sigma"; |
1130 | 336 |
|
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
337 |
|
5069 | 338 |
Goal "(r^+)^= = r^*"; |
4838 | 339 |
by Safe_tac; |
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
340 |
by (etac trancl_into_rtrancl 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
341 |
by (etac rtranclE 1); |
4772
8c7e7eaffbdf
split_all_tac now fails if there is nothing to split
oheimb
parents:
4764
diff
changeset
|
342 |
by (Auto_tac ); |
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
343 |
by (etac rtrancl_into_trancl1 1); |
5132 | 344 |
by (assume_tac 1); |
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
345 |
qed "reflcl_trancl"; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
346 |
Addsimps[reflcl_trancl]; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
347 |
|
5069 | 348 |
Goal "(r^=)^+ = r^*"; |
4838 | 349 |
by Safe_tac; |
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
350 |
by (dtac trancl_into_rtrancl 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
351 |
by (Asm_full_simp_tac 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
352 |
by (etac rtranclE 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
353 |
by Safe_tac; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
354 |
by (rtac r_into_trancl 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
355 |
by (Simp_tac 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
356 |
by (rtac rtrancl_into_trancl1 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
357 |
by (etac (rtrancl_reflcl RS equalityD2 RS subsetD) 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
358 |
by (Fast_tac 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
359 |
qed "trancl_reflcl"; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
360 |
Addsimps[trancl_reflcl]; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
361 |
|
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
362 |
qed_goal "trancl_empty" Trancl.thy "{}^+ = {}" |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
363 |
(K [auto_tac (claset() addEs [trancl_induct], simpset())]); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
364 |
Addsimps[trancl_empty]; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
365 |
|
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
366 |
qed_goal "rtrancl_empty" Trancl.thy "{}^* = id" |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
367 |
(K [rtac (reflcl_trancl RS subst) 1, Simp_tac 1]); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
368 |
Addsimps[rtrancl_empty]; |