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