author | paulson |
Fri, 19 Sep 1997 16:12:21 +0200 | |
changeset 3685 | 5b8c0c8f576e |
parent 3457 | a8ab7c64817c |
child 3723 | 034f0f5ca43f |
permissions | -rw-r--r-- |
1465 | 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 |
||
6 |
For trancl.thy. Theorems about the transitive closure of a relation |
|
7 |
*) |
|
8 |
||
9 |
open Trancl; |
|
10 |
||
11 |
(** The relation rtrancl **) |
|
12 |
||
13 |
goal Trancl.thy "mono(%s. id Un (r O s))"; |
|
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*) |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
21 |
goal Trancl.thy "(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*) |
1921 | 31 |
goal Trancl.thy "!!r. [| (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*) |
|
1301 | 37 |
goal Trancl.thy "!!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*) |
|
43 |
goalw Trancl.thy [rtrancl_def] "!!r s. 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); |
2935 | 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); |
|
2935 | 70 |
by (blast_tac (!claset addIs prems) 1); |
71 |
by (blast_tac (!claset addIs prems) 1); |
|
923 | 72 |
qed "rtrancl_induct"; |
73 |
||
1746
f0c6aabc6c02
Moved split_rule et al from ind_syntax.ML to Prod.ML.
nipkow
parents:
1706
diff
changeset
|
74 |
bind_thm |
f0c6aabc6c02
Moved split_rule et al from ind_syntax.ML to Prod.ML.
nipkow
parents:
1706
diff
changeset
|
75 |
("rtrancl_induct2", |
f0c6aabc6c02
Moved split_rule et al from ind_syntax.ML to Prod.ML.
nipkow
parents:
1706
diff
changeset
|
76 |
Prod_Syntax.split_rule |
f0c6aabc6c02
Moved split_rule et al from ind_syntax.ML to Prod.ML.
nipkow
parents:
1706
diff
changeset
|
77 |
(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
|
78 |
|
923 | 79 |
(*transitivity of transitive closure!! -- by induction.*) |
1642 | 80 |
goalw Trancl.thy [trans_def] "trans(r^*)"; |
1786
8a31d85d27b8
best_tac, deepen_tac and safe_tac now also use default claset.
berghofe
parents:
1766
diff
changeset
|
81 |
by (safe_tac (!claset)); |
1642 | 82 |
by (eres_inst_tac [("b","z")] rtrancl_induct 1); |
2922 | 83 |
by (ALLGOALS(blast_tac (!claset addIs [rtrancl_into_rtrancl]))); |
1642 | 84 |
qed "trans_rtrancl"; |
85 |
||
86 |
bind_thm ("rtrancl_trans", trans_rtrancl RS transD); |
|
87 |
||
923 | 88 |
|
89 |
(*elimination of rtrancl -- by induction on a special formula*) |
|
90 |
val major::prems = goal Trancl.thy |
|
1465 | 91 |
"[| (a::'a,b) : r^*; (a = b) ==> P; \ |
92 |
\ !!y.[| (a,y) : r^*; (y,b) : r |] ==> P \ |
|
923 | 93 |
\ |] ==> P"; |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
94 |
by (subgoal_tac "(a::'a) = b | (? y. (a,y) : r^* & (y,b) : r)" 1); |
923 | 95 |
by (rtac (major RS rtrancl_induct) 2); |
2935 | 96 |
by (blast_tac (!claset addIs prems) 2); |
97 |
by (blast_tac (!claset addIs prems) 2); |
|
923 | 98 |
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1)); |
99 |
qed "rtranclE"; |
|
100 |
||
1642 | 101 |
bind_thm ("rtrancl_into_rtrancl2", r_into_rtrancl RS rtrancl_trans); |
102 |
||
103 |
||
104 |
(*** More r^* equations and inclusions ***) |
|
105 |
||
106 |
goal Trancl.thy "(r^*)^* = r^*"; |
|
107 |
by (rtac set_ext 1); |
|
108 |
by (res_inst_tac [("p","x")] PairE 1); |
|
109 |
by (hyp_subst_tac 1); |
|
110 |
by (rtac iffI 1); |
|
1552 | 111 |
by (etac rtrancl_induct 1); |
1642 | 112 |
by (rtac rtrancl_refl 1); |
2922 | 113 |
by (blast_tac (!claset addIs [rtrancl_trans]) 1); |
1642 | 114 |
by (etac r_into_rtrancl 1); |
115 |
qed "rtrancl_idemp"; |
|
116 |
Addsimps [rtrancl_idemp]; |
|
117 |
||
118 |
goal Trancl.thy "!!r s. r <= s^* ==> r^* <= s^*"; |
|
2031 | 119 |
by (dtac rtrancl_mono 1); |
1642 | 120 |
by (Asm_full_simp_tac 1); |
121 |
qed "rtrancl_subset_rtrancl"; |
|
122 |
||
123 |
goal Trancl.thy "!!R. [| R <= S; S <= R^* |] ==> S^* = R^*"; |
|
124 |
by (dtac rtrancl_mono 1); |
|
125 |
by (dtac rtrancl_mono 1); |
|
126 |
by (Asm_full_simp_tac 1); |
|
2891 | 127 |
by (Blast_tac 1); |
1642 | 128 |
qed "rtrancl_subset"; |
129 |
||
130 |
goal Trancl.thy "!!R. (R^* Un S^*)^* = (R Un S)^*"; |
|
2922 | 131 |
by (blast_tac (!claset addSIs [rtrancl_subset] |
132 |
addIs [r_into_rtrancl, rtrancl_mono RS subsetD]) 1); |
|
1642 | 133 |
qed "rtrancl_Un_rtrancl"; |
1496 | 134 |
|
1642 | 135 |
goal Trancl.thy "(R^=)^* = R^*"; |
2922 | 136 |
by (blast_tac (!claset addSIs [rtrancl_subset] |
137 |
addIs [rtrancl_refl, r_into_rtrancl]) 1); |
|
1642 | 138 |
qed "rtrancl_reflcl"; |
139 |
Addsimps [rtrancl_reflcl]; |
|
140 |
||
3439 | 141 |
goal Trancl.thy "!!r. (x,y) : (r^-1)^* ==> (x,y) : (r^*)^-1"; |
142 |
by (rtac inverseI 1); |
|
1642 | 143 |
by (etac rtrancl_induct 1); |
144 |
by (rtac rtrancl_refl 1); |
|
2922 | 145 |
by (blast_tac (!claset addIs [r_into_rtrancl,rtrancl_trans]) 1); |
3439 | 146 |
qed "rtrancl_inverseD"; |
1642 | 147 |
|
3439 | 148 |
goal Trancl.thy "!!r. (x,y) : (r^*)^-1 ==> (x,y) : (r^-1)^*"; |
149 |
by (dtac inverseD 1); |
|
1642 | 150 |
by (etac rtrancl_induct 1); |
151 |
by (rtac rtrancl_refl 1); |
|
2922 | 152 |
by (blast_tac (!claset addIs [r_into_rtrancl,rtrancl_trans]) 1); |
3439 | 153 |
qed "rtrancl_inverseI"; |
1642 | 154 |
|
3439 | 155 |
goal Trancl.thy "(r^-1)^* = (r^*)^-1"; |
156 |
by (safe_tac (!claset addSIs [rtrancl_inverseI])); |
|
1642 | 157 |
by (res_inst_tac [("p","x")] PairE 1); |
158 |
by (hyp_subst_tac 1); |
|
3439 | 159 |
by (etac rtrancl_inverseD 1); |
160 |
qed "rtrancl_inverse"; |
|
1642 | 161 |
|
1706
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
162 |
val major::prems = goal Trancl.thy |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
163 |
"[| (a,b) : r^*; P(b); \ |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
164 |
\ !!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
|
165 |
\ ==> P(a)"; |
3439 | 166 |
by (rtac ((major RS inverseI RS rtrancl_inverseI) RS rtrancl_induct) 1); |
2031 | 167 |
by (resolve_tac prems 1); |
3439 | 168 |
by (blast_tac (!claset addIs prems addSDs[rtrancl_inverseD])1); |
169 |
qed "inverse_rtrancl_induct"; |
|
1706
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
170 |
|
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
171 |
val prems = goal Trancl.thy |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
172 |
"[| ((a,b),(c,d)) : r^*; P c d; \ |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
173 |
\ !!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
|
174 |
\ |] ==> P a b"; |
2031 | 175 |
by (res_inst_tac[("R","P")]splitD 1); |
3439 | 176 |
by (res_inst_tac[("P","split P")]inverse_rtrancl_induct 1); |
2031 | 177 |
by (resolve_tac prems 1); |
178 |
by (Simp_tac 1); |
|
179 |
by (resolve_tac prems 1); |
|
180 |
by (split_all_tac 1); |
|
181 |
by (Asm_full_simp_tac 1); |
|
182 |
by (REPEAT(ares_tac prems 1)); |
|
3439 | 183 |
qed "inverse_rtrancl_induct2"; |
1496 | 184 |
|
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
185 |
val major::prems = goal Trancl.thy |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
186 |
"[| (x,z):r^*; \ |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
187 |
\ x=z ==> P; \ |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
188 |
\ !!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
|
189 |
\ |] ==> P"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
190 |
by (subgoal_tac "x = z | (? y. (x,y) : r & (y,z) : r^*)" 1); |
3439 | 191 |
by (rtac (major RS inverse_rtrancl_induct) 2); |
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
192 |
by (blast_tac (!claset addIs prems) 2); |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
193 |
by (blast_tac (!claset addIs prems) 2); |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
194 |
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
|
195 |
qed "rtranclE2"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
196 |
|
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
197 |
goal Trancl.thy "r O r^* = r^* O r"; |
3457 | 198 |
by (Step_tac 1); |
199 |
by (blast_tac (!claset addEs [rtranclE2] addIs [rtrancl_into_rtrancl]) 1); |
|
200 |
by (blast_tac (!claset addEs [rtranclE] addIs [rtrancl_into_rtrancl2]) 1); |
|
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
201 |
qed "r_comp_rtrancl_eq"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
202 |
|
923 | 203 |
|
204 |
(**** The relation trancl ****) |
|
205 |
||
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
206 |
goalw Trancl.thy [trancl_def] "!!p.[| p:r^+; r <= s |] ==> p:s^+"; |
3457 | 207 |
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
|
208 |
qed "trancl_mono"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
209 |
|
923 | 210 |
(** Conversions between trancl and rtrancl **) |
211 |
||
212 |
val [major] = goalw Trancl.thy [trancl_def] |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
213 |
"(a,b) : r^+ ==> (a,b) : r^*"; |
923 | 214 |
by (resolve_tac [major RS compEpair] 1); |
215 |
by (REPEAT (ares_tac [rtrancl_into_rtrancl] 1)); |
|
216 |
qed "trancl_into_rtrancl"; |
|
217 |
||
218 |
(*r^+ contains r*) |
|
219 |
val [prem] = goalw Trancl.thy [trancl_def] |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
220 |
"[| (a,b) : r |] ==> (a,b) : r^+"; |
923 | 221 |
by (REPEAT (ares_tac [prem,compI,rtrancl_refl] 1)); |
222 |
qed "r_into_trancl"; |
|
223 |
||
224 |
(*intro rule by definition: from rtrancl and r*) |
|
225 |
val prems = goalw Trancl.thy [trancl_def] |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
226 |
"[| (a,b) : r^*; (b,c) : r |] ==> (a,c) : r^+"; |
923 | 227 |
by (REPEAT (resolve_tac ([compI]@prems) 1)); |
228 |
qed "rtrancl_into_trancl1"; |
|
229 |
||
230 |
(*intro rule from r and rtrancl*) |
|
231 |
val prems = goal Trancl.thy |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
232 |
"[| (a,b) : r; (b,c) : r^* |] ==> (a,c) : r^+"; |
923 | 233 |
by (resolve_tac (prems RL [rtranclE]) 1); |
234 |
by (etac subst 1); |
|
235 |
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
|
236 |
by (rtac (rtrancl_trans RS rtrancl_into_trancl1) 1); |
923 | 237 |
by (REPEAT (ares_tac (prems@[r_into_rtrancl]) 1)); |
238 |
qed "rtrancl_into_trancl2"; |
|
239 |
||
1642 | 240 |
(*Nice induction rule for trancl*) |
241 |
val major::prems = goal Trancl.thy |
|
242 |
"[| (a,b) : r^+; \ |
|
243 |
\ !!y. [| (a,y) : r |] ==> P(y); \ |
|
244 |
\ !!y z.[| (a,y) : r^+; (y,z) : r; P(y) |] ==> P(z) \ |
|
245 |
\ |] ==> P(b)"; |
|
246 |
by (rtac (rewrite_rule [trancl_def] major RS compEpair) 1); |
|
247 |
(*by induction on this formula*) |
|
248 |
by (subgoal_tac "ALL z. (y,z) : r --> P(z)" 1); |
|
249 |
(*now solve first subgoal: this formula is sufficient*) |
|
2891 | 250 |
by (Blast_tac 1); |
1642 | 251 |
by (etac rtrancl_induct 1); |
2935 | 252 |
by (ALLGOALS (blast_tac (!claset addIs (rtrancl_into_trancl1::prems)))); |
1642 | 253 |
qed "trancl_induct"; |
254 |
||
923 | 255 |
(*elimination of r^+ -- NOT an induction rule*) |
256 |
val major::prems = goal Trancl.thy |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
257 |
"[| (a::'a,b) : r^+; \ |
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
258 |
\ (a,b) : r ==> P; \ |
1465 | 259 |
\ !!y.[| (a,y) : r^+; (y,b) : r |] ==> P \ |
923 | 260 |
\ |] ==> P"; |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
261 |
by (subgoal_tac "(a::'a,b) : r | (? y. (a,y) : r^+ & (y,b) : r)" 1); |
923 | 262 |
by (REPEAT (eresolve_tac ([asm_rl,disjE,exE,conjE]@prems) 1)); |
263 |
by (rtac (rewrite_rule [trancl_def] major RS compEpair) 1); |
|
264 |
by (etac rtranclE 1); |
|
2891 | 265 |
by (Blast_tac 1); |
2922 | 266 |
by (blast_tac (!claset addSIs [rtrancl_into_trancl1]) 1); |
923 | 267 |
qed "tranclE"; |
268 |
||
269 |
(*Transitivity of r^+. |
|
270 |
Proved by unfolding since it uses transitivity of rtrancl. *) |
|
271 |
goalw Trancl.thy [trancl_def] "trans(r^+)"; |
|
272 |
by (rtac transI 1); |
|
273 |
by (REPEAT (etac compEpair 1)); |
|
1122
20b708827030
renamed trans_rtrancl to rtrancl_trans and modified it by expanding trans.
nipkow
parents:
1121
diff
changeset
|
274 |
by (rtac (rtrancl_into_rtrancl RS (rtrancl_trans RS compI)) 1); |
923 | 275 |
by (REPEAT (assume_tac 1)); |
276 |
qed "trans_trancl"; |
|
277 |
||
1642 | 278 |
bind_thm ("trancl_trans", trans_trancl RS transD); |
279 |
||
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
280 |
goalw Trancl.thy [trancl_def] |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
281 |
"!!r. [| (x,y):r^*; (y,z):r^+ |] ==> (x,z):r^+"; |
3457 | 282 |
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
|
283 |
qed "rtrancl_trancl_trancl"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
284 |
|
923 | 285 |
val prems = goal Trancl.thy |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
286 |
"[| (a,b) : r; (b,c) : r^+ |] ==> (a,c) : r^+"; |
923 | 287 |
by (rtac (r_into_trancl RS (trans_trancl RS transD)) 1); |
288 |
by (resolve_tac prems 1); |
|
289 |
by (resolve_tac prems 1); |
|
290 |
qed "trancl_into_trancl2"; |
|
291 |
||
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
292 |
(* primitive recursion for trancl over finite relations: *) |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
293 |
goal Trancl.thy "(insert (y,x) r)^+ = r^+ Un {(a,b). (a,y):r^* & (x,b):r^*}"; |
3457 | 294 |
by (rtac equalityI 1); |
295 |
by (rtac subsetI 1); |
|
296 |
by (split_all_tac 1); |
|
297 |
by (etac trancl_induct 1); |
|
298 |
by (blast_tac (!claset addIs [r_into_trancl]) 1); |
|
299 |
by (blast_tac (!claset addIs |
|
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
300 |
[rtrancl_into_trancl1,trancl_into_rtrancl,r_into_trancl,trancl_trans]) 1); |
3457 | 301 |
by (rtac subsetI 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_trancl2, rtrancl_trancl_trancl, |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
304 |
impOfSubs rtrancl_mono, trancl_mono]) 1); |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
305 |
qed "trancl_insert"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
306 |
|
3439 | 307 |
goalw Trancl.thy [trancl_def] "(r^-1)^+ = (r^+)^-1"; |
3457 | 308 |
by (simp_tac (!simpset addsimps [rtrancl_inverse,inverse_comp]) 1); |
309 |
by (simp_tac (!simpset addsimps [rtrancl_inverse RS sym,r_comp_rtrancl_eq]) 1); |
|
3439 | 310 |
qed "trancl_inverse"; |
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
311 |
|
1130 | 312 |
|
923 | 313 |
val major::prems = goal Trancl.thy |
1642 | 314 |
"[| (a,b) : r^*; r <= A Times A |] ==> a=b | a:A"; |
923 | 315 |
by (cut_facts_tac prems 1); |
316 |
by (rtac (major RS rtrancl_induct) 1); |
|
317 |
by (rtac (refl RS disjI1) 1); |
|
2891 | 318 |
by (Blast_tac 1); |
1642 | 319 |
val lemma = result(); |
923 | 320 |
|
321 |
goalw Trancl.thy [trancl_def] |
|
1642 | 322 |
"!!r. r <= A Times A ==> r^+ <= A Times A"; |
2891 | 323 |
by (blast_tac (!claset addSDs [lemma]) 1); |
923 | 324 |
qed "trancl_subset_Sigma"; |
1130 | 325 |