src/HOL/Transitive_Closure_lemmas.ML
author wenzelm
Thu, 15 Nov 2001 18:20:13 +0100
changeset 12207 4dff931b852f
parent 11327 cd2c27a23df1
child 12486 0ed8bdd883e0
permissions -rw-r--r--
added Induct/Binary_Trees.thy, Induct/Tree_Forest (converted from former ex/TF.ML ex/TF.thy ex/Term.ML ex/Term.thy);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10980
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
     1
(*  Title:      HOL/Transitive_Closure_lemmas.ML
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
     5
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
     6
Theorems about the transitive closure of a relation
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
     7
*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
     8
11327
cd2c27a23df1 Transitive closure is now defined via "inductive".
berghofe
parents: 10996
diff changeset
     9
val rtrancl_refl = thm "rtrancl_refl";
cd2c27a23df1 Transitive closure is now defined via "inductive".
berghofe
parents: 10996
diff changeset
    10
val rtrancl_into_rtrancl = thm "rtrancl_into_rtrancl";
10980
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    11
val trancl_def = thm "trancl_def";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    12
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    13
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    14
(** The relation rtrancl **)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    15
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    16
section "^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    17
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    18
(*rtrancl of r contains r*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    19
Goal "!!p. p : r ==> p : r^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    20
by (split_all_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    21
by (etac (rtrancl_refl RS rtrancl_into_rtrancl) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    22
qed "r_into_rtrancl";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    23
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    24
AddIs [r_into_rtrancl];
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    25
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    26
(*monotonicity of rtrancl*)
11327
cd2c27a23df1 Transitive closure is now defined via "inductive".
berghofe
parents: 10996
diff changeset
    27
Goal "r <= s ==> r^* <= s^*";
cd2c27a23df1 Transitive closure is now defined via "inductive".
berghofe
parents: 10996
diff changeset
    28
by (rtac subsetI 1);
cd2c27a23df1 Transitive closure is now defined via "inductive".
berghofe
parents: 10996
diff changeset
    29
by (split_all_tac 1);
cd2c27a23df1 Transitive closure is now defined via "inductive".
berghofe
parents: 10996
diff changeset
    30
by (etac (thm "rtrancl.induct") 1);
cd2c27a23df1 Transitive closure is now defined via "inductive".
berghofe
parents: 10996
diff changeset
    31
by (rtac rtrancl_into_rtrancl 2);
cd2c27a23df1 Transitive closure is now defined via "inductive".
berghofe
parents: 10996
diff changeset
    32
by (ALLGOALS Blast_tac);
10980
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    33
qed "rtrancl_mono";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    34
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    35
(*nice induction rule*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    36
val major::prems = Goal
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    37
    "[| (a::'a,b) : r^*;    \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    38
\       P(a); \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    39
\       !!y z.[| (a,y) : r^*;  (y,z) : r;  P(y) |] ==> P(z) |]  \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    40
\     ==> P(b)";
11327
cd2c27a23df1 Transitive closure is now defined via "inductive".
berghofe
parents: 10996
diff changeset
    41
by (rtac (read_instantiate [("P","%x y. x = a --> P y")]
cd2c27a23df1 Transitive closure is now defined via "inductive".
berghofe
parents: 10996
diff changeset
    42
  (major RS thm "rtrancl.induct") RS mp) 1);
cd2c27a23df1 Transitive closure is now defined via "inductive".
berghofe
parents: 10996
diff changeset
    43
by (ALLGOALS (blast_tac (claset() addIs prems)));
10980
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    44
qed "rtrancl_induct";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    45
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    46
bind_thm ("rtrancl_induct2", split_rule
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    47
  (read_instantiate [("a","(ax,ay)"), ("b","(bx,by)")] rtrancl_induct));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    48
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    49
(*transitivity of transitive closure!! -- by induction.*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    50
Goalw [trans_def] "trans(r^*)";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    51
by Safe_tac;
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    52
by (eres_inst_tac [("b","z")] rtrancl_induct 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    53
by (ALLGOALS(blast_tac (claset() addIs [rtrancl_into_rtrancl])));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    54
qed "trans_rtrancl";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    55
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    56
bind_thm ("rtrancl_trans", trans_rtrancl RS transD);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    57
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    58
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    59
(*elimination of rtrancl -- by induction on a special formula*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    60
val major::prems = Goal
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    61
    "[| (a::'a,b) : r^*;  (a = b) ==> P;        \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    62
\       !!y.[| (a,y) : r^*; (y,b) : r |] ==> P  \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    63
\    |] ==> P";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    64
by (subgoal_tac "(a::'a) = b  | (? y. (a,y) : r^* & (y,b) : r)" 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    65
by (rtac (major RS rtrancl_induct) 2);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    66
by (blast_tac (claset() addIs prems) 2);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    67
by (blast_tac (claset() addIs prems) 2);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    68
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    69
qed "rtranclE";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    70
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    71
bind_thm ("rtrancl_into_rtrancl2", r_into_rtrancl RS rtrancl_trans);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    72
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    73
(*** More r^* equations and inclusions ***)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    74
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    75
Goal "(r^*)^* = r^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    76
by Auto_tac;
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    77
by (etac rtrancl_induct 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    78
by (rtac rtrancl_refl 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    79
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    80
qed "rtrancl_idemp";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    81
Addsimps [rtrancl_idemp];
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    82
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    83
Goal "R^* O R^* = R^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    84
by (rtac set_ext 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    85
by (split_all_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    86
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    87
qed "rtrancl_idemp_self_comp";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    88
Addsimps [rtrancl_idemp_self_comp];
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    89
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    90
Goal "r <= s^* ==> r^* <= s^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    91
by (dtac rtrancl_mono 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    92
by (Asm_full_simp_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    93
qed "rtrancl_subset_rtrancl";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    94
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    95
Goal "[| R <= S; S <= R^* |] ==> S^* = R^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    96
by (dtac rtrancl_mono 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    97
by (dtac rtrancl_mono 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    98
by (Asm_full_simp_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
    99
by (Blast_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   100
qed "rtrancl_subset";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   101
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   102
Goal "(R^* Un S^*)^* = (R Un S)^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   103
by (blast_tac (claset() addSIs [rtrancl_subset]
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   104
                        addIs [r_into_rtrancl, rtrancl_mono RS subsetD]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   105
qed "rtrancl_Un_rtrancl";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   106
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   107
Goal "(R^=)^* = R^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   108
by (blast_tac (claset() addSIs [rtrancl_subset] addIs [r_into_rtrancl]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   109
qed "rtrancl_reflcl";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   110
Addsimps [rtrancl_reflcl];
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   111
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   112
Goal "(r - Id)^* = r^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   113
by (rtac sym 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   114
by (rtac rtrancl_subset 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   115
 by (Blast_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   116
by (Clarify_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   117
by (rename_tac "a b" 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   118
by (case_tac "a=b" 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   119
 by (Blast_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   120
by (blast_tac (claset() addSIs [r_into_rtrancl]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   121
qed "rtrancl_r_diff_Id";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   122
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   123
Goal "(x,y) : (r^-1)^* ==> (y,x) : r^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   124
by (etac rtrancl_induct 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   125
by (rtac rtrancl_refl 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   126
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   127
qed "rtrancl_converseD";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   128
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   129
Goal "(y,x) : r^* ==> (x,y) : (r^-1)^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   130
by (etac rtrancl_induct 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   131
by (rtac rtrancl_refl 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   132
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   133
qed "rtrancl_converseI";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   134
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   135
Goal "(r^-1)^* = (r^*)^-1";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   136
(*blast_tac fails: the split_all_tac wrapper must be called to convert
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   137
  the set element to a pair*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   138
by (safe_tac (claset() addSDs [rtrancl_converseD] addSIs [rtrancl_converseI]));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   139
qed "rtrancl_converse";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   140
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   141
val major::prems = Goal
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   142
    "[| (a,b) : r^*; P(b); \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   143
\       !!y z.[| (y,z) : r;  (z,b) : r^*;  P(z) |] ==> P(y) |]  \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   144
\     ==> P(a)";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   145
by (rtac (major RS rtrancl_converseI RS rtrancl_induct) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   146
by (resolve_tac prems 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   147
by (blast_tac (claset() addIs prems addSDs[rtrancl_converseD])1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   148
qed "converse_rtrancl_induct";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   149
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   150
bind_thm ("converse_rtrancl_induct2", split_rule
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   151
  (read_instantiate [("a","(ax,ay)"),("b","(bx,by)")]converse_rtrancl_induct));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   152
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   153
val major::prems = Goal
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   154
 "[| (x,z):r^*; \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   155
\    x=z ==> P; \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   156
\    !!y. [| (x,y):r; (y,z):r^* |] ==> P \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   157
\ |] ==> P";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   158
by (subgoal_tac "x = z  | (? y. (x,y) : r & (y,z) : r^*)" 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   159
by (rtac (major RS converse_rtrancl_induct) 2);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   160
by (blast_tac (claset() addIs prems) 2);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   161
by (blast_tac (claset() addIs prems) 2);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   162
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   163
qed "converse_rtranclE";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   164
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   165
bind_thm ("converse_rtranclE2", split_rule
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   166
  (read_instantiate [("x","(xa,xb)"), ("z","(za,zb)")] converse_rtranclE));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   167
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   168
Goal "r O r^* = r^* O r";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   169
by (blast_tac (claset() addEs [rtranclE, converse_rtranclE] 
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   170
	               addIs [rtrancl_into_rtrancl, rtrancl_into_rtrancl2]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   171
qed "r_comp_rtrancl_eq";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   172
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   173
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   174
(**** The relation trancl ****)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   175
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   176
section "^+";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   177
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   178
Goalw [trancl_def] "[| p:r^+; r <= s |] ==> p:s^+";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   179
by (blast_tac (claset() addIs [rtrancl_mono RS subsetD]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   180
qed "trancl_mono";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   181
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   182
(** Conversions between trancl and rtrancl **)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   183
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   184
Goalw [trancl_def]
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   185
    "!!p. p : r^+ ==> p : r^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   186
by (split_all_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   187
by (etac compEpair 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   188
by (REPEAT (ares_tac [rtrancl_into_rtrancl] 1));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   189
qed "trancl_into_rtrancl";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   190
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   191
(*r^+ contains r*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   192
Goalw [trancl_def]
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   193
   "!!p. p : r ==> p : r^+";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   194
by (split_all_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   195
by (REPEAT (ares_tac [prem,compI,rtrancl_refl] 1));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   196
qed "r_into_trancl";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   197
AddIs [r_into_trancl];
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   198
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   199
(*intro rule by definition: from rtrancl and r*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   200
Goalw [trancl_def] "[| (a,b) : r^*;  (b,c) : r |]   ==>  (a,c) : r^+";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   201
by Auto_tac;
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   202
qed "rtrancl_into_trancl1";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   203
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   204
(*intro rule from r and rtrancl*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   205
Goal "[| (a,b) : r;  (b,c) : r^* |]   ==>  (a,c) : r^+";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   206
by (etac rtranclE 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   207
by (blast_tac (claset() addIs [r_into_trancl]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   208
by (rtac (rtrancl_trans RS rtrancl_into_trancl1) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   209
by (REPEAT (ares_tac [r_into_rtrancl] 1));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   210
qed "rtrancl_into_trancl2";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   211
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   212
(*Nice induction rule for trancl*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   213
val major::prems = Goal
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   214
  "[| (a,b) : r^+;                                      \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   215
\     !!y.  [| (a,y) : r |] ==> P(y);                   \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   216
\     !!y z.[| (a,y) : r^+;  (y,z) : r;  P(y) |] ==> P(z)       \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   217
\  |] ==> P(b)";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   218
by (rtac (rewrite_rule [trancl_def] major  RS  compEpair) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   219
(*by induction on this formula*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   220
by (subgoal_tac "ALL z. (y,z) : r --> P(z)" 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   221
(*now solve first subgoal: this formula is sufficient*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   222
by (Blast_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   223
by (etac rtrancl_induct 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   224
by (ALLGOALS (blast_tac (claset() addIs (rtrancl_into_trancl1::prems))));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   225
qed "trancl_induct";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   226
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   227
(*Another induction rule for trancl, incorporating transitivity.*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   228
val major::prems = Goal
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   229
 "[| (x,y) : r^+; \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   230
\    !!x y. (x,y) : r ==> P x y; \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   231
\    !!x y z. [| (x,y) : r^+; P x y; (y,z) : r^+; P y z |] ==> P x z \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   232
\ |] ==> P x y";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   233
by (blast_tac (claset() addIs ([r_into_trancl,major RS trancl_induct]@prems))1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   234
qed "trancl_trans_induct";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   235
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   236
(*elimination of r^+ -- NOT an induction rule*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   237
val major::prems = Goal
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   238
    "[| (a::'a,b) : r^+;  \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   239
\       (a,b) : r ==> P; \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   240
\       !!y.[| (a,y) : r^+;  (y,b) : r |] ==> P  \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   241
\    |] ==> P";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   242
by (subgoal_tac "(a::'a,b) : r | (? y. (a,y) : r^+  &  (y,b) : r)" 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   243
by (REPEAT (eresolve_tac ([asm_rl,disjE,exE,conjE]@prems) 1));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   244
by (rtac (rewrite_rule [trancl_def] major RS compEpair) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   245
by (etac rtranclE 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   246
by (Blast_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   247
by (blast_tac (claset() addSIs [rtrancl_into_trancl1]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   248
qed "tranclE";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   249
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   250
(*Transitivity of r^+.
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   251
  Proved by unfolding since it uses transitivity of rtrancl. *)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   252
Goalw [trancl_def] "trans(r^+)";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   253
by (rtac transI 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   254
by (REPEAT (etac compEpair 1));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   255
by (rtac (rtrancl_into_rtrancl RS (rtrancl_trans RS compI)) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   256
by (REPEAT (assume_tac 1));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   257
qed "trans_trancl";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   258
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   259
bind_thm ("trancl_trans", trans_trancl RS transD);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   260
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   261
Goalw [trancl_def] "[| (x,y):r^*; (y,z):r^+ |] ==> (x,z):r^+";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   262
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   263
qed "rtrancl_trancl_trancl";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   264
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   265
(* "[| (a,b) : r;  (b,c) : r^+ |]   ==>  (a,c) : r^+" *)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   266
bind_thm ("trancl_into_trancl2", [trans_trancl, r_into_trancl] MRS transD);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   267
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   268
(* primitive recursion for trancl over finite relations: *)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   269
Goal "(insert (y,x) r)^+ = r^+ Un {(a,b). (a,y):r^* & (x,b):r^*}";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   270
by (rtac equalityI 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   271
 by (rtac subsetI 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   272
 by (split_all_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   273
 by (etac trancl_induct 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   274
  by (blast_tac (claset() addIs [r_into_trancl]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   275
 by (blast_tac (claset() addIs
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   276
     [rtrancl_into_trancl1,trancl_into_rtrancl,r_into_trancl,trancl_trans]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   277
by (rtac subsetI 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   278
by (blast_tac (claset() addIs
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   279
     [rtrancl_into_trancl2, rtrancl_trancl_trancl,
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   280
      impOfSubs rtrancl_mono, trancl_mono]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   281
qed "trancl_insert";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   282
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   283
Goalw [trancl_def] "(r^-1)^+ = (r^+)^-1";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   284
by (simp_tac (simpset() addsimps [rtrancl_converse,converse_comp]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   285
by (simp_tac (simpset() addsimps [rtrancl_converse RS sym,
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   286
				  r_comp_rtrancl_eq]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   287
qed "trancl_converse";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   288
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   289
Goal "(x,y) : (r^+)^-1 ==> (x,y) : (r^-1)^+";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   290
by (asm_full_simp_tac (simpset() addsimps [trancl_converse]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   291
qed "trancl_converseI";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   292
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   293
Goal "(x,y) : (r^-1)^+ ==> (x,y) : (r^+)^-1";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   294
by (asm_full_simp_tac (simpset() addsimps [trancl_converse]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   295
qed "trancl_converseD";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   296
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   297
val major::prems = Goal
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   298
    "[| (a,b) : r^+; !!y. (y,b) : r ==> P(y); \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   299
\       !!y z.[| (y,z) : r;  (z,b) : r^+;  P(z) |] ==> P(y) |]  \
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   300
\     ==> P(a)";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   301
by (rtac ((major RS converseI RS trancl_converseI) RS trancl_induct) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   302
 by (resolve_tac prems 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   303
 by (etac converseD 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   304
by (blast_tac (claset() addIs prems addSDs [trancl_converseD])1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   305
qed "converse_trancl_induct";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   306
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   307
Goal "(x,y):R^+ ==> ? z. (x,z):R & (z,y):R^*";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   308
be converse_trancl_induct 1;
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   309
by Auto_tac;
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   310
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   311
qed "tranclD";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   312
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   313
(*Unused*)
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   314
Goal "r^-1 Int r^+ = {} ==> (x, x) ~: r^+";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   315
by (subgoal_tac "!y. (x, y) : r^+ --> x~=y" 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   316
by (Fast_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   317
by (strip_tac 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   318
by (etac trancl_induct 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   319
by (auto_tac (claset() addIs [r_into_trancl], simpset()));
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   320
qed "irrefl_tranclI";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   321
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   322
Goal "!!X. [| !x. (x, x) ~: r^+; (x,y) : r |] ==> x ~= y";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   323
by (blast_tac (claset() addDs [r_into_trancl]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   324
qed "irrefl_trancl_rD";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   325
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   326
Goal "[| (a,b) : r^*;  r <= A <*> A |] ==> a=b | a:A";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   327
by (etac rtrancl_induct 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   328
by Auto_tac;
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   329
val lemma = result();
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   330
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   331
Goalw [trancl_def] "r <= A <*> A ==> r^+ <= A <*> A";
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   332
by (blast_tac (claset() addSDs [lemma]) 1);
0a45f2efaaec Transitive_Closure turned into new-style theory;
wenzelm
parents:
diff changeset
   333
qed "trancl_subset_Sigma";