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