author  berghofe 
Mon, 21 Jan 2002 14:45:00 +0100  
changeset 12823  9d3f5056296b 
parent 12691  d21db58bcdc2 
child 12937  0c4fd7529467 
permissions  rwrr 
10213  1 
(* Title: HOL/Transitive_Closure.thy 
2 
ID: $Id$ 

3 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory 

4 
Copyright 1992 University of Cambridge 

5 
*) 

6 

12691  7 
header {* Reflexive and Transitive closure of a relation *} 
8 

9 
theory Transitive_Closure = Inductive: 

10 

11 
text {* 

12 
@{text rtrancl} is reflexive/transitive closure, 

13 
@{text trancl} is transitive closure, 

14 
@{text reflcl} is reflexive closure. 

15 

16 
These postfix operators have \emph{maximum priority}, forcing their 

17 
operands to be atomic. 

18 
*} 

10213  19 

11327
cd2c27a23df1
Transitive closure is now defined via "inductive".
berghofe
parents:
11115
diff
changeset

20 
consts 
12691  21 
rtrancl :: "('a \<times> 'a) set => ('a \<times> 'a) set" ("(_^*)" [1000] 999) 
11327
cd2c27a23df1
Transitive closure is now defined via "inductive".
berghofe
parents:
11115
diff
changeset

22 

cd2c27a23df1
Transitive closure is now defined via "inductive".
berghofe
parents:
11115
diff
changeset

23 
inductive "r^*" 
12691  24 
intros 
12823  25 
rtrancl_refl [intro!, CPure.intro!, simp]: "(a, a) : r^*" 
26 
rtrancl_into_rtrancl [CPure.intro]: "(a, b) : r^* ==> (b, c) : r ==> (a, c) : r^*" 

11327
cd2c27a23df1
Transitive closure is now defined via "inductive".
berghofe
parents:
11115
diff
changeset

27 

10213  28 
constdefs 
12691  29 
trancl :: "('a \<times> 'a) set => ('a \<times> 'a) set" ("(_^+)" [1000] 999) 
10331  30 
"r^+ == r O rtrancl r" 
10213  31 

32 
syntax 

12691  33 
"_reflcl" :: "('a \<times> 'a) set => ('a \<times> 'a) set" ("(_^=)" [1000] 999) 
10213  34 
translations 
12691  35 
"r^=" == "r \<union> Id" 
10213  36 

10827  37 
syntax (xsymbols) 
12691  38 
rtrancl :: "('a \<times> 'a) set => ('a \<times> 'a) set" ("(_\\<^sup>*)" [1000] 999) 
39 
trancl :: "('a \<times> 'a) set => ('a \<times> 'a) set" ("(_\\<^sup>+)" [1000] 999) 

40 
"_reflcl" :: "('a \<times> 'a) set => ('a \<times> 'a) set" ("(_\\<^sup>=)" [1000] 999) 

41 

42 

43 
subsection {* Reflexivetransitive closure *} 

44 

45 
lemma r_into_rtrancl [intro]: "!!p. p \<in> r ==> p \<in> r^*" 

46 
 {* @{text rtrancl} of @{text r} contains @{text r} *} 

47 
apply (simp only: split_tupled_all) 

48 
apply (erule rtrancl_refl [THEN rtrancl_into_rtrancl]) 

49 
done 

50 

51 
lemma rtrancl_mono: "r \<subseteq> s ==> r^* \<subseteq> s^*" 

52 
 {* monotonicity of @{text rtrancl} *} 

53 
apply (rule subsetI) 

54 
apply (simp only: split_tupled_all) 

55 
apply (erule rtrancl.induct) 

56 
apply (rule_tac [2] rtrancl_into_rtrancl) 

57 
apply blast+ 

58 
done 

59 

12823  60 
theorem rtrancl_induct [consumes 1, induct set: rtrancl]: 
12691  61 
(assumes a: "(a, b) : r^*" 
62 
and cases: "P a" "!!y z. [ (a, y) : r^*; (y, z) : r; P y ] ==> P z") 

63 
"P b" 

64 
proof  

65 
from a have "a = a > P b" 

12823  66 
by (induct "%x y. x = a > P y" a b) (rules intro: cases)+ 
12691  67 
thus ?thesis by rules 
68 
qed 

69 

70 
ML_setup {* 

71 
bind_thm ("rtrancl_induct2", split_rule 

72 
(read_instantiate [("a","(ax,ay)"), ("b","(bx,by)")] (thm "rtrancl_induct"))); 

73 
*} 

74 

75 
lemma trans_rtrancl: "trans(r^*)" 

76 
 {* transitivity of transitive closure!!  by induction *} 

12823  77 
proof (rule transI) 
78 
fix x y z 

79 
assume "(x, y) \<in> r\<^sup>*" 

80 
assume "(y, z) \<in> r\<^sup>*" 

81 
thus "(x, z) \<in> r\<^sup>*" by induct (rules!)+ 

82 
qed 

12691  83 

84 
lemmas rtrancl_trans = trans_rtrancl [THEN transD, standard] 

85 

86 
lemma rtranclE: 

87 
"[ (a::'a,b) : r^*; (a = b) ==> P; 

88 
!!y.[ (a,y) : r^*; (y,b) : r ] ==> P 

89 
] ==> P" 

90 
 {* elimination of @{text rtrancl}  by induction on a special formula *} 

91 
proof  

92 
assume major: "(a::'a,b) : r^*" 

93 
case rule_context 

94 
show ?thesis 

95 
apply (subgoal_tac "(a::'a) = b  (EX y. (a,y) : r^* & (y,b) : r)") 

96 
apply (rule_tac [2] major [THEN rtrancl_induct]) 

97 
prefer 2 apply (blast!) 

98 
prefer 2 apply (blast!) 

99 
apply (erule asm_rl exE disjE conjE prems)+ 

100 
done 

101 
qed 

102 

12823  103 
lemma converse_rtrancl_into_rtrancl: 
104 
"(a, b) \<in> r \<Longrightarrow> (b, c) \<in> r\<^sup>* \<Longrightarrow> (a, c) \<in> r\<^sup>*" 

105 
by (rule rtrancl_trans) rules+ 

12691  106 

107 
text {* 

108 
\medskip More @{term "r^*"} equations and inclusions. 

109 
*} 

110 

111 
lemma rtrancl_idemp [simp]: "(r^*)^* = r^*" 

112 
apply auto 

113 
apply (erule rtrancl_induct) 

114 
apply (rule rtrancl_refl) 

115 
apply (blast intro: rtrancl_trans) 

116 
done 

117 

118 
lemma rtrancl_idemp_self_comp [simp]: "R^* O R^* = R^*" 

119 
apply (rule set_ext) 

120 
apply (simp only: split_tupled_all) 

121 
apply (blast intro: rtrancl_trans) 

122 
done 

123 

124 
lemma rtrancl_subset_rtrancl: "r \<subseteq> s^* ==> r^* \<subseteq> s^*" 

125 
apply (drule rtrancl_mono) 

126 
apply simp 

127 
done 

128 

129 
lemma rtrancl_subset: "R \<subseteq> S ==> S \<subseteq> R^* ==> S^* = R^*" 

130 
apply (drule rtrancl_mono) 

131 
apply (drule rtrancl_mono) 

132 
apply simp 

133 
apply blast 

134 
done 

135 

136 
lemma rtrancl_Un_rtrancl: "(R^* \<union> S^*)^* = (R \<union> S)^*" 

137 
by (blast intro!: rtrancl_subset intro: r_into_rtrancl rtrancl_mono [THEN subsetD]) 

138 

139 
lemma rtrancl_reflcl [simp]: "(R^=)^* = R^*" 

140 
by (blast intro!: rtrancl_subset intro: r_into_rtrancl) 

141 

142 
lemma rtrancl_r_diff_Id: "(r  Id)^* = r^*" 

143 
apply (rule sym) 

144 
apply (rule rtrancl_subset) 

145 
apply blast 

146 
apply clarify 

147 
apply (rename_tac a b) 

148 
apply (case_tac "a = b") 

149 
apply blast 

150 
apply (blast intro!: r_into_rtrancl) 

151 
done 

152 

12823  153 
theorem rtrancl_converseD: 
154 
(assumes r: "(x, y) \<in> (r^1)^*") "(y, x) \<in> r^*" 

155 
proof  

156 
from r show ?thesis 

157 
by induct (rules intro: rtrancl_trans dest!: converseD)+ 

158 
qed 

12691  159 

12823  160 
theorem rtrancl_converseI: 
161 
(assumes r: "(y, x) \<in> r^*") "(x, y) \<in> (r^1)^*" 

162 
proof  

163 
from r show ?thesis 

164 
by induct (rules intro: rtrancl_trans converseI)+ 

165 
qed 

12691  166 

167 
lemma rtrancl_converse: "(r^1)^* = (r^*)^1" 

168 
by (fast dest!: rtrancl_converseD intro!: rtrancl_converseI) 

169 

12823  170 
theorem converse_rtrancl_induct: 
171 
(assumes major: "(a, b) : r^*" 

172 
and cases: "P b" "!!y z. [ (y, z) : r; (z, b) : r^*; P z ] ==> P y") 

173 
"P a" 

12691  174 
proof  
12823  175 
from rtrancl_converseI [OF major] 
12691  176 
show ?thesis 
12823  177 
by induct (rules intro: cases dest!: converseD rtrancl_converseD)+ 
12691  178 
qed 
179 

180 
ML_setup {* 

181 
bind_thm ("converse_rtrancl_induct2", split_rule 

182 
(read_instantiate [("a","(ax,ay)"),("b","(bx,by)")] (thm "converse_rtrancl_induct"))); 

183 
*} 

184 

185 
lemma converse_rtranclE: 

186 
"[ (x,z):r^*; 

187 
x=z ==> P; 

188 
!!y. [ (x,y):r; (y,z):r^* ] ==> P 

189 
] ==> P" 

190 
proof  

191 
assume major: "(x,z):r^*" 

192 
case rule_context 

193 
show ?thesis 

194 
apply (subgoal_tac "x = z  (EX y. (x,y) : r & (y,z) : r^*)") 

195 
apply (rule_tac [2] major [THEN converse_rtrancl_induct]) 

196 
prefer 2 apply (blast!) 

197 
prefer 2 apply (blast!) 

198 
apply (erule asm_rl exE disjE conjE prems)+ 

199 
done 

200 
qed 

201 

202 
ML_setup {* 

203 
bind_thm ("converse_rtranclE2", split_rule 

204 
(read_instantiate [("x","(xa,xb)"), ("z","(za,zb)")] (thm "converse_rtranclE"))); 

205 
*} 

206 

207 
lemma r_comp_rtrancl_eq: "r O r^* = r^* O r" 

208 
by (blast elim: rtranclE converse_rtranclE 

209 
intro: rtrancl_into_rtrancl converse_rtrancl_into_rtrancl) 

210 

211 

212 
subsection {* Transitive closure *} 

10331  213 

12691  214 
lemma trancl_mono: "p \<in> r^+ ==> r \<subseteq> s ==> p \<in> s^+" 
215 
apply (unfold trancl_def) 

216 
apply (blast intro: rtrancl_mono [THEN subsetD]) 

217 
done 

218 

219 
text {* 

220 
\medskip Conversions between @{text trancl} and @{text rtrancl}. 

221 
*} 

222 

223 
lemma trancl_into_rtrancl: "!!p. p \<in> r^+ ==> p \<in> r^*" 

224 
apply (unfold trancl_def) 

225 
apply (simp only: split_tupled_all) 

226 
apply (erule rel_compEpair) 

227 
apply (assumption  rule rtrancl_into_rtrancl)+ 

228 
done 

229 

230 
lemma r_into_trancl [intro]: "!!p. p \<in> r ==> p \<in> r^+" 

231 
 {* @{text "r^+"} contains @{text r} *} 

232 
apply (unfold trancl_def) 

233 
apply (simp only: split_tupled_all) 

234 
apply (assumption  rule rel_compI rtrancl_refl)+ 

235 
done 

236 

237 
lemma rtrancl_into_trancl1: "(a, b) \<in> r^* ==> (b, c) \<in> r ==> (a, c) \<in> r^+" 

238 
 {* intro rule by definition: from @{text rtrancl} and @{text r} *} 

239 
by (auto simp add: trancl_def) 

240 

241 
lemma rtrancl_into_trancl2: "[ (a,b) : r; (b,c) : r^* ] ==> (a,c) : r^+" 

242 
 {* intro rule from @{text r} and @{text rtrancl} *} 

243 
apply (erule rtranclE) 

244 
apply (blast intro: r_into_trancl) 

245 
apply (rule rtrancl_trans [THEN rtrancl_into_trancl1]) 

246 
apply (assumption  rule r_into_rtrancl)+ 

247 
done 

248 

249 
lemma trancl_induct: 

250 
"[ (a,b) : r^+; 

251 
!!y. [ (a,y) : r ] ==> P(y); 

252 
!!y z.[ (a,y) : r^+; (y,z) : r; P(y) ] ==> P(z) 

253 
] ==> P(b)" 

254 
 {* Nice induction rule for @{text trancl} *} 

255 
proof  

256 
assume major: "(a, b) : r^+" 

257 
case rule_context 

258 
show ?thesis 

259 
apply (rule major [unfolded trancl_def, THEN rel_compEpair]) 

260 
txt {* by induction on this formula *} 

261 
apply (subgoal_tac "ALL z. (y,z) : r > P (z)") 

262 
txt {* now solve first subgoal: this formula is sufficient *} 

263 
apply blast 

264 
apply (erule rtrancl_induct) 

265 
apply (blast intro: rtrancl_into_trancl1 prems)+ 

266 
done 

267 
qed 

268 

269 
lemma trancl_trans_induct: 

270 
"[ (x,y) : r^+; 

271 
!!x y. (x,y) : r ==> P x y; 

272 
!!x y z. [ (x,y) : r^+; P x y; (y,z) : r^+; P y z ] ==> P x z 

273 
] ==> P x y" 

274 
 {* Another induction rule for trancl, incorporating transitivity *} 

275 
proof  

276 
assume major: "(x,y) : r^+" 

277 
case rule_context 

278 
show ?thesis 

279 
by (blast intro: r_into_trancl major [THEN trancl_induct] prems) 

280 
qed 

281 

282 
lemma tranclE: 

283 
"[ (a::'a,b) : r^+; 

284 
(a,b) : r ==> P; 

285 
!!y.[ (a,y) : r^+; (y,b) : r ] ==> P 

286 
] ==> P" 

287 
 {* elimination of @{text "r^+"}  \emph{not} an induction rule *} 

288 
proof  

289 
assume major: "(a::'a,b) : r^+" 

290 
case rule_context 

291 
show ?thesis 

292 
apply (subgoal_tac "(a::'a, b) : r  (EX y. (a,y) : r^+ & (y,b) : r)") 

293 
apply (erule asm_rl disjE exE conjE prems)+ 

294 
apply (rule major [unfolded trancl_def, THEN rel_compEpair]) 

295 
apply (erule rtranclE) 

296 
apply blast 

297 
apply (blast intro!: rtrancl_into_trancl1) 

298 
done 

299 
qed 

10980  300 

12691  301 
lemma trans_trancl: "trans(r^+)" 
302 
 {* Transitivity of @{term "r^+"} *} 

303 
 {* Proved by unfolding since it uses transitivity of @{text rtrancl} *} 

304 
apply (unfold trancl_def) 

305 
apply (rule transI) 

306 
apply (erule rel_compEpair)+ 

307 
apply (rule rtrancl_into_rtrancl [THEN rtrancl_trans [THEN rel_compI]]) 

308 
apply assumption+ 

309 
done 

310 

311 
lemmas trancl_trans = trans_trancl [THEN transD, standard] 

312 

313 
lemma rtrancl_trancl_trancl: "(x, y) \<in> r^* ==> (y, z) \<in> r^+ ==> (x, z) \<in> r^+" 

314 
apply (unfold trancl_def) 

315 
apply (blast intro: rtrancl_trans) 

316 
done 

317 

318 
lemma trancl_into_trancl2: "(a, b) \<in> r ==> (b, c) \<in> r^+ ==> (a, c) \<in> r^+" 

319 
by (erule transD [OF trans_trancl r_into_trancl]) 

320 

321 
lemma trancl_insert: 

322 
"(insert (y, x) r)^+ = r^+ \<union> {(a, b). (a, y) \<in> r^* \<and> (x, b) \<in> r^*}" 

323 
 {* primitive recursion for @{text trancl} over finite relations *} 

324 
apply (rule equalityI) 

325 
apply (rule subsetI) 

326 
apply (simp only: split_tupled_all) 

327 
apply (erule trancl_induct) 

328 
apply blast 

329 
apply (blast intro: rtrancl_into_trancl1 trancl_into_rtrancl r_into_trancl trancl_trans) 

330 
apply (rule subsetI) 

331 
apply (blast intro: trancl_mono rtrancl_mono 

332 
[THEN [2] rev_subsetD] rtrancl_trancl_trancl rtrancl_into_trancl2) 

333 
done 

334 

335 
lemma trancl_converse: "(r^1)^+ = (r^+)^1" 

336 
apply (unfold trancl_def) 

337 
apply (simp add: rtrancl_converse converse_rel_comp) 

338 
apply (simp add: rtrancl_converse [symmetric] r_comp_rtrancl_eq) 

339 
done 

340 

341 
lemma trancl_converseI: "(x, y) \<in> (r^+)^1 ==> (x,y) \<in> (r^1)^+" 

342 
by (simp add: trancl_converse) 

343 

344 
lemma trancl_converseD: "(x, y) \<in> (r^1)^+ ==> (x, y) \<in> (r^+)^1" 

345 
by (simp add: trancl_converse) 

346 

347 
lemma converse_trancl_induct: 

348 
"[ (a,b) : r^+; !!y. (y,b) : r ==> P(y); 

349 
!!y z.[ (y,z) : r; (z,b) : r^+; P(z) ] ==> P(y) ] 

350 
==> P(a)" 

351 
proof  

352 
assume major: "(a,b) : r^+" 

353 
case rule_context 

354 
show ?thesis 

355 
apply (rule major [THEN converseI, THEN trancl_converseI [THEN trancl_induct]]) 

356 
apply (rule prems) 

357 
apply (erule converseD) 

358 
apply (blast intro: prems dest!: trancl_converseD) 

359 
done 

360 
qed 

361 

362 
lemma tranclD: "(x, y) \<in> R^+ ==> EX z. (x, z) \<in> R \<and> (z, y) \<in> R^*" 

363 
apply (erule converse_trancl_induct) 

364 
apply auto 

365 
apply (blast intro: rtrancl_trans) 

366 
done 

367 

368 
lemma irrefl_tranclI: "r^1 \<inter> r^+ = {} ==> (x, x) \<notin> r^+" 

369 
apply (subgoal_tac "ALL y. (x, y) : r^+ > x \<noteq> y") 

370 
apply fast 

371 
apply (intro strip) 

372 
apply (erule trancl_induct) 

373 
apply (auto intro: r_into_trancl) 

374 
done 

375 

376 
lemma irrefl_trancl_rD: "!!X. ALL x. (x, x) \<notin> r^+ ==> (x, y) \<in> r ==> x \<noteq> y" 

377 
by (blast dest: r_into_trancl) 

378 

379 
lemma trancl_subset_Sigma_aux: 

380 
"(a, b) \<in> r^* ==> r \<subseteq> A \<times> A ==> a = b \<or> a \<in> A" 

381 
apply (erule rtrancl_induct) 

382 
apply auto 

383 
done 

384 

385 
lemma trancl_subset_Sigma: "r \<subseteq> A \<times> A ==> r^+ \<subseteq> A \<times> A" 

386 
apply (unfold trancl_def) 

387 
apply (blast dest!: trancl_subset_Sigma_aux) 

388 
done 

10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

389 

11090  390 
lemma reflcl_trancl [simp]: "(r^+)^= = r^*" 
11084  391 
apply safe 
12691  392 
apply (erule trancl_into_rtrancl) 
11084  393 
apply (blast elim: rtranclE dest: rtrancl_into_trancl1) 
394 
done 

10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

395 

11090  396 
lemma trancl_reflcl [simp]: "(r^=)^+ = r^*" 
11084  397 
apply safe 
398 
apply (drule trancl_into_rtrancl) 

399 
apply simp 

400 
apply (erule rtranclE) 

401 
apply safe 

402 
apply (rule r_into_trancl) 

403 
apply simp 

404 
apply (rule rtrancl_into_trancl1) 

405 
apply (erule rtrancl_reflcl [THEN equalityD2, THEN subsetD]) 

406 
apply fast 

407 
done 

10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

408 

11090  409 
lemma trancl_empty [simp]: "{}^+ = {}" 
11084  410 
by (auto elim: trancl_induct) 
10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

411 

11090  412 
lemma rtrancl_empty [simp]: "{}^* = Id" 
11084  413 
by (rule subst [OF reflcl_trancl]) simp 
10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

414 

11090  415 
lemma rtranclD: "(a, b) \<in> R^* ==> a = b \<or> a \<noteq> b \<and> (a, b) \<in> R^+" 
11084  416 
by (force simp add: reflcl_trancl [symmetric] simp del: reflcl_trancl) 
417 

10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

418 

12691  419 
text {* @{text Domain} and @{text Range} *} 
10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

420 

11090  421 
lemma Domain_rtrancl [simp]: "Domain (R^*) = UNIV" 
11084  422 
by blast 
10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

423 

11090  424 
lemma Range_rtrancl [simp]: "Range (R^*) = UNIV" 
11084  425 
by blast 
10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

426 

11090  427 
lemma rtrancl_Un_subset: "(R^* \<union> S^*) \<subseteq> (R Un S)^*" 
11084  428 
by (rule rtrancl_Un_rtrancl [THEN subst]) fast 
10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

429 

11090  430 
lemma in_rtrancl_UnI: "x \<in> R^* \<or> x \<in> S^* ==> x \<in> (R \<union> S)^*" 
11084  431 
by (blast intro: subsetD [OF rtrancl_Un_subset]) 
10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

432 

11090  433 
lemma trancl_domain [simp]: "Domain (r^+) = Domain r" 
11084  434 
by (unfold Domain_def) (blast dest: tranclD) 
10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

435 

11090  436 
lemma trancl_range [simp]: "Range (r^+) = Range r" 
11084  437 
by (simp add: Range_def trancl_converse [symmetric]) 
10996
74e970389def
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow
parents:
10980
diff
changeset

438 

11115  439 
lemma Not_Domain_rtrancl: 
12691  440 
"x ~: Domain R ==> ((x, y) : R^*) = (x = y)" 
441 
apply auto 

442 
by (erule rev_mp, erule rtrancl_induct, auto) 

443 

11327
cd2c27a23df1
Transitive closure is now defined via "inductive".
berghofe
parents:
11115
diff
changeset

444 

12691  445 
text {* More about converse @{text rtrancl} and @{text trancl}, should 
446 
be merged with main body. *} 

12428
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

447 

12691  448 
lemma r_r_into_trancl: "(a, b) \<in> R ==> (b, c) \<in> R ==> (a, c) \<in> R^+" 
12428
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

449 
by (fast intro: trancl_trans) 
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

450 

f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

451 
lemma trancl_into_trancl [rule_format]: 
12691  452 
"(a, b) \<in> r\<^sup>+ ==> (b, c) \<in> r > (a,c) \<in> r\<^sup>+" 
453 
apply (erule trancl_induct) 

12428
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

454 
apply (fast intro: r_r_into_trancl) 
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

455 
apply (fast intro: r_r_into_trancl trancl_trans) 
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

456 
done 
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

457 

f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

458 
lemma trancl_rtrancl_trancl: 
12691  459 
"(a, b) \<in> r\<^sup>+ ==> (b, c) \<in> r\<^sup>* ==> (a, c) \<in> r\<^sup>+" 
12428
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

460 
apply (drule tranclD) 
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

461 
apply (erule exE, erule conjE) 
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

462 
apply (drule rtrancl_trans, assumption) 
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

463 
apply (drule rtrancl_into_trancl2, assumption) 
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

464 
apply assumption 
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

465 
done 
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

466 

12691  467 
lemmas transitive_closure_trans [trans] = 
468 
r_r_into_trancl trancl_trans rtrancl_trans 

469 
trancl_into_trancl trancl_into_trancl2 

470 
rtrancl_into_rtrancl converse_rtrancl_into_rtrancl 

471 
rtrancl_trancl_trancl trancl_rtrancl_trancl 

12428
f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

472 

f3033eed309a
setup [trans] rules for calculational Isar reasoning
kleing
parents:
11327
diff
changeset

473 
declare trancl_into_rtrancl [elim] 
11327
cd2c27a23df1
Transitive closure is now defined via "inductive".
berghofe
parents:
11115
diff
changeset

474 

cd2c27a23df1
Transitive closure is now defined via "inductive".
berghofe
parents:
11115
diff
changeset

475 
declare rtranclE [cases set: rtrancl] 
cd2c27a23df1
Transitive closure is now defined via "inductive".
berghofe
parents:
11115
diff
changeset

476 
declare trancl_induct [induct set: trancl] 
cd2c27a23df1
Transitive closure is now defined via "inductive".
berghofe
parents:
11115
diff
changeset

477 
declare tranclE [cases set: trancl] 
cd2c27a23df1
Transitive closure is now defined via "inductive".
berghofe
parents:
11115
diff
changeset

478 

10213  479 
end 