src/HOL/Transitive_Closure.ML
author nipkow
Thu Oct 12 18:44:35 2000 +0200 (2000-10-12)
changeset 10213 01c2744a3786
permissions -rw-r--r--
*** empty log message ***
nipkow@10213
     1
(*  Title:      HOL/Transitive_Closure
nipkow@10213
     2
    ID:         $Id$
nipkow@10213
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
nipkow@10213
     4
    Copyright   1992  University of Cambridge
nipkow@10213
     5
nipkow@10213
     6
Theorems about the transitive closure of a relation
nipkow@10213
     7
*)
nipkow@10213
     8
nipkow@10213
     9
(** The relation rtrancl **)
nipkow@10213
    10
nipkow@10213
    11
section "^*";
nipkow@10213
    12
nipkow@10213
    13
Goal "mono(%s. Id Un (r O s))";
nipkow@10213
    14
by (rtac monoI 1);
nipkow@10213
    15
by (REPEAT (ares_tac [monoI, subset_refl, comp_mono, Un_mono] 1));
nipkow@10213
    16
qed "rtrancl_fun_mono";
nipkow@10213
    17
nipkow@10213
    18
bind_thm ("rtrancl_unfold", rtrancl_fun_mono RS (rtrancl_def RS def_lfp_unfold));
nipkow@10213
    19
nipkow@10213
    20
(*Reflexivity of rtrancl*)
nipkow@10213
    21
Goal "(a,a) : r^*";
nipkow@10213
    22
by (stac rtrancl_unfold 1);
nipkow@10213
    23
by (Blast_tac 1);
nipkow@10213
    24
qed "rtrancl_refl";
nipkow@10213
    25
nipkow@10213
    26
Addsimps [rtrancl_refl];
nipkow@10213
    27
AddSIs   [rtrancl_refl];
nipkow@10213
    28
nipkow@10213
    29
nipkow@10213
    30
(*Closure under composition with r*)
nipkow@10213
    31
Goal "[| (a,b) : r^*;  (b,c) : r |] ==> (a,c) : r^*";
nipkow@10213
    32
by (stac rtrancl_unfold 1);
nipkow@10213
    33
by (Blast_tac 1);
nipkow@10213
    34
qed "rtrancl_into_rtrancl";
nipkow@10213
    35
nipkow@10213
    36
(*rtrancl of r contains r*)
nipkow@10213
    37
Goal "!!p. p : r ==> p : r^*";
nipkow@10213
    38
by (split_all_tac 1);
nipkow@10213
    39
by (etac (rtrancl_refl RS rtrancl_into_rtrancl) 1);
nipkow@10213
    40
qed "r_into_rtrancl";
nipkow@10213
    41
nipkow@10213
    42
AddIs [r_into_rtrancl];
nipkow@10213
    43
nipkow@10213
    44
(*monotonicity of rtrancl*)
nipkow@10213
    45
Goalw [rtrancl_def] "r <= s ==> r^* <= s^*";
nipkow@10213
    46
by (REPEAT(ares_tac [lfp_mono,Un_mono,comp_mono,subset_refl] 1));
nipkow@10213
    47
qed "rtrancl_mono";
nipkow@10213
    48
nipkow@10213
    49
(** standard induction rule **)
nipkow@10213
    50
nipkow@10213
    51
val major::prems = Goal 
nipkow@10213
    52
  "[| (a,b) : r^*; \
nipkow@10213
    53
\     !!x. P(x,x); \
nipkow@10213
    54
\     !!x y z.[| P(x,y); (x,y): r^*; (y,z): r |]  ==>  P(x,z) |] \
nipkow@10213
    55
\  ==>  P(a,b)";
nipkow@10213
    56
by (rtac ([rtrancl_def, rtrancl_fun_mono, major] MRS def_lfp_induct) 1);
nipkow@10213
    57
by (blast_tac (claset() addIs prems) 1);
nipkow@10213
    58
qed "rtrancl_full_induct";
nipkow@10213
    59
nipkow@10213
    60
(*nice induction rule*)
nipkow@10213
    61
val major::prems = Goal
nipkow@10213
    62
    "[| (a::'a,b) : r^*;    \
nipkow@10213
    63
\       P(a); \
nipkow@10213
    64
\       !!y z.[| (a,y) : r^*;  (y,z) : r;  P(y) |] ==> P(z) |]  \
nipkow@10213
    65
\     ==> P(b)";
nipkow@10213
    66
(*by induction on this formula*)
nipkow@10213
    67
by (subgoal_tac "! y. (a::'a,b) = (a,y) --> P(y)" 1);
nipkow@10213
    68
(*now solve first subgoal: this formula is sufficient*)
nipkow@10213
    69
by (Blast_tac 1);
nipkow@10213
    70
(*now do the induction*)
nipkow@10213
    71
by (resolve_tac [major RS rtrancl_full_induct] 1);
nipkow@10213
    72
by (blast_tac (claset() addIs prems) 1);
nipkow@10213
    73
by (blast_tac (claset() addIs prems) 1);
nipkow@10213
    74
qed "rtrancl_induct";
nipkow@10213
    75
nipkow@10213
    76
bind_thm ("rtrancl_induct2", split_rule
nipkow@10213
    77
  (read_instantiate [("a","(ax,ay)"), ("b","(bx,by)")] rtrancl_induct));
nipkow@10213
    78
nipkow@10213
    79
(*transitivity of transitive closure!! -- by induction.*)
nipkow@10213
    80
Goalw [trans_def] "trans(r^*)";
nipkow@10213
    81
by Safe_tac;
nipkow@10213
    82
by (eres_inst_tac [("b","z")] rtrancl_induct 1);
nipkow@10213
    83
by (ALLGOALS(blast_tac (claset() addIs [rtrancl_into_rtrancl])));
nipkow@10213
    84
qed "trans_rtrancl";
nipkow@10213
    85
nipkow@10213
    86
bind_thm ("rtrancl_trans", trans_rtrancl RS transD);
nipkow@10213
    87
nipkow@10213
    88
nipkow@10213
    89
(*elimination of rtrancl -- by induction on a special formula*)
nipkow@10213
    90
val major::prems = Goal
nipkow@10213
    91
    "[| (a::'a,b) : r^*;  (a = b) ==> P;        \
nipkow@10213
    92
\       !!y.[| (a,y) : r^*; (y,b) : r |] ==> P  \
nipkow@10213
    93
\    |] ==> P";
nipkow@10213
    94
by (subgoal_tac "(a::'a) = b  | (? y. (a,y) : r^* & (y,b) : r)" 1);
nipkow@10213
    95
by (rtac (major RS rtrancl_induct) 2);
nipkow@10213
    96
by (blast_tac (claset() addIs prems) 2);
nipkow@10213
    97
by (blast_tac (claset() addIs prems) 2);
nipkow@10213
    98
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1));
nipkow@10213
    99
qed "rtranclE";
nipkow@10213
   100
nipkow@10213
   101
bind_thm ("rtrancl_into_rtrancl2", r_into_rtrancl RS rtrancl_trans);
nipkow@10213
   102
nipkow@10213
   103
(*** More r^* equations and inclusions ***)
nipkow@10213
   104
nipkow@10213
   105
Goal "(r^*)^* = r^*";
nipkow@10213
   106
by Auto_tac;
nipkow@10213
   107
by (etac rtrancl_induct 1);
nipkow@10213
   108
by (rtac rtrancl_refl 1);
nipkow@10213
   109
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
nipkow@10213
   110
qed "rtrancl_idemp";
nipkow@10213
   111
Addsimps [rtrancl_idemp];
nipkow@10213
   112
nipkow@10213
   113
Goal "R^* O R^* = R^*";
nipkow@10213
   114
by (rtac set_ext 1);
nipkow@10213
   115
by (split_all_tac 1);
nipkow@10213
   116
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
nipkow@10213
   117
qed "rtrancl_idemp_self_comp";
nipkow@10213
   118
Addsimps [rtrancl_idemp_self_comp];
nipkow@10213
   119
nipkow@10213
   120
Goal "r <= s^* ==> r^* <= s^*";
nipkow@10213
   121
by (dtac rtrancl_mono 1);
nipkow@10213
   122
by (Asm_full_simp_tac 1);
nipkow@10213
   123
qed "rtrancl_subset_rtrancl";
nipkow@10213
   124
nipkow@10213
   125
Goal "[| R <= S; S <= R^* |] ==> S^* = R^*";
nipkow@10213
   126
by (dtac rtrancl_mono 1);
nipkow@10213
   127
by (dtac rtrancl_mono 1);
nipkow@10213
   128
by (Asm_full_simp_tac 1);
nipkow@10213
   129
by (Blast_tac 1);
nipkow@10213
   130
qed "rtrancl_subset";
nipkow@10213
   131
nipkow@10213
   132
Goal "(R^* Un S^*)^* = (R Un S)^*";
nipkow@10213
   133
by (blast_tac (claset() addSIs [rtrancl_subset]
nipkow@10213
   134
                        addIs [r_into_rtrancl, rtrancl_mono RS subsetD]) 1);
nipkow@10213
   135
qed "rtrancl_Un_rtrancl";
nipkow@10213
   136
nipkow@10213
   137
Goal "(R^=)^* = R^*";
nipkow@10213
   138
by (blast_tac (claset() addSIs [rtrancl_subset] addIs [r_into_rtrancl]) 1);
nipkow@10213
   139
qed "rtrancl_reflcl";
nipkow@10213
   140
Addsimps [rtrancl_reflcl];
nipkow@10213
   141
nipkow@10213
   142
Goal "(r - Id)^* = r^*";
nipkow@10213
   143
by (rtac sym 1);
nipkow@10213
   144
by (rtac rtrancl_subset 1);
nipkow@10213
   145
 by (Blast_tac 1);
nipkow@10213
   146
by (Clarify_tac 1);
nipkow@10213
   147
by (rename_tac "a b" 1);
nipkow@10213
   148
by (case_tac "a=b" 1);
nipkow@10213
   149
 by (Blast_tac 1);
nipkow@10213
   150
by (blast_tac (claset() addSIs [r_into_rtrancl]) 1);
nipkow@10213
   151
qed "rtrancl_r_diff_Id";
nipkow@10213
   152
nipkow@10213
   153
Goal "(x,y) : (r^-1)^* ==> (y,x) : r^*";
nipkow@10213
   154
by (etac rtrancl_induct 1);
nipkow@10213
   155
by (rtac rtrancl_refl 1);
nipkow@10213
   156
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
nipkow@10213
   157
qed "rtrancl_converseD";
nipkow@10213
   158
nipkow@10213
   159
Goal "(y,x) : r^* ==> (x,y) : (r^-1)^*";
nipkow@10213
   160
by (etac rtrancl_induct 1);
nipkow@10213
   161
by (rtac rtrancl_refl 1);
nipkow@10213
   162
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
nipkow@10213
   163
qed "rtrancl_converseI";
nipkow@10213
   164
nipkow@10213
   165
Goal "(r^-1)^* = (r^*)^-1";
nipkow@10213
   166
(*blast_tac fails: the split_all_tac wrapper must be called to convert
nipkow@10213
   167
  the set element to a pair*)
nipkow@10213
   168
by (safe_tac (claset() addSDs [rtrancl_converseD] addSIs [rtrancl_converseI]));
nipkow@10213
   169
qed "rtrancl_converse";
nipkow@10213
   170
nipkow@10213
   171
val major::prems = Goal
nipkow@10213
   172
    "[| (a,b) : r^*; P(b); \
nipkow@10213
   173
\       !!y z.[| (y,z) : r;  (z,b) : r^*;  P(z) |] ==> P(y) |]  \
nipkow@10213
   174
\     ==> P(a)";
nipkow@10213
   175
by (rtac (major RS rtrancl_converseI RS rtrancl_induct) 1);
nipkow@10213
   176
by (resolve_tac prems 1);
nipkow@10213
   177
by (blast_tac (claset() addIs prems addSDs[rtrancl_converseD])1);
nipkow@10213
   178
qed "converse_rtrancl_induct";
nipkow@10213
   179
nipkow@10213
   180
bind_thm ("converse_rtrancl_induct2", split_rule
nipkow@10213
   181
  (read_instantiate [("a","(ax,ay)"),("b","(bx,by)")]converse_rtrancl_induct));
nipkow@10213
   182
nipkow@10213
   183
val major::prems = Goal
nipkow@10213
   184
 "[| (x,z):r^*; \
nipkow@10213
   185
\    x=z ==> P; \
nipkow@10213
   186
\    !!y. [| (x,y):r; (y,z):r^* |] ==> P \
nipkow@10213
   187
\ |] ==> P";
nipkow@10213
   188
by (subgoal_tac "x = z  | (? y. (x,y) : r & (y,z) : r^*)" 1);
nipkow@10213
   189
by (rtac (major RS converse_rtrancl_induct) 2);
nipkow@10213
   190
by (blast_tac (claset() addIs prems) 2);
nipkow@10213
   191
by (blast_tac (claset() addIs prems) 2);
nipkow@10213
   192
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1));
nipkow@10213
   193
qed "converse_rtranclE";
nipkow@10213
   194
nipkow@10213
   195
bind_thm ("converse_rtranclE2", split_rule
nipkow@10213
   196
  (read_instantiate [("x","(xa,xb)"), ("z","(za,zb)")] converse_rtranclE));
nipkow@10213
   197
nipkow@10213
   198
Goal "r O r^* = r^* O r";
nipkow@10213
   199
by (blast_tac (claset() addEs [rtranclE, converse_rtranclE] 
nipkow@10213
   200
	               addIs [rtrancl_into_rtrancl, rtrancl_into_rtrancl2]) 1);
nipkow@10213
   201
qed "r_comp_rtrancl_eq";
nipkow@10213
   202
nipkow@10213
   203
nipkow@10213
   204
(**** The relation trancl ****)
nipkow@10213
   205
nipkow@10213
   206
section "^+";
nipkow@10213
   207
nipkow@10213
   208
Goalw [trancl_def] "[| p:r^+; r <= s |] ==> p:s^+";
nipkow@10213
   209
by (blast_tac (claset() addIs [rtrancl_mono RS subsetD]) 1);
nipkow@10213
   210
qed "trancl_mono";
nipkow@10213
   211
nipkow@10213
   212
(** Conversions between trancl and rtrancl **)
nipkow@10213
   213
nipkow@10213
   214
Goalw [trancl_def]
nipkow@10213
   215
    "!!p. p : r^+ ==> p : r^*";
nipkow@10213
   216
by (split_all_tac 1);
nipkow@10213
   217
by (etac compEpair 1);
nipkow@10213
   218
by (REPEAT (ares_tac [rtrancl_into_rtrancl] 1));
nipkow@10213
   219
qed "trancl_into_rtrancl";
nipkow@10213
   220
nipkow@10213
   221
(*r^+ contains r*)
nipkow@10213
   222
Goalw [trancl_def]
nipkow@10213
   223
   "!!p. p : r ==> p : r^+";
nipkow@10213
   224
by (split_all_tac 1);
nipkow@10213
   225
by (REPEAT (ares_tac [prem,compI,rtrancl_refl] 1));
nipkow@10213
   226
qed "r_into_trancl";
nipkow@10213
   227
AddIs [r_into_trancl];
nipkow@10213
   228
nipkow@10213
   229
(*intro rule by definition: from rtrancl and r*)
nipkow@10213
   230
Goalw [trancl_def] "[| (a,b) : r^*;  (b,c) : r |]   ==>  (a,c) : r^+";
nipkow@10213
   231
by Auto_tac;
nipkow@10213
   232
qed "rtrancl_into_trancl1";
nipkow@10213
   233
nipkow@10213
   234
(*intro rule from r and rtrancl*)
nipkow@10213
   235
Goal "[| (a,b) : r;  (b,c) : r^* |]   ==>  (a,c) : r^+";
nipkow@10213
   236
by (etac rtranclE 1);
nipkow@10213
   237
by (blast_tac (claset() addIs [r_into_trancl]) 1);
nipkow@10213
   238
by (rtac (rtrancl_trans RS rtrancl_into_trancl1) 1);
nipkow@10213
   239
by (REPEAT (ares_tac [r_into_rtrancl] 1));
nipkow@10213
   240
qed "rtrancl_into_trancl2";
nipkow@10213
   241
nipkow@10213
   242
(*Nice induction rule for trancl*)
nipkow@10213
   243
val major::prems = Goal
nipkow@10213
   244
  "[| (a,b) : r^+;                                      \
nipkow@10213
   245
\     !!y.  [| (a,y) : r |] ==> P(y);                   \
nipkow@10213
   246
\     !!y z.[| (a,y) : r^+;  (y,z) : r;  P(y) |] ==> P(z)       \
nipkow@10213
   247
\  |] ==> P(b)";
nipkow@10213
   248
by (rtac (rewrite_rule [trancl_def] major  RS  compEpair) 1);
nipkow@10213
   249
(*by induction on this formula*)
nipkow@10213
   250
by (subgoal_tac "ALL z. (y,z) : r --> P(z)" 1);
nipkow@10213
   251
(*now solve first subgoal: this formula is sufficient*)
nipkow@10213
   252
by (Blast_tac 1);
nipkow@10213
   253
by (etac rtrancl_induct 1);
nipkow@10213
   254
by (ALLGOALS (blast_tac (claset() addIs (rtrancl_into_trancl1::prems))));
nipkow@10213
   255
qed "trancl_induct";
nipkow@10213
   256
nipkow@10213
   257
(*Another induction rule for trancl, incorporating transitivity.*)
nipkow@10213
   258
val major::prems = Goal
nipkow@10213
   259
 "[| (x,y) : r^+; \
nipkow@10213
   260
\    !!x y. (x,y) : r ==> P x y; \
nipkow@10213
   261
\    !!x y z. [| (x,y) : r^+; P x y; (y,z) : r^+; P y z |] ==> P x z \
nipkow@10213
   262
\ |] ==> P x y";
nipkow@10213
   263
by (blast_tac (claset() addIs ([r_into_trancl,major RS trancl_induct]@prems))1);
nipkow@10213
   264
qed "trancl_trans_induct";
nipkow@10213
   265
nipkow@10213
   266
(*elimination of r^+ -- NOT an induction rule*)
nipkow@10213
   267
val major::prems = Goal
nipkow@10213
   268
    "[| (a::'a,b) : r^+;  \
nipkow@10213
   269
\       (a,b) : r ==> P; \
nipkow@10213
   270
\       !!y.[| (a,y) : r^+;  (y,b) : r |] ==> P  \
nipkow@10213
   271
\    |] ==> P";
nipkow@10213
   272
by (subgoal_tac "(a::'a,b) : r | (? y. (a,y) : r^+  &  (y,b) : r)" 1);
nipkow@10213
   273
by (REPEAT (eresolve_tac ([asm_rl,disjE,exE,conjE]@prems) 1));
nipkow@10213
   274
by (rtac (rewrite_rule [trancl_def] major RS compEpair) 1);
nipkow@10213
   275
by (etac rtranclE 1);
nipkow@10213
   276
by (Blast_tac 1);
nipkow@10213
   277
by (blast_tac (claset() addSIs [rtrancl_into_trancl1]) 1);
nipkow@10213
   278
qed "tranclE";
nipkow@10213
   279
nipkow@10213
   280
(*Transitivity of r^+.
nipkow@10213
   281
  Proved by unfolding since it uses transitivity of rtrancl. *)
nipkow@10213
   282
Goalw [trancl_def] "trans(r^+)";
nipkow@10213
   283
by (rtac transI 1);
nipkow@10213
   284
by (REPEAT (etac compEpair 1));
nipkow@10213
   285
by (rtac (rtrancl_into_rtrancl RS (rtrancl_trans RS compI)) 1);
nipkow@10213
   286
by (REPEAT (assume_tac 1));
nipkow@10213
   287
qed "trans_trancl";
nipkow@10213
   288
nipkow@10213
   289
bind_thm ("trancl_trans", trans_trancl RS transD);
nipkow@10213
   290
nipkow@10213
   291
Goalw [trancl_def] "[| (x,y):r^*; (y,z):r^+ |] ==> (x,z):r^+";
nipkow@10213
   292
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
nipkow@10213
   293
qed "rtrancl_trancl_trancl";
nipkow@10213
   294
nipkow@10213
   295
(* "[| (a,b) : r;  (b,c) : r^+ |]   ==>  (a,c) : r^+" *)
nipkow@10213
   296
bind_thm ("trancl_into_trancl2", [trans_trancl, r_into_trancl] MRS transD);
nipkow@10213
   297
nipkow@10213
   298
(* primitive recursion for trancl over finite relations: *)
nipkow@10213
   299
Goal "(insert (y,x) r)^+ = r^+ Un {(a,b). (a,y):r^* & (x,b):r^*}";
nipkow@10213
   300
by (rtac equalityI 1);
nipkow@10213
   301
 by (rtac subsetI 1);
nipkow@10213
   302
 by (split_all_tac 1);
nipkow@10213
   303
 by (etac trancl_induct 1);
nipkow@10213
   304
  by (blast_tac (claset() addIs [r_into_trancl]) 1);
nipkow@10213
   305
 by (blast_tac (claset() addIs
nipkow@10213
   306
     [rtrancl_into_trancl1,trancl_into_rtrancl,r_into_trancl,trancl_trans]) 1);
nipkow@10213
   307
by (rtac subsetI 1);
nipkow@10213
   308
by (blast_tac (claset() addIs
nipkow@10213
   309
     [rtrancl_into_trancl2, rtrancl_trancl_trancl,
nipkow@10213
   310
      impOfSubs rtrancl_mono, trancl_mono]) 1);
nipkow@10213
   311
qed "trancl_insert";
nipkow@10213
   312
nipkow@10213
   313
Goalw [trancl_def] "(r^-1)^+ = (r^+)^-1";
nipkow@10213
   314
by (simp_tac (simpset() addsimps [rtrancl_converse,converse_comp]) 1);
nipkow@10213
   315
by (simp_tac (simpset() addsimps [rtrancl_converse RS sym,
nipkow@10213
   316
				  r_comp_rtrancl_eq]) 1);
nipkow@10213
   317
qed "trancl_converse";
nipkow@10213
   318
nipkow@10213
   319
Goal "(x,y) : (r^+)^-1 ==> (x,y) : (r^-1)^+";
nipkow@10213
   320
by (asm_full_simp_tac (simpset() addsimps [trancl_converse]) 1);
nipkow@10213
   321
qed "trancl_converseI";
nipkow@10213
   322
nipkow@10213
   323
Goal "(x,y) : (r^-1)^+ ==> (x,y) : (r^+)^-1";
nipkow@10213
   324
by (asm_full_simp_tac (simpset() addsimps [trancl_converse]) 1);
nipkow@10213
   325
qed "trancl_converseD";
nipkow@10213
   326
nipkow@10213
   327
val major::prems = Goal
nipkow@10213
   328
    "[| (a,b) : r^+; !!y. (y,b) : r ==> P(y); \
nipkow@10213
   329
\       !!y z.[| (y,z) : r;  (z,b) : r^+;  P(z) |] ==> P(y) |]  \
nipkow@10213
   330
\     ==> P(a)";
nipkow@10213
   331
by (rtac ((major RS converseI RS trancl_converseI) RS trancl_induct) 1);
nipkow@10213
   332
 by (resolve_tac prems 1);
nipkow@10213
   333
 by (etac converseD 1);
nipkow@10213
   334
by (blast_tac (claset() addIs prems addSDs [trancl_converseD])1);
nipkow@10213
   335
qed "converse_trancl_induct";
nipkow@10213
   336
nipkow@10213
   337
Goal "(x,y):R^+ ==> ? z. (x,z):R & (z,y):R^*";
nipkow@10213
   338
be converse_trancl_induct 1;
nipkow@10213
   339
by Auto_tac;
nipkow@10213
   340
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
nipkow@10213
   341
qed "tranclD";
nipkow@10213
   342
nipkow@10213
   343
(*Unused*)
nipkow@10213
   344
Goal "r^-1 Int r^+ = {} ==> (x, x) ~: r^+";
nipkow@10213
   345
by (subgoal_tac "!y. (x, y) : r^+ --> x~=y" 1);
nipkow@10213
   346
by (Fast_tac 1);
nipkow@10213
   347
by (strip_tac 1);
nipkow@10213
   348
by (etac trancl_induct 1);
nipkow@10213
   349
by (auto_tac (claset() addIs [r_into_trancl], simpset()));
nipkow@10213
   350
qed "irrefl_tranclI";
nipkow@10213
   351
nipkow@10213
   352
Goal "!!X. [| !x. (x, x) ~: r^+; (x,y) : r |] ==> x ~= y";
nipkow@10213
   353
by (blast_tac (claset() addDs [r_into_trancl]) 1);
nipkow@10213
   354
qed "irrefl_trancl_rD";
nipkow@10213
   355
nipkow@10213
   356
Goal "[| (a,b) : r^*;  r <= A <*> A |] ==> a=b | a:A";
nipkow@10213
   357
by (etac rtrancl_induct 1);
nipkow@10213
   358
by Auto_tac;
nipkow@10213
   359
val lemma = result();
nipkow@10213
   360
nipkow@10213
   361
Goalw [trancl_def] "r <= A <*> A ==> r^+ <= A <*> A";
nipkow@10213
   362
by (blast_tac (claset() addSDs [lemma]) 1);
nipkow@10213
   363
qed "trancl_subset_Sigma";
nipkow@10213
   364
nipkow@10213
   365
nipkow@10213
   366
Goal "(r^+)^= = r^*";
nipkow@10213
   367
by Safe_tac;
nipkow@10213
   368
by  (etac trancl_into_rtrancl 1);
nipkow@10213
   369
by (blast_tac (claset() addEs [rtranclE] addDs [rtrancl_into_trancl1]) 1);
nipkow@10213
   370
qed "reflcl_trancl";
nipkow@10213
   371
Addsimps[reflcl_trancl];
nipkow@10213
   372
nipkow@10213
   373
Goal "(r^=)^+ = r^*";
nipkow@10213
   374
by Safe_tac;
nipkow@10213
   375
by  (dtac trancl_into_rtrancl 1);
nipkow@10213
   376
by  (Asm_full_simp_tac 1);
nipkow@10213
   377
by (etac rtranclE 1);
nipkow@10213
   378
by  Safe_tac;
nipkow@10213
   379
by  (rtac r_into_trancl 1);
nipkow@10213
   380
by  (Simp_tac 1);
nipkow@10213
   381
by (rtac rtrancl_into_trancl1 1);
nipkow@10213
   382
by (etac (rtrancl_reflcl RS equalityD2 RS subsetD) 1);
nipkow@10213
   383
by (Fast_tac 1);
nipkow@10213
   384
qed "trancl_reflcl";
nipkow@10213
   385
Addsimps[trancl_reflcl];
nipkow@10213
   386
nipkow@10213
   387
Goal "{}^+ = {}";
nipkow@10213
   388
by (auto_tac (claset() addEs [trancl_induct], simpset()));
nipkow@10213
   389
qed "trancl_empty";
nipkow@10213
   390
Addsimps[trancl_empty];
nipkow@10213
   391
nipkow@10213
   392
Goal "{}^* = Id";
nipkow@10213
   393
by (rtac (reflcl_trancl RS subst) 1);
nipkow@10213
   394
by (Simp_tac 1);
nipkow@10213
   395
qed "rtrancl_empty";
nipkow@10213
   396
Addsimps[rtrancl_empty];
nipkow@10213
   397
nipkow@10213
   398
Goal "(a,b):R^* ==> a=b | a~=b & (a,b):R^+";
nipkow@10213
   399
by(force_tac (claset(), simpset() addsimps [reflcl_trancl RS sym] 
nipkow@10213
   400
				  delsimps [reflcl_trancl]) 1);
nipkow@10213
   401
qed "rtranclD";
nipkow@10213
   402