137 by (fast_tac (comp_cs addIs prems) 1); |
137 by (fast_tac (comp_cs addIs prems) 1); |
138 by (fast_tac (comp_cs addIs prems) 1); |
138 by (fast_tac (comp_cs addIs prems) 1); |
139 qed "rtrancl_induct"; |
139 qed "rtrancl_induct"; |
140 |
140 |
141 (*transitivity of transitive closure!! -- by induction.*) |
141 (*transitivity of transitive closure!! -- by induction.*) |
142 goal Trancl.thy "trans(r^*)"; |
142 goal Trancl.thy "!!r. [| (a,b):r^*; (b,c):r^* |] ==> (a,c):r^*"; |
143 by (rtac transI 1); |
143 by (eres_inst_tac [("b","c")] rtrancl_induct 1); |
144 by (res_inst_tac [("b","z")] rtrancl_induct 1); |
144 by(ALLGOALS(fast_tac (HOL_cs addIs [rtrancl_into_rtrancl]))); |
145 by (DEPTH_SOLVE (eresolve_tac [asm_rl, rtrancl_into_rtrancl] 1)); |
145 qed "rtrancl_trans"; |
146 qed "trans_rtrancl"; |
|
147 |
146 |
148 (*elimination of rtrancl -- by induction on a special formula*) |
147 (*elimination of rtrancl -- by induction on a special formula*) |
149 val major::prems = goal Trancl.thy |
148 val major::prems = goal Trancl.thy |
150 "[| (a::'a,b) : r^*; (a = b) ==> P; \ |
149 "[| (a::'a,b) : r^*; (a = b) ==> P; \ |
151 \ !!y.[| (a,y) : r^*; (y,b) : r |] ==> P \ |
150 \ !!y.[| (a,y) : r^*; (y,b) : r |] ==> P \ |
184 val prems = goal Trancl.thy |
183 val prems = goal Trancl.thy |
185 "[| (a,b) : r; (b,c) : r^* |] ==> (a,c) : r^+"; |
184 "[| (a,b) : r; (b,c) : r^* |] ==> (a,c) : r^+"; |
186 by (resolve_tac (prems RL [rtranclE]) 1); |
185 by (resolve_tac (prems RL [rtranclE]) 1); |
187 by (etac subst 1); |
186 by (etac subst 1); |
188 by (resolve_tac (prems RL [r_into_trancl]) 1); |
187 by (resolve_tac (prems RL [r_into_trancl]) 1); |
189 by (rtac (trans_rtrancl RS transD RS rtrancl_into_trancl1) 1); |
188 by (rtac (rtrancl_trans RS rtrancl_into_trancl1) 1); |
190 by (REPEAT (ares_tac (prems@[r_into_rtrancl]) 1)); |
189 by (REPEAT (ares_tac (prems@[r_into_rtrancl]) 1)); |
191 qed "rtrancl_into_trancl2"; |
190 qed "rtrancl_into_trancl2"; |
192 |
191 |
193 (*elimination of r^+ -- NOT an induction rule*) |
192 (*elimination of r^+ -- NOT an induction rule*) |
194 val major::prems = goal Trancl.thy |
193 val major::prems = goal Trancl.thy |
207 (*Transitivity of r^+. |
206 (*Transitivity of r^+. |
208 Proved by unfolding since it uses transitivity of rtrancl. *) |
207 Proved by unfolding since it uses transitivity of rtrancl. *) |
209 goalw Trancl.thy [trancl_def] "trans(r^+)"; |
208 goalw Trancl.thy [trancl_def] "trans(r^+)"; |
210 by (rtac transI 1); |
209 by (rtac transI 1); |
211 by (REPEAT (etac compEpair 1)); |
210 by (REPEAT (etac compEpair 1)); |
212 by (rtac (rtrancl_into_rtrancl RS (trans_rtrancl RS transD RS compI)) 1); |
211 by (rtac (rtrancl_into_rtrancl RS (rtrancl_trans RS compI)) 1); |
213 by (REPEAT (assume_tac 1)); |
212 by (REPEAT (assume_tac 1)); |
214 qed "trans_trancl"; |
213 qed "trans_trancl"; |
215 |
214 |
216 val prems = goal Trancl.thy |
215 val prems = goal Trancl.thy |
217 "[| (a,b) : r; (b,c) : r^+ |] ==> (a,c) : r^+"; |
216 "[| (a,b) : r; (b,c) : r^+ |] ==> (a,c) : r^+"; |
219 by (resolve_tac prems 1); |
218 by (resolve_tac prems 1); |
220 by (resolve_tac prems 1); |
219 by (resolve_tac prems 1); |
221 qed "trancl_into_trancl2"; |
220 qed "trancl_into_trancl2"; |
222 |
221 |
223 (*More about r^*) |
222 (*More about r^*) |
224 |
|
225 goal Trancl.thy "!!r. (b,c):r^* ==> !a. (a,b):r^* --> (a,c):r^*"; |
|
226 be rtrancl_induct 1; |
|
227 by(ALLGOALS(fast_tac (comp_cs addIs [rtrancl_into_rtrancl]))); |
|
228 bind_thm ("rtrancl_comp", result() RS spec RSN (2,rev_mp)); |
|
229 |
223 |
230 goal Trancl.thy "(r^*)^* = r^*"; |
224 goal Trancl.thy "(r^*)^* = r^*"; |
231 br set_ext 1; |
225 br set_ext 1; |
232 by(res_inst_tac [("p","x")] PairE 1); |
226 by(res_inst_tac [("p","x")] PairE 1); |
233 by(hyp_subst_tac 1); |
227 by(hyp_subst_tac 1); |
234 br iffI 1; |
228 br iffI 1; |
235 be rtrancl_induct 1; |
229 be rtrancl_induct 1; |
236 br rtrancl_refl 1; |
230 br rtrancl_refl 1; |
237 by(fast_tac (HOL_cs addEs [rtrancl_comp]) 1); |
231 by(fast_tac (HOL_cs addEs [rtrancl_trans]) 1); |
238 be r_into_rtrancl 1; |
232 be r_into_rtrancl 1; |
239 qed "rtrancl_idemp"; |
233 qed "rtrancl_idemp"; |
240 |
234 |
241 val major::prems = goal Trancl.thy |
235 val major::prems = goal Trancl.thy |
242 "[| (a,b) : r^*; r <= Sigma A (%x.A) |] ==> a=b | a:A"; |
236 "[| (a,b) : r^*; r <= Sigma A (%x.A) |] ==> a=b | a:A"; |