author | oheimb |
Mon, 27 Apr 1998 19:32:19 +0200 | |
changeset 4838 | 196100237656 |
parent 4830 | bd73675adbed |
child 5069 | 3ea049f7979d |
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 |
||
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); |
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 |
||
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^*)"; |
4153 | 81 |
by Safe_tac; |
1642 | 82 |
by (eres_inst_tac [("b","z")] rtrancl_induct 1); |
4089 | 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); |
4089 | 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); |
4089 | 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 |
||
4830 | 118 |
goal thy "R^* O R^* = R^*"; |
119 |
br set_ext 1; |
|
120 |
by(split_all_tac 1); |
|
121 |
by(blast_tac (claset() addIs [rtrancl_trans]) 1); |
|
122 |
qed "rtrancl_idemp_self_comp"; |
|
123 |
Addsimps [rtrancl_idemp_self_comp]; |
|
124 |
||
1642 | 125 |
goal Trancl.thy "!!r s. r <= s^* ==> r^* <= s^*"; |
2031 | 126 |
by (dtac rtrancl_mono 1); |
1642 | 127 |
by (Asm_full_simp_tac 1); |
128 |
qed "rtrancl_subset_rtrancl"; |
|
129 |
||
130 |
goal Trancl.thy "!!R. [| R <= S; S <= R^* |] ==> S^* = R^*"; |
|
131 |
by (dtac rtrancl_mono 1); |
|
132 |
by (dtac rtrancl_mono 1); |
|
133 |
by (Asm_full_simp_tac 1); |
|
2891 | 134 |
by (Blast_tac 1); |
1642 | 135 |
qed "rtrancl_subset"; |
136 |
||
137 |
goal Trancl.thy "!!R. (R^* Un S^*)^* = (R Un S)^*"; |
|
4089 | 138 |
by (blast_tac (claset() addSIs [rtrancl_subset] |
2922 | 139 |
addIs [r_into_rtrancl, rtrancl_mono RS subsetD]) 1); |
1642 | 140 |
qed "rtrancl_Un_rtrancl"; |
1496 | 141 |
|
1642 | 142 |
goal Trancl.thy "(R^=)^* = R^*"; |
4089 | 143 |
by (blast_tac (claset() addSIs [rtrancl_subset] |
2922 | 144 |
addIs [rtrancl_refl, r_into_rtrancl]) 1); |
1642 | 145 |
qed "rtrancl_reflcl"; |
146 |
Addsimps [rtrancl_reflcl]; |
|
147 |
||
3439 | 148 |
goal Trancl.thy "!!r. (x,y) : (r^-1)^* ==> (x,y) : (r^*)^-1"; |
4746 | 149 |
by (rtac converseI 1); |
1642 | 150 |
by (etac rtrancl_induct 1); |
151 |
by (rtac rtrancl_refl 1); |
|
4089 | 152 |
by (blast_tac (claset() addIs [r_into_rtrancl,rtrancl_trans]) 1); |
4746 | 153 |
qed "rtrancl_converseD"; |
1642 | 154 |
|
3439 | 155 |
goal Trancl.thy "!!r. (x,y) : (r^*)^-1 ==> (x,y) : (r^-1)^*"; |
4746 | 156 |
by (dtac converseD 1); |
1642 | 157 |
by (etac rtrancl_induct 1); |
158 |
by (rtac rtrancl_refl 1); |
|
4089 | 159 |
by (blast_tac (claset() addIs [r_into_rtrancl,rtrancl_trans]) 1); |
4746 | 160 |
qed "rtrancl_converseI"; |
1642 | 161 |
|
3439 | 162 |
goal Trancl.thy "(r^-1)^* = (r^*)^-1"; |
4838 | 163 |
by (safe_tac (claset() addSDs [rtrancl_converseD] addSIs [rtrancl_converseI])); |
4746 | 164 |
qed "rtrancl_converse"; |
1642 | 165 |
|
1706
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
166 |
val major::prems = goal Trancl.thy |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
167 |
"[| (a,b) : r^*; P(b); \ |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
168 |
\ !!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
|
169 |
\ ==> P(a)"; |
4746 | 170 |
by (rtac ((major RS converseI RS rtrancl_converseI) RS rtrancl_induct) 1); |
2031 | 171 |
by (resolve_tac prems 1); |
4746 | 172 |
by (blast_tac (claset() addIs prems addSDs[rtrancl_converseD])1); |
173 |
qed "converse_rtrancl_induct"; |
|
1706
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
174 |
|
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
175 |
val prems = goal Trancl.thy |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
176 |
"[| ((a,b),(c,d)) : r^*; P c d; \ |
4e0d5c7f57fa
Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents:
1642
diff
changeset
|
177 |
\ !!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
|
178 |
\ |] ==> P a b"; |
2031 | 179 |
by (res_inst_tac[("R","P")]splitD 1); |
4746 | 180 |
by (res_inst_tac[("P","split P")]converse_rtrancl_induct 1); |
2031 | 181 |
by (resolve_tac prems 1); |
182 |
by (Simp_tac 1); |
|
183 |
by (resolve_tac prems 1); |
|
184 |
by (split_all_tac 1); |
|
185 |
by (Asm_full_simp_tac 1); |
|
186 |
by (REPEAT(ares_tac prems 1)); |
|
4746 | 187 |
qed "converse_rtrancl_induct2"; |
1496 | 188 |
|
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
189 |
val major::prems = goal Trancl.thy |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
190 |
"[| (x,z):r^*; \ |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
191 |
\ x=z ==> P; \ |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
192 |
\ !!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
|
193 |
\ |] ==> P"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
194 |
by (subgoal_tac "x = z | (? y. (x,y) : r & (y,z) : r^*)" 1); |
4746 | 195 |
by (rtac (major RS converse_rtrancl_induct) 2); |
4089 | 196 |
by (blast_tac (claset() addIs prems) 2); |
197 |
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
|
198 |
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
|
199 |
qed "rtranclE2"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
200 |
|
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
201 |
goal Trancl.thy "r O r^* = r^* O r"; |
4089 | 202 |
by (blast_tac (claset() addEs [rtranclE, rtranclE2] |
3723 | 203 |
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
|
204 |
qed "r_comp_rtrancl_eq"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
205 |
|
923 | 206 |
|
207 |
(**** The relation trancl ****) |
|
208 |
||
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
209 |
goalw Trancl.thy [trancl_def] "!!p.[| p:r^+; r <= s |] ==> p:s^+"; |
4089 | 210 |
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
|
211 |
qed "trancl_mono"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
212 |
|
923 | 213 |
(** Conversions between trancl and rtrancl **) |
214 |
||
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
215 |
goalw Trancl.thy [trancl_def] |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
216 |
"!!p. p : r^+ ==> p : r^*"; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
217 |
by (split_all_tac 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
218 |
by (etac compEpair 1); |
923 | 219 |
by (REPEAT (ares_tac [rtrancl_into_rtrancl] 1)); |
220 |
qed "trancl_into_rtrancl"; |
|
221 |
||
222 |
(*r^+ contains r*) |
|
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
223 |
goalw Trancl.thy [trancl_def] |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
224 |
"!!p. p : r ==> p : r^+"; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
225 |
by (split_all_tac 1); |
923 | 226 |
by (REPEAT (ares_tac [prem,compI,rtrancl_refl] 1)); |
227 |
qed "r_into_trancl"; |
|
228 |
||
229 |
(*intro rule by definition: from rtrancl and r*) |
|
230 |
val prems = goalw Trancl.thy [trancl_def] |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
231 |
"[| (a,b) : r^*; (b,c) : r |] ==> (a,c) : r^+"; |
923 | 232 |
by (REPEAT (resolve_tac ([compI]@prems) 1)); |
233 |
qed "rtrancl_into_trancl1"; |
|
234 |
||
235 |
(*intro rule from r and rtrancl*) |
|
236 |
val prems = goal Trancl.thy |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
237 |
"[| (a,b) : r; (b,c) : r^* |] ==> (a,c) : r^+"; |
923 | 238 |
by (resolve_tac (prems RL [rtranclE]) 1); |
239 |
by (etac subst 1); |
|
240 |
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
|
241 |
by (rtac (rtrancl_trans RS rtrancl_into_trancl1) 1); |
923 | 242 |
by (REPEAT (ares_tac (prems@[r_into_rtrancl]) 1)); |
243 |
qed "rtrancl_into_trancl2"; |
|
244 |
||
1642 | 245 |
(*Nice induction rule for trancl*) |
246 |
val major::prems = goal Trancl.thy |
|
247 |
"[| (a,b) : r^+; \ |
|
248 |
\ !!y. [| (a,y) : r |] ==> P(y); \ |
|
249 |
\ !!y z.[| (a,y) : r^+; (y,z) : r; P(y) |] ==> P(z) \ |
|
250 |
\ |] ==> P(b)"; |
|
251 |
by (rtac (rewrite_rule [trancl_def] major RS compEpair) 1); |
|
252 |
(*by induction on this formula*) |
|
253 |
by (subgoal_tac "ALL z. (y,z) : r --> P(z)" 1); |
|
254 |
(*now solve first subgoal: this formula is sufficient*) |
|
2891 | 255 |
by (Blast_tac 1); |
1642 | 256 |
by (etac rtrancl_induct 1); |
4089 | 257 |
by (ALLGOALS (blast_tac (claset() addIs (rtrancl_into_trancl1::prems)))); |
1642 | 258 |
qed "trancl_induct"; |
259 |
||
923 | 260 |
(*elimination of r^+ -- NOT an induction rule*) |
261 |
val major::prems = goal Trancl.thy |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
262 |
"[| (a::'a,b) : r^+; \ |
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
263 |
\ (a,b) : r ==> P; \ |
1465 | 264 |
\ !!y.[| (a,y) : r^+; (y,b) : r |] ==> P \ |
923 | 265 |
\ |] ==> P"; |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
266 |
by (subgoal_tac "(a::'a,b) : r | (? y. (a,y) : r^+ & (y,b) : r)" 1); |
923 | 267 |
by (REPEAT (eresolve_tac ([asm_rl,disjE,exE,conjE]@prems) 1)); |
268 |
by (rtac (rewrite_rule [trancl_def] major RS compEpair) 1); |
|
269 |
by (etac rtranclE 1); |
|
2891 | 270 |
by (Blast_tac 1); |
4089 | 271 |
by (blast_tac (claset() addSIs [rtrancl_into_trancl1]) 1); |
923 | 272 |
qed "tranclE"; |
273 |
||
274 |
(*Transitivity of r^+. |
|
275 |
Proved by unfolding since it uses transitivity of rtrancl. *) |
|
276 |
goalw Trancl.thy [trancl_def] "trans(r^+)"; |
|
277 |
by (rtac transI 1); |
|
278 |
by (REPEAT (etac compEpair 1)); |
|
1122
20b708827030
renamed trans_rtrancl to rtrancl_trans and modified it by expanding trans.
nipkow
parents:
1121
diff
changeset
|
279 |
by (rtac (rtrancl_into_rtrancl RS (rtrancl_trans RS compI)) 1); |
923 | 280 |
by (REPEAT (assume_tac 1)); |
281 |
qed "trans_trancl"; |
|
282 |
||
1642 | 283 |
bind_thm ("trancl_trans", trans_trancl RS transD); |
284 |
||
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
285 |
goalw Trancl.thy [trancl_def] |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
286 |
"!!r. [| (x,y):r^*; (y,z):r^+ |] ==> (x,z):r^+"; |
4089 | 287 |
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
|
288 |
qed "rtrancl_trancl_trancl"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
289 |
|
923 | 290 |
val prems = goal Trancl.thy |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
923
diff
changeset
|
291 |
"[| (a,b) : r; (b,c) : r^+ |] ==> (a,c) : r^+"; |
923 | 292 |
by (rtac (r_into_trancl RS (trans_trancl RS transD)) 1); |
293 |
by (resolve_tac prems 1); |
|
294 |
by (resolve_tac prems 1); |
|
295 |
qed "trancl_into_trancl2"; |
|
296 |
||
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
297 |
(* primitive recursion for trancl over finite relations: *) |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
298 |
goal Trancl.thy "(insert (y,x) r)^+ = r^+ Un {(a,b). (a,y):r^* & (x,b):r^*}"; |
3457 | 299 |
by (rtac equalityI 1); |
300 |
by (rtac subsetI 1); |
|
301 |
by (split_all_tac 1); |
|
302 |
by (etac trancl_induct 1); |
|
4089 | 303 |
by (blast_tac (claset() addIs [r_into_trancl]) 1); |
304 |
by (blast_tac (claset() addIs |
|
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
305 |
[rtrancl_into_trancl1,trancl_into_rtrancl,r_into_trancl,trancl_trans]) 1); |
3457 | 306 |
by (rtac subsetI 1); |
4089 | 307 |
by (blast_tac (claset() addIs |
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
308 |
[rtrancl_into_trancl2, rtrancl_trancl_trancl, |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
309 |
impOfSubs rtrancl_mono, trancl_mono]) 1); |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
310 |
qed "trancl_insert"; |
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
311 |
|
3439 | 312 |
goalw Trancl.thy [trancl_def] "(r^-1)^+ = (r^+)^-1"; |
4746 | 313 |
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
|
314 |
by (simp_tac (simpset() addsimps [rtrancl_converse RS sym,r_comp_rtrancl_eq])1); |
4746 | 315 |
qed "trancl_converse"; |
3413
c1f63cc3a768
Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents:
2935
diff
changeset
|
316 |
|
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
317 |
val irrefl_tranclI = prove_goal Trancl.thy |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
318 |
"!!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
|
319 |
rtac allI 1, |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
320 |
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
|
321 |
Fast_tac 1, |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
322 |
strip_tac 1, |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
323 |
etac trancl_induct 1, |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
324 |
auto_tac (claset() addEs [equals0D, r_into_trancl], simpset())]); |
1130 | 325 |
|
923 | 326 |
val major::prems = goal Trancl.thy |
1642 | 327 |
"[| (a,b) : r^*; r <= A Times A |] ==> a=b | a:A"; |
923 | 328 |
by (cut_facts_tac prems 1); |
329 |
by (rtac (major RS rtrancl_induct) 1); |
|
330 |
by (rtac (refl RS disjI1) 1); |
|
2891 | 331 |
by (Blast_tac 1); |
1642 | 332 |
val lemma = result(); |
923 | 333 |
|
334 |
goalw Trancl.thy [trancl_def] |
|
1642 | 335 |
"!!r. r <= A Times A ==> r^+ <= A Times A"; |
4089 | 336 |
by (blast_tac (claset() addSDs [lemma]) 1); |
923 | 337 |
qed "trancl_subset_Sigma"; |
1130 | 338 |
|
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
339 |
|
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
340 |
goal Trancl.thy "(r^+)^= = r^*"; |
4838 | 341 |
by Safe_tac; |
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
342 |
by (etac trancl_into_rtrancl 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
343 |
by (etac rtranclE 1); |
4772
8c7e7eaffbdf
split_all_tac now fails if there is nothing to split
oheimb
parents:
4764
diff
changeset
|
344 |
by (Auto_tac ); |
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
345 |
by (etac rtrancl_into_trancl1 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
346 |
ba 1; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
347 |
qed "reflcl_trancl"; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
348 |
Addsimps[reflcl_trancl]; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
349 |
|
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
350 |
goal Trancl.thy "(r^=)^+ = r^*"; |
4838 | 351 |
by Safe_tac; |
4764
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
352 |
by (dtac trancl_into_rtrancl 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
353 |
by (Asm_full_simp_tac 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
354 |
by (etac rtranclE 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
355 |
by Safe_tac; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
356 |
by (rtac r_into_trancl 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
357 |
by (Simp_tac 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
358 |
by (rtac rtrancl_into_trancl1 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
359 |
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
|
360 |
by (Fast_tac 1); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
361 |
qed "trancl_reflcl"; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
362 |
Addsimps[trancl_reflcl]; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
363 |
|
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
364 |
qed_goal "trancl_empty" Trancl.thy "{}^+ = {}" |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
365 |
(K [auto_tac (claset() addEs [trancl_induct], simpset())]); |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
366 |
Addsimps[trancl_empty]; |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
367 |
|
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
368 |
qed_goal "rtrancl_empty" Trancl.thy "{}^* = id" |
9b3293646b5d
generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents:
4746
diff
changeset
|
369 |
(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
|
370 |
Addsimps[rtrancl_empty]; |